gfx

package
v0.0.0-...-e1c21c9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: Zlib Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ANCHOR_CENTER Anchor = 0x00
	ANCHOR_LEFT          = 0x01
	ANCHOR_RIGHT         = 0x02
	ANCHOR_UP            = 0x04
	ANCHOR_DOWN          = 0x08
)
View Source
const MAX_BATCH_QUAD_SIZE = uint32(8 << 10)

~ 640k per-batch, 32k vertex, 8k quad

View Source
const MAX_BATCH_VERTEX_SIZE = 4 * MAX_BATCH_QUAD_SIZE
View Source
const STEP = 64
View Source
const SharedIndexBufferSize uint16 = 0xFFFF

Variables

View Source
var (
	White  = Color{0xFF, 0xFF, 0xFF, 0xFF}
	Black  = Color{0, 0, 0, 0xFF}
	LTGray = Color{0xCC, 0xCC, 0xCC, 0xFF}
	Gray   = Color{0x88, 0x88, 0x88, 0xFF}
	DKGray = Color{0x44, 0x44, 0x44, 0xFF}

	Red   = Color{0xFF, 0, 0, 0xFF}
	Green = Color{0, 0xFF, 0, 0xFF}
	Blue  = Color{0, 0, 0xFF, 0xFF}

	Cyan    = Color{0, 0xFF, 0xFF, 0xFF}
	Magenta = Color{0xFF, 00, 0xFF, 0xFF}
	Yellow  = Color{0xFF, 0xFF, 0x00, 0xFF}

	Transparent = Color{}
	Opaque      = Color{0xFF, 0xFF, 0xFF, 0xFF}
)
View Source
var Context *context

global shared

View Source
var P4C4 = []bk.VertexComp{
	{4, bk.AttrFloat, 0, 0},
	{4, bk.AttrUInt8, 16, 1},
}

format <x,y,u,v rgba>

View Source
var PosTexColorVertexSize = unsafe.Sizeof(PosTexColorVertex{})
View Source
var UInt16Size = unsafe.Sizeof(uint16(0))

Functions

func Destroy

func Destroy()

func Flush

func Flush() (num int)

func Init

func Init(pixelRatio float32)

func OverlapAB

func OverlapAB(a, b *AABB) bool

func PackSortId

func PackSortId(z int16, b uint16) (sid uint32)

func UnpackSortId

func UnpackSortId(sortId uint32) (z int16, b uint16)

Types

type AABB

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

type Anchor

type Anchor uint8

Anchor type

type Atlas

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

A small struct to describe a group of sub-texture

func (*Atlas) AddItem

func (at *Atlas) AddItem(x, y, w, h float32, name string, rotated bool)

func (*Atlas) GetByIndex

func (at *Atlas) GetByIndex(index int) (tex SubTex, ok bool)

func (*Atlas) GetByName

func (at *Atlas) GetByName(name string) (tex SubTex, ok bool)

func (*Atlas) Region

func (at *Atlas) Region(ii int) Region

func (*Atlas) Size

func (at *Atlas) Size(ii int) Size

type Batch

type Batch struct {
	TextureId uint16

	VertexId uint16
	IndexId  uint16
	// contains filtered or unexported fields
}

* Batch 系统设计 对所有物体进行分类:静态和动态,静态物体使用稳定的batch系统,动态物体每次重新计算batch

静态: 使用稳定的batch面临的最大问题是,batch内存的物体的可见性问题。如果batch内的物体有的可见, 有的不可见(有可能是不再视野内,也有可能是主动隐藏). 采用 unity 方案,只减少状态切换,不减少 drawcall 的做法, 实现比较简单(否则要面临修改VBO缓存的问题)。

动态: 动态Batch每次都需要重新构建,只要实现正确的合并算法即可。

暗示:在 sortkey 中提供一个字段 batch=0 (默认情况使用动态batch),batch=1,2..N 的情况按batch值进行 分批处理。 优化:按照空间划分可以得到不同子空间的batch,可以在batch中再做一次筛选滤掉不可见的物体。

渲染: 静态系统,按照 batch-id 找到对应的batch数据,生成渲染命令 动态系统,直接合并数据并生成渲染命令

目前Batch实现只支持格式:pos_uv_color

type BatchContext

type BatchContext struct {

	// batch-list
	BatchList [128]Batch
	// contains filtered or unexported fields
}

