tables3d

package
v0.3.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MaxLights = 3

Variables

View Source
var Identity = func() gfx.Matrix {
	var identity gfx.Matrix

	identity.Identity()

	return identity
}()

Functions

This section is empty.

Types

type BakedModelObject

type BakedModelObject struct {
	// contains filtered or unexported fields
}

func (*BakedModelObject) Render

func (baked *BakedModelObject) Render(transform *gfx.Matrix, skipTransparent bool)

type BufferData

type BufferData struct {
	X, Y, Z    float32
	S, T       uint16
	Nx, Ny, Nz float32
}

type Model

type Model struct {
	// v: List of geometric vertices, with (x, y, z [,w]) coordinates.
	//    w is optional and defaults to 1.0.
	Vertex []gfx.Vector
	// vt: List of texture coordinates, in (u, [,v ,w]) coordinates.
	//     These will vary between 0 and 1. v, w are optional and default to 0.
	//     We don't use w, so it is omitted from the parsed data.
	TexCoord [][2]float32
	// vn: List of vertex Normals in (x,y,z) form; Normals might not be unit vectors.
	Normals [][3]float32
	Objects []*ModelObjectFaces
}

func ParseObj

func ParseObj(r io.Reader) (*Model, error)

type ModelFace

type ModelFace struct {
	// each of these are 1 more than an index into the corresponding slice or 0.
	Vertex   int
	TexCoord int
	Normal   int
}

type ModelInstance

type ModelInstance struct {
	Name       string
	X, Y, Z    float32
	Rx, Ry, Rz float32
	Sx, Sy, Sz float32
	// contains filtered or unexported fields
}

type ModelObject

type ModelObject struct {
	Name        string
	Material    string
	Tex         *gfx.AssetTexture
	ShaderMode  int
	Transparent bool

	// i: vendor-specific (Spy Cards Online) extension: instance of other object.
	//    i Name x y z rx ry rz sx sy sz
	Instances []*ModelInstance

	Buffer []BufferData
	// contains filtered or unexported fields
}

func NewObject

func NewObject(name string) *ModelObject

func Object

func Object(name string) *ModelObject

func SceneBaseObject

func SceneBaseObject(name string) *ModelObject

func SceneFurnitureObject

func SceneFurnitureObject(name string) *ModelObject

func SpriteObject

func SpriteObject(name string, s *sprites.Sprite) *ModelObject

func (*ModelObject) Bake

func (o *ModelObject) Bake() []*BakedModelObject

func (*ModelObject) MarkDirty

func (o *ModelObject) MarkDirty()

type ModelObjectFaces

type ModelObjectFaces struct {
	*ModelObject

	// f: List of Faces. For simplicity, we assume Faces are always triangles.
	Faces [][3]ModelFace
}

type Scene

type Scene struct {
	CamPos         [3]float32
	CamDist        float32
	CamAngle       [2]float32
	LightAngles    [MaxLights][2]float32
	LightAmbient   [3]float32
	LightIntensity [MaxLights][3]float32

	Objects []*SceneObject
	Skybox  *gfx.AssetTexture

	FOV           float32
	HorizontalFOV bool
	// contains filtered or unexported fields
}

func (*Scene) Clone

func (s *Scene) Clone() *Scene

func (*Scene) Render

func (s *Scene) Render()

type SceneObject

type SceneObject struct {
	Model     *ModelObject
	Transform gfx.Matrix
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL