Skip to content

Commit

Permalink
Flat renderer skeleton, misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
weqqr committed Oct 23, 2024
1 parent cdf1535 commit 582375f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
GOEXE=$(shell go env GOEXE)
PANORAMA_BIN=bin/panorama${GOEXE}
SRCS:=$(shell find . -wholename 'internal/**/*.go')

.PHONY: all
all: ${PANORAMA_BIN}
all: panorama

bin/panorama: \
cmd/panorama/* \
internal/**/* \
static/**/*
.PHONY: panorama
panorama:
go build -o ${PANORAMA_BIN} ./cmd/panorama

.PHONY: lint
Expand Down
2 changes: 1 addition & 1 deletion internal/game/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (m *MediaCache) Mesh(name string) *mesh.Model {
if model, ok := m.models[name]; ok {
return model
} else {
slog.Warn("unknown image", "name", name)
slog.Warn("unknown mesh", "name", name)

return nil
}
Expand Down
42 changes: 42 additions & 0 deletions internal/render/flat/renderer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package flat

import (
"image"

"github.com/lord-server/panorama/internal/game"
"github.com/lord-server/panorama/internal/lm"
"github.com/lord-server/panorama/internal/raster"
"github.com/lord-server/panorama/internal/render"
"github.com/lord-server/panorama/internal/spatial"
"github.com/lord-server/panorama/internal/world"
)

type FlatRenderer struct {
nr render.NodeRasterizer

region spatial.Region
game *game.Game
}

func NewRenderer(region spatial.Region, game *game.Game) *FlatRenderer {
return &FlatRenderer{
nr: render.NewNodeRasterizer(lm.DimetricProjection()),
region: region,
game: game,
}
}

func (r *FlatRenderer) RenderTile(
tilePos render.TilePosition,
world *world.World,
game *game.Game,
) *raster.RenderBuffer {
rect := image.Rect(0, 0, 256, 256)
target := raster.NewRenderBuffer(rect)

return target
}

func (r *FlatRenderer) ProjectRegion(region spatial.Region) spatial.ProjectedRegion {
return spatial.ProjectedRegion{}
}

0 comments on commit 582375f

Please sign in to comment.