管理一或多个Batch实例 最多可以生成 128 个 Batch 分组 最多可以使用 8 个 VBO 缓存

type BatchObject

type BatchObject interface {
	Fill(vertex []PosTexColorVertex)
	Size() int
}

type BatchRender

type BatchRender struct {

	// batch context
	BatchContext
	// contains filtered or unexported fields
}

/ A Tex2D Batch TypeRender

func NewBatchRender

func NewBatchRender(vsh, fsh string) *BatchRender

func (*BatchRender) Begin

func (br *BatchRender) Begin(tex uint16, depth int16)

func (*BatchRender) Draw

func (br *BatchRender) Draw(b BatchObject)

func (*BatchRender) End

func (br *BatchRender) End()

func (*BatchRender) Flush

func (br *BatchRender) Flush() (num int)

func (*BatchRender) SetCamera

func (br *BatchRender) SetCamera(camera *Camera)

type BoundingBox

type BoundingBox struct {
	Min f32.Vec2
	Max f32.Vec2
}

/ 可见性系统,以一个组件的形式呈现

type BoundingComp

type BoundingComp struct {
	BoundingBox
}

/ 每个Entity只有一个可见性对象,如果它包含多个 RenderComp,那么求出一个最大面积 / 作为该对象的可见面积

func (*BoundingComp) Add

func (bc *BoundingComp) Add(bb *BoundingBox)

合并两个矩形

func (*BoundingComp) SetBounding

func (bc *BoundingComp) SetBounding(bb *BoundingBox)

func (*BoundingComp) Sub

func (bc *BoundingComp) Sub(bb *BoundingBox)

减去一个矩形的贡献

type BoundingTable

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

func (*BoundingTable) Comp

func (bt *BoundingTable) Comp(entity engi.Entity) (bc *BoundingComp)

func (*BoundingTable) NewComp

func (bt *BoundingTable) NewComp(entity engi.Entity) (bc *BoundingComp)

type Camera

type Camera struct {
	Eye f32.Vec3
	// contains filtered or unexported fields
}

func (*Camera) Bounding

func (c *Camera) Bounding() (left, top, right, bottom float32)

func (*Camera) Flow

func (c *Camera) Flow(entity engi.Entity)

func (*Camera) InView

func (c *Camera) InView(xf *Transform, size, gravity f32.Vec2) bool

func (*Camera) MoveBy

func (c *Camera) MoveBy(dx, dy float32)

func (*Camera) MoveTo

func (c *Camera) MoveTo(x, y float32)

func (*Camera) P

func (c *Camera) P() (left, right, bottom, top float32)

func (*Camera) Position

func (c *Camera) Position() (x, y float32)

func (*Camera) RotateBy

func (c *Camera) RotateBy(d float32)

func (*Camera) RotateTo

func (c *Camera) RotateTo(rt float32)

func (*Camera) Rotation

func (c *Camera) Rotation() float32

func (*Camera) Scale

func (c *Camera) Scale() (sx, sy float32)

func (*Camera) ScaleBy

func (c *Camera) ScaleBy(dsx, dsy float32)

func (*Camera) ScaleTo

func (c *Camera) ScaleTo(sx, sy float32)

func (*Camera) Scene2Screen

func (c *Camera) Scene2Screen(x, y float32) (x1, y1 float32)

Scene2Screen converts (x,y) in game's world coordinate to screen coordinate.

func (*Camera) Screen

func (c *Camera) Screen() (w, h float32)

func (*Camera) Screen2Scene

func (c *Camera) Screen2Scene(x, y float32) (x1, y1 float32)

Screen2Scene converts (x,y) in screen coordinate to (x1,y1) in game's world coordinate.

func (*Camera) SetBound

func (c *Camera) SetBound(left, top, right, bottom float32)

func (*Camera) SetDesiredViewport

func (c *Camera) SetDesiredViewport(w, h float32)

func (*Camera) SetViewPort

func (c *Camera) SetViewPort(w, h float32)

TODO:相机默认位置应该在屏幕中间

func (*Camera) View

func (c *Camera) View() (x, y, w, h float32)

type CameraMode

type CameraMode uint8
const (
	Perspective CameraMode = iota
	Orthographic
)

type Color

type Color color.RGBA

func PMAColor

func PMAColor(r, g, b, a uint8) Color

PMAColor returns a pre-multiplied alpha Color.

func PMAColorf

func PMAColorf(r, g, b, a float32) Color

func U32Color

func U32Color(v uint32) Color

Color value should follow byte-order: 0xAABBGGRR

func (Color) RGBA

func (c Color) RGBA() (r, g, b, a uint32)

func (Color) U32

func (c Color) U32() uint32

type CompRef

type CompRef struct {
	Type int32
	*Transform
	*SpriteComp
}

func (CompRef) BatchId

func (b CompRef) BatchId() uint16

func (CompRef) SetBatchId

func (b CompRef) SetBatchId(id uint16)

func (CompRef) SetZOrder

func (zo CompRef) SetZOrder(z int16)

func (CompRef) Z

func (zo CompRef) Z() int16

type Mesh

type Mesh struct {
	IndexId  uint16
	VertexId uint16

	FirstVertex uint16
	NumVertex   uint16

	FirstIndex uint16
	NumIndex   uint16
	// contains filtered or unexported fields
}

func (*Mesh) Delete

func (m *Mesh) Delete()

func (*Mesh) SetIndex

func (m *Mesh) SetIndex(v []uint16)

func (*Mesh) SetTexture

func (m *Mesh) SetTexture(id uint16)

func (*Mesh) SetVertex

func (m *Mesh) SetVertex(v []PosTexColorVertex)

func (*Mesh) Setup

func (m *Mesh) Setup()

func (*Mesh) Update

func (m *Mesh) Update()

type MeshComp

type MeshComp struct {
	engi.Entity
	Mesh
	// contains filtered or unexported fields
}

func (*MeshComp) SetSize

func (m *MeshComp) SetSize(width, height float32)

func (*MeshComp) SetVisible

func (m *MeshComp) SetVisible(v bool)

func (*MeshComp) SetZOrder

func (zo *MeshComp) SetZOrder(z int16)

func (*MeshComp) Size

func (m *MeshComp) Size() (w, h float32)

func (*MeshComp) Z

func (zo *MeshComp) Z() int16

type MeshRender

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

func NewMeshRender

func NewMeshRender(vsh, fsh string) *MeshRender

func (*MeshRender) Draw

func (mr *MeshRender) Draw(m *Mesh, mat4 *f32.Mat4, depth int32)

draw

func (*MeshRender) Extract

func (mr *MeshRender) Extract(visibleObjects []uint32)

extract render object

func (*MeshRender) SetCamera

func (mr *MeshRender) SetCamera(camera *Camera)

type MeshRenderFeature

type MeshRenderFeature struct {
	Stack *StackAllocator

	R *MeshRender
	// contains filtered or unexported fields
}

///

func (*MeshRenderFeature) Draw

func (f *MeshRenderFeature) Draw(nodes RenderNodes)

func (*MeshRenderFeature) Extract

func (f *MeshRenderFeature) Extract(v *View)

func (*MeshRenderFeature) Flush

func (f *MeshRenderFeature) Flush()

func (*MeshRenderFeature) Register

func (f *MeshRenderFeature) Register(rs *RenderSystem)

此处初始化所有的依赖

type MeshTable

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

func NewMeshTable

func NewMeshTable(cap int) *MeshTable

func (*MeshTable) Alive

func (mt *MeshTable) Alive(entity engi.Entity) bool

func (*MeshTable) Comp

func (mt *MeshTable) Comp(entity engi.Entity) (mc *MeshComp)

func (*MeshTable) Delete

func (mt *MeshTable) Delete(entity engi.Entity)

func (*MeshTable) Destroy

func (mt *MeshTable) Destroy()

func (*MeshTable) NewComp

func (mt *MeshTable) NewComp(entity engi.Entity) (mc *MeshComp)

func (*MeshTable) Size

func (mt *MeshTable) Size() (size, cap int)

type PosTexColorVertex

type PosTexColorVertex struct {
	X, Y, U, V float32
	RGBA       uint32
}

vertex struct

type Region

type Region struct {
	X1, Y1  float32
	X2, Y2  float32
	Rotated bool
}

type Render

type Render interface {
	SetCamera(camera *Camera)
}

type RenderFeature

type RenderFeature interface {
	Extract(v *View)
	Draw(nodes RenderNodes)
	Flush()
}

传入参数是经过可见性系统筛选后的 Entity,这是一个很小的数组,可以 直接传给各个 RenderFeature 来做可见性判断.

type RenderMesh

type RenderMesh struct {
	*Mesh
	Matrix []float32
}

type RenderNodes

type RenderNodes []SortObject

func (RenderNodes) Len

func (nodes RenderNodes) Len() int

func (RenderNodes) Less

func (nodes RenderNodes) Less(i, j int) bool

func (RenderNodes) Swap

func (nodes RenderNodes) Swap(i, j int)

type RenderObject

type RenderObject struct {
	engi.Entity
	Size    f32.Vec2
	Center  f32.Vec2
	ZOrder  int16
	BatchId uint16
}

Shared properties by most render object.

type RenderSystem

type RenderSystem struct {
	MainCamera Camera
	View

	// visibility test
	V VisibilitySystem

	// render-data
	TableList []interface{}

	// render
	RenderList []Render

	// feature knows how to use render-data and render
	FeatureList []RenderFeature
	// contains filtered or unexported fields
}

所有的Table和Render都在此管理 其它的 RenderFeature 在此提取依赖 这样的话, RenderSystem 就沦为一个管理 RenderFeature 和 Table 的地方 它们之间也会存在各种组合...

func NewRenderSystem

func NewRenderSystem() (rs *RenderSystem)

func (*RenderSystem) Accept

func (th *RenderSystem) Accept(rf RenderFeature) (index int)

func (*RenderSystem) Destroy

func (th *RenderSystem) Destroy()

func (*RenderSystem) RegisterRender

func (th *RenderSystem) RegisterRender(t RenderType, render Render)

register type-render

func (*RenderSystem) RequireTable

func (th *RenderSystem) RequireTable(tables []interface{})

func (*RenderSystem) Update

func (th *RenderSystem) Update(dt float32)

type RenderType

type RenderType int32

type SRT

type SRT struct {
	Scale    f32.Vec2
	Rotation float32
	Position f32.Vec2
}

type ShapeRender

type ShapeRender struct {
}

func (*ShapeRender) DrawCircle

func (sr *ShapeRender) DrawCircle()

func (*ShapeRender) DrawLine

func (sr *ShapeRender) DrawLine()

func (*ShapeRender) DrawPolygon

func (sr *ShapeRender) DrawPolygon()

func (*ShapeRender) DrawRect

func (sr *ShapeRender) DrawRect()

func (*ShapeRender) DrawTriangle

func (sr *ShapeRender) DrawTriangle()

type Size

type Size struct {
	Width, Height float32
}

type SortObject

type SortObject struct {
	SortId uint32
	Value  uint32
}

type Sprite

type Sprite Tex2D

Sprite is Tex2D

type SpriteComp

type SpriteComp struct {
	engi.Entity
	Sprite
	// contains filtered or unexported fields
}

SpriteComp & SpriteTable Usually, sprite can be rendered with a BatchRenderer

func (*SpriteComp) BatchId

func (b *SpriteComp) BatchId() uint16

func (*SpriteComp) Color

func (sc *SpriteComp) Color() Color

func (*SpriteComp) Flip

func (sc *SpriteComp) Flip(flipX, flipY bool)

func (*SpriteComp) Gravity

func (sc *SpriteComp) Gravity() (x, y float32)

func (*SpriteComp) SetBatchId

func (b *SpriteComp) SetBatchId(id uint16)

func (*SpriteComp) SetColor

func (sc *SpriteComp) SetColor(c Color)

func (*SpriteComp) SetGravity

func (sc *SpriteComp) SetGravity(x, y float32)

func (*SpriteComp) SetSize

func (sc *SpriteComp) SetSize(w, h float32)

func (*SpriteComp) SetSprite

func (sc *SpriteComp) SetSprite(spt Sprite)

func (*SpriteComp) SetVisible

func (sc *SpriteComp) SetVisible(v bool)

func (*SpriteComp) SetZOrder

func (zo *SpriteComp) SetZOrder(z int16)

func (*SpriteComp) Size

func (sc *SpriteComp) Size() (w, h float32)

func (*SpriteComp) Visible

func (sc *SpriteComp) Visible() bool

func (*SpriteComp) Z

func (zo *SpriteComp) Z() int16

type SpriteRenderFeature

type SpriteRenderFeature struct {
	Stack *StackAllocator

	R *BatchRender
	// contains filtered or unexported fields
}

///

func (*SpriteRenderFeature) Draw

func (f *SpriteRenderFeature) Draw(nodes RenderNodes)

func (*SpriteRenderFeature) Extract

func (f *SpriteRenderFeature) Extract(v *View)

func (*SpriteRenderFeature) Flush

func (f *SpriteRenderFeature) Flush()

func (*SpriteRenderFeature) Register

func (f *SpriteRenderFeature) Register(rs *RenderSystem)

此处初始化所有的依赖

func (*SpriteRenderFeature) SetRender

func (f *SpriteRenderFeature) SetRender(render *BatchRender)

func (*SpriteRenderFeature) SetTable

func (f *SpriteRenderFeature) SetTable(st *SpriteTable, xt *TransformTable)

type SpriteTable

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

func NewSpriteTable

func NewSpriteTable(cap int) *SpriteTable

func (*SpriteTable) Alive

func (st *SpriteTable) Alive(entity engi.Entity) bool

func (*SpriteTable) Comp

func (st *SpriteTable) Comp(entity engi.Entity) (sc *SpriteComp)

func (*SpriteTable) Delete

func (st *SpriteTable) Delete(entity engi.Entity)

func (*SpriteTable) Destroy

func (st *SpriteTable) Destroy()

func (*SpriteTable) NewComp

func (st *SpriteTable) NewComp(entity engi.Entity) (sc *SpriteComp)

func (*SpriteTable) NewCompX

func (st *SpriteTable) NewCompX(entity engi.Entity, spt Tex2D) (sc *SpriteComp)

New SpriteComp with parameter

func (*SpriteTable) Size

func (st *SpriteTable) Size() (size, cap int)

type StackAllocator

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

// This is a stack allocator used for fast per step allocations.

func (*StackAllocator) Alloc

func (stack *StackAllocator) Alloc(size int32) (ptr unsafe.Pointer)

Alloc alloc memory on the stack.

func (*StackAllocator) Free

func (stack *StackAllocator) Free(size int32)

Free frees memory on the stack, it should pair with Alloc.

type SubTex

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

SubTexture = (atlas-id << 16) + SubTexture-id

func (SubTex) Id

func (tex SubTex) Id() (atlas, index int)

func (SubTex) Region

func (tex SubTex) Region() Region

func (SubTex) Size

func (tex SubTex) Size() Size

func (SubTex) Tex

func (tex SubTex) Tex() uint16

type Tex2D

type Tex2D interface {
	// return texture id
	Tex() uint16
	// uv
	Region() Region
	// size
	Size() Size
}

Tex2D is a Texture or a SubTexture

func NewTex

func NewTex(id uint16) Tex2D

type TexManager

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

Texture Resource Manager

var R *TexManager

TextureManager as a global variable.

func (*TexManager) Atlas

func (tm *TexManager) Atlas(name string) (at *Atlas)

func (*TexManager) Delete

func (tm *TexManager) Delete(name string)

func (*TexManager) NewAtlas

func (tm *TexManager) NewAtlas(id uint16, size int, name string) (at *Atlas)

纹理图集的管理是以纹理为单位.

type TextComp

type TextComp struct {
	engi.Entity
	// contains filtered or unexported fields
}

TextSprite

func (*TextComp) BatchId

func (b *TextComp) BatchId() uint16

func (*TextComp) Color

func (tc *TextComp) Color() Color

func (*TextComp) Font

func (tc *TextComp) Font() font.Font

func (*TextComp) FontSize

func (tc *TextComp) FontSize() float32

func (*TextComp) Gravity

func (tc *TextComp) Gravity() (x, y float32)

func (*TextComp) SetBatchId

func (b *TextComp) SetBatchId(id uint16)

func (*TextComp) SetColor

func (tc *TextComp) SetColor(color Color)

func (*TextComp) SetFont

func (tc *TextComp) SetFont(fnt font.Font)

should have default font!!

func (*TextComp) SetFontSize

func (tc *TextComp) SetFontSize(sz float32)

func (*TextComp) SetGravity

func (tc *TextComp) SetGravity(x, y float32)

func (*TextComp) SetText

func (tc *TextComp) SetText(text string)

func (*TextComp) SetVisible

func (tc *TextComp) SetVisible(v bool)

func (*TextComp) SetZOrder

func (zo *TextComp) SetZOrder(z int16)

func (*TextComp) Size

func (tc *TextComp) Size() (w, h float32)

func (*TextComp) Text

func (tc *TextComp) Text() string

func (*TextComp) Visible

func (tc *TextComp) Visible() bool

func (*TextComp) Z

func (zo *TextComp) Z() int16

type TextQuad

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

type TextRenderFeature

type TextRenderFeature struct {
	Stack *StackAllocator
	R     *BatchRender
	// contains filtered or unexported fields
}

func (*TextRenderFeature) Draw

func (f *TextRenderFeature) Draw(nodes RenderNodes)

func (*TextRenderFeature) Extract

func (f *TextRenderFeature) Extract(v *View)

func (*TextRenderFeature) Flush

func (f *TextRenderFeature) Flush()

func (*TextRenderFeature) Register

func (f *TextRenderFeature) Register(rs *RenderSystem)

此处初始化所有的依赖

type TextTable

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

TextTable

func NewTextTable

func NewTextTable(cap int) *TextTable

func (*TextTable) Alive

func (tt *TextTable) Alive(entity engi.Entity) bool

func (*TextTable) Comp

func (tt *TextTable) Comp(entity engi.Entity) (tc *TextComp)

func (*TextTable) Delete

func (tt *TextTable) Delete(entity engi.Entity) (tc *TextComp)

func (*TextTable) Destroy

func (tt *TextTable) Destroy()

Destroy Table

func (*TextTable) NewComp

func (tt *TextTable) NewComp(entity engi.Entity) (tc *TextComp)

func (*TextTable) Size

func (tt *TextTable) Size() (size, cap int)

type Transform

type Transform struct {
	engi.Entity
	// contains filtered or unexported fields
}

还可以做更细的拆分,把 Matrix 全部放到一个数组里面 position, position, position .... position rotation, rotation, rotation .... rotation 把这两个数组申请为一块,然后分两个小组使用

func (*Transform) FirstChild

func (xf *Transform) FirstChild() (c *Transform)

func (*Transform) LinkChild

func (xf *Transform) LinkChild(c *Transform)

func (*Transform) LinkChildren

func (xf *Transform) LinkChildren(list ...*Transform)

func (*Transform) Local

func (xf *Transform) Local() SRT

func (*Transform) MoveBy

func (xf *Transform) MoveBy(dx, dy float32)

func (*Transform) Parent

func (xf *Transform) Parent() (p *Transform)

func (*Transform) Position

func (xf *Transform) Position() f32.Vec2

func (*Transform) RemoveChild

func (xf *Transform) RemoveChild(c *Transform)

func (*Transform) RotateBy

func (xf *Transform) RotateBy(d float32)

func (*Transform) Rotation

func (xf *Transform) Rotation() float32

func (*Transform) Scale

func (xf *Transform) Scale() f32.Vec2

func (*Transform) ScaleBy

func (xf *Transform) ScaleBy(dx, dy float32)

func (*Transform) SetPosition

func (xf *Transform) SetPosition(position f32.Vec2)

Set local position relative to parent

func (*Transform) SetRotation

func (xf *Transform) SetRotation(rotation float32)

apply

func (*Transform) SetScale

func (xf *Transform) SetScale(scale f32.Vec2)

apply scale to child

func (*Transform) Sibling

func (xf *Transform) Sibling() (prev, next *Transform)

func (*Transform) World

func (xf *Transform) World() SRT

type TransformTable

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

func NewTransformTable

func NewTransformTable(cap int) *TransformTable

func (*TransformTable) Alive

func (tt *TransformTable) Alive(entity engi.Entity) bool

func (*TransformTable) Comp

func (tt *TransformTable) Comp(entity engi.Entity) (xf *Transform)

Return the TransformComp or nil

func (*TransformTable) Delete

func (tt *TransformTable) Delete(entity engi.Entity)

Swap erase the TransformComp if exist Delete will unlink the parent-child relation

func (*TransformTable) Destroy

func (tt *TransformTable) Destroy()

func (*TransformTable) NewComp

func (tt *TransformTable) NewComp(entity engi.Entity) (xf *Transform)

Create a new TransformComp for the entity, Return the old one, if it already exist .

func (*TransformTable) Size

func (tt *TransformTable) Size() (size, cap int)

type View

type View struct {
	*Camera
	RenderNodes
}

type VisibilitySystem

type VisibilitySystem interface {
	UpdateBounding(id int32, bb BoundingBox)
	UpdateTransform()
	Collect(camera *Camera) []engi.Entity
}

Directories

Path Synopsis
bk-api provide low-level graphics api.
bk-api provide low-level graphics api.

Jump to

Keyboard shortcuts

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