Documentation
¶
Index ¶
- Constants
- Variables
- func BlendModeAdditive() ebiten.Blend
- func BlendModeClear() ebiten.Blend
- func BlendModeDefault() ebiten.Blend
- func BlendModeMultiply() ebiten.Blend
- func DrawDebugText(screen *ebiten.Image, txtStr string, posX, posY, textScale float32, ...)
- func DrawSrcToDestBlendedWithDepthTexture(dst, src, depth *ebiten.Image, rangeStart, rangeEnd float32, ...)
- func ExtendBase3DShader(customFragment string) (*ebiten.Shader, error)
- func Max[number float32 | float64 | int | int32 | int64](x, y number) number
- func Min[number float32 | float64 | int | int32 | int64](x, y number) number
- type AOBakeOptions
- type AccumulationColorMode
- type AmbientLight
- type Animation
- func (animation *Animation) AddChannel(name string) *AnimationChannel
- func (animation *Animation) FindMarker(markerName string) (Marker, bool)
- func (animation *Animation) Length() float32
- func (animation *Animation) Library() *Library
- func (animation *Animation) LoopMode() AnimationLoopMode
- func (animation *Animation) Name() string
- func (animation *Animation) Properties() *Properties
- func (animation *Animation) RelativeMotion() bool
- func (animation *Animation) SetLoopMode(loopMode AnimationLoopMode)
- func (animation *Animation) SetName(name string)
- func (animation *Animation) SetRelativeMotion(relativeMotion bool)
- func (animation *Animation) String() string
- type AnimationChannel
- type AnimationLoopMode
- type AnimationPlayer
- func (ap *AnimationPlayer) AfterMarker(markerName string) bool
- func (ap *AnimationPlayer) Animation() *Animation
- func (ap *AnimationPlayer) BeforeMarker(markerName string) bool
- func (ap *AnimationPlayer) Clone() *AnimationPlayer
- func (ap *AnimationPlayer) Finished() bool
- func (ap *AnimationPlayer) FinishedPlayingByName(animName string) bool
- func (ap *AnimationPlayer) IsPlaying() bool
- func (ap *AnimationPlayer) IsPlayingByName(animName string) bool
- func (ap *AnimationPlayer) IsPlayingByPropName(propName string) bool
- func (ap *AnimationPlayer) IsPlayingByPropNameValue(propName string, value any) bool
- func (ap *AnimationPlayer) Pause()
- func (ap *AnimationPlayer) Play(animations ...*Animation) *AnimationSequence
- func (ap *AnimationPlayer) PlayByName(animationNames ...string) *AnimationSequence
- func (ap *AnimationPlayer) Playhead() float32
- func (ap *AnimationPlayer) Resume()
- func (ap *AnimationPlayer) SetPlayhead(time float32)
- func (ap *AnimationPlayer) SetRoot(node INode)
- func (ap *AnimationPlayer) TouchedMarker(markerName string) bool
- func (ap *AnimationPlayer) Trigger() *AnimationSequence
- func (ap *AnimationPlayer) Update(dt float32)
- type AnimationPlayerCallbackFunction
- type AnimationSequence
- func (apc *AnimationSequence) Clear() *AnimationSequence
- func (apc *AnimationSequence) ClearError()
- func (apc *AnimationSequence) Clone() *AnimationSequence
- func (apc *AnimationSequence) Error() error
- func (apc *AnimationSequence) Then(callbackFunction AnimationPlayerCallbackFunction) *AnimationSequence
- func (apc *AnimationSequence) ThenPlay(anims ...*Animation) *AnimationSequence
- func (apc *AnimationSequence) ThenPlayByName(animNames ...string) *AnimationSequence
- type AnimationTrack
- type AnimationValues
- type AutoSubdivisionLevel
- type Bitfield
- type BoundingAABB
- func (box *BoundingAABB) Clone() INode
- func (box *BoundingAABB) ClosestPoint(point Vector3) Vector3
- func (box *BoundingAABB) Colliding(other IBoundingObject) bool
- func (box *BoundingAABB) Collision(other IBoundingObject) *Collision
- func (box *BoundingAABB) CollisionTest(settings CollisionTestSettings) *Collision
- func (box *BoundingAABB) ContainsAABB(other *BoundingAABB) bool
- func (box *BoundingAABB) Dimensions() Dimensions
- func (box *BoundingAABB) PointInside(point Vector3) bool
- func (box *BoundingAABB) SetDimensions(newWidth, newHeight, newDepth float32)
- func (box *BoundingAABB) Type() NodeType
- type BoundingCapsule
- func (capsule *BoundingCapsule) Bottom() Vector3
- func (capsule *BoundingCapsule) Clone() INode
- func (capsule *BoundingCapsule) Colliding(other IBoundingObject) bool
- func (capsule *BoundingCapsule) Collision(other IBoundingObject) *Collision
- func (capsule *BoundingCapsule) CollisionTest(settings CollisionTestSettings) *Collision
- func (capsule *BoundingCapsule) Dimensions() Dimensions
- func (capsule *BoundingCapsule) LocalHeight() float32
- func (capsule *BoundingCapsule) LocalRadius() float32
- func (capsule *BoundingCapsule) NearestPointOnLine(point Vector3) Vector3
- func (capsule *BoundingCapsule) PointInside(point Vector3) bool
- func (capsule *BoundingCapsule) SetHeight(height float32)
- func (capsule *BoundingCapsule) SetRadius(radius float32)
- func (capsule *BoundingCapsule) Top() Vector3
- func (capsule *BoundingCapsule) Type() NodeType
- func (capsule *BoundingCapsule) WorldHeight() float32
- func (capsule *BoundingCapsule) WorldRadius() float32
- type BoundingCapsuleUpAxis
- type BoundingSphere
- func (sphere *BoundingSphere) Clone() INode
- func (sphere *BoundingSphere) Colliding(other IBoundingObject) bool
- func (sphere *BoundingSphere) Collision(other IBoundingObject) *Collision
- func (sphere *BoundingSphere) CollisionTest(settings CollisionTestSettings) *Collision
- func (sphere *BoundingSphere) Dimensions() Dimensions
- func (sphere *BoundingSphere) LocalRadius() float32
- func (sphere *BoundingSphere) PointInside(point Vector3) bool
- func (sphere *BoundingSphere) SetRadius(radius float32)
- func (sphere *BoundingSphere) Type() NodeType
- func (sphere *BoundingSphere) WorldRadius() float32
- type BoundingTriangles
- func (bt *BoundingTriangles) Broadphase() *Broadphase
- func (bt *BoundingTriangles) Clone() INode
- func (bt *BoundingTriangles) Colliding(other IBoundingObject) bool
- func (bt *BoundingTriangles) Collision(other IBoundingObject) *Collision
- func (bt *BoundingTriangles) CollisionTest(settings CollisionTestSettings) *Collision
- func (bt *BoundingTriangles) Dimensions() Dimensions
- func (bt *BoundingTriangles) EnableBroadphase(enabled bool)
- func (bt *BoundingTriangles) Type() NodeType
- func (bt *BoundingTriangles) UpdateTransform()
- type Broadphase
- func (b *Broadphase) Clone(newBoundingTriangles *BoundingTriangles) *Broadphase
- func (b *Broadphase) ForEachTriangleFromBoundingObject(boundingObject IBoundingObject, forEach func(tri *Triangle) bool) bool
- func (b *Broadphase) ForEachTriangleInDimensions(dim Dimensions, forEach BroadphaseTestFunction) bool
- func (b *Broadphase) Mesh() *Mesh
- func (b *Broadphase) Resize(cellSizeX, cellSizeY, cellSizeZ float32)
- type BroadphaseTestFunction
- type Camera
- func (camera *Camera) AccumulationColorTexture() *ebiten.Image
- func (camera *Camera) AspectRatio() float32
- func (camera *Camera) Clear()
- func (camera *Camera) ClearWithColor(clear Color4)
- func (camera *Camera) ClipToScreen(vert Vector3) Vector3
- func (camera *Camera) Clone() INode
- func (camera *Camera) ColorTexture() *ebiten.Image
- func (camera *Camera) CurrentSector() *Sector
- func (camera *Camera) DepthTexture() *ebiten.Image
- func (camera *Camera) DrawDebugBoundsColored(screen *ebiten.Image, rootNode INode, options DrawDebugBoundsColoredSettings)
- func (camera *Camera) DrawDebugCenters(screen *ebiten.Image, rootNode INode, color Color4)
- func (camera *Camera) DrawDebugDrawCallCount(screen *ebiten.Image, rootNode INode, textScale float32, color Color4)
- func (camera *Camera) DrawDebugDrawOrder(screen *ebiten.Image, rootNode INode, textScale float32, color Color4)
- func (camera *Camera) DrawDebugFrustums(screen *ebiten.Image, rootNode INode, color Color4)
- func (camera *Camera) DrawDebugNormals(screen *ebiten.Image, rootNode INode, normalLength float32, color Color4)
- func (camera *Camera) DrawDebugTriangleIDs(screen *ebiten.Image, rootNode INode, textScale float32, color Color4)
- func (camera *Camera) DrawDebugWireframe(screen *ebiten.Image, rootNode INode, color Color4)
- func (camera *Camera) DynamicRender(settings ...DynamicRenderSettings) error
- func (camera *Camera) Far() float32
- func (camera *Camera) FieldOfView() float32
- func (camera *Camera) Height() int
- func (camera *Camera) ModelInFrustum(model *Model) bool
- func (camera *Camera) MouseRayTest(options MouseRayTestOptions) *RayHit
- func (camera *Camera) Near() float32
- func (camera *Camera) NormalTexture() *ebiten.Image
- func (camera *Camera) OrthoScale() float32
- func (camera *Camera) Perspective() bool
- func (camera *Camera) PointInFrustum(point Vector3) bool
- func (camera *Camera) Projection() Matrix4
- func (camera *Camera) Render(scene *Scene, lights, models NodeIterator)
- func (camera *Camera) RenderImageSequence(frameCount int, renderFunc func(frameIndex int)) []*ebiten.Image
- func (camera *Camera) RenderNodes(scene *Scene, rootNode INode)
- func (camera *Camera) RenderScene(scene *Scene)
- func (camera *Camera) RenderSprite3D(screen *ebiten.Image, renderSettings ...RenderSprite3DSettings)
- func (camera *Camera) Resize(w, h int)
- func (camera *Camera) ScreenToWorld(x, y, depth float32) Vector3
- func (camera *Camera) ScreenToWorldPixels(x, y int, depth float32) Vector3
- func (camera *Camera) SetFar(far float32)
- func (camera *Camera) SetFieldOfView(fovY float32)
- func (camera *Camera) SetNear(near float32)
- func (camera *Camera) SetOrthoScale(scale float32)
- func (camera *Camera) SetPerspective(perspective bool)
- func (camera *Camera) Size() (w, h int)
- func (camera *Camera) SphereInFrustum(position Vector3, radius float32) bool
- func (camera *Camera) Type() NodeType
- func (camera *Camera) ViewMatrix() Matrix4
- func (camera *Camera) Width() int
- func (camera *Camera) WorldToClip(vert Vector3) Vector3
- func (camera *Camera) WorldToScreen(vert Vector3) Vector3
- func (camera *Camera) WorldToScreenPixels(vert Vector3) Vector3
- func (camera *Camera) WorldUnitToViewRangePercentage(unit float32) float32
- type Collision
- func CollisionTestAABB(x, y, z, width, height, depth float32, settings CollisionTestSettings) *Collision
- func CollisionTestAABBVec(position, size Vector3, settings CollisionTestSettings) *Collision
- func CollisionTestCapsule(x, y, z, radius, height float32, up BoundingCapsuleUpAxis, ...) *Collision
- func CollisionTestCapsuleVec(position Vector3, radius, height float32, up BoundingCapsuleUpAxis, ...) *Collision
- func CollisionTestSphere(x, y, z, radius float32, settings CollisionTestSettings) *Collision
- func CollisionTestSphereVec(position Vector3, radius float32, settings CollisionTestSettings) *Collision
- func (result *Collision) AverageContactPoint() Vector3
- func (col *Collision) AverageMTV() Vector3
- func (col *Collision) AverageNormal() Vector3
- func (result *Collision) AverageSlope() float32
- func (result *Collision) CollidedWithMaterialByName(matName string) bool
- func (result *Collision) CollidedWithMaterialPropName(matHasPropNamed string) bool
- func (result *Collision) CollidedWithParentBitfieldValueName(bitValueName string) bool
- func (result *Collision) CollidedWithParentPropName(parentHasPropNamed string) bool
- func (result *Collision) CollidedWithParentPropPair(parentHasPropNamed string, value any) bool
- func (result *Collision) ForEachCollidedMaterial(forEach func(mat *Material) bool)
- func (col *Collision) MaxMTV() Vector3
- func (col *Collision) SlideAgainstAverageNormal(movementVec Vector3) Vector3
- type CollisionTestSettings
- type Color3
- func (color Color3) Add(other Color3) Color3
- func (color Color3) AddRGB(r, g, b float32) Color3
- func (color Color3) AddScalar(scalar float32) Color3
- func (color Color3) ConvertTosRGB() Color3
- func (c Color3) Equals(other Color3) bool
- func (color Color3) Hue() float32
- func (c Color3) IsZero() bool
- func (c Color3) Lerp(other Color3, percentage float32) Color3
- func (c Color3) LerpRGB(r, g, b, percentage float32) Color3
- func (color Color3) Mix(other Color3, percentage float32) Color3
- func (color Color3) Multiply(other Color3) Color3
- func (color Color3) MultiplyRGB(scalarR, scalarG, scalarB float32) Color3
- func (color Color3) MultiplyScalar(scalar float32) Color3
- func (color Color3) Saturation() float32
- func (color Color3) SetHue(h float32) Color3
- func (color Color3) SetSaturation(s float32) Color3
- func (color Color3) SetValue(v float32) Color3
- func (color Color3) String() string
- func (color Color3) Sub(other Color3) Color3
- func (color Color3) SubRGB(r, g, b float32) Color3
- func (c Color3) ToColor4() Color4
- func (color Color3) ToFloat32Array() [3]float32
- func (color Color3) ToFloat32s() (float32, float32, float32)
- func (c Color3) ToNRGBA64() color.NRGBA64
- func (c Color3) ToRGBA64() color.RGBA64
- func (color Color3) Tofloat32s() (float32, float32, float32)
- func (color Color3) Value() float32
- type Color4
- func (color Color4) Add(other Color4) Color4
- func (c Color4) AddAlpha(alpha float32) Color4
- func (color Color4) AddRGBA(r, g, b, a float32) Color4
- func (color Color4) ConvertTosRGB() Color4
- func (c Color4) Equals(other Color4) bool
- func (color Color4) Hue() float32
- func (c Color4) Invert() Color4
- func (c Color4) IsZero() bool
- func (c Color4) Lerp(other Color4, percentage float32) Color4
- func (c Color4) LerpRGBA(r, g, b, a, percentage float32) Color4
- func (color Color4) Mix(other Color4, percentage float32) Color4
- func (color Color4) Multiply(other Color4) Color4
- func (color Color4) MultiplyRGBA(scalarR, scalarG, scalarB, scalarA float32) Color4
- func (color Color4) MultiplyScalarRGB(scalar float32) Color4
- func (color Color4) MultiplyScalarRGBA(scalar float32) Color4
- func (color Color4) Saturation() float32
- func (color Color4) SetAlpha(alpha float32) Color4
- func (color Color4) SetHue(h float32) Color4
- func (color Color4) SetSaturation(s float32) Color4
- func (color Color4) SetValue(v float32) Color4
- func (color Color4) String() string
- func (color Color4) Sub(other Color4) Color4
- func (c Color4) SubAlpha(alpha float32) Color4
- func (color Color4) SubRGBA(r, g, b, a float32) Color4
- func (c Color4) ToColor3() Color3
- func (color Color4) ToFloat32Array() [4]float32
- func (color Color4) ToFloat32s() (float32, float32, float32, float32)
- func (c Color4) ToNRGBA64() color.NRGBA64
- func (c Color4) ToRGBA64() color.RGBA64
- func (color Color4) Tofloat32s() (float32, float32, float32, float32)
- func (color Color4) Value() float32
- type ColorCurve
- type ColorCurvePoint
- type ColorTween
- type CustomMaterialDepthFunction
- type Data
- type DebugInfo
- func (d *DebugInfo) ActiveLightCount() int
- func (d *DebugInfo) AnimationTime() time.Duration
- func (d *DebugInfo) BatchedParts() int
- func (d *DebugInfo) Draw(screen *ebiten.Image, textScale float32, col Color4)
- func (d *DebugInfo) DrawnParts() int
- func (d *DebugInfo) DrawnTris() int
- func (d *DebugInfo) FrameTime() time.Duration
- func (d *DebugInfo) LightCount() int
- func (d *DebugInfo) LightTime() time.Duration
- func (d *DebugInfo) NodeCount() int
- func (d *DebugInfo) PrevFrametimes() []float32
- func (d *DebugInfo) SetCombineWith(others ...*DebugInfo)
- func (d *DebugInfo) TotalParts() int
- func (d *DebugInfo) TotalTris() int
- type DebugInfoDuration
- type Dimensions
- func (dim Dimensions) Canon() Dimensions
- func (dim Dimensions) Center() Vector3
- func (dim Dimensions) Contains(point Vector3) bool
- func (dim Dimensions) Depth() float32
- func (dim Dimensions) Dimension(axis int) float32
- func (dim Dimensions) Height() float32
- func (dim Dimensions) Intersects(other Dimensions) bool
- func (dim Dimensions) MaxDimension() float32
- func (dim Dimensions) MaxSpan() float32
- func (dim Dimensions) Projection(axis int) Projection
- func (dim Dimensions) Size() Vector3
- func (dim Dimensions) Width() float32
- type DirectionalLight
- func (sun *DirectionalLight) Clone() INode
- func (sun *DirectionalLight) Light(tri *Triangle, model *Model, targetColors *VertexColorChannel)
- func (sun *DirectionalLight) Type() NodeType
- func (sun *DirectionalLight) VertexLight(index int, tri *Triangle, model *Model, targetColors *VertexColorChannel)
- type DrawDebugBoundsColoredSettings
- type DynamicRenderSettings
- type FloatRange
- type FogBlendMode
- type FogCurve
- type GLTFLoadOptions
- type Grid
- func (grid *Grid) Center() Vector3
- func (grid *Grid) Clone() INode
- func (grid *Grid) ClosestGridPoint(position Vector3) *GridPoint
- func (grid *Grid) ClosestPositionOnGrid(position Vector3) Vector3
- func (grid *Grid) Combine(others ...*Grid)
- func (grid *Grid) Dimensions() Dimensions
- func (grid *Grid) DisconnectAllPoints()
- func (grid *Grid) FirstPoint() *GridPoint
- func (grid *Grid) ForEachPoint(forEach func(gridPoint *GridPoint))
- func (grid *Grid) FurthestGridPoint(position Vector3) *GridPoint
- func (grid *Grid) HopCounts(from Vector3, targetPositions ...Vector3) []HopCount
- func (grid *Grid) LastPoint() *GridPoint
- func (grid *Grid) MergeDuplicatePoints(margin float32)
- func (grid *Grid) Points() []*GridPoint
- func (grid *Grid) RandomPoint() *GridPoint
- func (grid *Grid) Type() NodeType
- type GridConnection
- type GridPath
- type GridPoint
- func (point *GridPoint) Clone() INode
- func (point *GridPoint) Connect(other *GridPoint) (aToB, bToA *GridConnection)
- func (point *GridPoint) Connection(other *GridPoint) *GridConnection
- func (point *GridPoint) Disconnect(other *GridPoint)
- func (point *GridPoint) DisconnectAll()
- func (point *GridPoint) IsConnected(other *GridPoint) bool
- func (point *GridPoint) IsOnSameGrid(other *GridPoint) bool
- func (point *GridPoint) PathTo(goal *GridPoint) *GridPath
- func (point *GridPoint) Type() NodeType
- type HopCount
- type IBoundingObject
- type ILight
- type INode
- type IPath
- type IntRange
- type Intersection
- type Keyframe
- type Library
- func (lib *Library) AddScene(sceneName string) *Scene
- func (lib *Library) AnimationByID(id uint32) *Animation
- func (lib *Library) AnimationByName(name string) *Animation
- func (lib *Library) MaterialByID(id uint32) *Material
- func (lib *Library) MaterialByName(name string) *Material
- func (lib *Library) MeshByID(id uint32) *Mesh
- func (lib *Library) MeshByName(name string) *Mesh
- func (lib *Library) NodeByID(id uint32) INode
- func (lib *Library) NodeByName(objectName string) INode
- func (lib *Library) SceneByID(id uint32) *Scene
- func (lib *Library) SceneByName(name string) *Scene
- func (lib *Library) WorldByID(id uint32) *World
- func (lib *Library) WorldByName(name string) *World
- type LightBase
- type LightGroup
- type LightVolume
- func (l *LightVolume) Clone() INode
- func (l *LightVolume) Dimensions() Dimensions
- func (l *LightVolume) Light(tri *Triangle, model *Model, targetColors *VertexColorChannel)
- func (l *LightVolume) LightVolumeBlur(cellRadius int, iterations int, blurStrength float32, ...)
- func (l *LightVolume) LightVolumeCellAtIndices(x, y, z int) *LightVolumeCell
- func (l *LightVolume) LightVolumeCellAtWorldPosition(position Vector3) *LightVolumeCell
- func (l *LightVolume) LightVolumeCellCount(dimension int) int
- func (l *LightVolume) LightVolumeCellCountX() int
- func (l *LightVolume) LightVolumeCellCountY() int
- func (l *LightVolume) LightVolumeCellCountZ() int
- func (l *LightVolume) LightVolumeCellSize(dimension int) float32
- func (l *LightVolume) LightVolumeCellSizeX() float32
- func (l *LightVolume) LightVolumeCellSizeY() float32
- func (l *LightVolume) LightVolumeCellSizeZ() float32
- func (l *LightVolume) LightVolumeDebugDraw(screen *ebiten.Image, camera *Camera, debugCenterPos Vector3, radius float32)
- func (l *LightVolume) LightVolumeForEachCell(forEach func(cell *LightVolumeCell) bool)
- func (l *LightVolume) LightVolumeLightBias() Vector3
- func (l *LightVolume) LightVolumeOffset() Vector3
- func (l *LightVolume) LightVolumePropagate(iterations int, propagationFalloff float32, ...)
- func (l *LightVolume) LightVolumePropagateAllDirections(cellRadius int, iterations int, propagationStrength float32, ...)
- func (l *LightVolume) LightVolumeResize(dimensions Dimensions, cellsizeX, cellsizeY, cellsizeZ float32)
- func (l *LightVolume) LightVolumeSetLightBias(x, y, z float32)
- func (l *LightVolume) LightVolumeSetLightBiasVec(vec Vector3)
- func (l *LightVolume) LightVolumeSetOffset(x, y, z float32)
- func (l *LightVolume) LightVolumeSetOffsetVec(vec Vector3)
- func (l *LightVolume) Type() NodeType
- func (l *LightVolume) VertexLight(vertIndex int, tri *Triangle, model *Model, targetColors *VertexColorChannel)
- type LightVolumeCell
- func (c *LightVolumeCell) Blocked(dir LightVolumeDirection) bool
- func (c *LightVolumeCell) ClearUseLights()
- func (c *LightVolumeCell) Color() Color4
- func (c *LightVolumeCell) Data() any
- func (c *LightVolumeCell) ForEachNeighborInDirection(neighborDirection LightVolumeDirection, ...)
- func (c *LightVolumeCell) HasTag(tag uint8) bool
- func (c *LightVolumeCell) IndexX() int
- func (c *LightVolumeCell) IndexY() int
- func (c *LightVolumeCell) IndexZ() int
- func (c *LightVolumeCell) IsAtBackSide() bool
- func (c *LightVolumeCell) IsAtBottomSide() bool
- func (c *LightVolumeCell) IsAtFrontSide() bool
- func (c *LightVolumeCell) IsAtLeftSide() bool
- func (c *LightVolumeCell) IsAtRightSide() bool
- func (c *LightVolumeCell) IsAtTopSide() bool
- func (c *LightVolumeCell) IsDirectNeighborOf(other LightVolumeCell, direction LightVolumeDirection) bool
- func (c *LightVolumeCell) Neighbor(direction LightVolumeDirection) *LightVolumeCell
- func (c *LightVolumeCell) RemoveTag(tag uint8)
- func (c *LightVolumeCell) SetBlocked(direction LightVolumeDirection, blocked bool)
- func (c *LightVolumeCell) SetBlockedAll(blocked bool)
- func (c *LightVolumeCell) SetColor(color Color4)
- func (c *LightVolumeCell) SetColorMonochrome(value float32)
- func (c *LightVolumeCell) SetColorRGB(r, g, b float32)
- func (c *LightVolumeCell) SetData(data any)
- func (c *LightVolumeCell) SetTag(tag uint8)
- func (c *LightVolumeCell) SetUseLights(lights ...ILight)
- func (c *LightVolumeCell) UseLights() []ILight
- func (c *LightVolumeCell) WorldPosition() Vector3
- type LightVolumeDirection
- type Marker
- type Material
- func (m *Material) Clone() *Material
- func (m *Material) DisposeShader()
- func (m *Material) ID() uint32
- func (m *Material) Library() *Library
- func (m *Material) Name() string
- func (m *Material) Properties() *Properties
- func (m *Material) SetName(name string)
- func (m *Material) SetShader(shader *ebiten.Shader)
- func (m *Material) SetShaderText(src []byte) (*ebiten.Shader, error)
- func (m *Material) Shader() *ebiten.Shader
- func (m *Material) String() string
- type Matrix4
- func NewEmptyMatrix4() Matrix4
- func NewMatrix4() Matrix4
- func NewMatrix4LookAt(from, to, up Vector3) Matrix4
- func NewMatrix4Rotate(x, y, z, angle float32) Matrix4
- func NewMatrix4RotateFromEuler(euler Vector3) Matrix4
- func NewMatrix4Scale(x, y, z float32) Matrix4
- func NewMatrix4Translate(x, y, z float32) Matrix4
- func NewProjectionMatrix4Orthographic(near, far, right, left, top, bottom float32) Matrix4
- func NewProjectionMatrix4Perspective(fovy, near, far, viewWidth, viewHeight float32) Matrix4
- func (matrix Matrix4) Add(other Matrix4) Matrix4
- func (matrix Matrix4) BlenderToTetra() Matrix4
- func (matrix *Matrix4) Clear()
- func (matrix Matrix4) Clone() Matrix4
- func (matrix Matrix4) Column(columnIndex int) Vector4
- func (matrix Matrix4) Columns() [][]float32
- func (matrix Matrix4) Decompose() (Vector3, Vector3, Matrix4)
- func (matrix Matrix4) DecomposePosition() Vector3
- func (matrix Matrix4) DecomposeRotation() Matrix4
- func (matrix Matrix4) DecomposeScale() Vector3
- func (matrix Matrix4) Equals(other Matrix4) bool
- func (matrix Matrix4) Forward() Vector3
- func (matrix Matrix4) HasValidRotation() bool
- func (matrix *Matrix4) Index(index int) float32
- func (matrix Matrix4) Inverted() Matrix4
- func (matrix Matrix4) IsIdentity() bool
- func (matrix Matrix4) IsZero() bool
- func (mat Matrix4) Lerp(other Matrix4, percent float32) Matrix4
- func (matrix Matrix4) Mult(other Matrix4) Matrix4
- func (matrix Matrix4) MultVec(vect Vector3) Vector3
- func (matrix Matrix4) MultVecW(vect Vector3) Vector4
- func (matrix Matrix4) Right() Vector3
- func (matrix Matrix4) Rotated(x, y, z, angle float32) Matrix4
- func (matrix Matrix4) Round(unitSize float32) Matrix4
- func (matrix Matrix4) Row(rowIndex int) Vector4
- func (matrix Matrix4) RowAsVector3(rowIndex int) Vector3
- func (matrix Matrix4) Scale(scalar float32) Matrix4
- func (matrix *Matrix4) Set(other Matrix4)
- func (matrix *Matrix4) SetByIndex(index int, value float32)
- func (matrix *Matrix4) SetColumn(columnIndex int, vec Vector4)
- func (matrix *Matrix4) SetFloats(floats []float32) Matrix4
- func (matrix *Matrix4) SetRow(rowIndex int, vec Vector4)
- func (mat Matrix4) Slerp(other Matrix4, percent float32) Matrix4
- func (matrix Matrix4) String() string
- func (matrix Matrix4) Sub(other Matrix4) Matrix4
- func (matrix Matrix4) ToFloatSlice() []float32
- func (matrix Matrix4) ToFloats() [16]float32
- func (matrix Matrix4) ToQuaternion() Quaternion
- func (matrix Matrix4) Transposed() Matrix4
- func (matrix Matrix4) Up() Vector3
- type Mesh
- func (mesh *Mesh) AddMeshPart(material *Material) *MeshPart
- func (mesh *Mesh) AddVertices(verts ...VertexInfo)
- func (mesh *Mesh) AutoNormal()
- func (mesh *Mesh) Clone() *Mesh
- func (mesh *Mesh) CombineVertexColors(targetChannel int, multiplicative bool, sourceChannels ...int)
- func (mesh *Mesh) ForEachMaterial(forEach func(mat *Material) bool)
- func (mesh *Mesh) GetVertexInfo(vertexIndex int) VertexInfo
- func (mesh *Mesh) Library() *Library
- func (mesh *Mesh) Materials() []*Material
- func (mesh *Mesh) MeshPartByMaterialName(materialName string) *MeshPart
- func (mesh *Mesh) Properties() *Properties
- func (mesh *Mesh) SetShapeKeys(shapeKeys []*MeshShapeKey)
- func (mesh *Mesh) SetVertexColor(channel *VertexColorChannel, color Color4)
- func (mesh *Mesh) ShapeKeyByIndex(index int) *MeshShapeKey
- func (mesh *Mesh) ShapeKeyByName(name string) *MeshShapeKey
- func (mesh *Mesh) ShapeKeys() []*MeshShapeKey
- func (mesh *Mesh) String() string
- func (mesh *Mesh) TriangleByID(id uint32) *Triangle
- func (mesh *Mesh) TriangleByIndex(index int) *Triangle
- func (mesh *Mesh) UpdateBounds()
- func (mesh *Mesh) VertexColorChannelByName(name string) *VertexColorChannel
- func (mesh *Mesh) VertexNormalWithShapeKeys(vertIndex int) Vector3
- func (mesh *Mesh) VertexPositionWithShapeKeys(vertIndex int) Vector3
- type MeshPart
- func (part *MeshPart) AddTriangles(indices ...int)
- func (part *MeshPart) ApplyMatrix(matrix Matrix4)
- func (part *MeshPart) AssignToMesh(mesh *Mesh)
- func (part *MeshPart) Clone() *MeshPart
- func (part *MeshPart) ForEachTri(triFunc func(tri *Triangle))
- func (part *MeshPart) ForEachVertexIndex(vertFunc func(vertIndex int), onlyVisible bool)
- func (part *MeshPart) TriangleCount() int
- func (part *MeshPart) VertexIndexCount() int
- type MeshShapeKey
- type MeshUniqueType
- type ModVector2
- func (ip *ModVector2) Add(other *ModVector2) *ModVector2
- func (ip *ModVector2) AddMagnitude(mag float32) *ModVector2
- func (ip *ModVector2) AddX(x float32) *ModVector2
- func (ip *ModVector2) AddY(x float32) *ModVector2
- func (ip *ModVector2) Angle(baselineVec *ModVector2) float32
- func (ip *ModVector2) Ceil() *ModVector2
- func (ip *ModVector2) Clamp(x, y float32) *ModVector2
- func (ip *ModVector2) ClampAngle(baselineVec *ModVector2, maxAngle float32) *ModVector2
- func (ip *ModVector2) ClampMagnitude(maxMag float32) *ModVector2
- func (ip *ModVector2) ClampVec(extents *ModVector2) *ModVector2
- func (ip *ModVector2) Clone() *ModVector2
- func (ip *ModVector2) Divide(scalar float32) *ModVector2
- func (ip *ModVector2) Expand(margin, min float32) *ModVector2
- func (ip *ModVector2) Floor() *ModVector2
- func (ip *ModVector2) Invert() *ModVector2
- func (ip *ModVector2) Lerp(other *ModVector2, percentage float32) *ModVector2
- func (ip *ModVector2) MoveTowards(target *ModVector2, magnitude float32) *ModVector2
- func (ip *ModVector2) Mult(other *ModVector2) *ModVector2
- func (ip *ModVector2) Reflect(normal *ModVector2) *ModVector2
- func (ip *ModVector2) Rotate(angle float32) *ModVector2
- func (ip *ModVector2) Round(roundToUnits float32) *ModVector2
- func (ip *ModVector2) Scale(scalar float32) *ModVector2
- func (vec *ModVector2) Set(other *ModVector2)
- func (ip *ModVector2) SetXY(x, y float32) *ModVector2
- func (ip *ModVector2) SetZero() *ModVector2
- func (ip *ModVector2) Slerp(other *ModVector2, percentage float32) *ModVector2
- func (ip *ModVector2) String() string
- func (ip *ModVector2) Sub(other Vector2) *ModVector2
- func (ip *ModVector2) SubMagnitude(mag float32) *ModVector2
- func (ip *ModVector2) SubX(x float32) *ModVector2
- func (ip *ModVector2) SubY(x float32) *ModVector2
- func (ip *ModVector2) Swizzle2(swizzleString string) *ModVector2
- func (ip *ModVector2) Swizzle3(swizzleString string) *ModVector3
- func (ip *ModVector2) ToVector() Vector2
- func (ip *ModVector2) Unit() *ModVector2
- type ModVector3
- func (ip *ModVector3) Add(other *ModVector3) *ModVector3
- func (ip *ModVector3) AddMagnitude(mag float32) *ModVector3
- func (ip *ModVector3) AddX(x float32) *ModVector3
- func (ip *ModVector3) AddY(x float32) *ModVector3
- func (ip *ModVector3) AddZ(x float32) *ModVector3
- func (ip *ModVector3) Angle(baselineVec *ModVector3) float32
- func (ip *ModVector3) AngleSigned(baselineVec, planeNormal *ModVector3) float32
- func (ip *ModVector3) Ceil() *ModVector3
- func (ip *ModVector3) Clamp(x, y, z float32) *ModVector3
- func (ip *ModVector3) ClampAngle(baselineVec *ModVector3, maxAngle float32) *ModVector3
- func (ip *ModVector3) ClampMagnitude(maxMag float32) *ModVector3
- func (ip *ModVector3) ClampVec(extents *ModVector3) *ModVector3
- func (ip *ModVector3) Clone() *ModVector3
- func (ip *ModVector3) Cross(other *ModVector3) *ModVector3
- func (ip *ModVector3) Divide(scalar float32) *ModVector3
- func (ip *ModVector3) Expand(margin, min float32) *ModVector3
- func (ip *ModVector3) Floor() *ModVector3
- func (ip *ModVector3) Invert() *ModVector3
- func (ip *ModVector3) Lerp(other *ModVector3, percentage float32) *ModVector3
- func (ip *ModVector3) MoveTowards(target *ModVector3, magnitude float32) *ModVector3
- func (ip *ModVector3) Mult(other *ModVector3) *ModVector3
- func (ip *ModVector3) Reflect(normal *ModVector3) *ModVector3
- func (ip *ModVector3) Rotate(x, y, z, angle float32) *ModVector3
- func (ip *ModVector3) RotateVec(axis *ModVector3, angle float32) *ModVector3
- func (ip *ModVector3) Round(roundToUnits float32) *ModVector3
- func (ip *ModVector3) Scale(scalar float32) *ModVector3
- func (vec *ModVector3) Set(other *ModVector3)
- func (ip *ModVector3) SetXYZ(x, y, z float32) *ModVector3
- func (ip *ModVector3) SetZero() *ModVector3
- func (ip *ModVector3) Slerp(other *ModVector3, percentage float32) *ModVector3
- func (ip *ModVector3) SlideAgainst(reflectingNormal Vector3) *ModVector3
- func (ip *ModVector3) Slope() float32
- func (ip *ModVector3) String() string
- func (ip *ModVector3) Sub(other *ModVector3) *ModVector3
- func (ip *ModVector3) SubMagnitude(mag float32) *ModVector3
- func (ip *ModVector3) SubX(x float32) *ModVector3
- func (ip *ModVector3) SubY(x float32) *ModVector3
- func (ip *ModVector3) SubZ(x float32) *ModVector3
- func (ip *ModVector3) Swizzle2(swizzleString string) *ModVector2
- func (ip *ModVector3) Swizzle3(swizzleString string) *ModVector3
- func (ip *ModVector3) ToVector() Vector3
- func (ip *ModVector3) Unit() *ModVector3
- type Model
- func (model *Model) BakeAO(bakeOptions AOBakeOptions)
- func (model *Model) BakeLighting(targetChannel int, camera *Camera, lights NodeIterator)
- func (model *Model) Clone() INode
- func (model *Model) Dimensions() Dimensions
- func (model *Model) DynamicBatchAdd(meshPart *MeshPart, batchedModels ...*Model) error
- func (model *Model) DynamicBatchClear()
- func (model *Model) DynamicBatchRemove(batched ...*Model)
- func (model *Model) DynamicBatchTriangleCount() int
- func (model *Model) DynamicBatcher() bool
- func (model *Model) Mesh() *Mesh
- func (model *Model) ProcessVertices(vpMatrix Matrix4, camera *Camera, meshPart *MeshPart, processOnlyVisible bool, ...)
- func (model *Model) ReassignBones(armatureRoot INode)
- func (model *Model) Sector() *Sector
- func (model *Model) SetMesh(mesh *Mesh)
- func (model *Model) StaticMerge(target *Model, targetMeshPart *MeshPart)
- func (model *Model) Type() NodeType
- type MouseRayTestOptions
- func (r MouseRayTestOptions) WithDepth(depth float32) MouseRayTestOptions
- func (r MouseRayTestOptions) WithDoublesided(doubleSided bool) MouseRayTestOptions
- func (r MouseRayTestOptions) WithOnHit(onHit func(hit RayHit, index, count int) bool) MouseRayTestOptions
- func (r MouseRayTestOptions) WithTestAgainst(iterator NodeIterator) MouseRayTestOptions
- type Node
- func (node *Node) AddChildren(children ...INode)
- func (node *Node) AnimationPlayer() *AnimationPlayer
- func (node *Node) Callbacks() *NodeCallbacks
- func (node *Node) Children(recursive bool) NodeList
- func (node *Node) ChildrenCount(recursive bool) int
- func (node *Node) ClearLocalTransform()
- func (node *Node) Clone() INode
- func (node *Node) Data() any
- func (node *Node) DescendantOf(parent INode) bool
- func (node *Node) DistanceSquaredTo(other INode) float32
- func (node *Node) DistanceTo(other INode) float32
- func (node *Node) ForEachChild(recursive bool, forEach func(node INode, index int) bool)
- func (node *Node) Get(path string) INode
- func (node *Node) Grow(x, y, z float32)
- func (node *Node) GrowVec(vec Vector3)
- func (node *Node) HierarchyAsString() string
- func (node *Node) ID() uint32
- func (node *Node) InSceneTree() bool
- func (node *Node) Index() int
- func (node *Node) IsBone() bool
- func (node *Node) IsVisible() bool
- func (node *Node) Library() *Library
- func (node *Node) LocalPosition() Vector3
- func (node *Node) LocalRotation() Matrix4
- func (node *Node) LocalScale() Vector3
- func (node *Node) Move(x, y, z float32)
- func (node *Node) MoveByOrientation(x, y, z float32)
- func (node *Node) MoveByOrientationVec(vec Vector3)
- func (node *Node) MoveTowards(x, y, z float32, distance float32)
- func (node *Node) MoveTowardsLerp(x, y, z float32, percentage float32)
- func (node *Node) MoveTowardsNode(target INode, distance float32)
- func (node *Node) MoveTowardsNodeLerp(target INode, percentage float32)
- func (node *Node) MoveTowardsVec(vec Vector3, distance float32)
- func (node *Node) MoveTowardsVecLerp(vec Vector3, percentage float32)
- func (node *Node) MoveVec(vec Vector3)
- func (node *Node) Name() string
- func (node *Node) Parent() INode
- func (node *Node) Path() string
- func (node *Node) Properties() *Properties
- func (node *Node) PropertiesContainsBitByName(bitfieldBitName string) bool
- func (node *Node) ReindexChild(child INode, newIndex int) int
- func (node *Node) RemoveChildren(children ...INode)
- func (node *Node) ReplaceWith(other INode)
- func (node *Node) ResetWorldPosition()
- func (node *Node) ResetWorldRotation()
- func (node *Node) ResetWorldScale()
- func (node *Node) ResetWorldTransform()
- func (node *Node) Root() *Node
- func (node *Node) Rotate(x, y, z, angle float32)
- func (node *Node) RotateMatrix4(mat Matrix4)
- func (node *Node) RotateVec(vec Vector3, angle float32)
- func (node *Node) Scene() *Scene
- func (n *Node) Search() SearchOptions
- func (node *Node) Sector() *Sector
- func (node *Node) SectorType() SectorType
- func (node *Node) SetData(data any)
- func (node *Node) SetLocalPosition(x, y, z float32)
- func (node *Node) SetLocalPositionVec(position Vector3)
- func (node *Node) SetLocalRotation(rotation Matrix4)
- func (node *Node) SetLocalScale(w, h, d float32)
- func (node *Node) SetLocalScaleVec(scale Vector3)
- func (node *Node) SetLocalX(x float32)
- func (node *Node) SetLocalY(y float32)
- func (node *Node) SetLocalZ(z float32)
- func (node *Node) SetName(name string)
- func (node *Node) SetSectorType(sectorType SectorType)
- func (node *Node) SetVisible(visible bool, recursive bool)
- func (node *Node) SetWorldPosition(x, y, z float32)
- func (node *Node) SetWorldPositionVec(vec Vector3)
- func (node *Node) SetWorldRotation(rotation Matrix4)
- func (node *Node) SetWorldScale(w, h, d float32)
- func (node *Node) SetWorldScaleVec(scale Vector3)
- func (node *Node) SetWorldTransform(transform Matrix4)
- func (node *Node) SetWorldX(x float32)
- func (node *Node) SetWorldY(y float32)
- func (node *Node) SetWorldZ(z float32)
- func (node *Node) String() string
- func (node *Node) Transform() Matrix4
- func (node *Node) Type() NodeType
- func (node *Node) Unparent()
- func (node *Node) VectorTo(other INode) Vector3
- func (node *Node) WorldPosition() Vector3
- func (node *Node) WorldRotation() Matrix4
- func (node *Node) WorldScale() Vector3
- type NodeCallbacks
- type NodeIterator
- type NodeList
- func (n *NodeList) Add(node INode)
- func (n NodeList) Capacity() int
- func (n *NodeList) Clear()
- func (n *NodeList) Combine(other NodeIterator)
- func (n NodeList) Count() int
- func (n NodeList) First() INode
- func (n NodeList) ForEach(forEach func(node INode, index int) bool)
- func (n NodeList) Get(index int) INode
- func (n NodeList) Last() INode
- type NodeType
- type Particle
- type ParticleSystem
- func (ps *ParticleSystem) Clone() *ParticleSystem
- func (ps *ParticleSystem) Model() *Model
- func (ps *ParticleSystem) Remove(part *Particle)
- func (ps *ParticleSystem) SetSettings(settings ParticleSystemSettings)
- func (ps *ParticleSystem) Settings() ParticleSystemSettings
- func (ps *ParticleSystem) Spawn()
- func (ps *ParticleSystem) Update(dt float32)
- type ParticleSystemSettings
- func (pss *ParticleSystemSettings) Clone() ParticleSystemSettings
- func (p ParticleSystemSettings) WithAllowNegativeScale(allow bool) ParticleSystemSettings
- func (p ParticleSystemSettings) WithColorCurve(colorCurve ColorCurve) ParticleSystemSettings
- func (p ParticleSystemSettings) WithFriction(friction float32) ParticleSystemSettings
- func (p ParticleSystemSettings) WithLifetime(lifetime FloatRange) ParticleSystemSettings
- func (p ParticleSystemSettings) WithLocalPosition(localPosition bool) ParticleSystemSettings
- func (p ParticleSystemSettings) WithMovementFunction(movementFunction func(p *Particle)) ParticleSystemSettings
- func (p ParticleSystemSettings) WithRotationAdd(rotation Vector3Range) ParticleSystemSettings
- func (p ParticleSystemSettings) WithScale(scale Vector3Range) ParticleSystemSettings
- func (p ParticleSystemSettings) WithScaleAdd(scale Vector3Range) ParticleSystemSettings
- func (p ParticleSystemSettings) WithSpawnCount(spawnCount IntRange) ParticleSystemSettings
- func (p ParticleSystemSettings) WithSpawnOffset(spawnOffset Vector3Range) ParticleSystemSettings
- func (p ParticleSystemSettings) WithSpawnOffsetFunction(spawnOffsetFunction func(p *Particle)) ParticleSystemSettings
- func (p ParticleSystemSettings) WithSpawnOn(spawnOn bool) ParticleSystemSettings
- func (p ParticleSystemSettings) WithSpawnRate(spawnRate FloatRange) ParticleSystemSettings
- func (p ParticleSystemSettings) WithVelocity(velocity Vector3Range) ParticleSystemSettings
- func (p ParticleSystemSettings) WithVelocityAdd(velocity Vector3Range) ParticleSystemSettings
- func (p ParticleSystemSettings) WithVertexSpawn(model *Model, spawnMode int) ParticleSystemSettings
- type Path
- type PathStepper
- func (ps *PathStepper) AtEnd() bool
- func (ps *PathStepper) AtStart() bool
- func (ps *PathStepper) Current() Vector3
- func (ps *PathStepper) GotoNext()
- func (ps *PathStepper) GotoPrev()
- func (ps *PathStepper) Next() Vector3
- func (ps *PathStepper) Path() IPath
- func (ps *PathStepper) Prev() Vector3
- func (ps *PathStepper) ProgressToWorldPosition(perc float32) Vector3
- func (ps *PathStepper) SetIndexToEnd()
- func (ps *PathStepper) SetIndexToStart()
- func (ps *PathStepper) SetPath(path IPath)
- type PointLight
- func (p *PointLight) Clone() INode
- func (p *PointLight) Light(tri *Triangle, model *Model, targetColors *VertexColorChannel)
- func (p *PointLight) Range() float32
- func (p *PointLight) SetRange(lightRange float32)
- func (p *PointLight) Type() NodeType
- func (p *PointLight) VertexLight(index int, tri *Triangle, model *Model, targetColors *VertexColorChannel)
- type Projection
- type Properties
- func (props *Properties) Add(propName string) *Property
- func (props *Properties) Clear()
- func (props *Properties) Clone() *Properties
- func (props *Properties) CopyFrom(src *Properties, overwrite bool)
- func (props *Properties) Count() int
- func (props *Properties) ForEach(forEach func(p *Property, index int) bool)
- func (props *Properties) Get(propIndex int) *Property
- func (props *Properties) GetByName(propName string) *Property
- func (props *Properties) Has(propName string) bool
- func (props *Properties) HasBitfieldValue(value Bitfield) bool
- func (props *Properties) HasNameAndBitfieldValue(propName string, value Bitfield) bool
- func (props *Properties) HasNameAndValue(propName string, value any) bool
- func (props *Properties) Remove(key string)
- func (props *Properties) Set(propName string, value any) *Property
- type Property
- func (prop *Property) AsBitfield() Bitfield
- func (prop *Property) AsBool() bool
- func (prop *Property) AsColor() Color4
- func (prop *Property) AsFloat32() float32
- func (prop *Property) AsInt() int
- func (prop *Property) AsString() string
- func (prop *Property) AsStringSceneObjectPair() (sceneName, objectName string)
- func (prop *Property) AsVector2() Vector2
- func (prop *Property) AsVector3() Vector3
- func (prop *Property) IsBitfield() bool
- func (prop *Property) IsBool() bool
- func (prop *Property) IsColor() bool
- func (prop *Property) IsFloat32() bool
- func (prop *Property) IsInt() bool
- func (prop *Property) IsString() bool
- func (prop *Property) IsVector2() bool
- func (prop *Property) IsVector3() bool
- func (prop *Property) Name() string
- func (prop *Property) Set(value any)
- type Quaternion
- func (quat Quaternion) Conjugate() Quaternion
- func (quat Quaternion) Dot(other Quaternion) float32
- func (quat Quaternion) Inverted() Quaternion
- func (quat Quaternion) IsZero() bool
- func (quat Quaternion) Lerp(end Quaternion, percent float32) Quaternion
- func (quat Quaternion) Magnitude() float32
- func (q1 Quaternion) Mult(q2 Quaternion) Quaternion
- func (quat Quaternion) RotateVec(v Vector3) Vector3
- func (quat Quaternion) Scale(factor float32) Quaternion
- func (quat Quaternion) Slerp(end Quaternion, percent float32) Quaternion
- func (quat Quaternion) ToAxisAngle() (Vector3, float32)
- func (quat Quaternion) ToMatrix4() Matrix4
- func (quat Quaternion) Unit() Quaternion
- type RayHit
- type RayTestOptions
- func (r RayTestOptions) AddPosition(from, to Vector3) RayTestOptions
- func (r RayTestOptions) WithDoublesided(doubleSided bool) RayTestOptions
- func (r RayTestOptions) WithOnHit(onHit func(hit RayHit, index, count int) bool) RayTestOptions
- func (r RayTestOptions) WithTestAgainst(iterator NodeIterator) RayTestOptions
- type RenderSprite3DSettings
- type Scene
- func (scene *Scene) BitfieldNameByIndex(index int) string
- func (scene *Scene) BitfieldNameByValue(value Bitfield) string
- func (scene *Scene) BitfieldNames() []string
- func (scene *Scene) BitfieldValueByName(name string) Bitfield
- func (scene *Scene) Callbacks() *SceneCallbacks
- func (scene *Scene) Clone() *Scene
- func (scene *Scene) Data() any
- func (scene *Scene) Get(nodePath string) INode
- func (scene *Scene) HandleAutobatch()
- func (s *Scene) ID() uint32
- func (scene *Scene) Library() *Library
- func (s *Scene) Name() string
- func (scene *Scene) Properties() *Properties
- func (scene *Scene) SetData(data any)
- func (s *Scene) SetName(name string)
- func (scene *Scene) String() string
- type SceneCallbacks
- type SearchOptions
- func (s SearchOptions) ByCustomFunc(customFunc func(INode) bool) SearchOptions
- func (s SearchOptions) ByNames(names ...string) SearchOptions
- func (s SearchOptions) ByNamesPartial(names ...string) SearchOptions
- func (s SearchOptions) ByParentNames(names ...string) SearchOptions
- func (s SearchOptions) ByParentNamesPartial(names ...string) SearchOptions
- func (s SearchOptions) ByParentPropHasBitfieldValue(bitValue Bitfield) SearchOptions
- func (s SearchOptions) ByParentPropHasBitfieldValueByName(bitfieldValueName string) SearchOptions
- func (s SearchOptions) ByParentPropNames(names ...string) SearchOptions
- func (s SearchOptions) ByParentPropPair(name string, value any) SearchOptions
- func (s SearchOptions) ByParentPropValues(values ...any) SearchOptions
- func (s SearchOptions) ByParentType(nt NodeType) SearchOptions
- func (s SearchOptions) ByPropHasBitfieldValue(bitValue Bitfield) SearchOptions
- func (s SearchOptions) ByPropHasBitfieldValueByName(bitfieldValueName string) SearchOptions
- func (s SearchOptions) ByPropNames(names ...string) SearchOptions
- func (s SearchOptions) ByPropPair(name string, value any) SearchOptions
- func (s SearchOptions) ByPropValues(values ...any) SearchOptions
- func (s SearchOptions) ByType(nt NodeType) SearchOptions
- func (s SearchOptions) ForEach(forEach func(node INode, index int) bool)
- func (s SearchOptions) Get(index int) INode
- func (s SearchOptions) GetCount() int
- func (s SearchOptions) GetFirst() INode
- func (s SearchOptions) GetLast() INode
- func (s SearchOptions) GetNodeList() NodeList
- func (s SearchOptions) NotNode(node INode) SearchOptions
- func (s SearchOptions) NotNodes(nodes NodeIterator) SearchOptions
- func (s SearchOptions) WithStartingNode(withStartingNode bool) SearchOptions
- type Sector
- type SectorDetectionType
- type SectorType
- type Set
- type Text
- func (text *Text) AdvanceTypewriterIndex(advanceBy int) bool
- func (textObj *Text) ClearText() *Text
- func (text *Text) Clone() *Text
- func (text *Text) Dispose()
- func (text *Text) FinishTypewriter()
- func (text *Text) SetStyle(style TextStyle)
- func (textObj *Text) SetText(txt string, arguments ...any) *Text
- func (text *Text) SetTypewriterIndex(typewriterIndex int)
- func (text *Text) SetTypewriterOn(on bool)
- func (text *Text) Style() TextStyle
- func (text *Text) Text() string
- func (text *Text) TypewriterFinished() bool
- func (text *Text) TypewriterIndex() int
- func (text *Text) TypewriterOn() bool
- type TextHorizontalAlignment
- type TextStyle
- type TextVerticalAlignment
- type TextureAnimation
- type TextureFilter
- type TexturePlayer
- func (player *TexturePlayer) Animation() *TextureAnimation
- func (player *TexturePlayer) ApplyUVOffset(offsetX, offsetY float32)
- func (player *TexturePlayer) IsPlaying() bool
- func (player *TexturePlayer) Play(animation *TextureAnimation)
- func (player *TexturePlayer) Reset(vertexSelection VertexSelection)
- func (player *TexturePlayer) SetAnimation(anim *TextureAnimation)
- func (player *TexturePlayer) SetPlaying(isPlaying bool)
- func (player *TexturePlayer) Update(dt float32)
- type Triangle
- func (tri *Triangle) Clone() *Triangle
- func (tri *Triangle) ForEachVertexIndex(vertFunc func(vertexIndex int))
- func (t *Triangle) ID() uint32
- func (t *Triangle) IsDegenerate() bool
- func (tri *Triangle) RecalculateCenter()
- func (tri *Triangle) RecalculateNormal()
- func (tri *Triangle) ResetVertexNormals()
- func (tri *Triangle) SharesVertexPositions(other *Triangle) (shareA, shareB, shareC, count int)
- func (t *Triangle) VertexIndex(index int) int
- type Vector2
- func (vec Vector2) Add(other Vector2) Vector2
- func (vec Vector2) AddMagnitude(mag float32) Vector2
- func (vec Vector2) AddX(x float32) Vector2
- func (vec Vector2) AddY(y float32) Vector2
- func (vec Vector2) Angle(other Vector2) float32
- func (vec Vector2) AngleRotation() float32
- func (vec Vector2) Ceil() Vector2
- func (vec Vector2) Clamp(x, y float32) Vector2
- func (vec Vector2) ClampAngle(baselineVec Vector2, maxAngle float32) Vector2
- func (vec Vector2) ClampMagnitude(maxMag float32) Vector2
- func (vec Vector2) ClampToVec(extents Vector2) Vector2
- func (vec Vector2) Clone() Vector2
- func (vec Vector2) DistanceSquaredTo(other Vector2) float32
- func (vec Vector2) DistanceTo(other Vector2) float32
- func (vec Vector2) Divide(scalar float32) Vector2
- func (vec Vector2) Dot(other Vector2) float32
- func (vec Vector2) Equals(other Vector2) bool
- func (vec Vector2) Expand(margin, min float32) Vector2
- func (vec Vector2) Floats() [2]float32
- func (vec Vector2) Floor() Vector2
- func (vec Vector2) Invert() Vector2
- func (vec Vector2) IsInf() bool
- func (vec Vector2) IsNaN() bool
- func (vec Vector2) IsZero() bool
- func (vec Vector2) Lerp(other Vector2, percentage float32) Vector2
- func (vec Vector2) Magnitude() float32
- func (vec Vector2) MagnitudeSquared() float32
- func (v Vector2) Modify() *ModVector2
- func (vec Vector2) MoveTowards(target Vector2, magnitude float32) Vector2
- func (vec Vector2) Mult(other Vector2) Vector2
- func (vec Vector2) Perp() Vector2
- func (vec Vector2) Reflect(normal Vector2) Vector2
- func (vec Vector2) Rotate(angle float32) Vector2
- func (vec Vector2) Round(snapToUnits float32) Vector2
- func (vec Vector2) Scale(scalar float32) Vector2
- func (vec *Vector2) Set(other Vector2)
- func (vec *Vector2) SetToZero()
- func (vec Vector2) SetX(x float32) Vector2
- func (vec Vector2) SetXY(x, y float32) Vector2
- func (vec Vector2) SetY(y float32) Vector2
- func (vec Vector2) Slerp(targetDirection Vector2, percentage float32) Vector2
- func (vec Vector2) String() string
- func (vec Vector2) Sub(other Vector2) Vector2
- func (vec Vector2) SubMagnitude(mag float32) Vector2
- func (vec Vector2) SubX(x float32) Vector2
- func (vec Vector2) SubY(y float32) Vector2
- func (vec Vector2) Swizzle2(swizzleString string) Vector2
- func (vec Vector2) Swizzle3(swizzleString string) Vector3
- func (vec Vector2) Unit() Vector2
- type Vector3
- func (vec Vector3) Add(other Vector3) Vector3
- func (vec Vector3) AddMagnitude(mag float32) Vector3
- func (vec Vector3) AddX(value float32) Vector3
- func (vec Vector3) AddXYZ(x, y, z float32) Vector3
- func (vec Vector3) AddY(value float32) Vector3
- func (vec Vector3) AddZ(value float32) Vector3
- func (vec Vector3) Angle(other Vector3) float32
- func (vec Vector3) AngleSigned(other, planeNormal Vector3) float32
- func (vec Vector3) Ceil() Vector3
- func (vec Vector3) Clamp(x, y, z float32) Vector3
- func (vec Vector3) ClampAngle(baselineVec Vector3, maxAngle float32) Vector3
- func (vec Vector3) ClampMagnitude(maxMag float32) Vector3
- func (vec Vector3) ClampToDimensions(dim Dimensions) Vector3
- func (vec Vector3) ClampToVec(extents Vector3) Vector3
- func (vec Vector3) Clone() Vector3
- func (vec Vector3) Cross(other Vector3) Vector3
- func (vec Vector3) DistanceSquaredTo(other Vector3) float32
- func (vec Vector3) DistanceTo(other Vector3) float32
- func (vec Vector3) Divide(scalar float32) Vector3
- func (vec Vector3) Dot(other Vector3) float32
- func (vec Vector3) Equals(other Vector3) bool
- func (vec Vector3) Expand(margin, min float32) Vector3
- func (vec Vector3) Floats() [3]float32
- func (vec Vector3) Floor() Vector3
- func (vec Vector3) Invert() Vector3
- func (vec Vector3) IsInf() bool
- func (vec Vector3) IsNaN() bool
- func (vec Vector3) IsZero() bool
- func (vec Vector3) Lerp(other Vector3, percentage float32) Vector3
- func (vec Vector3) Magnitude() float32
- func (vec Vector3) MagnitudeSquared() float32
- func (v Vector3) Max() float32
- func (v Vector3) Min() float32
- func (vec *Vector3) Modify() *ModVector3
- func (vec Vector3) MoveTowards(target Vector3, magnitude float32) Vector3
- func (vec Vector3) Mult(other Vector3) Vector3
- func (vec Vector3) Reflect(normal Vector3) Vector3
- func (vec Vector3) Rotate(x, y, z, angle float32) Vector3
- func (vec Vector3) RotateVec(axis Vector3, angle float32) Vector3
- func (vec Vector3) Round(roundToUnits float32) Vector3
- func (vec Vector3) Scale(scalar float32) Vector3
- func (vec *Vector3) Set(other Vector3)
- func (vec *Vector3) SetToZero()
- func (vec Vector3) SetX(x float32) Vector3
- func (vec Vector3) SetXYZ(x, y, z float32) Vector3
- func (vec Vector3) SetY(y float32) Vector3
- func (vec Vector3) SetZ(z float32) Vector3
- func (vec Vector3) Slerp(end Vector3, percentage float32) Vector3
- func (v Vector3) SlideAgainst(reflectingNormal Vector3) Vector3
- func (v Vector3) Slope() float32
- func (vec Vector3) String() string
- func (vec Vector3) Sub(other Vector3) Vector3
- func (vec Vector3) SubMagnitude(mag float32) Vector3
- func (vec Vector3) SubX(value float32) Vector3
- func (vec Vector3) SubXYZ(x, y, z float32) Vector3
- func (vec Vector3) SubY(value float32) Vector3
- func (vec Vector3) SubZ(value float32) Vector3
- func (vec Vector3) Swizzle2(swizzleString string) Vector2
- func (vec Vector3) Swizzle3(swizzleString string) Vector3
- func (vec Vector3) To4D() Vector4
- func (vec Vector3) Unit() Vector3
- type Vector3Range
- func (ran *Vector3Range) SetAll(value float32)
- func (ran *Vector3Range) SetAxes(x, y, z float32)
- func (ran *Vector3Range) SetCustomFunc(customFunc func(nRange *Vector3Range) Vector3)
- func (ran *Vector3Range) SetRangeX(min, max float32)
- func (ran *Vector3Range) SetRangeY(min, max float32)
- func (ran *Vector3Range) SetRangeZ(min, max float32)
- func (ran *Vector3Range) SetRanges(min, max float32)
- func (ran Vector3Range) Value() Vector3
- type Vector4
- type VertexColorChannel
- type VertexInfo
- type VertexSelection
- func (vs VertexSelection) ApplyMatrix(matrix Matrix4)
- func (vs *VertexSelection) Clear()
- func (vs VertexSelection) Clone() VertexSelection
- func (vs VertexSelection) Contains(index int) bool
- func (vs VertexSelection) Count() int
- func (vs VertexSelection) ForEachIndex(forEach func(mesh *Mesh, index int))
- func (vs VertexSelection) IsEmpty() bool
- func (vs VertexSelection) Move(x, y, z float32)
- func (vs VertexSelection) MoveUVs(dx, dy float32)
- func (vs *VertexSelection) MoveUVsVec(vec Vector2)
- func (vs VertexSelection) MoveVec(vec Vector3)
- func (vs VertexSelection) RotateUVs(rotation float32)
- func (vs VertexSelection) ScaleUVs(px, py float32)
- func (vs *VertexSelection) ScaleUVsVec(vec Vector2)
- func (vs VertexSelection) SelectAll() VertexSelection
- func (vs VertexSelection) SelectByFunc(function func(index int) bool) VertexSelection
- func (vs VertexSelection) SelectByNormal(normal Vector3) VertexSelection
- func (vs VertexSelection) SelectIndices(indices ...int) VertexSelection
- func (vs VertexSelection) SelectMaterialName(materialNames ...string) VertexSelection
- func (vs VertexSelection) SelectMeshPart(meshParts ...*MeshPart) VertexSelection
- func (vs VertexSelection) SelectMeshPartIndex(meshpartIndex int) VertexSelection
- func (vs VertexSelection) SelectRange(start, end int) VertexSelection
- func (vs VertexSelection) SelectSharedVertices() VertexSelection
- func (vs VertexSelection) SelectTriangles(triangles ...*Triangle) VertexSelection
- func (vs VertexSelection) SelectVertexColorChannelNames(channelNames ...string) VertexSelection
- func (vs VertexSelection) SelectVertexGroupNames(vertexGroupNames ...string) VertexSelection
- func (vs VertexSelection) SetColor(channel *VertexColorChannel, color Color4)
- func (vs VertexSelection) SetNormal(normal Vector3)
- func (vs VertexSelection) SetPositionOffset(x, y, z float32)
- func (vs VertexSelection) SetPositionOffsetVec(vec Vector3)
- func (vs VertexSelection) SetUVOffset(x, y float32)
- func (vs VertexSelection) SetUVOffsetVec(vec Vector2)
- type World
Constants ¶
const ( TrackTypePosition = "Pos" TrackTypeScale = "Sca" TrackTypeRotation = "Rot" )
const ( InterpolationLinear int = iota InterpolationConstant InterpolationCubic // Unimplemented )
const ( TriangleSortModeBackToFront = iota // TriangleSortBackToFront sorts the triangles from back to front (naturally). This is the default. TriangleSortModeFrontToBack // TriangleSortFrontToBack sorts the triangles in reverse order. TriangleSortModeNone // TriangleSortNone doesn't sort the triangles at all; this is the fastest triangle sorting mode, while also being the most graphically inaccurate. Usable if triangles don't visually intersect. )
const ( // TransparencyModeAuto means it will be opaque if the object or material's alpha >= 1, and transparent otherwise. TransparencyModeAuto = iota // TransparencyModeOpaque means the triangles are rendered to the color and depth buffer as normal. TransparencyModeOpaque // TransparencyModeAlphaClip means the triangles are rendered to the color and depth buffer, using the alpha of the triangles' texture to "cut out" the triangles. TransparencyModeAlphaClip // TransparencyModeTransparent means the triangles are not rendered to the depth buffer, but are rendered in a second pass after opaque and alpha-clip triangles. They are automatically sorted from back-to-front. TransparencyModeTransparent )
const ( BillboardYUpGlobalY = iota BillboardYUpCameraY )
const ( LightingModeDefault = iota // Default lighting mode LightingModeFixedNormals // Lighting applies as though faces always point towards light sources; good for 2D sprites LightingModeDoubleSided // Lighting applies for double-sided faces )
const ( TextureMapModeUV = iota // Default texture mapping mode. The UV values on the model impact where the texture renders. TextureMapModeScreen // Screen-space texture mapping mode. The texture renders plainly to the screen. )
const ( DepthModeDefault = iota // Default custom depth mode; unaltered depth writing DepthModeUnbillboarded // Unbillboarded depth mode; depth is written as though the mesh were not transformed )
const ( LightVolumeShadingModePerVertexWithoutNormal = iota // Shade vertices per vertex position; include normals so vertices outside of a light volume cell reflect it if facing that cell. LightVolumeShadingModePerVertexWithNormal // Shade vertices per vertex position; don't include the vertices' normals LightVolumeShadingModePerObject // Shade vertices per the vertices' overall object's position LightVolumeShadingModeOff // Don't shade vertices per the vertices of objects as they move around in light volumes )
const ( AutoBatchNone = iota // No automatic batching AutoBatchDynamic // Dynamically batch AutoBatchStatic // Statically merge )
const ( NodeTypeNode NodeType = 1 << iota // NodeTypeNode represents specifically a node NodeTypeModel = 1<<iota + NodeTypeNode // NodeTypeModel represents specifically a Model NodeTypeCamera // NodeTypeCamera represents specifically a Camera NodeTypePath // NodeTypePath represents specifically a Path NodeTypeGrid // NodeTypeGrid represents specifically a Grid NodeTypeGridPoint // NodeTypeGrid represents specifically a GridPoint (note the extra underscore to ensure !NodeTypeGridPoint.Is(NodeTypeGrid)) NodeTypeBoundingObject = 1<<iota + NodeTypeNode // NodeTypeBoundingObject represents any generic bounding object NodeTypeBoundingAABB = 1<<iota + NodeTypeBoundingObject // NodeTypeBoundingAABB represents specifically a BoundingAABB NodeTypeBoundingCapsule // NodeTypeBoundingCapsule represents specifically a BoundingCapsule NodeTypeBoundingTriangles // NodeTypeBoundingTriangles represents specifically a BoundingTriangles object NodeTypeBoundingSphere // NodeTypeBoundingSphere represents specifically a BoundingSphere BoundingObject NodeTypeLight = 1<<iota + NodeTypeNode // NodeTypeLight represents any generic light NodeTypeAmbientLight = 1<<iota + NodeTypeLight // NodeTypeAmbientLight represents specifically an ambient light NodeTypePointLight // NodeTypePointLight represents specifically a point light NodeTypeDirectionalLight // NodeTypeDirectionalLight represents specifically a directional (sun) light NodeTypeCubeLight // NodeTypeCubeLight represents, specifically, a cube light NodeTypeLightVolume // NodeTypeLightVolume represents, specifically, a light volume )
const ( ParticleVertexSpawnModeOff = iota // Particles spawn at the center of the system's root Model. ParticleVertexSpawnModeAscending // Particles spawn at the vertices of the system's root Model. They spawn in ascending order before looping. ParticleVertexSpawnModeDescending // Particles spawn at the vertices of the system's root Model. They spawn in descending order before looping. ParticleVertexSpawnModeRandom // Particles spawn at the vertices of the system's root Model. They spawn in random order. )
const ( SectorDetectionTypeVertices = iota // If sector neighbors are detected by sharing vertex positions SectorDetectionTypeAABB // If sector neighbors are detected by AABB )
const ( TextAlignHorizontalLeft TextHorizontalAlignment = iota // Left aligned text. The text hugs the left side of the texture. TextAlignHorizontalCenter // Center aligned text. All text lines are centered horizontally in the texture's width. TextAlignHorizontalRight // Right aligned text. The text hugs the right side of the texture. TextAlignVerticalTop TextVerticalAlignment = iota // Top aligned text. The text hugs the top side of the texture. TextAlignVerticalCenter // Center aligned text. All text lines are centered horizontally in the texture's width. TextAlignVerticalBottom // Bottom aligned text. The text hugs the bottom side of the texture. )
const ErrorObjectHitNotBoundingTriangles = "error: object hit not a BoundingTriangles instance; no UV or vertex color data can be pulled from RayHit result"
const ErrorObjectHitNotChildOfModel = "error: object hit not a child of a Model"
const ErrorVertexChannelOutsideRange = "error: vertex color channel not found by given name"
const MaxTriangleCount = ebiten.MaxVertexCount / 3
The hardware-limited maximum number of triangles displayable at any given time.
Variables ¶
var ReadableReferences = true
If enabled, Nodes, Materials, and other object types will be represented by their names when printed directly. Otherwise, they will be represented by their pointer locations, like default.
var WorldBackward = NewVector3(0, 0, 1)
WorldBackward represents a unit vector in the global direction of backwards (towards the camera, assuming no rotations) on the right-handed OpenGL / Tetra3D's coordinate system (+Z).
var WorldDown = WorldUp.Invert()
WorldDown represents a unit vector in the global direction of downward on the right-handed OpenGL / Tetra3D's coordinate system (+Y).
var WorldForward = WorldBackward.Invert()
WorldForward represents a unit vector in the global direction of forwards (away from the camera, assuming no rotations) on the right-handed OpenGL / Tetra3D's coordinate system (-Z).
var WorldLeft = WorldRight.Invert()
WorldLeft represents a unit vector in the global direction of leftward on the right-handed OpenGL / Tetra3D's coordinate system (-X).
var WorldRight = NewVector3(1, 0, 0)
WorldRight represents a unit vector in the global direction of rightward on the right-handed OpenGL / Tetra3D's coordinate system (+X).
var WorldUp = NewVector3(0, 1, 0)
WorldUp represents a unit vector in the global direction of upward on the right-handed OpenGL / Tetra3D's coordinate system (+Y).
Functions ¶
func BlendModeAdditive ¶ added in v0.17.1
func BlendModeClear ¶ added in v0.17.1
func BlendModeDefault ¶ added in v0.17.1
func BlendModeMultiply ¶ added in v0.17.1
func DrawDebugText ¶ added in v0.18.0
func DrawSrcToDestBlendedWithDepthTexture ¶ added in v0.18.0
func DrawSrcToDestBlendedWithDepthTexture(dst, src, depth *ebiten.Image, rangeStart, rangeEnd float32, bayerMatrixDitherSize float32, transparencyCurve FogCurve)
Draws src to dst blended with the given depth texture. All of the images provided should be the same size. The depth texture should be a packed texture, like the one generated by Tetra3d. rangeStart is the minimum allowed depth percentage, ranging from 0 to 1. 0 would be the sensible default. rangeEnd is the maximum allowed depth percentage, ranging from 0 to 1. 1 would be the sensible default. bayerMatrixDitherSize is the size of the dithering size. 0 disables dithering. transparencyCurve is the curve used to control fading.
func ExtendBase3DShader ¶ added in v0.15.0
ExtendBase3DShader allows you to make a custom fragment shader that extends the base 3D shader, allowing you to make a shader that has fog and depth testing built-in, as well as access to the combined painted vertex colors and vertex-based lighting. To do this, make a Kage shader, but rename the fragment entry point from "Fragment()" to "CustomFragment()". Otherwise, the arguments are the same - dstPos, srcPos, and color, with color containing both vertex color and lighting data. The return vec4 is also the same - the value that is returned from CustomFragment will be used for fog. To turn off lighting or fog individually, you would simply turn on shadelessness and foglessness in your object's Material (or shadelessness in your Model itself).
Types ¶
type AOBakeOptions ¶ added in v0.10.0
type AOBakeOptions struct {
TargetMeshParts []*MeshPart // The target meshparts / materials to use for baking AO values to. If not set, then all meshparts will be used.
TargetVertices VertexSelection
// The target vertex color channel to bake the ambient occlusion to.
// If the Model doesn't have enough vertex color channels to bake to this channel index, the BakeAO() function will
// create vertex color channels to fill in the values up to the target channel index.
TargetChannel int
OcclusionAngle float32 // How severe the angle must be (in radians) for the occlusion effect to show up.
OcclusionColor Color4 // The color for the ambient occlusion.
// A filter indicating other models that influence ambient occlusion when baking. If this is not set, the AO will
// just take effect for triangles within the Model, rather than also taking effect for objects that
// are close to the baking Model.
OtherModels []*Model
InterModelDistance float32 // How far the other models in OtherModels must be to influence the baking AO.
}
func NewDefaultAOBakeOptions ¶ added in v0.10.0
func NewDefaultAOBakeOptions() AOBakeOptions
NewDefaultAOBakeOptions creates a new AOBakeOptions struct with default settings.
type AccumulationColorMode ¶ added in v0.16.0
type AccumulationColorMode int
const ( AccumulationColorModeNone AccumulationColorMode = iota // No accumulation buffer rendering AccumulationColorModeBelow // Accumulation buffer is on and applies over time, renders ColorTexture after the accumulation result (which is, then, below) AccumulationColorModeAbove // Accumulation buffer is on and applies over time, renders ColorTexture before the accumulation result (which is on top) AccumulationColorModeSingleLastFrame // Accumulation buffer is on and renders just the previous frame's ColorTexture result )
type AmbientLight ¶ added in v0.5.0
type AmbientLight struct {
*LightBase
// contains filtered or unexported fields
}
AmbientLight represents an ambient light that colors the entire Scene.
func NewAmbientLight ¶ added in v0.5.0
func NewAmbientLight(name string, r, g, b, energy float32) *AmbientLight
NewAmbientLight returns a new AmbientLight.
func (*AmbientLight) Clone ¶ added in v0.5.0
func (amb *AmbientLight) Clone() INode
func (*AmbientLight) Light ¶ added in v0.5.0
func (amb *AmbientLight) Light(tri *Triangle, model *Model, targetColors *VertexColorChannel)
Light returns the light level for the ambient light. It doesn't use the provided Triangle; it takes it as an argument to simply adhere to the Light interface.
func (*AmbientLight) Type ¶ added in v0.8.1
func (amb *AmbientLight) Type() NodeType
Type returns the NodeType for this object.
func (*AmbientLight) VertexLight ¶ added in v0.18.0
func (amb *AmbientLight) VertexLight(vertexIndex int, tri *Triangle, model *Model, targetColors *VertexColorChannel)
type Animation ¶
type Animation struct {
// contains filtered or unexported fields
}
Animation represents an animation of some description; it can have multiple channels, indicating movement, scale, or rotational change of one or more Nodes in the Animation.
func NewAnimation ¶
NewAnimation creates a new Animation of the name specified.
func (*Animation) AddChannel ¶
func (animation *Animation) AddChannel(name string) *AnimationChannel
Adds an animation channel to the Animation.
func (*Animation) FindMarker ¶ added in v0.14.0
FindMarker returns a marker, found by name, and a boolean value indicating if a marker by the specified name was found or not.
func (*Animation) Library ¶ added in v0.8.1
Library returns the Library from which this Animation was loaded. If it was created in code, this function would return nil.
func (*Animation) LoopMode ¶ added in v0.18.0
func (animation *Animation) LoopMode() AnimationLoopMode
Returns the loop mode for the Animation.
func (*Animation) Properties ¶ added in v0.16.0
func (animation *Animation) Properties() *Properties
func (*Animation) RelativeMotion ¶ added in v0.16.0
Returns if the animation is set to work with relative motion.
func (*Animation) SetLoopMode ¶ added in v0.18.0
func (animation *Animation) SetLoopMode(loopMode AnimationLoopMode)
Sets the loop mode for the given animation.
func (*Animation) SetRelativeMotion ¶ added in v0.18.0
Sets relative motion for the Animation.
type AnimationChannel ¶
type AnimationChannel struct {
Name string
Tracks map[string]*AnimationTrack
// contains filtered or unexported fields
}
AnimationChannel represents a set of tracks (one for position, scale, and rotation) for the various nodes contained within the Animation.
func NewAnimationChannel ¶
func NewAnimationChannel(name string) *AnimationChannel
func (*AnimationChannel) AddTrack ¶
func (channel *AnimationChannel) AddTrack(trackType string) *AnimationTrack
type AnimationLoopMode ¶ added in v0.18.0
type AnimationLoopMode int
const ( AnimationLoopModeLoop AnimationLoopMode = iota // Loop on animation completion AnimationLoopModePingPong // Reverse on animation completion; if this is the case, the OnFinish() callback is called after two loops (one reversal) AnimationLoopModeOneshot // Stop on animation completion )
type AnimationPlayer ¶
type AnimationPlayer struct {
RootNode INode
ChannelsToNodes map[*AnimationChannel]INode
ChannelsUpdated bool
PlaySpeed float32 // Playback speed in percentage - defaults to 1 (100%)
OnMarkerTouch func(marker Marker, animation *Animation) // Callback indicating when the AnimationPlayer has entered a marker
AnimatedProperties map[INode]AnimationValues // The properties that have been animated
BlendTime float32 // How much time in seconds to blend between two animations
// contains filtered or unexported fields
}
AnimationPlayer is an object that allows you to play back an animation on a Node.
func NewAnimationPlayer ¶
func NewAnimationPlayer(node INode) *AnimationPlayer
NewAnimationPlayer returns a new AnimationPlayer for the Node.
func (*AnimationPlayer) AfterMarker ¶ added in v0.10.0
func (ap *AnimationPlayer) AfterMarker(markerName string) bool
AfterMarker returns if the AnimationPlayer's playhead is after a marker with the specified name.
func (*AnimationPlayer) Animation ¶
func (ap *AnimationPlayer) Animation() *Animation
Returns the currently playing animation for the AnimationPlayer.
func (*AnimationPlayer) BeforeMarker ¶ added in v0.10.0
func (ap *AnimationPlayer) BeforeMarker(markerName string) bool
BeforeMarker returns if the AnimationPlayer's playhead is before a marker with the specified name.
func (*AnimationPlayer) Clone ¶
func (ap *AnimationPlayer) Clone() *AnimationPlayer
Clone returns a clone of the specified AnimationPlayer.
func (*AnimationPlayer) Finished ¶ added in v0.10.0
func (ap *AnimationPlayer) Finished() bool
Finished returns whether the AnimationPlayer is finished playing its current animation.
func (*AnimationPlayer) FinishedPlayingByName ¶ added in v0.16.0
func (ap *AnimationPlayer) FinishedPlayingByName(animName string) bool
FinishedPlayingByName returns whether the AnimationPlayer just got finished playing an animation of the specified name.
func (*AnimationPlayer) IsPlaying ¶ added in v0.15.0
func (ap *AnimationPlayer) IsPlaying() bool
func (*AnimationPlayer) IsPlayingByName ¶ added in v0.16.0
func (ap *AnimationPlayer) IsPlayingByName(animName string) bool
Returns if the AnimationPlayer is playing an animation of the given name.
func (*AnimationPlayer) IsPlayingByPropName ¶ added in v0.18.0
func (ap *AnimationPlayer) IsPlayingByPropName(propName string) bool
Returns if the AnimationPlayer is playing an animation with a property of the given name.
func (*AnimationPlayer) IsPlayingByPropNameValue ¶ added in v0.18.0
func (ap *AnimationPlayer) IsPlayingByPropNameValue(propName string, value any) bool
Returns if the AnimationPlayer is playing an animation with a property of the given name and value.
func (*AnimationPlayer) Pause ¶ added in v0.18.0
func (ap *AnimationPlayer) Pause()
Pauses playback on the AnimationPlayer.
func (*AnimationPlayer) Play ¶
func (ap *AnimationPlayer) Play(animations ...*Animation) *AnimationSequence
Plays the specified animations back in sequence, starting with the first one. If the first animation is already playing, the function does nothing. Calling this clears any sequenced animations present in the AnimationPlayerCallback. The function returns the AnimationPlayer's AnimationSequence object to allow sequencing an event after the animation plays. If no animations are provided to the function, the AnimationSequence object will hold an error indicating this fact.
func (*AnimationPlayer) PlayByName ¶ added in v0.16.0
func (ap *AnimationPlayer) PlayByName(animationNames ...string) *AnimationSequence
Plays the specified animations back in sequence, starting with the first one. If the first animation is already playing, the function does nothing. Calling this clears any sequenced animations present in the AnimationSequence object. The function returns the AnimationPlayer's AnimationSequence object to allow sequencing events after the animation plays. If any animations aren't found or no animation names are provided, the AnimationSequence object will hold an error.
func (*AnimationPlayer) Playhead ¶
func (ap *AnimationPlayer) Playhead() float32
func (*AnimationPlayer) Resume ¶ added in v0.18.0
func (ap *AnimationPlayer) Resume()
Resumes playback on the AnimationPlayer.
func (*AnimationPlayer) SetPlayhead ¶ added in v0.13.0
func (ap *AnimationPlayer) SetPlayhead(time float32)
SetPlayhead sets the playhead of the animation player to the specified time in seconds, and also performs an update of the animated nodes.
func (*AnimationPlayer) SetRoot ¶
func (ap *AnimationPlayer) SetRoot(node INode)
SetRoot sets the root node of the animation player to act on. Note that this should be the root node.
func (*AnimationPlayer) TouchedMarker ¶ added in v0.10.0
func (ap *AnimationPlayer) TouchedMarker(markerName string) bool
TouchedMarker returns if a marker with the specified name was touched this past frame - note that this relies on calling AnimationPlayer.Update().
func (*AnimationPlayer) Trigger ¶ added in v0.18.0
func (ap *AnimationPlayer) Trigger() *AnimationSequence
Returns the trigger object for sequencing animations or triggering them on animation completion. If clear is true, then any currently playing animation will be immediately halted.
func (*AnimationPlayer) Update ¶
func (ap *AnimationPlayer) Update(dt float32)
Update updates the animation player by the delta specified in seconds (usually 1/FPS or 1/TARGET FPS), animating the transformation properties of the root node's tree.
type AnimationPlayerCallbackFunction ¶ added in v0.18.0
type AnimationPlayerCallbackFunction func(ap *AnimationPlayer, loopCount int)
Represents a function to call when an animation player finishes playing an animation.
type AnimationSequence ¶ added in v0.18.0
type AnimationSequence struct {
// contains filtered or unexported fields
}
An object to sequence events to execute once an animation is finished playing.
func (*AnimationSequence) Clear ¶ added in v0.18.0
func (apc *AnimationSequence) Clear() *AnimationSequence
Clears the callback's queued callback functions.
func (*AnimationSequence) ClearError ¶ added in v0.18.0
func (apc *AnimationSequence) ClearError()
Clears the error in the callback.
func (*AnimationSequence) Clone ¶ added in v0.18.0
func (apc *AnimationSequence) Clone() *AnimationSequence
Returns a clone of the AnimationPlayerCallback.
func (*AnimationSequence) Error ¶ added in v0.18.0
func (apc *AnimationSequence) Error() error
Returns the error the callback holds if it cannot proceed with playback for whatever reason (e.g. can't find an animation by name).
func (*AnimationSequence) Then ¶ added in v0.18.0
func (apc *AnimationSequence) Then(callbackFunction AnimationPlayerCallbackFunction) *AnimationSequence
Schedules a callback function to execute when an animation player finishes playing back the previous animation, or to start with if the owning AnimationPlayer is not playing anything currently. Note that the callback executes on animation loop / completion.
func (*AnimationSequence) ThenPlay ¶ added in v0.18.0
func (apc *AnimationSequence) ThenPlay(anims ...*Animation) *AnimationSequence
Schedules playback of a sequence of animations to play when an animation player finishes playing back the previous animation, or to start with if the owning AnimationPlayer is not playing anything currently. Note that the callback executes on animation loop / completion.
func (*AnimationSequence) ThenPlayByName ¶ added in v0.18.0
func (apc *AnimationSequence) ThenPlayByName(animNames ...string) *AnimationSequence
Schedules playback of a sequence of animations (retrieved from the AnimationPlayer's library by name) to play when an animation player finishes playing back the previous animation, or to start with if the owning AnimationPlayer is not playing anything currently.
type AnimationTrack ¶
AnimationTrack represents a collection of keyframes that drive an animation type (position, scale or rotation) for a node in an animation.
func (*AnimationTrack) AddKeyframe ¶
func (track *AnimationTrack) AddKeyframe(time float32, data any)
AddKeyframe adds a keyframe of the necessary data type to the AnimationTrack.
func (*AnimationTrack) ValueAsQuaternion ¶
func (track *AnimationTrack) ValueAsQuaternion(time float32) (Quaternion, bool)
ValueAsQuaternion returns the Quaternion associated with this AnimationTrack using the given time in seconds, and a boolean indicating if the Quaternion exists (i.e. if this is track has rotation animation data).
func (*AnimationTrack) ValueAsVector ¶
func (track *AnimationTrack) ValueAsVector(time float32) (Vector3, bool)
ValueAsVector returns a Vector associated with the current time in seconds, as well as a boolean indicating if the Vector exists (i.e. if the AnimationTrack has location or scale data in the animation). The Vector will be interpolated according to time between keyframes.
type AnimationValues ¶
type AnimationValues struct {
Position Vector3
PositionExists bool
PositionInterpolation int
Scale Vector3
ScaleExists bool
ScaleInterpolation int
Rotation Quaternion
RotationExists bool
RotationInterpolation int
// contains filtered or unexported fields
}
AnimationValues indicate the current position, scale, and rotation for a Node.
type AutoSubdivisionLevel ¶ added in v0.18.0
type Bitfield ¶ added in v0.18.0
type Bitfield uint32
Represents a bit set of boolean values. This, for example, provides faster filtering for Nodes than checking properties' names or values.
func ToBitfield ¶ added in v0.18.0
Converts the bit of the given index to a Bitfield value (e.g. ToBitfield(0) == 2, ToBitfield(1) == 4).
type BoundingAABB ¶
type BoundingAABB struct {
*Node
// contains filtered or unexported fields
}
BoundingAABB represents a 3D AABB (Axis-Aligned Bounding Box), a 3D cube of varying width, height, and depth that cannot rotate. The primary purpose of a BoundingAABB is, like the other Bounding* Nodes, to perform intersection testing between itself and other BoundingObject Nodes.
func NewBoundingAABB ¶
func NewBoundingAABB(name string, width, height, depth float32) *BoundingAABB
NewBoundingAABB returns a new BoundingAABB Node.
func NewBoundingAABBFromDimensions ¶ added in v0.18.0
func NewBoundingAABBFromDimensions(name string, dim Dimensions) *BoundingAABB
func (*BoundingAABB) Clone ¶
func (box *BoundingAABB) Clone() INode
Clone returns a new BoundingAABB.
func (*BoundingAABB) ClosestPoint ¶
func (box *BoundingAABB) ClosestPoint(point Vector3) Vector3
ClosestPoint returns the closest point, to the point given, on the inside or surface of the BoundingAABB in world space.
func (*BoundingAABB) Colliding ¶ added in v0.9.1
func (box *BoundingAABB) Colliding(other IBoundingObject) bool
Colliding returns true if the BoundingAABB collides with another IBoundingObject.
func (*BoundingAABB) Collision ¶ added in v0.9.1
func (box *BoundingAABB) Collision(other IBoundingObject) *Collision
Collision returns the Collision between the BoundingAABB and the other IBoundingObject. If there is no intersection, the function returns nil. (Note that BoundingAABB > BoundingTriangles collision is buggy at the moment.)
func (*BoundingAABB) CollisionTest ¶ added in v0.9.1
func (box *BoundingAABB) CollisionTest(settings CollisionTestSettings) *Collision
CollisionTest performs a collision test using the provided collision test settings structure. Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the object; if no collision is found, then it returns nil.
func (*BoundingAABB) ContainsAABB ¶ added in v0.15.0
func (box *BoundingAABB) ContainsAABB(other *BoundingAABB) bool
ContainsAABB returns if the calling BoundingAABB contains the provided other BoundingAABB.
func (*BoundingAABB) Dimensions ¶ added in v0.10.0
func (box *BoundingAABB) Dimensions() Dimensions
func (*BoundingAABB) PointInside ¶ added in v0.10.0
func (box *BoundingAABB) PointInside(point Vector3) bool
func (*BoundingAABB) SetDimensions ¶
func (box *BoundingAABB) SetDimensions(newWidth, newHeight, newDepth float32)
SetDimensions sets the BoundingAABB's internal dimensions (prior to resizing or rotating the Node).
func (*BoundingAABB) Type ¶ added in v0.8.1
func (box *BoundingAABB) Type() NodeType
Type returns the NodeType for this object.
type BoundingCapsule ¶
type BoundingCapsule struct {
*Node
// contains filtered or unexported fields
}
BoundingCapsule represents a 3D capsule, whose primary purpose is to perform intersection testing between itself and other Bounding Nodes.
func NewBoundingCapsule ¶
func NewBoundingCapsule(name string, radius, height float32, up BoundingCapsuleUpAxis) *BoundingCapsule
NewBoundingCapsule returns a new BoundingCapsule instance. Name is the name of the underlying Node for the Capsule, height is the total height of the Capsule, and radius is how big around the capsule is. Height has to be at least radius (otherwise, it would no longer be a capsule).
func (*BoundingCapsule) Bottom ¶
func (capsule *BoundingCapsule) Bottom() Vector3
Bottom returns the world position of the bottom of the BoundingCapsule.
func (*BoundingCapsule) Clone ¶
func (capsule *BoundingCapsule) Clone() INode
Clone returns a new BoundingCapsule.
func (*BoundingCapsule) Colliding ¶ added in v0.9.1
func (capsule *BoundingCapsule) Colliding(other IBoundingObject) bool
Colliding returns true if the BoundingCapsule is intersecting the other BoundingObject.
func (*BoundingCapsule) Collision ¶ added in v0.9.1
func (capsule *BoundingCapsule) Collision(other IBoundingObject) *Collision
Collision returns a Collision struct if the BoundingCapsule is intersecting another BoundingObject. If no intersection is reported, Collision returns nil.
func (*BoundingCapsule) CollisionTest ¶ added in v0.9.1
func (capsule *BoundingCapsule) CollisionTest(settings CollisionTestSettings) *Collision
CollisionTest performs a collision test using the provided collision test settings structure. Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the object; if no collision is found, then it returns nil.
func (*BoundingCapsule) Dimensions ¶ added in v0.18.0
func (capsule *BoundingCapsule) Dimensions() Dimensions
func (*BoundingCapsule) LocalHeight ¶ added in v0.18.0
func (capsule *BoundingCapsule) LocalHeight() float32
Returns the local height of the Capsule (the height without taking into account the object's transform).
func (*BoundingCapsule) LocalRadius ¶ added in v0.18.0
func (capsule *BoundingCapsule) LocalRadius() float32
Returns the local radius of the Capsule (the radius without taking into account the object's transform).
func (*BoundingCapsule) NearestPointOnLine ¶ added in v0.18.0
func (capsule *BoundingCapsule) NearestPointOnLine(point Vector3) Vector3
NearestPointOnLine returns the closest point on the capsule's "central line" to the point provided. Essentially, NearestPointOnLine returns a point along the capsule's line in world coordinates, capped between its bottom and top.
func (*BoundingCapsule) PointInside ¶
func (capsule *BoundingCapsule) PointInside(point Vector3) bool
PointInside returns true if the point provided is within the capsule.
func (*BoundingCapsule) SetHeight ¶ added in v0.18.0
func (capsule *BoundingCapsule) SetHeight(height float32)
Sets the local height of the Capsule in world units without taking into account the object's transform.
func (*BoundingCapsule) SetRadius ¶ added in v0.18.0
func (capsule *BoundingCapsule) SetRadius(radius float32)
Sets the local radius of the Capsule in world units without taking into account the object's transform.
func (*BoundingCapsule) Top ¶
func (capsule *BoundingCapsule) Top() Vector3
Top returns the world position of the top of the BoundingCapsule.
func (*BoundingCapsule) Type ¶ added in v0.8.1
func (capsule *BoundingCapsule) Type() NodeType
Type returns the NodeType for this object.
func (*BoundingCapsule) WorldHeight ¶ added in v0.18.0
func (capsule *BoundingCapsule) WorldHeight() float32
Returns the height of the Capsule in world units after taking into account its scale.
func (*BoundingCapsule) WorldRadius ¶
func (capsule *BoundingCapsule) WorldRadius() float32
Returns the radius of the Capsule in world units after taking into account its scale.
type BoundingCapsuleUpAxis ¶ added in v0.18.0
type BoundingCapsuleUpAxis int
const ( BoundingCapsuleUpX BoundingCapsuleUpAxis = iota BoundingCapsuleUpY BoundingCapsuleUpZ )
type BoundingSphere ¶
type BoundingSphere struct {
*Node
// contains filtered or unexported fields
}
BoundingSphere represents a 3D sphere.
func NewBoundingSphere ¶
func NewBoundingSphere(name string, radius float32) *BoundingSphere
NewBoundingSphere returns a new BoundingSphere instance.
func (*BoundingSphere) Clone ¶
func (sphere *BoundingSphere) Clone() INode
Clone returns a new BoundingSphere instance.
func (*BoundingSphere) Colliding ¶ added in v0.9.1
func (sphere *BoundingSphere) Colliding(other IBoundingObject) bool
Colliding returns true if the BoundingSphere is intersecting the other BoundingObject.
func (*BoundingSphere) Collision ¶ added in v0.9.1
func (sphere *BoundingSphere) Collision(other IBoundingObject) *Collision
Collision returns a Collision if the BoundingSphere is intersecting another BoundingObject. If no intersection is reported, Collision returns nil.
func (*BoundingSphere) CollisionTest ¶ added in v0.9.1
func (sphere *BoundingSphere) CollisionTest(settings CollisionTestSettings) *Collision
CollisionTest performs a collision test using the provided collision test settings structure. Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the object; if no collision is found, then it returns nil.
func (*BoundingSphere) Dimensions ¶ added in v0.18.0
func (sphere *BoundingSphere) Dimensions() Dimensions
Returns a Dimensions set that fully contains the BoundingSphere object.
func (*BoundingSphere) LocalRadius ¶ added in v0.18.0
func (sphere *BoundingSphere) LocalRadius() float32
Returns the local radius of the BoundingSphere object.
func (*BoundingSphere) PointInside ¶
func (sphere *BoundingSphere) PointInside(point Vector3) bool
PointInside returns whether the given point is inside of the sphere or not.
func (*BoundingSphere) SetRadius ¶ added in v0.18.0
func (sphere *BoundingSphere) SetRadius(radius float32)
Sets the local radius of the BoundingSphere object.
func (*BoundingSphere) Type ¶ added in v0.8.1
func (sphere *BoundingSphere) Type() NodeType
Type returns the NodeType for this object.
func (*BoundingSphere) WorldRadius ¶
func (sphere *BoundingSphere) WorldRadius() float32
Returns the radius of the BoundingSphere in world units, after taking into account its scale.
type BoundingTriangles ¶
type BoundingTriangles struct {
*Node
BoundingAABB *BoundingAABB
Mesh *Mesh
// contains filtered or unexported fields
}
BoundingTriangles is a Node specifically for detecting a collision between any of the triangles from a mesh instance and another BoundingObject.
func NewBoundingTriangles ¶
func NewBoundingTriangles(name string, mesh *Mesh, broadphaseGridSize float32) *BoundingTriangles
NewBoundingTriangles returns a new BoundingTriangles object. name is the name of the BoundingTriangles node, while mesh is a reference to the Mesh that the BoundingTriangles object should use for collision. broadphaseCellSize is how large the BoundingTriangle's broadphase collision cells should be - larger cells means more triangles are checked at a time when doing collision checks, while larger cells also means fewer broadphase cells need to be checked. Striking a balance is a good idea if you're setting this value by hand (by default, the grid size is the maximum dimension size / 20, rounded up (a grid of at least one cell every 20 Blender Units). A size of 0 disables the usage of the broadphase for collision checks.
func (*BoundingTriangles) Broadphase ¶ added in v0.10.0
func (bt *BoundingTriangles) Broadphase() *Broadphase
Returns the Broadphase object for broadphase collision detection.
func (*BoundingTriangles) Clone ¶ added in v0.5.0
func (bt *BoundingTriangles) Clone() INode
Clone returns a new BoundingTriangles Node with the same values set as the original.
func (*BoundingTriangles) Colliding ¶ added in v0.9.1
func (bt *BoundingTriangles) Colliding(other IBoundingObject) bool
Colliding returns true if the BoundingTriangles object is intersecting the other specified BoundingObject.
func (*BoundingTriangles) Collision ¶ added in v0.9.1
func (bt *BoundingTriangles) Collision(other IBoundingObject) *Collision
Collision returns a Collision if the BoundingTriangles object is intersecting another BoundingObject. If no intersection is reported, Collision returns nil. (Note that BoundingTriangles > AABB collision is buggy at the moment.)
func (*BoundingTriangles) CollisionTest ¶ added in v0.9.1
func (bt *BoundingTriangles) CollisionTest(settings CollisionTestSettings) *Collision
CollisionTest performs a collision test using the provided collision test settings structure. Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the object; if no collision is found, then it returns nil.
func (*BoundingTriangles) Dimensions ¶ added in v0.18.0
func (bt *BoundingTriangles) Dimensions() Dimensions
Dimensions returns the transformed dimensions of the Model's mesh.
func (*BoundingTriangles) EnableBroadphase ¶ added in v0.18.0
func (bt *BoundingTriangles) EnableBroadphase(enabled bool)
DisableBroadphase turns off the broadphase system for collision detection by settings its grid and cell size to 0. To turn broadphase collision back on, simply call Broadphase.Resize(gridSize) with a gridSize value above 0.
func (*BoundingTriangles) Type ¶ added in v0.8.1
func (bt *BoundingTriangles) Type() NodeType
Type returns the NodeType for this object.
func (*BoundingTriangles) UpdateTransform ¶ added in v0.10.0
func (bt *BoundingTriangles) UpdateTransform()
Transform returns a Matrix4 indicating the global position, rotation, and scale of the object, transforming it by any parents'. If there's no change between the previous Transform() call and this one, Transform() will return a cached version of the transform for efficiency.
type Broadphase ¶ added in v0.10.0
type Broadphase struct {
// contains filtered or unexported fields
}
Broadphase is a utility object specifically created to assist with quickly ruling out triangles for collision detection or mesh rendering. This works largely automatically; you should generally not have to tweak this too much. The general idea is that the broadphase is composed of rectangles in a grid layout, completely covering the owning mesh. When you, say, check for a collision against a BoundingTriangles object, it first checks the Broadphase object to determine which set(s) of triangles the colliding object could be colliding with for finer examination.
func NewBroadphase ¶ added in v0.10.0
func NewBroadphase(boundingTris *BoundingTriangles, cellSizeX, cellSizeY, cellSizeZ float32) *Broadphase
NewBroadphase returns a new Broadphase object that performs broadphase triangle detection for a Mesh.
func (*Broadphase) Clone ¶ added in v0.10.0
func (b *Broadphase) Clone(newBoundingTriangles *BoundingTriangles) *Broadphase
Clone clones the Broadphase.
func (*Broadphase) ForEachTriangleFromBoundingObject ¶ added in v0.16.1
func (b *Broadphase) ForEachTriangleFromBoundingObject(boundingObject IBoundingObject, forEach func(tri *Triangle) bool) bool
Performs a function on each triangle within the bounds of the given BoundingObject. The function returns a boolean indicating if any triangle was found in the given bounds.
func (*Broadphase) ForEachTriangleInDimensions ¶ added in v0.18.0
func (b *Broadphase) ForEachTriangleInDimensions(dim Dimensions, forEach BroadphaseTestFunction) bool
Performs a function on each triangle within the given Dimensions object. The function returns a boolean indicating if any triangle was found in the given bounds.
func (*Broadphase) Mesh ¶ added in v0.15.0
func (b *Broadphase) Mesh() *Mesh
Mesh returns the mesh that is associated with the Broadphase object.
func (*Broadphase) Resize ¶ added in v0.10.0
func (b *Broadphase) Resize(cellSizeX, cellSizeY, cellSizeZ float32)
Resize resizes the Broadphase struct, using the new gridSize for how big in units each cell in the grid should be.
type BroadphaseTestFunction ¶ added in v0.18.0
type Camera ¶
type Camera struct {
*Node
RenderDepth bool // If the Camera should attempt to render a depth texture; if this is true, then DepthTexture() will hold the depth texture render results. Defaults to true.
RenderNormals bool // If the Camera should attempt to render a normal texture; if this is true, then NormalTexture() will hold the normal texture render results. Defaults to false.
SectorRendering bool // If the Camera should render using sectors or not; if no sectors are present, then it won't attempt to render with them. Defaults to false.
SectorRenderDepth int // How far out the Camera renders other sectors. Defaults to 1 (so the current sector and its immediate neighbors).
PerspectiveCorrectedTextureMapping bool // If the Camera should render textures with perspective corrected texture mapping. Defaults to false.
// How many lights (sorted by distance) should be used to render each object, maximum. If it's greater than 0,
// then only that many lights will be considered. If less than or equal to 0 (the default), then all available lights will be used.
MaxLightCount int
MaxLightCountFocusPoint INode // The focus point for determining light culling based on distance from the camera; when this is nil, the camera's world position is used
// The mode to use when rendering previous frames to the accumulation buffer.
// When set to anything but AccumulationColorModeNone, clearing the Camera will copy the previous frame's color texture render result to the accumulation buffer.
// The AccumulationColorMode influences in what order the color texture and previous frame's acccumulation color mode result is drawn to the buffer.
// Defaults to AccumulateColorModeNone.
AccumulationColorMode AccumulationColorMode
// Draw image options to use when rendering frames to the accumulation buffer; use this to fade out or color previous frames.
// This should probably be set once, or once per frame before rendering; otherwise, the effects compound and it's impossible to see the result.
AccumulationDrawOptions *ebiten.DrawImageOptions
// When set to a value > 0, it will snap all rendered models' vertices to a grid of the provided size (so VertexSnapping of 0.1 will snap all rendered positions to 0.1 intervals).
// Note that snapping vertices is not free and does take some time to execute (so if you're up against a performance limit, turning off vertex snapping might make a bit of a difference).
// Defaults to 0 (off).
VertexSnapping float32
DebugInfo *DebugInfo
// DepthMargin is a margin in percentage on both the near and far plane to leave some
// distance remaining in the depth buffer for triangle comparison.
// This ensures that objects that are, for example, close to or far from the camera
// don't begin Z-fighting unnecessarily. It defaults to 4% (on both ends).
DepthMargin float32
// contains filtered or unexported fields
}
Camera represents a camera (where you look from) in Tetra3D.
func (*Camera) AccumulationColorTexture ¶ added in v0.8.1
AccumulationColorTexture returns the camera's final result accumulation color texture from previous renders. If the Camera's AccumulateColorMode property is set to AccumulateColorModeNone, the function will return nil instead.
func (*Camera) AspectRatio ¶ added in v0.8.1
AspectRatio returns the camera's aspect ratio (width / height).
func (*Camera) Clear ¶
func (camera *Camera) Clear()
Clear should be called at the beginning of a single rendered frame and clears the Camera's backing textures before rendering. It also resets the debug values. This function will use the world's clear color, assuming the Camera is in a Scene that has a World. If the Scene has no World, or the Camera is not in the Scene, then it will clear using transparent black.
func (*Camera) ClearWithColor ¶ added in v0.15.0
ClearWithColor should be called at the beginning of a single rendered frame and clears the Camera's backing textures to the desired color before rendering. It also resets the debug values.
func (*Camera) ClipToScreen ¶
ClipToScreen projects the pre-transformed vertex in View space and remaps it to screen coordinates.
func (*Camera) ColorTexture ¶
ColorTexture returns the camera's final result color texture from any previous Render() or RenderNodes() calls.
func (*Camera) CurrentSector ¶ added in v0.12.1
CurrentSector returns the current sector the Camera is in, if sector-based rendering is enabled.
func (*Camera) DepthTexture ¶
DepthTexture returns the camera's final result depth texture from any previous Render() or RenderNodes() calls. If Camera.RenderDepth is set to false, the function will return nil instead.
func (*Camera) DrawDebugBoundsColored ¶ added in v0.8.1
func (camera *Camera) DrawDebugBoundsColored(screen *ebiten.Image, rootNode INode, options DrawDebugBoundsColoredSettings)
DrawDebugBoundsColored will draw shapes approximating the shapes and positions of BoundingObjects underneath the rootNode. The shapes will be drawn in the color provided for each kind of bounding object to the screen image provided.
func (*Camera) DrawDebugCenters ¶
DrawDebugCenters draws the center positions of nodes under the rootNode using the color given to the screen image provided.
func (*Camera) DrawDebugDrawCallCount ¶ added in v0.8.1
func (camera *Camera) DrawDebugDrawCallCount(screen *ebiten.Image, rootNode INode, textScale float32, color Color4)
DrawDebugDrawCallCount draws the draw call count of all visible Models underneath the rootNode in the color provided to the screen image provided.
func (*Camera) DrawDebugDrawOrder ¶ added in v0.8.1
func (camera *Camera) DrawDebugDrawOrder(screen *ebiten.Image, rootNode INode, textScale float32, color Color4)
DrawDebugDrawOrder draws the drawing order of all triangles of all visible Models underneath the rootNode in the color provided to the screen image provided.
func (*Camera) DrawDebugFrustums ¶ added in v0.9.0
DrawDebugFrustums will draw shapes approximating the frustum spheres for objects underneath the rootNode. The shapes will be drawn in the color provided to the screen image provided.
func (*Camera) DrawDebugNormals ¶
func (camera *Camera) DrawDebugNormals(screen *ebiten.Image, rootNode INode, normalLength float32, color Color4)
DrawDebugNormals draws the normals of visible models underneath the rootNode given to the screen. NormalLength is the length of the normal lines in units. Color is the color to draw the normals.
func (*Camera) DrawDebugTriangleIDs ¶ added in v0.17.0
func (camera *Camera) DrawDebugTriangleIDs(screen *ebiten.Image, rootNode INode, textScale float32, color Color4)
Draws the IDs of all triangles of all visible Models underneath the rootNode in the color provided to the screen image provided.
func (*Camera) DrawDebugWireframe ¶
DrawDebugWireframe draws the wireframe triangles of all visible Models underneath the rootNode in the color provided to the screen image provided.
func (*Camera) DynamicRender ¶ added in v0.15.0
func (camera *Camera) DynamicRender(settings ...DynamicRenderSettings) error
DynamicRender quickly and easily renders an object with the desired setup. The Camera must be present in a Scene to perform this function.
func (*Camera) FieldOfView ¶
FieldOfView returns the vertical field of view in degrees.
func (*Camera) ModelInFrustum ¶ added in v0.16.0
ModelInFrustum returns if a model is onscreen when viewed through a Camera.
func (*Camera) MouseRayTest ¶ added in v0.12.0
func (camera *Camera) MouseRayTest(options MouseRayTestOptions) *RayHit
MouseRayTest casts a ray forward from the mouse's position onscreen, testing against the provided IBoundingObjects found in the MouseRayTestOptions struct. The function calls the callback found in the MouseRayTestOptions struct for each object struck by the ray. The function returns the first struck object; if none were struck, it returns nil. Note that each object can only be struck once by the raycast, with the exception of BoundingTriangles objects (since a single ray may strike multiple triangles).
func (*Camera) NormalTexture ¶ added in v0.12.1
NormalTexture returns the camera's final result normal texture from any previous Render() or RenderNodes() calls. If Camera.RenderNormals is set to false, the function will return nil instead.
func (*Camera) OrthoScale ¶
OrthoScale returns the scale of an orthographic camera in world units across (horizontally).
func (*Camera) Perspective ¶
Perspective returns whether the Camera is perspective or not (orthographic).
func (*Camera) PointInFrustum ¶ added in v0.8.1
PointInFrustum returns true if the point is visible through the camera frustum.
func (*Camera) Projection ¶
Projection returns the Camera's projection matrix.
func (*Camera) Render ¶
func (camera *Camera) Render(scene *Scene, lights, models NodeIterator)
Render renders all of the models passed using the provided Scene's properties (fog, for example) and lights provided. Note that if Camera.RenderDepth is false, scenes rendered one after another in multiple Render() calls will be rendered on top of each other in the Camera's texture buffers. Also, the function will automatically include the Scene's world ambient light, if there is a world.
func (*Camera) RenderImageSequence ¶ added in v0.16.0
func (camera *Camera) RenderImageSequence(frameCount int, renderFunc func(frameIndex int)) []*ebiten.Image
RenderImageSequence runs a render function for each frame in an image sequence. frameCount is the number of frames to render, and renderFunc is a callback to be called for each frame; it should perform any rendering functions that would write to the returned image sequence textures each frame. The size of each image in the returned sequence would be the size of the camera.
Say you had a camera pointed at a model and wanted to make a 60 frame image sequence of it spinning. An example would be something like:
camera.RenderImageSequence(60, func(frameIndex int){
camera.Clear() // Clear the camera
camera.RenderScene(scene) // Renders to the camera's color texture; gets copied to an image in the sequence
model.Rotate(0, 1, 0, Pi * 2 / 60) // Rotates the model 2pi over 60 frames
})
func (*Camera) RenderNodes ¶
RenderNodes renders all nodes starting with the provided rootNode using the Scene's properties (fog, for example). Note that if Camera.RenderDepth is false, scenes rendered one after another in multiple RenderScene() calls will be rendered on top of each other in the Camera's texture buffers. Note that each MeshPart of a Model has a maximum renderable triangle count of 21845.
func (*Camera) RenderScene ¶ added in v0.11.0
RenderScene renders the provided Scene. Note that if Camera.RenderDepth is false, scenes rendered one after another in multiple RenderScene() calls will be rendered on top of each other in the Camera's texture buffers. Note that each MeshPart of a Model has a maximum renderable triangle count of 21845.
func (*Camera) RenderSprite3D ¶ added in v0.15.0
func (camera *Camera) RenderSprite3D(screen *ebiten.Image, renderSettings ...RenderSprite3DSettings)
RenderSprite3D draws an image on the screen in 2D, but at the screen position of the 3D world position provided, and with depth intersection. This allows you to render 2D elements "at" a 3D position, and can be very useful in situations where you want a sprite to render at 100% size and no perspective or skewing, but still look like it's in the 3D space (like in a game with a fixed camera viewpoint).
func (*Camera) Resize ¶
Resize resizes the backing texture for the Camera to the specified width and height. If the camera already has a backing texture and the width and height are already set to the specified arguments, then the function does nothing.
func (*Camera) ScreenToWorld ¶ added in v0.12.0
ScreenToWorld converts an x and y position on screen to a 3D point in front of the camera. x and y are values ranging between -1 and 1 for both the horizontal and vertical axes. The depth argument changes how deep the returned Vector is in 3D world units.
func (*Camera) ScreenToWorldPixels ¶ added in v0.15.0
ScreenToWorldPixels converts an x and y pixel position on screen to a 3D point in front of the camera. The depth argument changes how deep the returned Vector is in 3D world units.
func (*Camera) SetFieldOfView ¶ added in v0.12.0
SetFieldOfView sets the vertical field of the view of the camera in degrees.
func (*Camera) SetOrthoScale ¶ added in v0.12.0
SetOrthoScale sets the scale of an orthographic camera in world units across (horizontally).
func (*Camera) SetPerspective ¶
SetPerspective sets the Camera's projection to be a perspective (true) or orthographic (false) projection.
func (*Camera) Size ¶ added in v0.11.0
Size returns the width and height of the camera's backing color texture. All of the Camera's textures are the same size, so these same size values can also be used for the depth texture, the accumulation buffer, etc.
func (*Camera) SphereInFrustum ¶ added in v0.8.1
SphereInFrustum returns true if a sphere at the given location with the given radius would be visible through the camera frustum.
func (*Camera) ViewMatrix ¶
ViewMatrix returns the Camera's view matrix.
func (*Camera) WorldToClip ¶
WorldToClip transforms a 3D position in the world to clip coordinates (before screen normalization).
func (*Camera) WorldToScreen ¶
WorldToScreen transforms a 3D position in the world to a 2D vector, with X and Y ranging from -1 to 1. The Z coordinate indicates depth away from the camera in 3D world units.
func (*Camera) WorldToScreenPixels ¶ added in v0.15.0
WorldToScreenPixels transforms a 3D position in the world to a position onscreen, with X and Y representing the pixels. The Z coordinate indicates depth away from the camera in 3D world units.
func (*Camera) WorldUnitToViewRangePercentage ¶ added in v0.14.0
WorldUnitToViewRangePercentage converts a unit of world space into a percentage of the view range. Basically, let's say a camera's far range is 100 and its near range is 0. If you called camera.WorldUnitToViewRangePercentage(50), it would return 0.5. This function is primarily useful for custom depth functions operating on Materials.
type Collision ¶ added in v0.9.1
type Collision struct {
Object IBoundingObject // The BoundingObject collided with
// The slice of Intersections, one for each object or triangle intersected with.
// The slice is sorted in order by overall magnitude of minimum translation vector (e.g. how far
// into the intersection the object is), and if those values are similar, then by perpendicularity to
// the colliding object
Intersections []*Intersection
}
Collision represents the result of a collision test. A Collision test may result in multiple intersections, and so an Collision holds each of these individual intersections in its Intersections slice. The intersections are sorted in order of distance from the starting point of the intersection (the center of the colliding sphere / aabb, the closest point in the capsule, the center of the closest triangle, etc) to the contact point.
func CollisionTestAABB ¶ added in v0.15.0
func CollisionTestAABB(x, y, z, width, height, depth float32, settings CollisionTestSettings) *Collision
CollisionTestAABB performs a quick bounding AABB check at the specified x, y, and z position using the collision settings provided. The bounding AABB will have the provided width, height, and depth. Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the AABB at the settings specified. Note that AABB tests with BoundingTriangles are currently buggy.
func CollisionTestAABBVec ¶ added in v0.15.0
func CollisionTestAABBVec(position, size Vector3, settings CollisionTestSettings) *Collision
CollisionTestAABBVec places a bounding AABB at the position given with the specified size to perform a collision test. Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the AABB at the settings specified. Note that AABB tests with BoundingTriangles are currently buggy.
func CollisionTestCapsule ¶ added in v0.15.0
func CollisionTestCapsule(x, y, z, radius, height float32, up BoundingCapsuleUpAxis, settings CollisionTestSettings) *Collision
CollisionTestCapsule performs a quick bounding capsule check at the specified position and size using the collision settings provided. Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the capsule at the settings specified.
func CollisionTestCapsuleVec ¶ added in v0.15.0
func CollisionTestCapsuleVec(position Vector3, radius, height float32, up BoundingCapsuleUpAxis, settings CollisionTestSettings) *Collision
CollisionTestCapsuleVec places a bounding capsule at the position given with the specified radius and height to perform a collision test. Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the capsule at the settings specified.
func CollisionTestSphere ¶ added in v0.15.0
func CollisionTestSphere(x, y, z, radius float32, settings CollisionTestSettings) *Collision
CollisionTestSphere performs a quick bounding sphere check at the specified X, Y, and Z position with the radius given, against the bounding objects provided in "others". Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the sphere at the settings specified.
func CollisionTestSphereVec ¶ added in v0.15.0
func CollisionTestSphereVec(position Vector3, radius float32, settings CollisionTestSettings) *Collision
CollisionTestSphereVec performs a quick bounding sphere check at the specified position with the radius given, against the bounding objects provided in "others". Collisions reported will be sorted in distance from closest to furthest. The function will return the first collision found with the sphere at the settings specified.
func (*Collision) AverageContactPoint ¶ added in v0.9.1
AverageContactPoint returns the average world contact point out of the contact points of all Intersections contained within the Collision.
func (*Collision) AverageMTV ¶ added in v0.9.1
AverageMTV returns the average MTV (minimum translation vector) from all Intersections contained within the Collision. To be specific, this isn't actually the pure average, but rather is the result of adding together all MTVs from Intersections in the Collision for the direction, and using the greatest MTV's magnitude for the distance of the returned vector. In other words, AverageMTV returns the MTV to move in that should resolve all intersections from the Collision.
func (*Collision) AverageNormal ¶ added in v0.10.0
AverageNormal returns the average normal vector from all Intersections contained within the Collision.
func (*Collision) AverageSlope ¶ added in v0.9.1
AverageSlope returns the average slope of the Collision (ranging from -1 to 1, with 0 pointing straight up). This average is spread across all intersections contained within the Collision.
func (*Collision) CollidedWithMaterialByName ¶ added in v0.18.0
Returns if the object in the collision has a parent with a material with the given name.
func (*Collision) CollidedWithMaterialPropName ¶ added in v0.18.0
Returns if the object in the collision has a parent with a material with a property with the given name.
func (*Collision) CollidedWithParentBitfieldValueName ¶ added in v0.18.0
Returns if the object in the collision has a parent with a bitfield value property with a bit of the given name flipped.
func (*Collision) CollidedWithParentPropName ¶ added in v0.18.0
Returns if the object in the collision has a parent with a property of the given name.
func (*Collision) CollidedWithParentPropPair ¶ added in v0.18.0
Returns if the object in the collision has a parent with a property of the given name with the given value.
func (*Collision) ForEachCollidedMaterial ¶ added in v0.18.0
func (*Collision) MaxMTV ¶ added in v0.18.0
Returns the maximum MTV to be moved on all axes to escape intersection with all intersection points.
func (*Collision) SlideAgainstAverageNormal ¶ added in v0.10.0
SlideAgainstAverageNormal takes an input movement vector and alters it to slide against the Collision's average normal.
type CollisionTestSettings ¶ added in v0.11.0
type CollisionTestSettings struct {
// TestAgainst controls what objects to test against.
TestAgainst NodeIterator
// OnCollision is a callback function that is called when a valid collision test happens between the
// calling object and one of the valid INodes contained within the Others slice. The callback should return a boolean
// indicating if the test should continue after evaluating this collision (true) or not (false).
//
// Because this function is called whenever a Collision is found, anything done in this function will influence
// following possible Collisions. To illustrate this, let's say that you had object A that is colliding with objects B and C.
// If the collision with B is detected first, and you move A away so that it is no longer colliding with B or C, then the collision
// with C would not be detected (and OnCollision would not be called in this case).
//
// OnCollision is called in order of distance to intersection points (so two objects might have the same distance to their respective intersection points of a larger object).
// This being the case, you may need to store and re-sort the collisions to fit your needs.
// index is the index of the collision out of the total number of collisions, which is the count.
OnCollision func(col *Collision, index, count int) bool
}
CollisionTestSettings controls how a CollisionTest() call evaluates.
type Color3 ¶ added in v0.18.0
type Color3 struct {
R, G, B float32
}
func NewColor3FromColor ¶ added in v0.18.0
NewColorFromColor returns a new Color based on a provided color.Color.
func NewColor3FromHSV ¶ added in v0.18.0
NewColorFromHSV returns a new color, using hue, saturation, and value numbers, each ranging from 0 to 1. A hue of 0 is red, while 1 is also red, but on the other end of the spectrum. Cribbed from: https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go
func NewColor3FromHexString ¶ added in v0.18.0
func NewColor3Random ¶ added in v0.18.0
NewColorRandom creates a randomized color, with each component lying between the minimum and maximum values.
func (Color3) AddRGB ¶ added in v0.18.0
AddRGBA adds the provided R, G, and B values to the color as provided.
func (Color3) AddScalar ¶ added in v0.18.0
Adds the given Scalar value to all components of the Color3.
func (Color3) ConvertTosRGB ¶ added in v0.18.0
ConvertTosRGB() converts the color's R, G, and B components to the sRGB color space. This is used to convert colors from their values in GLTF to how they should appear on the screen. See: https://en.wikipedia.org/wiki/SRGB
func (Color3) Equals ¶ added in v0.18.0
Equals returns true if the two Colors are close enough in all values.
func (Color3) Hue ¶ added in v0.18.0
Hue returns the hue of the color as a value ranging from 0 to 1.
func (Color3) Lerp ¶ added in v0.18.0
Lerp linearly interpolates the color from the starting color to the target by the percentage given.
func (Color3) LerpRGB ¶ added in v0.18.0
Lerp linearly interpolates the color from the starting color to the target by the percentage given.
func (Color3) Mix ¶ added in v0.18.0
Mix mixes the calling Color with the other Color, mixed to the percentage given (ranging from 0 - 1).
func (Color3) Multiply ¶ added in v0.18.0
Multiply multiplies the existing Color by the provided Color.
func (Color3) MultiplyRGB ¶ added in v0.18.0
MultiplyRGBA multiplies the color's RGBA channels by the provided R, G, B, and A scalar values.
func (Color3) MultiplyScalar ¶ added in v0.18.0
func (Color3) Saturation ¶ added in v0.18.0
Saturation returns the saturation of the color as a value ranging from 0 to 1.
func (Color3) SetHue ¶ added in v0.18.0
SetHue returns a copy of the color with the hue set to the specified value. Hue goes through the rainbow, starting with red, and ranges from 0 to 1.
func (Color3) SetSaturation ¶ added in v0.18.0
SetSaturation returns a copy of the color with the saturation of the color set to the specified value. Saturation ranges from 0 to 1.
func (Color3) SetValue ¶ added in v0.18.0
SetValue returns a copy of the color with the value of the color set to the specified value. Value ranges from 0 to 1.
func (Color3) SubRGB ¶ added in v0.18.0
Sub subtracts the other Color from the calling Color instance.
func (Color3) ToFloat32Array ¶ added in v0.18.0
ToFloat32Array returns a [4]float32 array for each channel in the Color in the order of R, G, B, and A.
func (Color3) ToFloat32s ¶ added in v0.18.0
ToFloat32s returns the Color as four float32 in the order R, G, B, and A.
func (Color3) ToNRGBA64 ¶ added in v0.18.0
ToNRGBA64 converts a color to a color.NRGBA64 (non-alpha color multiplied) color instance.
func (Color3) Tofloat32s ¶ added in v0.18.0
Tofloat32s returns four float32 values for each channel in the Color in the order R, G, B, and A.
type Color4 ¶ added in v0.18.0
type Color4 struct {
R, G, B, A float32
}
Color4 represents a color, containing R, G, B, and A components, each expected to range from 0 to 1.
func NewColor4 ¶ added in v0.18.0
NewColor4 returns a new Color, with the provided R, G, B, and A components expected to range from 0 to 1.
func NewColor4FromColor ¶ added in v0.18.0
NewColor4FromColor returns a new Color based on a provided color.Color.
func NewColor4FromHSV ¶ added in v0.18.0
NewColor4FromHSV returns a new color, using hue, saturation, and value numbers, each ranging from 0 to 1. A hue of 0 is red, while 1 is also red, but on the other end of the spectrum. Cribbed from: https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go
func NewColor4FromHexString ¶ added in v0.18.0
func NewColor4Random ¶ added in v0.18.0
NewColor4Random creates a randomized color, with each component lying between the minimum and maximum values.
func (Color4) AddRGBA ¶ added in v0.18.0
AddRGBA adds the provided R, G, B, and A values to the color as provided. The components are expected to range from 0 to 1.
func (Color4) ConvertTosRGB ¶ added in v0.18.0
ConvertTosRGB() converts the color's R, G, and B components to the sRGB color space. This is used to convert colors from their values in GLTF to how they should appear on the screen. See: https://en.wikipedia.org/wiki/SRGB
func (Color4) Equals ¶ added in v0.18.0
Equals returns true if the two Colors are close enough in all values.
func (Color4) Hue ¶ added in v0.18.0
Hue returns the hue of the color as a value ranging from 0 to 1.
func (Color4) Lerp ¶ added in v0.18.0
Lerp linearly interpolates the color from the starting color to the target by the percentage given.
func (Color4) LerpRGBA ¶ added in v0.18.0
Lerp linearly interpolates the color from the starting color to the target by the percentage given.
func (Color4) Mix ¶ added in v0.18.0
Mix mixes the calling Color with the other Color, mixed to the percentage given (ranging from 0 - 1).
func (Color4) Multiply ¶ added in v0.18.0
Multiply multiplies the existing Color by the provided Color.
func (Color4) MultiplyRGBA ¶ added in v0.18.0
MultiplyRGBA multiplies the color's RGBA channels by the provided R, G, B, and A scalar values.
func (Color4) MultiplyScalarRGB ¶ added in v0.18.0
func (Color4) MultiplyScalarRGBA ¶ added in v0.18.0
func (Color4) Saturation ¶ added in v0.18.0
Saturation returns the saturation of the color as a value ranging from 0 to 1.
func (Color4) SetAlpha ¶ added in v0.18.0
SetAlpha returns a copy of the the Color with the alpha set to the provided alpha value.
func (Color4) SetHue ¶ added in v0.18.0
SetHue returns a copy of the color with the hue set to the specified value. Hue goes through the rainbow, starting with red, and ranges from 0 to 1.
func (Color4) SetSaturation ¶ added in v0.18.0
SetSaturation returns a copy of the color with the saturation of the color set to the specified value. Saturation ranges from 0 to 1.
func (Color4) SetValue ¶ added in v0.18.0
SetValue returns a copy of the color with the value of the color set to the specified value. Value ranges from 0 to 1.
func (Color4) SubRGBA ¶ added in v0.18.0
Sub subtracts the other Color from the calling Color instance.
func (Color4) ToFloat32Array ¶ added in v0.18.0
ToFloat32Array returns a [4]float32 array for each channel in the Color in the order of R, G, B, and A.
func (Color4) ToFloat32s ¶ added in v0.18.0
ToFloat32s returns the Color as four float32 in the order R, G, B, and A.
func (Color4) ToNRGBA64 ¶ added in v0.18.0
ToNRGBA64 converts a color to a color.NRGBA64 (non-alpha color multiplied) color instance.
func (Color4) Tofloat32s ¶ added in v0.18.0
Tofloat32s returns four float32 values for each channel in the Color in the order R, G, B, and A.
type ColorCurve ¶ added in v0.10.0
type ColorCurve struct {
Points []ColorCurvePoint
EasingFunction ease.TweenFunc
}
ColorCurve represents a range of colors that a value of 0 to 1 can interpolate between.
func NewColorCurve ¶ added in v0.10.0
func NewColorCurve(colors ...Color4) ColorCurve
NewColorCurve creats a new ColorCurve composed of the colors given, evenly spaced throughout the curve. If no colors are given, the ColorCurve is still valid - it's just empty.
func (*ColorCurve) Add ¶ added in v0.10.0
func (cc *ColorCurve) Add(color Color4, percentage float32)
Add adds a color point to the ColorCurve with the color and percentage provided (from 0-1).
func (*ColorCurve) AddRGBA ¶ added in v0.10.0
func (cc *ColorCurve) AddRGBA(r, g, b, a float32, percentage float32)
AddRGBA adds a point to the ColorCurve, with r, g, b, and a being the color and the percentage being a number between 0 and 1 indicating the .
func (ColorCurve) Clone ¶ added in v0.10.0
func (cc ColorCurve) Clone() ColorCurve
Clone creates a duplicate ColorCurve.
func (ColorCurve) Color ¶ added in v0.10.0
func (cc ColorCurve) Color(perc float32) Color4
Color returns the Color for the given percentage in the color curve. For example, if you have a curve composed of the colors {0, 0, 0, 0} at 0 and {1, 1, 1, 1} at 1, then calling Curve.Color(0.5) would return {0.5, 0.5, 0.5, 0.5}. If the curve doesn't have any color curve points, Color will return transparent.
type ColorCurvePoint ¶ added in v0.10.0
ColorCurvePoint indicates an individual color point in a color curve.
type ColorTween ¶ added in v0.16.0
type ColorTween struct {
ColorCurve ColorCurve // ColorCurve is the curve to use while tweening
Percent float32 // Percent is the percentage through the tween the ColorTween is
Speed float32 // Speed is the speed of the tween; if you want a
Duration float32 // Duration is the duration of the tween in seconds
// contains filtered or unexported fields
}
ColorTween represents an object that tweens across a ColorCurve.
func NewColorTween ¶ added in v0.16.0
func NewColorTween(duration float32, curve ColorCurve) ColorTween
ColorTween creates a new ColorTween object with the specified duration and curve.
func (*ColorTween) Color ¶ added in v0.16.0
func (c *ColorTween) Color() Color4
Color returns the current color from the internal ColorCurve.
func (*ColorTween) IsPlaying ¶ added in v0.16.0
func (c *ColorTween) IsPlaying() bool
IsPlaying returns if the ColorTween is playing.
func (*ColorTween) Play ¶ added in v0.16.0
func (c *ColorTween) Play()
Play starts playing the ColorTween back.
func (*ColorTween) Reset ¶ added in v0.16.0
func (c *ColorTween) Reset()
Reset resets the ColorTween.
func (*ColorTween) SetEasingFunction ¶ added in v0.16.0
func (c *ColorTween) SetEasingFunction(easingFunction ease.TweenFunc)
SetEasingFunction sets the easing function to be used by the tween and is present on the ColorCurve.
func (*ColorTween) Update ¶ added in v0.16.0
func (c *ColorTween) Update(dt float32) bool
Update updates the ColorTween using the delta value provided in seconds and returns if the tween is finished or not.
type CustomMaterialDepthFunction ¶ added in v0.18.0
type CustomMaterialDepthFunction func(model *Model, camera *Camera, meshPart *MeshPart, vertIndex int, originalDepth float32) float32
func NewCustomMaterialDepthFunctionPlus ¶ added in v0.18.0
func NewCustomMaterialDepthFunctionPlus(offset float32) CustomMaterialDepthFunction
func NewCustomMaterialDepthFunctionSet ¶ added in v0.18.0
func NewCustomMaterialDepthFunctionSet(setTo float32) CustomMaterialDepthFunction
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
func (Data) AsQuaternion ¶
func (data Data) AsQuaternion() Quaternion
type DebugInfo ¶
type DebugInfo struct {
On bool // If not on, debug info is not filled out
// contains filtered or unexported fields
}
DebugInfo is a struct that holds debugging information for a Camera's render pass. These values are reset when Camera.Clear() is called.
func (*DebugInfo) ActiveLightCount ¶ added in v0.5.1
func (*DebugInfo) AnimationTime ¶ added in v0.15.0
func (*DebugInfo) BatchedParts ¶ added in v0.10.0
func (*DebugInfo) Draw ¶ added in v0.18.0
Draws render debug information (like number of drawn objects, number of drawn triangles, frame time, etc) at the top-left of the provided screen *ebiten.Image, using the textScale and color provided. Note that the frame-time mentioned here is purely the time that Tetra3D spends sending render commands to the command queue. Any additional time that Ebitengine takes to flush that queue is not included in this average frame-time value, and is not visible outside of debugging and profiling, like with pprof.
func (*DebugInfo) DrawnParts ¶ added in v0.8.1
func (*DebugInfo) LightCount ¶ added in v0.5.1
func (*DebugInfo) PrevFrametimes ¶ added in v0.18.0
func (*DebugInfo) SetCombineWith ¶ added in v0.18.0
Combines debug infos together for rendering
func (*DebugInfo) TotalParts ¶ added in v0.8.1
type DebugInfoDuration ¶ added in v0.18.0
type DebugInfoDuration struct {
// contains filtered or unexported fields
}
func (*DebugInfoDuration) EndTimer ¶ added in v0.18.0
func (d *DebugInfoDuration) EndTimer()
func (*DebugInfoDuration) StartTimer ¶ added in v0.18.0
func (d *DebugInfoDuration) StartTimer()
type Dimensions ¶
type Dimensions struct {
Min, Max Vector3
}
Dimensions represents the minimum and maximum spatial dimensions of a Mesh arranged in a 2-space Vector slice.
func NewDimensions ¶ added in v0.18.0
func NewDimensions(min, max Vector3) Dimensions
Returns a new Dimensions object, canonized in case it's malformed.
func NewDimensionsFromPoints ¶ added in v0.10.0
func NewDimensionsFromPoints(points ...Vector3) Dimensions
NewDimensionsFromPoints creates a new Dimensions struct from the given series of positions.
func NewDimensionsXYZ ¶ added in v0.18.0
func NewDimensionsXYZ(minX, minY, minZ, maxX, maxY, maxZ float32) Dimensions
Returns a new Dimensions object, canonized in case it's malformed.
func (Dimensions) Canon ¶ added in v0.18.0
func (dim Dimensions) Canon() Dimensions
Returns the Dimensions set properly adjusted in case it's malformed (min is greater than max on any axis)
func (Dimensions) Center ¶
func (dim Dimensions) Center() Vector3
Center returns the center point inbetween the two corners of the dimension set.
func (Dimensions) Contains ¶ added in v0.18.0
func (dim Dimensions) Contains(point Vector3) bool
func (Dimensions) Depth ¶
func (dim Dimensions) Depth() float32
Depth returns the total difference between the minimum and maximum Z values.
func (Dimensions) Dimension ¶ added in v0.18.0
func (dim Dimensions) Dimension(axis int) float32
func (Dimensions) Height ¶
func (dim Dimensions) Height() float32
Height returns the total difference between the minimum and maximum Y values.
func (Dimensions) Intersects ¶ added in v0.18.0
func (dim Dimensions) Intersects(other Dimensions) bool
Intersects returns if the given Dimensions object intersects the other.
func (Dimensions) MaxDimension ¶ added in v0.8.1
func (dim Dimensions) MaxDimension() float32
MaxDimension returns the maximum value from all of the axes in the Dimensions. For example, if the Dimensions have a min of [-1, -2, -2], and a max of [6, 1.5, 1], Max() will return 7 for the X axis, as it's the largest distance between all axes.
func (Dimensions) MaxSpan ¶
func (dim Dimensions) MaxSpan() float32
MaxSpan returns the maximum span between the corners of the dimension set.
func (Dimensions) Projection ¶ added in v0.18.0
func (dim Dimensions) Projection(axis int) Projection
Projection returns a projection of one of the axes of the given dimensions.
func (Dimensions) Size ¶ added in v0.10.0
func (dim Dimensions) Size() Vector3
func (Dimensions) Width ¶
func (dim Dimensions) Width() float32
Width returns the total difference between the minimum and maximum X values.
type DirectionalLight ¶ added in v0.5.0
type DirectionalLight struct {
*LightBase
// contains filtered or unexported fields
}
DirectionalLight represents a directional light of infinite distance.
func NewDirectionalLight ¶ added in v0.5.0
func NewDirectionalLight(name string, r, g, b, energy float32) *DirectionalLight
NewDirectionalLight creates a new Directional Light with the specified RGB color and energy (assuming 1.0 energy is standard / "100%" lighting).
func (*DirectionalLight) Clone ¶ added in v0.5.0
func (sun *DirectionalLight) Clone() INode
Clone returns a new DirectionalLight clone from the given DirectionalLight.
func (*DirectionalLight) Light ¶ added in v0.5.0
func (sun *DirectionalLight) Light(tri *Triangle, model *Model, targetColors *VertexColorChannel)
Light returns the R, G, and B values for the DirectionalLight for each vertex of the provided Triangle.
func (*DirectionalLight) Type ¶ added in v0.8.1
func (sun *DirectionalLight) Type() NodeType
Type returns the NodeType for this object.
func (*DirectionalLight) VertexLight ¶ added in v0.18.0
func (sun *DirectionalLight) VertexLight(index int, tri *Triangle, model *Model, targetColors *VertexColorChannel)
type DrawDebugBoundsColoredSettings ¶ added in v0.14.0
type DrawDebugBoundsColoredSettings struct {
RenderAABBs bool // Whether BoundingAABBs should be rendered or not
AABBColor Color4 // The color used to render BoundingAABBs
RenderSpheres bool // Whether BoundingSpheres should be rendered or not
SphereColor Color4 // The color used to render BoundingSpheres
RenderCapsules bool // Whether BoundingCapsules should be rendered or not
CapsuleColor Color4 // The color used to render BoundingSpheres
RenderTriangles bool // Whether BoundingTriangles should be rendered or not
TrianglesColor Color4 // The color used to render BoundingTriangles
RenderTrianglesBackfaceCulled bool
RenderTrianglesAABB bool // Whether the AABB surrounding BoundingTriangles should be rendered not
TrianglesAABBColor Color4 // The color used to render the AABB surrounding BoundingTriangles
RenderBroadphases bool // Whether the broadphase cells surrounding BoundingTriangles should be rendered or not
BroadphaseColor Color4 // The color used to render broadphase cells
}
DrawDebugBoundsColoredSettings is a struct used to define how to draw debug information showing the positions of IBoundingObjects in a node tree.
func DefaultDrawDebugBoundsSettings ¶ added in v0.14.0
func DefaultDrawDebugBoundsSettings() DrawDebugBoundsColoredSettings
DefaultDrawDebugBoundsSettings returns the default settings for drawing the debug bounds for a nodegraph.
type DynamicRenderSettings ¶ added in v0.15.0
type DynamicRenderSettings struct {
Model *Model // The model to be cloned for usage
Position Vector3 // The position to render the Model at. Ignored if Transform is set.
Scale Vector3 // The scale to render the Model at. Ignored if Transform is set.
Rotation Matrix4 // The rotation to render the Model with. Ignored if Transform is set.
Transform Matrix4 // A transform to use for rendering; this is used if it is non-zero.
Color Color4 // The color to render the Model.
// contains filtered or unexported fields
}
type FloatRange ¶ added in v0.13.0
type FloatRange struct {
Min, Max float32
CustomFunc func(floatRange *FloatRange) float32
}
Represents a random value in a range of floats.
func NewFloatRange ¶ added in v0.13.0
func NewFloatRange() FloatRange
Returns a new FloatRange object.
func (*FloatRange) Set ¶ added in v0.13.0
func (ran *FloatRange) Set(min, max float32)
Sets the minimum and maximum values of the range to the specified values.
func (*FloatRange) SetCustomFunc ¶ added in v0.18.0
func (ran *FloatRange) SetCustomFunc(customFunc func(floatRange *FloatRange) float32)
Sets a custom function to use for retrieving a random value within the range. Note that you can use the range object's Value() function to get its default randomized result.
func (FloatRange) Value ¶ added in v0.13.0
func (ran FloatRange) Value() float32
Returns a random value in between the range's minimum and maximum values.
type FogBlendMode ¶ added in v0.18.0
type FogBlendMode int
const ( FogAdd FogBlendMode = iota // Additive blended fog FogSub // Subtractive blended fog FogOverwrite // Color overwriting fog (mixing base with fog color over depth distance) )
type GLTFLoadOptions ¶
type GLTFLoadOptions struct {
// Width and height of loaded Cameras. Defaults to -1 each, which will then instead load the size from the camera's resolution as exported in the GLTF file;
// if the camera resolution isn't set there, cameras will load with a 1920x1080 camera size.
CameraWidth, CameraHeight int
CameraDepth bool // If cameras should render depth or not
// DependentLibraryResolver is a function that takes a relative path (string) to the blend file representing the dependent Library that the loading
// Library requires. This function should return a reference to the dependent Library; if it returns nil, the linked objects from the dependent Library
// will not be instantiated in the loading Library.
// An example would be loading a level (level.gltf) composed of assets from another file (a GLTF file exported from assets.blend, which is a directory up).
// In this example, loading level.gltf would require the dependent library, found in assets.gltf. Loading level.gltf will refer to objects linked from the assets
// blend file, known as "../assets.blend".
// You could then simply load the assets library first and then code the DependentLibraryResolver function to take the assets library, or code the
// function to use the path to load the library on demand. You could then store the loaded result as necessary if multiple levels use this assets Library.
DependentLibraryResolver func(blendPath string) *Library
LoadExternalTextures bool // Whether any external textures should automatically be loaded if you load a GLTF file using LoadGLTFFile() and the textures are packed within the file. Defaults to true.
// contains filtered or unexported fields
}
func DefaultGLTFLoadOptions ¶
func DefaultGLTFLoadOptions() *GLTFLoadOptions
DefaultGLTFLoadOptions creates an instance of GLTFLoadOptions with some sensible defaults.
type Grid ¶ added in v0.10.0
type Grid struct {
*Node
}
Grid represents a collection of points and the connections between them. A Grid can be used for pathfinding or simply for connecting points in space (like for a world map in a level-based game, for example).
func (*Grid) Center ¶ added in v0.10.0
Center returns the center point of the Grid, given the positions of its GridPoints.
func (*Grid) ClosestGridPoint ¶ added in v0.15.0
ClosestGridPoint returns the nearest grid point to the given world position.
func (*Grid) ClosestPositionOnGrid ¶ added in v0.15.0
ClosestPositionOnGrid returns the nearest world position on the Grid to the given world position. This position can be directly on a GridPoint, or on a connection between GridPoints.
func (*Grid) Combine ¶ added in v0.10.0
Combine combines the Grid with the other Grids provided. This reparents the other' Grid's GridPoints (and other children) to be under the calling Grid's. If two GridPoints share the same position, they will be merged together. After combining a Grid with others, the other Grids will automatically be unparented from the scene nodegraph tree (as their GridPoints will have been absorbed).
func (*Grid) Dimensions ¶ added in v0.10.0
func (grid *Grid) Dimensions() Dimensions
Dimensions returns a Dimensions struct, indicating the overall "spread" of the GridPoints composing the Grid.
func (*Grid) DisconnectAllPoints ¶ added in v0.14.0
func (grid *Grid) DisconnectAllPoints()
DisconnectAllPoints disconnects all points from each other in the Grid.
func (*Grid) FirstPoint ¶ added in v0.10.0
FirstPoint returns the first point out of the Grid's GridPoints. If the Grid has no GridPoints, then it will return nil.
func (*Grid) ForEachPoint ¶ added in v0.14.0
ForEachPoint returns a slice of the children nodes that constitute this Grid's GridPoints.
func (*Grid) FurthestGridPoint ¶ added in v0.11.0
FurthestGridPoint returns the furthest grid point to the given world position.
func (*Grid) HopCounts ¶ added in v0.14.0
HopCounts returns the number of hops from the closest grid point to the starting position (from) to the closest grid points to all other provided positions.
func (*Grid) LastPoint ¶ added in v0.10.0
LastPoint returns the last point out of the Grid's GridPoints. If the Grid has no GridPoints, then it will return nil.
func (*Grid) MergeDuplicatePoints ¶ added in v0.15.0
func (*Grid) Points ¶ added in v0.10.0
Points returns a slice of the children nodes that constitute this Grid's GridPoints.
func (*Grid) RandomPoint ¶ added in v0.10.0
RandomPoint returns a random grid point in the grid.
type GridConnection ¶ added in v0.15.0
type GridConnection struct {
To *GridPoint
Passable bool // Whether the connection should be considered as passable when performing pathfinding.
Cost float32 // The cost of the jump, from one grid point to another. Defaults to 0.
// contains filtered or unexported fields
}
A GridConnection represents a one-way connection from one GridPoint to another.
func (*GridConnection) Clone ¶ added in v0.15.0
func (c *GridConnection) Clone() *GridConnection
Clone the GridConnection.
type GridPath ¶ added in v0.10.0
type GridPath struct {
GridPoints []Vector3
}
GridPath represents a sequence of grid points, used to traverse a path. GridPath implements IPath.
func (*GridPath) HopCount ¶ added in v0.15.0
HopCount returns the number of hops in the path (i.e. the number of nodes - 1).
type GridPoint ¶ added in v0.10.0
type GridPoint struct {
*Node
Connections []*GridConnection
// contains filtered or unexported fields
}
GridPoint represents a point on a Grid, used for pathfinding or connecting points in space. GridPoints are parented to a Grid and the connections are created seperate from their positions, which means you can move GridPoints freely after creation. Note that GridPoints consider themselves to be in the same Grid only if they have the same direct parent (being the Grid).
func NewGridPoint ¶ added in v0.10.0
NewGridPoint creates a new GridPoint.
func NewGridPointFromNode ¶ added in v0.15.0
NewGridPoint creates a new GridPoint from an existing Node.
func (*GridPoint) Connect ¶ added in v0.10.0
func (point *GridPoint) Connect(other *GridPoint) (aToB, bToA *GridConnection)
Connect connects the GridPoint to the given other GridPoint.
func (*GridPoint) Connection ¶ added in v0.15.0
func (point *GridPoint) Connection(other *GridPoint) *GridConnection
Connection returns the GridConnection from one GridPoint to another. If they aren't connected, this function will return nil. Note that a connection between GridPoints goes both ways (so there are two connections between two GridPoints - one from either direction).
func (*GridPoint) Disconnect ¶ added in v0.10.0
Disconnect disconnects the GridPoint from the given other GridPoint.
func (*GridPoint) DisconnectAll ¶ added in v0.14.0
func (point *GridPoint) DisconnectAll()
DisconnectAll disconnects the GridPoint from all other GridPoints.
func (*GridPoint) IsConnected ¶ added in v0.10.0
IsConnected returns if the provided GridPoint is connected to the given other GridPoint.
func (*GridPoint) IsOnSameGrid ¶ added in v0.10.0
IsOnSameGrid returns if the grid point is on the same grid as the other given GridPoint.
func (*GridPoint) PathTo ¶ added in v0.10.0
PathTo creates a path going from the GridPoint to the given other GridPoint. The path generated should be the shortest-possible route, taking into account both the cumulative lengths (in units) and costs of individual hops. If a path is not possible from the starting point to the end point, then PathTo will return nil.
type HopCount ¶ added in v0.14.0
type HopCount struct {
Start *GridPoint // The start of the path
Destination *GridPoint // The end of the path
HopCount int // How many hops it takes to get there (i.e. length of the path between the two points minus one)
}
HopCount indicates an instances of how many hops it takes to get to the specified GridPoint from the starting GridPoint.
type IBoundingObject ¶ added in v0.11.0
type IBoundingObject interface {
INode
// Colliding returns true if the BoundingObject is intersecting the other BoundingObject.
Colliding(other IBoundingObject) bool
// Collision returns a Collision if the BoundingObject is intersecting another BoundingObject. If
// no intersection is reported, Collision returns nil.
Collision(other IBoundingObject) *Collision
// CollisionTest performs a distance-ordered collision test using the provided collision test settings structure
// and returns the first collision found (if none are found, then it returns nil). To perform a function against
// multiple objects, use the OnCollision function in the CollisionTestSettings object.
CollisionTest(settings CollisionTestSettings) *Collision
// Returns the transformed dimensions of the bounding object.
Dimensions() Dimensions
}
IBoundingObject represents a Node type that can be tested for collision. The exposed functions are essentially just concerning whether an object that implements IBoundingObject is colliding with another IBoundingObject, and if so, by how much.
type ILight ¶ added in v0.10.0
type ILight interface {
INode
VertexLight(vertexIndex int, triangle *Triangle, model *Model, targetColors *VertexColorChannel)
Light(triangle *Triangle, model *Model, targetColors *VertexColorChannel) // Light lights the triangles in the MeshPart, storing the result in the targetColors
Color() Color4
SetColor(c Color4)
Energy() float32
SetEnergy(energy float32)
// contains filtered or unexported methods
}
ILight represents an interface that is fulfilled by an object that emits light, returning the color a vertex should be given that Vertex and its model matrix.
type INode ¶
type INode interface {
// Name returns the object's name.
Name() string
// String returns the object as a string.
String() string
// ID returns the object's unique ID.
ID() uint32
// SetName sets the object's name.
SetName(name string)
// Clone returns a clone of the specified INode implementer.
Clone() INode
// SetData sets user-customizeable data that could be usefully stored on this node.
SetData(data any)
// Data returns a pointer to user-customizeable data that could be usefully stored on this node.
Data() any
// Type returns the NodeType for this object.
Type() NodeType
// Library returns the source Library from which this Node was instantiated. If it was created through code, this will be nil.
Library() *Library
// Parent returns the Node's parent. If the Node has no parent, this will return nil.
Parent() INode
// Unparent unparents the Node from its parent, removing it from the scenegraph.
// Beware of using this in a hierarchical loop!
Unparent()
// DescendantOf returns if a Node is a descendant child of a parent Node.
DescendantOf(parent INode) bool
// Scene looks for the Node's parents recursively to return what scene it exists in.
// If the node is not within a tree (i.e. unparented), this will return nil.
Scene() *Scene
// Root returns the root node in this tree by recursively traversing this node's hierarchy of
// parents upwards.
Root() *Node
InSceneTree() bool // Returns if this node is in the scene tree.
// ReindexChild moves the child in the calling Node's children slice to the specified newPosition.
// The function returns the old index where the child Node was, or -1 if it wasn't a child of the calling Node.
// The newPosition is clamped to the size of the node's children slice.
ReindexChild(child INode, newPosition int) int
// Index returns the index of the Node in its parent's children list.
// If the node doesn't have a parent, its index will be -1.
Index() int
// Returns the Node's children as a NodeCollectionSet.
Children(recursive bool) NodeList
// Returns the number of children under the Node.
// When recursive, it traverses the entire tree underneath the Node;
// otherwise, it just returns the number of children directly beneath the Node.
ChildrenCount(recursive bool) int
// ForEachChild() runs a callback for each child in the Node's children set.
// If the callback returns false, then the execution stops with the current child.
ForEachChild(recursive bool, forEach func(node INode, index int) bool)
// AddChildren parents the provided children Nodes to the passed parent Node, inheriting its transformations and being under it in the scenegraph
// hierarchy. If the children are already parented to other Nodes, they are unparented before doing so.
AddChildren(...INode)
// RemoveChildren removes the provided children from this object.
// Beware of using this in a hierarchical loop!
RemoveChildren(...INode)
// Replaces the node with the other target node.
ReplaceWith(other INode)
// ClearLocalTransform clears the local transform properties (position, scale, and rotation) for the Node, reverting it to essentially an
// identity matrix (0, 0, 0 for position, 1, 1, 1 for scale, and an identity Matrix4 for rotation, indicating no rotation).
// This can be useful because by default, when you parent one Node to another, the local transform properties (position,
// scale, and rotation) are altered to keep the object in the same absolute location, even though the origin changes.
ClearLocalTransform()
// ResetWorldTransform resets the local transform properties (position, scale, and rotation) for the Node to the original transform when
// the Node was first created / cloned / instantiated in the Scene.
ResetWorldTransform()
// ResetWorldPosition resets the Node's local position to the value the Node had when
// it was first instantiated in the Scene or cloned.
ResetWorldPosition()
// ResetWorldScale resets the Node's local scale to the value the Node had when
// it was first instantiated in the Scene or cloned.
ResetWorldScale()
// ResetWorldRotation resets the Node's local rotation to the value the Node had when
// it was first instantiated in the Scene or cloned.
ResetWorldRotation()
// SetWorldTransform sets the Node's global (world) transform to the full 4x4 transformation matrix provided.
SetWorldTransform(transform Matrix4)
// LocalRotation returns the object's local rotation Matrix4.
LocalRotation() Matrix4
// SetLocalRotation sets the object's local rotation Matrix4 (relative to any parent).
SetLocalRotation(rotation Matrix4)
// LocalPosition returns the object's local position as a Vector.
LocalPosition() Vector3
// SetLocalPosition sets the object's local position (position relative to its parent). If this object has no parent, the position should be
// relative to world origin (0, 0, 0).
SetLocalPositionVec(position Vector3)
// SetLocalPosition sets the object's local position (position relative to its parent). If this object has no parent, the position should be
// relative to world origin (0, 0, 0).
SetLocalPosition(x, y, z float32)
// LocalScale returns the object's local scale (scale relative to its parent). If this object has no parent, the scale will be absolute.
LocalScale() Vector3
// SetLocalScale sets the object's local scale (scale relative to its parent). If this object has no parent, the scale would be absolute.
// scale should be a 3D vector (i.e. X, Y, and Z components).
SetLocalScaleVec(scale Vector3)
SetLocalScale(w, h, d float32)
// WorldRotation returns an absolute rotation Matrix4 representing the object's rotation.
WorldRotation() Matrix4
// SetWorldRotation sets an object's global, world rotation to the provided rotation Matrix4.
SetWorldRotation(rotation Matrix4)
// WorldPosition returns the node's world position, taking into account its parenting hierarchy.
WorldPosition() Vector3
// SetWorldPositionVec sets the world position of the given object using the provided position vector.
// Note that this isn't as performant as setting the position locally.
SetWorldPositionVec(position Vector3)
// SetWorldPosition sets the world position of the given object using the provided position arguments.
// Note that this isn't as performant as setting the position locally.
SetWorldPosition(x, y, z float32)
// SetWorldX sets the x component of the Node's world position.
SetWorldX(x float32)
// SetWorldY sets the y component of the Node's world position.
SetWorldY(x float32)
// SetWorldZ sets the z component of the Node's world position.
SetWorldZ(x float32)
// WorldScale returns the object's absolute world scale as a 3D vector (i.e. X, Y, and Z components).
WorldScale() Vector3
// SetWorldScaleVec sets the object's absolute world scale. scale should be a 3D vector (i.e. X, Y, and Z components).
SetWorldScaleVec(scale Vector3)
// SetWorldScale sets the object's absolute world scale. scale should be three float32 values signifying the scale on the X, Y, and Z components.
SetWorldScale(x, y, z float32)
// Move moves a Node in local space by the x, y, and z values provided.
Move(x, y, z float32)
// MoveVec moves a Node in local space using the vector provided.
MoveVec(moveVec Vector3)
// Moves a Node in local space, by the object's world orientation, by the x, y, and z values provided.
MoveByOrientation(x, y, z float32)
// Moves a Node in local space, by the object's world orientation, using the vector provided.
MoveByOrientationVec(moveVec Vector3)
// Moves a Node towards the node provided by the distance given in world space.
MoveTowardsNode(target INode, distance float32)
// Linearly interpolates movement of the node towards the target location by the given percentage.
MoveTowardsNodeLerp(target INode, percentage float32)
// Moves a Node towards the node provided by the distance given in world space.
MoveTowardsVec(target Vector3, distance float32)
// Linearly interpolates movement of the node towards the target location by the given percentage.
MoveTowardsVecLerp(target Vector3, percentage float32)
// Moves a Node towards the node provided by the distance given in world space.
MoveTowards(x, y, z, distance float32)
// Linearly interpolates movement of the node towards the target location by the given percentage.
MoveTowardsLerp(x, y, z, percentage float32)
// Rotate rotates a Node on its local orientation on a vector composed of the given x, y, and z values, by the angle provided in radians.
Rotate(x, y, z, angle float32)
// RotateVec rotates a Node on its local orientation on the given vector, by the angle provided in radians.
RotateVec(vec Vector3, angle float32)
// Rotates a Node on its local orientation using a rotation Matrix4.
RotateMatrix4(mat Matrix4)
// Grow scales the object additively (i.e. calling Node.Grow(1, 0, 0) will scale it +1 on the X-axis).
Grow(x, y, z float32)
// GrowVec scales the object additively (i.e. calling Node.Grow(1, 0, 0) will scale it +1 on the X-axis).
GrowVec(vec Vector3)
// Transform returns a Matrix4 indicating the global position, rotation, and scale of the object, transforming it by any parents'.
// If there's no change between the previous Transform() call and this one, Transform() will return a cached version of the
// transform for efficiency.
Transform() Matrix4
// IsVisible returns whether the Object is visible.
IsVisible() bool
// SetVisible sets the object's visibility. If recursive is true, all recursive children of this Node will have their visibility set the same way.
SetVisible(visible, recursive bool)
// Get searches a node's hierarchy using a string to find a specified node. The path is in the format of names of nodes, separated by forward
// slashes ('/'), and is relative to the node you use to call Get. As an example of Get, if you had a cup parented to a desk, which was
// parented to a room, that was finally parented to the root of the scene, it would be found at "Room/Desk/Cup". Note also that you can use "../" to
// "go up one" in the hierarchy (so cup.Get("../") would return the Desk node).
// Since Get uses forward slashes as path separation, it would be good to avoid using forward slashes in your Node names. Also note that Get()
// trims the extra spaces from the beginning and end of Node Names, so avoid using spaces at the beginning or end of your Nodes' names.
Get(path string) INode
// Search searches a node's hierarchy using a string to find the specified Node.
Search() SearchOptions
// HierarchyAsString returns a string displaying the hierarchy of this Node, and all recursive children.
// This is a useful function to debug the layout of a node tree, for example.
HierarchyAsString() string
// Path returns a string indicating the hierarchical path to get this Node from the root. The path returned will be absolute, such that
// passing it to Get() called on the scene root node will return this node. The path returned will not contain the root node's name ("Root").
Path() string
// Properties returns this object's game Properties struct.
Properties() *Properties
// Returns if the Node contains a property that has a bit flipped that is named in the Node's Scene by the given name.
PropertiesContainsBitByName(bitfieldBitName string) bool
// IsBone returns if the Node is a "bone" (a node that was a part of an armature and so can play animations back to influence a skinned mesh).
IsBone() bool
// AnimationPlayer returns the object's animation player - every object has an AnimationPlayer by default.
AnimationPlayer() *AnimationPlayer
// Sector returns the Sector this Node is in.
Sector() *Sector
SetSectorType(sectorType SectorType)
SectorType() SectorType
// DistanceTo returns the distance between the given Nodes' centers.
// Quick syntactic sugar for Node.WorldPosition().Distance(otherNode.WorldPosition()).
DistanceTo(otherNode INode) float32
// DistanceSquared returns the squared distance between the given Nodes' centers.
// Quick syntactic sugar for Node.WorldPosition().DistanceSquared(otherNode.WorldPosition()).
DistanceSquaredTo(otherNode INode) float32
// VectorTo returns a vector from one Node to another.
// Quick syntactic sugar for other.WorldPosition().Sub(node.WorldPosition()).
VectorTo(otherNode INode) Vector3
// Callbacks returns a Node's callbacks object. This object represents the callbacks that a Node has access to when events happen.
Callbacks() *NodeCallbacks
// contains filtered or unexported methods
}
INode represents an object that exists in 3D space and can be positioned relative to an origin point. By default, this origin point is {0, 0, 0} (or world origin), but Nodes can be parented to other Nodes to change this origin (making their movements relative and their transforms successive). Models and Cameras are two examples of objects that fully implement the INode interface by means of embedding Node.
type IPath ¶ added in v0.10.0
type IPath interface {
// Length returns the length of the overall path.
Length() float32
// Points returns the points of the IPath in a slice.
Points() []Vector3
HopCount() int // HopCount returns the number of hops in the path.
// contains filtered or unexported methods
}
IPath represents an object that implements a path, returning points of a given length across a distance.
type IntRange ¶ added in v0.13.0
Represents a random value in a range of ints.
func (*IntRange) Set ¶ added in v0.13.0
Sets the minimum and maximum values of the range to the specified values.
func (*IntRange) SetCustomFunc ¶ added in v0.18.0
Sets a custom function to use for retrieving a random value within the range. Note that you can use the range object's Value() function to get its default randomized result.
type Intersection ¶ added in v0.8.1
type Intersection struct {
StartingPoint Vector3 // The starting point for the initiating object in the intersection in world space; either the center of the object for sphere / aabb, the center of the closest point for capsules, or the triangle position for triangles.
ContactPoint Vector3 // The contact point for the intersection on the second, collided object in world space (i.e. the point of collision on the triangle in a Sphere>Triangles test).
MTV Vector3 // MTV represents the minimum translation vector to remove the calling object from the intersecting object.
Triangle *Triangle // Triangle represents the triangle that was intersected in intersection tests that involve triangle meshes; if no triangle mesh was tested against, then this will be nil.
Normal Vector3 // The colliding normal of the intersection
}
func (*Intersection) Distance ¶ added in v0.18.0
func (intersection *Intersection) Distance() float32
func (*Intersection) DistanceSquared ¶ added in v0.18.0
func (intersection *Intersection) DistanceSquared() float32
type Library ¶
type Library struct {
Scenes []*Scene // A slice of Scenes
ExportedScene *Scene // The scene that was open when the library was exported from the modeler
Animations []*Animation // A Map of Animations to their names
Meshes []*Mesh // A selection of Meshes (because they can be cloned while having the same names)
Materials []*Material // A selection of Materials (because they can be cloned while having the same names)
Worlds []*World // A Map of Worlds to their names
}
Library represents a collection of Scenes, Meshes, Animations, etc., as loaded from an intermediary file format (.dae or .gltf / .glb).
func LoadGLTFData ¶
func LoadGLTFData(data io.Reader, gltfLoadOptions *GLTFLoadOptions) (*Library, error)
LoadGLTFData loads a .gltf or .glb file from the byte data given, using a provided GLTFLoadOptions struct to alter how the file is loaded. Passing nil for loadOptions will load the file using default load options. Unlike with DAE files, Animations (including armature-based animations) and Cameras (assuming they are exported in the GLTF file) will be parsed properly. LoadGLTFFile will not work by default with external byte information buffers (i.e. .gltf and .glb file pairs) as the buffer is referenced in .gltf as just a filename. To handle this properly, load the .gltf file using LoadGLTFFile(). The function will return a Library, and an error if the process fails.
func LoadGLTFFileSystem ¶ added in v0.15.0
func LoadGLTFFileSystem(fileSystem fs.FS, filename string, gltfLoadOptions *GLTFLoadOptions) (*Library, error)
LoadGLTFFileSystem loads a .gltf or .glb file from the file system given using the filename provided. The provided GLTFLoadOptions struct alters how the file is loaded. Passing nil for gltfLoadOptions will load the file using default load options. LoadGLTFFileSystem properly handles .gltf + .bin file pairs. LoadGLTFFileSystem will return a Library, and an error if the process fails.
func (*Library) AnimationByID ¶ added in v0.17.0
func (*Library) AnimationByName ¶ added in v0.17.0
func (*Library) MaterialByID ¶ added in v0.17.0
func (*Library) MaterialByName ¶ added in v0.17.0
func (*Library) MeshByName ¶ added in v0.17.0
func (*Library) NodeByName ¶ added in v0.16.0
NodeByName allows you to find a node by name by searching through each of a Library's scenes. If the Node with the given name isn't found, NodeByName will return nil.
func (*Library) SceneByName ¶ added in v0.16.0
SceneByName searches all scenes in a Library to find the one with the provided name. If a scene with the given name isn't found, SceneByName will return nil.
func (*Library) WorldByName ¶ added in v0.17.0
type LightBase ¶ added in v0.18.0
type LightBase struct {
*Node
// contains filtered or unexported fields
}
type LightGroup ¶ added in v0.10.0
type LightGroup struct {
Lights []ILight // The collection of lights present in the LightGroup.
Active bool // If the LightGroup is active or not; when a Model's LightGroup is inactive, Models will fallback to the lights present under the Scene's root.
}
LightGroup represents a grouping of lights. This is used on Models to control which lights are used to light them.
func NewLightGroup ¶ added in v0.10.0
func NewLightGroup(lights ...ILight) *LightGroup
NewLightGroup creates a new LightGroup.
func (*LightGroup) Add ¶ added in v0.10.0
func (lg *LightGroup) Add(lights ...ILight)
Add adds the passed ILights to the LightGroup.
func (*LightGroup) Clone ¶ added in v0.10.0
func (lg *LightGroup) Clone() *LightGroup
Clone clones the LightGroup.
type LightVolume ¶ added in v0.18.0
type LightVolume struct {
*LightBase
// contains filtered or unexported fields
}
LightVolume represents a grid of colors representing light to color models that enter the space with.
func NewLightVolume ¶ added in v0.18.0
func NewLightVolume(name string, volumeDim Dimensions, cellSizeX, cellSizeY, cellSizeZ float32) *LightVolume
Creates a new light volume node of the given name, transformed dimensions, and light grid cellular size.
func NewLightVolumeFromModel ¶ added in v0.18.0
func NewLightVolumeFromModel(model *Model, cellSizeX, cellSizeY, cellSizeZ float32) *LightVolume
Creates a new light volume node from the given Model's name and dimensions, with the given cellular size. Note that the model will still exist, so you'll need to dispose of it as you'd like.
func (*LightVolume) Clone ¶ added in v0.18.0
func (l *LightVolume) Clone() INode
Clones the LightVolume and returns another.
func (*LightVolume) Dimensions ¶ added in v0.18.0
func (l *LightVolume) Dimensions() Dimensions
func (*LightVolume) Light ¶ added in v0.18.0
func (l *LightVolume) Light(tri *Triangle, model *Model, targetColors *VertexColorChannel)
Lights the mesh part of the model being rendered, placing the results into the targeted VertexColorChannel, only doing so for the visible parts of the mesh if onlyVisible is set to true.
func (*LightVolume) LightVolumeBlur ¶ added in v0.18.0
func (l *LightVolume) LightVolumeBlur(cellRadius int, iterations int, blurStrength float32, blurDirections ...LightVolumeDirection)
Blurs all of the cells in the LightVolume. radius is the number of cells around each cell to blur each cell's value. iterations is the number of times to run the blur. blurStrength is the strength of the blur, ranging from 0 to 1. Each application of the blur happens at the end of the iterations, not all at once.
func (*LightVolume) LightVolumeCellAtIndices ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellAtIndices(x, y, z int) *LightVolumeCell
func (*LightVolume) LightVolumeCellAtWorldPosition ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellAtWorldPosition(position Vector3) *LightVolumeCell
func (*LightVolume) LightVolumeCellCount ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellCount(dimension int) int
Returns the number of volume cells on the axis determined by the dimension argument (0 = X, 1 = Y, otherwise = Z).
func (*LightVolume) LightVolumeCellCountX ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellCountX() int
Returns the number of light volume cells on the X axis.
func (*LightVolume) LightVolumeCellCountY ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellCountY() int
Returns the number of light volume cells on the Y axis.
func (*LightVolume) LightVolumeCellCountZ ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellCountZ() int
Returns the number of light volume cells on the Z axis.
func (*LightVolume) LightVolumeCellSize ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellSize(dimension int) float32
Returns the size of light volume cells on the axis determined by the dimension argument (0 = X, 1 = Y, otherwise = Z).
func (*LightVolume) LightVolumeCellSizeX ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellSizeX() float32
Returns the size of light volume cells on the X axis.
func (*LightVolume) LightVolumeCellSizeY ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellSizeY() float32
Returns the size of light volume cells on the Y axis.
func (*LightVolume) LightVolumeCellSizeZ ¶ added in v0.18.0
func (l *LightVolume) LightVolumeCellSizeZ() float32
Returns the size of light volume cells on the Z axis.
func (*LightVolume) LightVolumeDebugDraw ¶ added in v0.18.0
func (*LightVolume) LightVolumeForEachCell ¶ added in v0.18.0
func (l *LightVolume) LightVolumeForEachCell(forEach func(cell *LightVolumeCell) bool)
func (*LightVolume) LightVolumeLightBias ¶ added in v0.18.0
func (l *LightVolume) LightVolumeLightBias() Vector3
Returns the light bias direction.
func (*LightVolume) LightVolumeOffset ¶ added in v0.18.0
func (l *LightVolume) LightVolumeOffset() Vector3
Returns the light volume offset.
func (*LightVolume) LightVolumePropagate ¶ added in v0.18.0
func (l *LightVolume) LightVolumePropagate(iterations int, propagationFalloff float32, propagationDirection LightVolumeDirection)
Propagates light through all of the cells in the LightVolume. iterations is the number of times to run the blur. propagationStrength is how strong the light propagates (so how the light darkens over each successive cell) and ranges from 0 to 1.
func (*LightVolume) LightVolumePropagateAllDirections ¶ added in v0.18.0
func (l *LightVolume) LightVolumePropagateAllDirections(cellRadius int, iterations int, propagationStrength float32, additiveLighting bool)
Propagaters light in all directions for all of the cells in the LightVolume. cellRadius is the number of cells around each cell to sample each cell's value. iterations is the number of times to run the filter. Each application of the blur happens at the end of the iterations, not all at once.
func (*LightVolume) LightVolumeResize ¶ added in v0.18.0
func (l *LightVolume) LightVolumeResize(dimensions Dimensions, cellsizeX, cellsizeY, cellsizeZ float32)
Resizes the LightVolume to be of the given transformed dimensions and cellular size. Calling this after initial creation will move the Cell properties over to the newly resized LightVolume, meaning you can create a low resolution LightVolume, populate its cells, then resize it and blur or spread the light for a finer looking result with the original data. If the LightVolume already has the given dimensions and cellular size, then nothing is done.
func (*LightVolume) LightVolumeSetLightBias ¶ added in v0.18.0
func (l *LightVolume) LightVolumeSetLightBias(x, y, z float32)
Sets the light bias direction - essentially, this shifts the positions that vertices are lit by in the direction given.
func (*LightVolume) LightVolumeSetLightBiasVec ¶ added in v0.18.0
func (l *LightVolume) LightVolumeSetLightBiasVec(vec Vector3)
Sets the light bias direction - essentially, this shifts the positions that vertices are lit by in the direction given.
func (*LightVolume) LightVolumeSetOffset ¶ added in v0.18.0
func (l *LightVolume) LightVolumeSetOffset(x, y, z float32)
Sets the light volume offset. This controls where the light cells are in the volume.
func (*LightVolume) LightVolumeSetOffsetVec ¶ added in v0.18.0
func (l *LightVolume) LightVolumeSetOffsetVec(vec Vector3)
Sets the light volume offset. This controls where the light cells are in the volume.
func (*LightVolume) Type ¶ added in v0.18.0
func (l *LightVolume) Type() NodeType
Type returns the type of INode this is (NodeTypeLightVolume).
func (*LightVolume) VertexLight ¶ added in v0.18.0
func (l *LightVolume) VertexLight(vertIndex int, tri *Triangle, model *Model, targetColors *VertexColorChannel)
type LightVolumeCell ¶ added in v0.18.0
type LightVolumeCell struct {
// contains filtered or unexported fields
}
LightVolumeCell represents a cell in the LightVolume.
func (*LightVolumeCell) Blocked ¶ added in v0.18.0
func (c *LightVolumeCell) Blocked(dir LightVolumeDirection) bool
func (*LightVolumeCell) ClearUseLights ¶ added in v0.18.0
func (c *LightVolumeCell) ClearUseLights()
func (*LightVolumeCell) Color ¶ added in v0.18.0
func (c *LightVolumeCell) Color() Color4
func (*LightVolumeCell) Data ¶ added in v0.18.0
func (c *LightVolumeCell) Data() any
func (*LightVolumeCell) ForEachNeighborInDirection ¶ added in v0.18.0
func (c *LightVolumeCell) ForEachNeighborInDirection(neighborDirection LightVolumeDirection, forEach func(neighbor *LightVolumeCell) bool)
func (*LightVolumeCell) HasTag ¶ added in v0.18.0
func (c *LightVolumeCell) HasTag(tag uint8) bool
func (*LightVolumeCell) IndexX ¶ added in v0.18.0
func (c *LightVolumeCell) IndexX() int
func (*LightVolumeCell) IndexY ¶ added in v0.18.0
func (c *LightVolumeCell) IndexY() int
func (*LightVolumeCell) IndexZ ¶ added in v0.18.0
func (c *LightVolumeCell) IndexZ() int
func (*LightVolumeCell) IsAtBackSide ¶ added in v0.18.0
func (c *LightVolumeCell) IsAtBackSide() bool
func (*LightVolumeCell) IsAtBottomSide ¶ added in v0.18.0
func (c *LightVolumeCell) IsAtBottomSide() bool
func (*LightVolumeCell) IsAtFrontSide ¶ added in v0.18.0
func (c *LightVolumeCell) IsAtFrontSide() bool
func (*LightVolumeCell) IsAtLeftSide ¶ added in v0.18.0
func (c *LightVolumeCell) IsAtLeftSide() bool
func (*LightVolumeCell) IsAtRightSide ¶ added in v0.18.0
func (c *LightVolumeCell) IsAtRightSide() bool
func (*LightVolumeCell) IsAtTopSide ¶ added in v0.18.0
func (c *LightVolumeCell) IsAtTopSide() bool
func (*LightVolumeCell) IsDirectNeighborOf ¶ added in v0.18.0
func (c *LightVolumeCell) IsDirectNeighborOf(other LightVolumeCell, direction LightVolumeDirection) bool
func (*LightVolumeCell) Neighbor ¶ added in v0.18.0
func (c *LightVolumeCell) Neighbor(direction LightVolumeDirection) *LightVolumeCell
func (*LightVolumeCell) RemoveTag ¶ added in v0.18.0
func (c *LightVolumeCell) RemoveTag(tag uint8)
func (*LightVolumeCell) SetBlocked ¶ added in v0.18.0
func (c *LightVolumeCell) SetBlocked(direction LightVolumeDirection, blocked bool)
func (*LightVolumeCell) SetBlockedAll ¶ added in v0.18.0
func (c *LightVolumeCell) SetBlockedAll(blocked bool)
func (*LightVolumeCell) SetColor ¶ added in v0.18.0
func (c *LightVolumeCell) SetColor(color Color4)
func (*LightVolumeCell) SetColorMonochrome ¶ added in v0.18.0
func (c *LightVolumeCell) SetColorMonochrome(value float32)
func (*LightVolumeCell) SetColorRGB ¶ added in v0.18.0
func (c *LightVolumeCell) SetColorRGB(r, g, b float32)
func (*LightVolumeCell) SetData ¶ added in v0.18.0
func (c *LightVolumeCell) SetData(data any)
func (*LightVolumeCell) SetTag ¶ added in v0.18.0
func (c *LightVolumeCell) SetTag(tag uint8)
func (*LightVolumeCell) SetUseLights ¶ added in v0.18.0
func (c *LightVolumeCell) SetUseLights(lights ...ILight)
func (*LightVolumeCell) UseLights ¶ added in v0.18.0
func (c *LightVolumeCell) UseLights() []ILight
func (*LightVolumeCell) WorldPosition ¶ added in v0.18.0
func (c *LightVolumeCell) WorldPosition() Vector3
type LightVolumeDirection ¶ added in v0.18.0
type LightVolumeDirection int
const ( LightVolumeDirectionNone LightVolumeDirection = iota LightVolumeDirectionDown LightVolumeDirectionRight LightVolumeDirectionForward LightVolumeDirectionLeft LightVolumeDirectionUp LightVolumeDirectionBack )
func (LightVolumeDirection) Invert ¶ added in v0.18.0
func (l LightVolumeDirection) Invert() LightVolumeDirection
type Marker ¶ added in v0.8.1
type Marker struct {
Time float32 // Time of the marker in seconds in the Animation.
Name string // Name of the marker.
}
Marker represents a tag as placed in an Animation in a 3D modeler.
type Material ¶
type Material struct {
Color Color4 // The overall color of the Material.
Texture *ebiten.Image // The texture applied to the Material.
UseTexture bool // Whether to use the texture while rendering or not.
TexturePath string // The path to the texture, if it was not packed into the exporter.
TextureFilterMode TextureFilter // Texture filtering mode
TextureMapMode int // Texture mapping mode.
TextureMapScreenSizeMultiplierW float32 // The size multiplier of the texture when mapping to the screen in pixels. 1.0 means a 32px texture will appear 32px onscreen.
TextureMapScreenSizeMultiplierH float32 // The size multiplier of the texture when mapping to the screen in pixels. 1.0 means a 32px texture will appear 32px onscreen.
BackfaceCulling bool // If backface culling is enabled (which it is by default), faces turned away from the camera aren't rendered.
TriangleSortMode int // TriangleSortMode influences how triangles with this Material are sorted.
Shadeless bool // If the material should be shadeless (unlit) or not
Fogless bool // If the material should be fogless or not
Blend ebiten.Blend // Blend mode to use when rendering the material (i.e. additive, multiplicative, etc)
LightVolumeShadingMode int // Whether to shade materials per vertex or by object position when in LightVolumes
BillboardEnabled bool // Billboard mode
BillboardLockX bool
BillboardLockY bool
BillboardLockZ bool
BillboardUpDirection int
Visible bool // Whether the material is visible or not
ReportCollisions bool // Whether the material is collideable or not when performing collision checks against a BoundingTriangle with this Material
ReportRays bool // Whether the material is collideable or not when performing ray checks against a BoundingTriangle with this Material
// FragmentShaderOn is an easy boolean toggle to control whether the shader is activated or not (it defaults to on).
FragmentShaderOn bool
// FragmentShaderOptions allows you to customize the custom fragment shader with uniforms or images.
// By default, it's an empty DrawTrianglesShaderOptions struct.
// Note that the first image slot is reserved for the color texture associated with the Material.
// The second slot is reserved for a depth texture (primarily the intermediate texture used to "cut" a
// rendered model).
// If you want a custom fragment shader that already has fog and depth-testing, use Extend3DBaseShader() to
// extend your custom fragment shader from Tetra3D's base 3D shader.
FragmentShaderOptions *ebiten.DrawTrianglesShaderOptions
// If a material is tagged as transparent, it's rendered in a separate render pass.
// Objects with transparent materials don't render to the depth texture and are sorted and rendered back-to-front, AFTER
// all non-transparent materials.
TransparencyMode int
BillboardedDepthMode int // What depth mode to use for writing depth for this material
LightingMode int // How materials are lit
// CustomDepthFunction is a customizeable function that takes the depth value of each vertex of a rendered MeshPart and
// transforms it, returning a different value.
// model is a reference to the rendering model, camera the rendering camera, meshPart the rendering mesh part, vertIndex
// the depth for the vertex being rendered of the given index, and originalDepth being the vertex's original transformed
// depth. The function should return the ideal depth of the vertex from the camera in world units.
// The default value for CustomDepthFunction is nil (so the depth of each vertex is unaltered).
CustomDepthFunction CustomMaterialDepthFunction
RenderOrder int
// contains filtered or unexported fields
}
func NewMaterial ¶
NewMaterial creates a new Material with the name given.
func (*Material) Clone ¶
Clone creates a clone of the specified Material. Note that Clone() cannot clone the Material's fragment shader or shader options.
func (*Material) DisposeShader ¶ added in v0.8.1
func (m *Material) DisposeShader()
DisposeShader disposes the custom fragment Shader for the Material (assuming it has one). If it does not have a Shader, nothing happens.
func (*Material) Library ¶ added in v0.8.1
Library returns the Library from which this Material was loaded. If it was created through code, this function will return nil.
func (*Material) Properties ¶ added in v0.11.0
func (m *Material) Properties() *Properties
Properties returns this Material's game Properties struct.
func (*Material) SetName ¶ added in v0.17.0
SetName sets the name of the material to the specified value.
func (*Material) SetShader ¶ added in v0.8.1
SetShader sets an already-compiled custom Kage shader to the Material. By default, a custom shader will render on top of everything and with no fog. Lighting will also be missing, but that's included in the Model's vertex color. If you want to extend the base 3D shader, use tetra3d.ExtendBase3DShader(). Note that custom shaders require usage of pixel-unit Kage shaders.
func (*Material) SetShaderText ¶ added in v0.14.0
SetShaderText creates a new custom Kage fragment shader for the Material if provided the shader's source code as a []byte. This custom shader would be used to render the mesh utilizing the material after rendering to the depth texture, but before compositing the finished render to the screen after fog. If the shader is nil, the Material will render using the default Tetra3D render setup (e.g. texture, UV values, vertex colors, and vertex lighting). SetShader will return the Shader, and an error if the Shader failed to compile. Note that custom shaders require usage of pixel-unit Kage shaders.
type Matrix4 ¶
type Matrix4 [4][4]float32
Matrix4 represents a 4x4 matrix for translation, scale, and rotation. A Matrix4 in Tetra3D is row-major (i.e. the X axis is matrix[0]).
func NewEmptyMatrix4 ¶
func NewEmptyMatrix4() Matrix4
func NewMatrix4 ¶
func NewMatrix4() Matrix4
NewMatrix4 returns a new identity Matrix4. A Matrix4 in Tetra3D is row-major (i.e. the X axis for a rotation Matrix4 is matrix[0][0], matrix[0][1], matrix[0][2]).
func NewMatrix4LookAt ¶ added in v0.17.1
NewMatrix4LookAt generates a new Matrix4 to rotate an object to point towards another object. to is the target's world position, from is the world position of the object looking towards the target, and up is the upward vector ( usually +Y, or [0, 1, 0] ).
func NewMatrix4Rotate ¶
NewMatrix4Rotate returns a new Matrix4 designed to rotate by the angle given (in radians) along the axis given [x, y, z]. This rotation works as though you pierced the object utilizing the matrix through by the axis, and then rotated it counter-clockwise by the angle in radians.
func NewMatrix4RotateFromEuler ¶ added in v0.11.2
NewMatrix4RotateFromEuler creates a rotation Matrix4 from the euler values contained within the Vector.
func NewMatrix4Scale ¶
NewMatrix4Scale returns a new identity Matrix4, but with the scale components set as provided. 1, 1, 1 is the default.
func NewMatrix4Translate ¶
NewMatrix4Scale returns a new identity Matrix4, but with the x, y, and z translation components set as provided.
func NewProjectionMatrix4Orthographic ¶ added in v0.18.0
NewProjectionMatrix4Orthographic generates an orthographic frustum Matrix4. near and far are the near and far clipping plane. right, left, top, and bottom are the right, left, top, and bottom planes (usually 1 and -1 for right and left, and the aspect ratio of the window and negative for top and bottom). Generally, you won't need to use this directly.
func NewProjectionMatrix4Perspective ¶ added in v0.18.0
NewProjectionMatrix4Perspective generates a perspective frustum Matrix4. fovy is the vertical field of view in degrees, near and far are the near and far clipping plane, while viewWidth and viewHeight is the width and height of the backing texture / camera. Generally, you won't need to use this directly.
func (Matrix4) BlenderToTetra ¶
BlenderToTetra returns a Matrix with the rows altered such that Blender's +Z is now Tetra's +Y and Blender's +Y is now Tetra's -Z.
func (Matrix4) Columns ¶
Columns returns the Matrix4 as a slice of []float32, in column-major order (so it's transposed from the row-major default).
func (Matrix4) Decompose ¶
Decompose decomposes the Matrix4 and returns three components - the position (a 3D Vector), scale (another 3D Vector), and rotation (a Matrix4) indicated by the Matrix4. Note that this is mainly used when loading a mesh from a 3D modeler - this being the case, it may not be the most precise, and negative scales are not supported.
func (Matrix4) DecomposePosition ¶ added in v0.18.0
func (Matrix4) DecomposeRotation ¶ added in v0.18.0
func (Matrix4) DecomposeScale ¶ added in v0.18.0
func (Matrix4) Equals ¶
Equals returns true if the matrix equals the same values in the provided Other Matrix4.
func (Matrix4) Forward ¶
Forward returns the forward rotational component of the Matrix4. For an identity matrix, this would be [0, 0, 1], or +Z (towards camera).
func (Matrix4) HasValidRotation ¶ added in v0.9.1
HasValidRotation returns if the first three vectors in the Matrix are non-zero
func (Matrix4) IsIdentity ¶
IsIdentity returns true if the matrix is an unmodified identity matrix.
func (Matrix4) Lerp ¶ added in v0.12.0
Linearly interpolates a matrix to another, destination Matrix by the percent given. It does this by converting both Matrices to Quaternions, lerping them, then converting the result back to a Matrix4.
func (Matrix4) Mult ¶
Mult multiplies a Matrix4 by another provided Matrix4 - this effectively combines them.
func (Matrix4) MultVec ¶
MultVec multiplies the vector provided by the Matrix4, giving a vector that has been rotated, scaled, or translated as desired.
func (Matrix4) MultVecW ¶
MultVecW multiplies the vector provided by the Matrix4, including the fourth (W) component, giving a vector that has been rotated, scaled, or translated as desired.
func (Matrix4) Right ¶
Right returns the right-facing rotational component of the Matrix4. For an identity matrix, this would be [1, 0, 0], or +X.
func (Matrix4) Rotated ¶
Rotated returns a clone of the Matrix4 rotated along the local axis by the angle given (in radians). This rotation works as though you pierced the object through by the axis, and then rotated it counter-clockwise by the angle in radians. The axis is relative to any existing rotation contained in the matrix.
func (Matrix4) RowAsVector3 ¶ added in v0.17.0
Row returns the indiced row from the Matrix4 as a Vector3.
func (*Matrix4) Set ¶ added in v0.10.0
Set allows you to set the Matrix4 to the same values as another Matrix4.
func (*Matrix4) SetByIndex ¶ added in v0.17.0
func (*Matrix4) SetColumn ¶
SetColumn sets the Matrix4 with the column in columnIndex set to the 4D vector passed.
func (*Matrix4) SetRow ¶
SetRow sets the Matrix4 with the row in rowIndex set to the 4D vector passed.
func (Matrix4) Slerp ¶ added in v0.18.0
Spherically lerps a matrix to another, destination Matrix by the percent given. It does this by converting both Matrices to Quaternions, lerping them, then converting the result back to a Matrix4.
func (Matrix4) ToFloatSlice ¶ added in v0.17.0
func (Matrix4) ToQuaternion ¶ added in v0.10.0
func (matrix Matrix4) ToQuaternion() Quaternion
ToQuaternion returns a Quaternion representative of the Matrix4's rotation (assuming it is just a purely rotational Matrix4).
func (Matrix4) Transposed ¶
Transposed transposes a Matrix4, switching the Matrix from being Row Major to being Column Major. For orthonormalized Matrices (matrices that have rows that are normalized (having a length of 1), like rotation matrices), this is equivalent to inverting it.
type Mesh ¶
type Mesh struct {
ID uint32
Name string // The name of the Mesh resource
MeshParts []*MeshPart // The various mesh parts (collections of triangles, rendered with a single material).
Triangles []*Triangle // The various triangles composing the Mesh.
// Vertices are stored as a struct-of-arrays for simplified and faster rendering.
// Each vertex property (position, normal, UV, colors, weights, bones, etc) is stored
// here and indexed in order of vertex index.
// vertexTransforms []Vector4
VertexPositions []Vector3
VertexPositionsOriginal []Vector3
VertexNormals []Vector3
// vertexTransformedNormals []Vector3
VertexUVs []Vector2 // The UV values for each vertex
VertexUVsOriginal []Vector2 // The original UV values for each vertex
VertexColors []*VertexColorChannel // A slice of channels for the mesh
VertexGroupNames []string // The names of the vertex groups applies to the Mesh; this is only populated if the Mesh is affected by an armature
VertexWeights [][]float32 // TODO: Replace this with [][8]float32 (or however many the maximum is for GLTF)
VertexBones [][]uint16 // TODO: Replace this with [][8]uint16 (or however many the maximum number of bones affecting a single vertex is for GLTF)
VertexActiveColorChannel int // VertexActiveColorChannel is the active vertex color used for coloring the mesh
Dimensions Dimensions
AutoSubdivide bool
// If Unique is set to a value other than MeshUniqueNone, whenever a Mesh is used for a Model and the Model is cloned,
// the Mesh or Mesh and Materials are cloned with it. Useful for things like sprites.
Unique MeshUniqueType
// contains filtered or unexported fields
}
Mesh represents a mesh that can be represented visually in different locations via Models. By default, a new Mesh has no MeshParts (so you would need to add one manually if you want to construct a Mesh via code).
func NewCubeMesh ¶ added in v0.11.0
NewCubeMesh creates a new Cube Mesh with the given dimensions and gives it a new material (suitably named "Cube").
func NewCylinderMesh ¶ added in v0.12.0
NewCylinderMesh creates a new cylinder Mesh and gives it a new material (suitably named "Cylinder"). sideCount is how many sides the cylinder should have, while radius is the radius of the cylinder in world units. if createCaps is true, then the cylinder will have triangle caps.
func NewIcosphereMesh ¶ added in v0.11.0
NewIcosphereMesh creates a new icosphere Mesh of the specified detail level. Note that the UVs are left at {0,0} because I'm lazy.
func NewPlaneMesh ¶ added in v0.11.0
NewPlaneMesh creates a new 2x2 plane Mesh with a new material (suitably named "Plane"). vertexCountX and vertexCountY indicate how many vertices should be on the plane in the X and Z direction, respectively. The minimum number of vertices for either argument is 2. Code for this is taken from https://answers.unity.com/questions/1850185/mesh-triangles-not-filling-whole-space-2.html.
func NewPrismMesh ¶ added in v0.11.2
func NewPrismMesh() *Mesh
NewPrismMesh creates a new prism Mesh and gives it a new material (suitably named "Prism").
func (*Mesh) AddMeshPart ¶ added in v0.8.1
AddMeshPart allows you to add a new MeshPart to the Mesh with the given Material (with a nil Material reference also being valid).
func (*Mesh) AddVertices ¶ added in v0.11.0
func (mesh *Mesh) AddVertices(verts ...VertexInfo)
func (*Mesh) AutoNormal ¶ added in v0.10.0
func (mesh *Mesh) AutoNormal()
AutoNormal automatically recalculates the normals for the triangles contained within the Mesh and sets the vertex normals for all triangles to the triangles' surface normal.
func (*Mesh) CombineVertexColors ¶ added in v0.10.0
func (mesh *Mesh) CombineVertexColors(targetChannel int, multiplicative bool, sourceChannels ...int)
CombineVertexColors allows you to combine vertex color channels together. The targetChannel is the channel that will hold the result, and multiplicative controls whether the combination is multiplicative (true) or additive (false). The sourceChannels ...int is the vertex color channel indices to combine together. If the channel indices provided in the sourceChannels ...int are too high for the number of channels on each vertex in the mesh, then those indices will be skipped.
func (*Mesh) ForEachMaterial ¶ added in v0.18.0
Loops through each material in the Mesh, per mesh part. If a material is used multiple times in the Mesh's mesh parts, it will be present multiple times.
func (*Mesh) GetVertexInfo ¶ added in v0.9.0
func (mesh *Mesh) GetVertexInfo(vertexIndex int) VertexInfo
GetVertexInfo returns a VertexInfo struct containing the vertex information for the vertex with the provided index.
func (*Mesh) Library ¶ added in v0.8.1
Library returns the Library from which this Mesh was loaded. If it was created through code, this function will return nil.
func (*Mesh) Materials ¶ added in v0.10.0
Materials returns a slice of the materials present in the Mesh's MeshParts. If a material is used multiple times in the Mesh's mesh parts, it will be present multiple times.
func (*Mesh) MeshPartByMaterialName ¶ added in v0.17.0
MeshPartByMaterialName allows you to retrieve a MeshPart by its material's name. If no material with the provided name is given, the function returns nil.
func (*Mesh) Properties ¶ added in v0.11.0
func (mesh *Mesh) Properties() *Properties
Properties returns this Mesh object's game Properties struct.
func (*Mesh) SetShapeKeys ¶ added in v0.18.0
func (mesh *Mesh) SetShapeKeys(shapeKeys []*MeshShapeKey)
Sets the mesh's shape keys.
func (*Mesh) SetVertexColor ¶
func (mesh *Mesh) SetVertexColor(channel *VertexColorChannel, color Color4)
SetVertexColor sets the specified vertex color for all vertices in the mesh for the target color channel.
func (*Mesh) ShapeKeyByIndex ¶ added in v0.18.0
func (mesh *Mesh) ShapeKeyByIndex(index int) *MeshShapeKey
Returns the mesh's shape key by index.
func (*Mesh) ShapeKeyByName ¶ added in v0.18.0
func (mesh *Mesh) ShapeKeyByName(name string) *MeshShapeKey
Returns the mesh's shape key by its name.
func (*Mesh) ShapeKeys ¶ added in v0.18.0
func (mesh *Mesh) ShapeKeys() []*MeshShapeKey
Returns the Mesh's shape keys.
func (*Mesh) TriangleByID ¶ added in v0.17.0
TriangleByID returns a triangle by the given ID, if it exists.
func (*Mesh) TriangleByIndex ¶ added in v0.17.0
TriangleByIndex returns a triangle by its index in the mesh's triangles slice.
func (*Mesh) UpdateBounds ¶
func (mesh *Mesh) UpdateBounds()
UpdateBounds updates the mesh's dimensions; call this after manually changing vertex positions.
func (*Mesh) VertexColorChannelByName ¶ added in v0.18.0
func (mesh *Mesh) VertexColorChannelByName(name string) *VertexColorChannel
Returns the given vertex color channel by name if it exists in the Mesh.
func (*Mesh) VertexNormalWithShapeKeys ¶ added in v0.18.0
Returns the normal of the vertex of the given index if shape keys are applied; otherwise returns the base normal.
func (*Mesh) VertexPositionWithShapeKeys ¶ added in v0.18.0
Returns the position of the vertex of the given index if shape keys are applied; otherwise returns the base normal.
type MeshPart ¶ added in v0.8.1
type MeshPart struct {
Mesh *Mesh
Material *Material
VertexIndexStart int
VertexIndexEnd int
TriangleStart int
TriangleEnd int
}
MeshPart represents a collection of vertices and triangles, which are all rendered at once, as a single part, with a single material. Depth testing is done between mesh parts or objects, so splitting an object up into different materials can be effective to help with depth sorting.
func NewMeshPart ¶ added in v0.8.1
NewMeshPart creates a new MeshPart that renders using the specified Material.
func (*MeshPart) AddTriangles ¶ added in v0.8.1
AddTriangles adds triangles to the MeshPart using the provided indices.
func (*MeshPart) ApplyMatrix ¶ added in v0.8.1
ApplyMatrix applies a transformation matrix to the vertices referenced by the MeshPart.
func (*MeshPart) AssignToMesh ¶ added in v0.11.0
func (*MeshPart) ForEachTri ¶ added in v0.11.0
func (*MeshPart) ForEachVertexIndex ¶ added in v0.11.0
ForEachVertexIndex calls the provided function for each vertex index that the MeshPart uses. If onlyVisible is true, then only the visible vertices (vertices that are rendered; that aren't backface culled or offscreen) will be used with the provided function.
func (*MeshPart) TriangleCount ¶ added in v0.9.0
TriangleCount returns the total number of triangles in the MeshPart, specifically.
func (*MeshPart) VertexIndexCount ¶ added in v0.11.0
type MeshShapeKey ¶ added in v0.18.0
type MeshShapeKey struct {
// contains filtered or unexported fields
}
MeshShapeKey represents a shape key (shape target / morph target) for morphing a mesh between positions.
func (*MeshShapeKey) Name ¶ added in v0.18.0
func (s *MeshShapeKey) Name() string
Returns the name of the MeshShapeKey.
func (*MeshShapeKey) SetName ¶ added in v0.18.0
func (s *MeshShapeKey) SetName(name string)
Sets the name of the MeshShapeKey.
func (*MeshShapeKey) SetWeight ¶ added in v0.18.0
func (s *MeshShapeKey) SetWeight(weight float32)
Sets the weight of the MeshShapeKey to the desired value. Can go beyond a 0 - 1 range.
func (*MeshShapeKey) Weight ¶ added in v0.18.0
func (s *MeshShapeKey) Weight() float32
Returns the weight of the MeshShapeKey. Can go beyond a 0 - 1 range.
type MeshUniqueType ¶ added in v0.16.0
type MeshUniqueType int
const ( MeshUniqueFalse MeshUniqueType = iota MeshUniqueMesh MeshUniqueMeshAndMaterials )
type ModVector2 ¶ added in v0.18.0
type ModVector2 struct {
*Vector2
}
ModVector2 represents a reference to a 2D Vector, made to facilitate easy method-chaining and modifications on that Vector3 (as you don't need to re-assign the results of a chain of operations to the original variable to "save" the results). Note that a ModVector2 is not meant to be used to chain methods on a vector to pass directly into a function; you can just use the normal vector functions for that purpose. ModVectors are pointers, which are allocated to the heap. This being the case, they should be slower relative to normal Vectors, so use them only in non-performance-critical parts of your application.
func NewModVector2 ¶ added in v0.18.0
func NewModVector2(x, y float32) *ModVector2
NewModVector2 creates a new ModVector2 instance.
func (*ModVector2) Add ¶ added in v0.18.0
func (ip *ModVector2) Add(other *ModVector2) *ModVector2
Add adds the other ModVector2 provided to the ModVector. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) AddMagnitude ¶ added in v0.18.0
func (ip *ModVector2) AddMagnitude(mag float32) *ModVector2
AddMagnitude adds the given magnitude to the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector2) AddX ¶ added in v0.18.0
func (ip *ModVector2) AddX(x float32) *ModVector2
AddX adds the value provided to the ModVector. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) AddY ¶ added in v0.18.0
func (ip *ModVector2) AddY(x float32) *ModVector2
AddY adds the value provided to the ModVector. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Angle ¶ added in v0.18.0
func (ip *ModVector2) Angle(baselineVec *ModVector2) float32
Angle returns the angle in radians between the calling ModVector2 and the provided other ModVector2.
func (*ModVector2) Ceil ¶ added in v0.18.0
func (ip *ModVector2) Ceil() *ModVector2
Ceil ceils the ModVector's components off, returning a new Vector. For example, Vector{0.1, 1.27, 3.33}.Modify().Ceil() will return Vector{1, 2, 4}. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Clamp ¶ added in v0.18.0
func (ip *ModVector2) Clamp(x, y float32) *ModVector2
Clamp clamps the Vector2 to the maximum values provided. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) ClampAngle ¶ added in v0.18.0
func (ip *ModVector2) ClampAngle(baselineVec *ModVector2, maxAngle float32) *ModVector2
ClampAngle clamps the Vector2 such that it doesn't exceed the angle specified (in radians). This function returns a normalized (unit) ModVector2 for method chaining.
func (*ModVector2) ClampMagnitude ¶ added in v0.18.0
func (ip *ModVector2) ClampMagnitude(maxMag float32) *ModVector2
ClampMagnitude clamps the overall magnitude of the Vector2 to the maximum magnitude specified. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) ClampVec ¶ added in v0.18.0
func (ip *ModVector2) ClampVec(extents *ModVector2) *ModVector2
ClampVec clamps the Vector2 to the maximum values in the Vector2 provided. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Clone ¶ added in v0.18.0
func (ip *ModVector2) Clone() *ModVector2
Clone returns a ModVector2 of a clone of its backing Vector. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Divide ¶ added in v0.18.0
func (ip *ModVector2) Divide(scalar float32) *ModVector2
Divide divides a Vector2 by the given scalar. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Expand ¶ added in v0.18.0
func (ip *ModVector2) Expand(margin, min float32) *ModVector2
Expand expands the ModVector2 by the margin specified, in absolute units, if each component is over the minimum argument. To illustrate: Given a ModVector2 of {1, 0.1, -0.3}, ModVector.Expand(0.5, 0.2) would give you a ModVector2 of {1.5, 0.1, -0.8}. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Floor ¶ added in v0.18.0
func (ip *ModVector2) Floor() *ModVector2
Floor floors the ModVector's components off, returning a new Vector. For example, Vector{0.1, 1.27, 3.33}.Modify().Floor() will return Vector{0, 1, 3}. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Invert ¶ added in v0.18.0
func (ip *ModVector2) Invert() *ModVector2
Invert inverts all components of the calling ModVector. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Lerp ¶ added in v0.18.0
func (ip *ModVector2) Lerp(other *ModVector2, percentage float32) *ModVector2
Lerp performs a linear interpolation between the starting ModVector2 and the provided other Vector, to the given percentage. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) MoveTowards ¶ added in v0.18.0
func (ip *ModVector2) MoveTowards(target *ModVector2, magnitude float32) *ModVector2
MoveTowards moves a Vector2 towards another Vector2 given a specific magnitude. If the distance is less than that magnitude, it returns the target vector.
func (*ModVector2) Mult ¶ added in v0.18.0
func (ip *ModVector2) Mult(other *ModVector2) *ModVector2
Mult performs Hadamard (component-wise) multiplication with the Vector2 on the other Vector2 provided. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Reflect ¶ added in v0.18.0
func (ip *ModVector2) Reflect(normal *ModVector2) *ModVector2
Reflect reflects the vector against the given surface normal.
func (*ModVector2) Rotate ¶ added in v0.18.0
func (ip *ModVector2) Rotate(angle float32) *ModVector2
RotateVec rotates the calling ModVector2 by an axis Vector2 composed of the x, y, and z components provided, by the angle provided (in radians). This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Round ¶ added in v0.18.0
func (ip *ModVector2) Round(roundToUnits float32) *ModVector2
Round rounds off the ModVector's components to the given space in world units. For example, Vector{0.1, 1.27, 3.33}.Modify().Round(0.25) will return Vector{0, 1.25, 3.25}. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Scale ¶ added in v0.18.0
func (ip *ModVector2) Scale(scalar float32) *ModVector2
Scale scales the Vector2 by the scalar provided. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Set ¶ added in v0.18.0
func (vec *ModVector2) Set(other *ModVector2)
Set sets the values in the ModVector2 to the values in the other ModVector2.
func (*ModVector2) SetXY ¶ added in v0.18.0
func (ip *ModVector2) SetXY(x, y float32) *ModVector2
SetXY sets the values in the Vector to the x, y, and z values provided.
func (*ModVector2) SetZero ¶ added in v0.18.0
func (ip *ModVector2) SetZero() *ModVector2
SetZero sets the Vector2 to zero.
func (*ModVector2) Slerp ¶ added in v0.18.0
func (ip *ModVector2) Slerp(other *ModVector2, percentage float32) *ModVector2
Slerp performs a spherical linear interpolation between the starting ModVector2 and the provided other Vector, to the given percentage. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) String ¶ added in v0.18.0
func (ip *ModVector2) String() string
String converts the ModVector2 to a string. Because it's a ModVector, it's represented with a *.
func (*ModVector2) Sub ¶ added in v0.18.0
func (ip *ModVector2) Sub(other Vector2) *ModVector2
Sub subtracts the other Vector2 from the calling ModVector. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) SubMagnitude ¶ added in v0.18.0
func (ip *ModVector2) SubMagnitude(mag float32) *ModVector2
SubMagnitude subtacts the given magnitude from the Vector's. If the vector's magnitude is less than the given magnitude to subtract, a zero-length Vector2 will be returned. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) SubX ¶ added in v0.18.0
func (ip *ModVector2) SubX(x float32) *ModVector2
SubX subs the value provided to the ModVector. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) SubY ¶ added in v0.18.0
func (ip *ModVector2) SubY(x float32) *ModVector2
SubY subs the value provided to the ModVector. This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Swizzle2 ¶ added in v0.18.0
func (ip *ModVector2) Swizzle2(swizzleString string) *ModVector2
Swizzle3 swizzles the ModVector2 using the string provided. The string can be of length 3 ("xyz") or 4 ("xyzw"). The string should be composed of the axes of a vector, i.e. 'x', 'y', 'z', or 'w'. Example: `vec := Vector{1, 2, 3}.Swizzle3("zxy") // Returns a Vector2 of {3, 1, 2}.` This function returns the calling ModVector2 for method chaining.
func (*ModVector2) Swizzle3 ¶ added in v0.18.0
func (ip *ModVector2) Swizzle3(swizzleString string) *ModVector3
Swizzle3 swizzles the ModVector2 using the string provided and returns a new *ModVector3. The string can be of length 3 ("xyx"). The string should be composed of the axes of a vector, i.e. 'x', 'y', 'z', or 'w'. Example: `vec := Vector{1, 2, 3}.Swizzle3("zxy") // Returns a Vector2 of {3, 1, 2}.`
func (*ModVector2) ToVector ¶ added in v0.18.0
func (ip *ModVector2) ToVector() Vector2
ToVector2 returns a copy of the Vector2 that the ModVector2 is modifying.
func (*ModVector2) Unit ¶ added in v0.18.0
func (ip *ModVector2) Unit() *ModVector2
Unit normalizes the ModVector2 (sets it to be of unit length). This function returns the calling ModVector2 for method chaining.
type ModVector3 ¶ added in v0.16.0
type ModVector3 struct {
*Vector3
}
ModVector3 represents a reference to a Vector, made to facilitate easy method-chaining and modifications on that Vector3 (as you don't need to re-assign the results of a chain of operations to the original variable to "save" the results). Note that a ModVector3 is not meant to be used to chain methods on a vector to pass directly into a function; you can just use the normal vector functions for that purpose. ModVectors are pointers, which are allocated to the heap. This being the case, they should be slower relative to normal Vectors, so use them only in non-performance-critical parts of your application.
func NewModVector3 ¶ added in v0.16.1
func NewModVector3(x, y, z float32) *ModVector3
NewModVector3 creates a new ModVector3 instance.
func (*ModVector3) Add ¶ added in v0.16.0
func (ip *ModVector3) Add(other *ModVector3) *ModVector3
Add adds the other ModVector3 provided to the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) AddMagnitude ¶ added in v0.18.0
func (ip *ModVector3) AddMagnitude(mag float32) *ModVector3
AddMagnitude adds the given magnitude to the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) AddX ¶ added in v0.16.1
func (ip *ModVector3) AddX(x float32) *ModVector3
AddX adds the value provided to the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) AddY ¶ added in v0.16.1
func (ip *ModVector3) AddY(x float32) *ModVector3
AddY adds the value provided to the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) AddZ ¶ added in v0.16.1
func (ip *ModVector3) AddZ(x float32) *ModVector3
AddZ adds the value provided to the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Angle ¶ added in v0.18.0
func (ip *ModVector3) Angle(baselineVec *ModVector3) float32
Angle returns the angle in radians between the calling ModVector3 and the provided other ModVector3.
func (*ModVector3) AngleSigned ¶ added in v0.18.0
func (ip *ModVector3) AngleSigned(baselineVec, planeNormal *ModVector3) float32
Angle returns the angle in radians between the calling ModVector3 and the provided other ModVector3.
func (*ModVector3) Ceil ¶ added in v0.16.0
func (ip *ModVector3) Ceil() *ModVector3
Ceil ceils the ModVector's components off, returning a new Vector. For example, Vector{0.1, 1.27, 3.33}.Modify().Ceil() will return Vector{1, 2, 4}. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Clamp ¶ added in v0.16.0
func (ip *ModVector3) Clamp(x, y, z float32) *ModVector3
Clamp clamps the Vector3 to the maximum values provided. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) ClampAngle ¶ added in v0.16.0
func (ip *ModVector3) ClampAngle(baselineVec *ModVector3, maxAngle float32) *ModVector3
ClampAngle clamps the Vector3 such that it doesn't exceed the angle specified (in radians). This function returns a normalized (unit) ModVector3 for method chaining.
func (*ModVector3) ClampMagnitude ¶ added in v0.16.0
func (ip *ModVector3) ClampMagnitude(maxMag float32) *ModVector3
ClampMagnitude clamps the overall magnitude of the Vector3 to the maximum magnitude specified. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) ClampVec ¶ added in v0.16.0
func (ip *ModVector3) ClampVec(extents *ModVector3) *ModVector3
ClampVec clamps the Vector3 to the maximum values in the Vector3 provided. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Clone ¶ added in v0.16.0
func (ip *ModVector3) Clone() *ModVector3
Clone returns a ModVector3 of a clone of its backing Vector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Cross ¶ added in v0.16.0
func (ip *ModVector3) Cross(other *ModVector3) *ModVector3
Cross performs a cross-product multiplication on the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Divide ¶ added in v0.16.0
func (ip *ModVector3) Divide(scalar float32) *ModVector3
Divide divides a Vector3 by the given scalar. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Expand ¶ added in v0.16.0
func (ip *ModVector3) Expand(margin, min float32) *ModVector3
Expand expands the ModVector3 by the margin specified, in absolute units, if each component is over the minimum argument. To illustrate: Given a ModVector3 of {1, 0.1, -0.3}, ModVector.Expand(0.5, 0.2) would give you a ModVector3 of {1.5, 0.1, -0.8}. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Floor ¶ added in v0.16.0
func (ip *ModVector3) Floor() *ModVector3
Floor floors the ModVector's components off, returning a new Vector. For example, Vector{0.1, 1.27, 3.33}.Modify().Floor() will return Vector{0, 1, 3}. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Invert ¶ added in v0.16.0
func (ip *ModVector3) Invert() *ModVector3
Invert inverts all components of the calling ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Lerp ¶ added in v0.16.0
func (ip *ModVector3) Lerp(other *ModVector3, percentage float32) *ModVector3
Lerp performs a linear interpolation between the starting ModVector3 and the provided other Vector, to the given percentage. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) MoveTowards ¶ added in v0.16.0
func (ip *ModVector3) MoveTowards(target *ModVector3, magnitude float32) *ModVector3
MoveTowards moves a Vector3 towards another Vector3 given a specific magnitude. If the distance is less than that magnitude, it returns the target vector.
func (*ModVector3) Mult ¶ added in v0.16.0
func (ip *ModVector3) Mult(other *ModVector3) *ModVector3
Mult performs Hadamard (component-wise) multiplication with the Vector3 on the other Vector3 provided. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Reflect ¶ added in v0.18.0
func (ip *ModVector3) Reflect(normal *ModVector3) *ModVector3
Reflect reflects the vector against the given surface normal.
func (*ModVector3) Rotate ¶ added in v0.16.0
func (ip *ModVector3) Rotate(x, y, z, angle float32) *ModVector3
RotateVec rotates the calling ModVector3 by an axis Vector3 composed of the x, y, and z components provided, by the angle provided (in radians). This function returns the calling ModVector3 for method chaining.
func (*ModVector3) RotateVec ¶ added in v0.16.0
func (ip *ModVector3) RotateVec(axis *ModVector3, angle float32) *ModVector3
RotateVec rotates the calling ModVector3 by the axis Vector3 and angle provided (in radians). This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Round ¶ added in v0.16.0
func (ip *ModVector3) Round(roundToUnits float32) *ModVector3
Round rounds off the ModVector's components to the given space in world units. For example, Vector{0.1, 1.27, 3.33}.Modify().Round(0.25) will return Vector{0, 1.25, 3.25}. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Scale ¶ added in v0.16.0
func (ip *ModVector3) Scale(scalar float32) *ModVector3
Scale scales the Vector3 by the scalar provided. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Set ¶ added in v0.16.1
func (vec *ModVector3) Set(other *ModVector3)
Set sets the values in the ModVector3 to the values in the other ModVector3.
func (*ModVector3) SetXYZ ¶ added in v0.17.0
func (ip *ModVector3) SetXYZ(x, y, z float32) *ModVector3
SetXYZ sets the values in the Vector to the x, y, and z values provided.
func (*ModVector3) SetZero ¶ added in v0.16.0
func (ip *ModVector3) SetZero() *ModVector3
SetZero sets the Vector3 to zero.
func (*ModVector3) Slerp ¶ added in v0.16.0
func (ip *ModVector3) Slerp(other *ModVector3, percentage float32) *ModVector3
Slerp performs a spherical linear interpolation between the starting ModVector3 and the provided other Vector, to the given percentage. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) SlideAgainst ¶ added in v0.18.0
func (ip *ModVector3) SlideAgainst(reflectingNormal Vector3) *ModVector3
Returns the Vector "slid against" the reflecting normal.
func (*ModVector3) Slope ¶ added in v0.18.0
func (ip *ModVector3) Slope() float32
Slope returns the vertical slope of the vector in radians. This ranges from 0 (straight up, [0, 1, 0]) to 1 (straight down, [0, -1, 0]).
func (*ModVector3) String ¶ added in v0.16.0
func (ip *ModVector3) String() string
String converts the ModVector3 to a string. Because it's a ModVector, it's represented with a *.
func (*ModVector3) Sub ¶ added in v0.16.0
func (ip *ModVector3) Sub(other *ModVector3) *ModVector3
Sub subtracts the other Vector3 from the calling ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) SubMagnitude ¶ added in v0.16.0
func (ip *ModVector3) SubMagnitude(mag float32) *ModVector3
SubMagnitude subtacts the given magnitude from the Vector's. If the vector's magnitude is less than the given magnitude to subtract, a zero-length Vector3 will be returned. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) SubX ¶ added in v0.16.1
func (ip *ModVector3) SubX(x float32) *ModVector3
SubX subs the value provided to the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) SubY ¶ added in v0.16.1
func (ip *ModVector3) SubY(x float32) *ModVector3
SubY subs the value provided to the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) SubZ ¶ added in v0.16.1
func (ip *ModVector3) SubZ(x float32) *ModVector3
SubZ subs the value provided to the ModVector. This function returns the calling ModVector3 for method chaining.
func (*ModVector3) Swizzle2 ¶ added in v0.18.0
func (ip *ModVector3) Swizzle2(swizzleString string) *ModVector2
Swizzle2 swizzles the ModVector3 using the string provided and returns a new *ModVector2. The string can be of length 2 ("xy"); spaces or unknown characters are treated as nothing. The string should be composed of the axes of a vector, i.e. 'x', 'y', 'z', or 'w'.
Example: `vec := Vector{1, 2, 3}.Swizzle2("z-x") // Returns a Vector3 of {3, -1}.`
func (*ModVector3) Swizzle3 ¶ added in v0.17.0
func (ip *ModVector3) Swizzle3(swizzleString string) *ModVector3
Swizzle3 swizzles the ModVector3 using the string provided. The string can be of length 3 ("xyz"). The string should be composed of the axes of a vector, i.e. 'x', 'y', 'z', or 'w'. Example: `vec := Vector{1, 2, 3}.Swizzle3("zxy") // Returns a Vector3 of {3, 1, 2}.` This function returns the calling ModVector3 for method chaining.
func (*ModVector3) ToVector ¶ added in v0.16.0
func (ip *ModVector3) ToVector() Vector3
ToVector3 returns a copy of the Vector3 that the ModVector3 is modifying.
func (*ModVector3) Unit ¶ added in v0.16.0
func (ip *ModVector3) Unit() *ModVector3
Unit normalizes the ModVector3 (sets it to be of unit length). This function returns the calling ModVector3 for method chaining.
type Model ¶
type Model struct {
*Node
FrustumCulling bool // Whether the Model is culled when it leaves the frustum.
Color Color4 // The overall multiplicative color of the Model.
Shadeless bool // Indicates if a Model is shadeless.
DynamicBatchModels map[*MeshPart][]*Model // Models that are dynamically merged into this one.
DynamicBatchOwner *Model
SkinRoot INode // The root node of the armature skinning this Model.
// A LightGroup indicates if a Model should be lit by a specific group of Lights. This allows you to control the overall lighting of scenes more accurately.
// If a Model has no LightGroup, the Model is lit by the lights present in the Scene.
LightGroup *LightGroup
// VertexTransformFunction is a function that runs on the world position of each vertex position rendered with the material.
// It accepts a vertex's position and normal as an argument, along with the index of the vertex in the mesh, and returns
// the transformed position and normal as outputs.
// One can use this to simply transform vertices of the mesh on CPU (note that this is, of course, not as performant as
// a traditional GPU vertex shader, but is fine for simple / low-poly mesh transformations).
// This function is run after skinning the vertex if the material belongs to a mesh that is skinned by an armature.
VertexTransformFunction func(vertexPosition, vertexNormal Vector3, vertexIndex int) (Vector3, Vector3)
// VertexClipFunction is a function that runs on the clipped result of each vertex position rendered with the material.
// The function takes the vertex position along with the vertex index in the mesh.
// This program runs after the vertex position is clipped to screen coordinates.
// Note that the VertexClipFunction must return the vector passed.
VertexClipFunction func(vertexPosition Vector4, vertexIndex int) Vector4
// Automatic batching mode; when set and a Model changes parenting, it will be automatically batched as necessary according to
// the AutoBatchMode set.
AutoBatchMode int
// contains filtered or unexported fields
}
Model represents a singular visual instantiation of a Mesh. A Mesh contains the vertex information (what to draw); a Model references the Mesh to draw it with a specific Position, Rotation, and/or Scale (where and how to draw).
func NewModel ¶
NewModel creates a new Model (or instance) of the Mesh and Name provided. A Model represents a singular visual instantiation of a Mesh.
func (*Model) BakeAO ¶ added in v0.10.0
func (model *Model) BakeAO(bakeOptions AOBakeOptions)
BakeAO bakes the ambient occlusion for a model to its vertex colors, using the baking options set in the provided AOBakeOptions struct. If nil is passed instead of bake options, a default AOBakeOptions struct will be created and used. The resulting vertex color will be mixed between whatever was originally there in that channel and the AO color where the color takes effect.
func (*Model) BakeLighting ¶ added in v0.10.0
func (model *Model) BakeLighting(targetChannel int, camera *Camera, lights NodeIterator)
BakeLighting bakes the colors for the provided lights into a Model's Mesh's vertex colors. Note that the baked lighting overwrites whatever vertex colors previously existed in the target channel (as otherwise, the colors could only get brighter with additive mixing, or only get darker with multiplicative mixing). It will add the Model's scene's ambient lighting in, if it's not there already.
func (*Model) Dimensions ¶ added in v0.16.0
func (model *Model) Dimensions() Dimensions
Dimensions returns the transformed dimensions of the Model's mesh.
func (*Model) DynamicBatchAdd ¶ added in v0.9.0
DynamicBatchAdd adds the provided models to the calling Model's dynamic batch, rendering with the specified meshpart (which should be part of the calling Model, of course). Note that unlike StaticMerge(), DynamicBatchAdd works by simply rendering the batched models using the calling Model's first MeshPart's material. By dynamically batching models together, this allows us to not flush between rendering multiple Models, saving a lot of render time, particularly if rendering many low-poly, individual models that have very little variance (i.e. if they all share a single texture). Calling this turns the model into a dynamic batching owner, meaning that it will no longer render its own mesh (for simplicity). For more information, see this Wiki page on batching / merging: https://github.com/SolarLune/Tetra3d/wiki/Merging-and-Batching-Draw-Calls
func (*Model) DynamicBatchClear ¶ added in v0.15.0
func (model *Model) DynamicBatchClear()
DynamicBatchClear clears the model's dynamic batch map from any models associated with it.
func (*Model) DynamicBatchRemove ¶ added in v0.9.0
DynamicBatchRemove removes the specified batched Models from the calling Model's dynamic batch slice.
func (*Model) DynamicBatchTriangleCount ¶ added in v0.9.0
DynamicBatchTriangleCount returns the total number of triangles of Models in the calling Model's dynamic batch.
func (*Model) DynamicBatcher ¶ added in v0.15.0
func (*Model) ProcessVertices ¶ added in v0.9.0
func (model *Model) ProcessVertices(vpMatrix Matrix4, camera *Camera, meshPart *MeshPart, processOnlyVisible bool, autoSubdivisionLevels []AutoSubdivisionLevel)
ProcessVertices processes the vertices a Model has in preparation for rendering, given a view-projection matrix, a camera, and the MeshPart being rendered.
func (*Model) ReassignBones ¶
ReassignBones reassigns the model to point to a different armature. armatureNode should be a pointer to the starting object Node of the armature (not any of its bones).
func (*Model) StaticMerge ¶ added in v0.11.0
Merges the vertices and triangles from the target meshpart of the target model into the calling Model, using the last meshpart of the calling Model's mesh. If the model has no meshparts, then it will create exactly one for handling vertices from the target meshpart.
type MouseRayTestOptions ¶ added in v0.16.0
type MouseRayTestOptions struct {
// Depth is the distance to extend the ray in world units; defaults to the Camera's far plane.
Depth float32
// If cast rays can strike both sides of BoundingTriangles triangles or not.
Doublesided bool
// TestAgainst is used to specify a selection of BoundingObjects to test against - this can be either a NodeFilter or a NodeCollection (a slice of Nodes).
TestAgainst NodeIterator
// OnHit is a callback called for each hit a cast Ray returns, sorted by distance from the starting point (the camera's position).
// OnHit is called for each object in order of distance to the starting point.
// OnHit is only called once for each object, apart from BoundingTriangles, as a single ray can hit multiple triangles of a BoundingTriangles mesh.
// hitIndex is the index of the hit out of the maximum number of hits found by the function (hitCount).
// The returned boolean indicates whether to keep iterating through all found rayhits, or to stop after the current one.
OnHit func(hit RayHit, hitIndex int, hitCount int) bool
}
MouseRayTestOptions is a struct designed to control what options to use when performing a ray test from the Camera towards the Mouse.
func (MouseRayTestOptions) WithDepth ¶ added in v0.17.1
func (r MouseRayTestOptions) WithDepth(depth float32) MouseRayTestOptions
WithDepth controls the maximum distance out from the camera the ray is cast.
func (MouseRayTestOptions) WithDoublesided ¶ added in v0.17.1
func (r MouseRayTestOptions) WithDoublesided(doubleSided bool) MouseRayTestOptions
WithDoublesided indicates if the ray test is double-sided or single-sided.
func (MouseRayTestOptions) WithOnHit ¶ added in v0.17.1
func (r MouseRayTestOptions) WithOnHit(onHit func(hit RayHit, index, count int) bool) MouseRayTestOptions
WithOnHit sets the callback to be called for each hit a cast Ray returns, sorted by distance from the starting point.
func (MouseRayTestOptions) WithTestAgainst ¶ added in v0.17.1
func (r MouseRayTestOptions) WithTestAgainst(iterator NodeIterator) MouseRayTestOptions
WithTestAgainst sets the test against iterator for the mouse raytest option set.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a minimal struct that fully implements the Node interface. Model and Camera embed Node into their structs to automatically easily implement Node.
func (*Node) AddChildren ¶
AddChildren parents the provided children Nodes to the passed parent Node, inheriting its transformations and being under it in the scenegraph hierarchy. If the children are already parented to other Nodes, they are unparented before doing so.
func (*Node) AnimationPlayer ¶
func (node *Node) AnimationPlayer() *AnimationPlayer
AnimationPlayer returns the object's animation player - every object has an AnimationPlayer by default.
func (*Node) Callbacks ¶ added in v0.16.0
func (node *Node) Callbacks() *NodeCallbacks
Callbacks returns a Node's callbacks object. This object represents the callbacks that a Node has access to when events happen.
func (*Node) Children ¶
Children returns the Node's children as a slice of INodes. recursive controls whether it returns all nodes recursive moving down the Node's hierarchy or not. If recursive is true, it's syntactic sugar for Node.FindNodes(FindNodeOptions{}).
func (*Node) ChildrenCount ¶ added in v0.18.0
Returns the number of children under the Node. When recursive, it traverses the entire tree underneath the Node; otherwise, it just returns the number of the Node's direct descendants.
func (*Node) ClearLocalTransform ¶ added in v0.13.0
func (node *Node) ClearLocalTransform()
ClearLocalTransform clears the local transform properties (position, scale, and rotation) for the Node, reverting it to essentially an identity matrix (0, 0, 0 for position, 1, 1, 1 for scale, and an identity Matrix4 for rotation, indicating no rotation). This can be useful because by default, when you parent one Node to another, the local transform properties (position, scale, and rotation) are altered to keep the object in the same absolute location, even though the origin changes.
func (*Node) Data ¶
Data returns a pointer to user-customizeable data that could be usefully stored on this node.
func (*Node) DescendantOf ¶ added in v0.18.0
DescendantOf returns if a Node is a descendant of a parent Node.
func (*Node) DistanceSquaredTo ¶ added in v0.14.0
DistanceSquaredTo returns the squared distance between the given Nodes' centers. Quick syntactic sugar for Node.WorldPosition().DistanceSquared(otherNode.WorldPosition()).
func (*Node) DistanceTo ¶ added in v0.13.0
DistanceTo returns the distance between the given Nodes' centers. Quick syntactic sugar for Node.WorldPosition().Distance(otherNode.WorldPosition()).
func (*Node) ForEachChild ¶ added in v0.16.0
ForEachChild runs the provided callback function for each child in the node's children slice. If the callback returns false, then it stops execution with the current child. Beware of removing children from a node in this loop (it's better to make a copy of children through a node.Search call if you're going to remove some).
func (*Node) Get ¶
Get searches a node's hierarchy using a string to find a specified node. The path is in the format of names of nodes, separated by forward slashes ('/'), and is relative to the node you use to call Get. As an example of Get, if you had a cup parented to a desk, which was parented to a room, that was finally parented to the root of the scene, it would be found at "Room/Desk/Cup". Note also that you can use "../" to "go up one" in the hierarchy (so cup.Get("../") would return the Desk node). Since Get uses forward slashes as path separation, it would be good to avoid using forward slashes in your Node names. Also note that Get() trims the extra spaces from the beginning and end of Node Names, so avoid using spaces at the beginning or end of your Nodes' names.
func (*Node) Grow ¶ added in v0.5.0
Grow scales the object additively using the x, y, and z arguments provided (i.e. calling Node.Grow(1, 0, 0) will scale it +1 on the X-axis).
func (*Node) GrowVec ¶ added in v0.10.0
GrowVec scales the object additively using the scaling vector provided (i.e. calling Node.GrowVec(Vector{1, 0, 0}) will scale it +1 on the X-axis).
func (*Node) HierarchyAsString ¶ added in v0.8.1
func (*Node) InSceneTree ¶ added in v0.16.0
InSceneTree returns if a Node is connected to the scene's root node through hierarchy.
func (*Node) Index ¶ added in v0.11.2
Index returns the index of the Node in its parent's children list. If the node doesn't have a parent, its index will be -1.
func (*Node) IsBone ¶ added in v0.4.3
IsBone returns if the Node is a "bone" (a node that was a part of an armature and so can play animations back to influence a skinned mesh).
func (*Node) Library ¶ added in v0.8.1
Library returns the Library from which this Node was instantiated. If it was created through code, this will be nil.
func (*Node) LocalPosition ¶
LocalPosition returns a 3D Vector consisting of the object's local position (position relative to its parent). If this object has no parent, the position will be relative to world origin (0, 0, 0).
func (*Node) LocalRotation ¶
LocalRotation returns the object's local rotation Matrix4.
func (*Node) LocalScale ¶
LocalScale returns the object's local scale (scale relative to its parent). If this object has no parent, the scale will be absolute.
func (*Node) MoveByOrientation ¶ added in v0.18.0
MoveByOrientation moves a Node in local space by the x, y, and z values provided.
func (*Node) MoveByOrientationVec ¶ added in v0.18.0
MoveByOrientationVec moves a Node in local space using the vector provided.
func (*Node) MoveTowards ¶ added in v0.17.1
MoveTowards moves the node towards a given location in world space by the distance provided. The movement is capped to the distance to the target location.
func (*Node) MoveTowardsLerp ¶ added in v0.18.0
Linearly interpolates the node moving towards the target position in world space by the percentage provided.
func (*Node) MoveTowardsNode ¶ added in v0.17.1
MoveTowardsNode moves the node towards the specified target Node in world space by the distance provided. The movement is capped to the distance to the target location.
func (*Node) MoveTowardsNodeLerp ¶ added in v0.18.0
Linearly interpolates the node moving towards the target vector in world space by the percentage provided.
func (*Node) MoveTowardsVec ¶ added in v0.17.1
MoveTowardsVec moves the node towards the target vector in world space by the distance provided. The movement is capped to the distance to the target location.
func (*Node) MoveTowardsVecLerp ¶ added in v0.18.0
Linearly interpolates the node moving towards the target vector in world space by the percentage provided.
func (*Node) MoveVec ¶ added in v0.5.0
MoveVec moves a Node in local space using the vector provided.
func (*Node) Parent ¶
Parent returns the Node's parent. If the Node has no parent, this will return nil.
func (*Node) Path ¶
Path returns a string indicating the hierarchical path to get this Node from the root. The path returned will be absolute, such that passing it to Get() called on the scene root node will return this node. The path returned will not contain the root node's name ("Root"). If the Node is not in a scene tree (i.e. does not have a path to a root node), Path() will return a blank string.
func (*Node) Properties ¶ added in v0.11.0
func (node *Node) Properties() *Properties
Properties represents an ordered set of game properties that can be used to identify this object.
func (*Node) PropertiesContainsBitByName ¶ added in v0.18.0
Returns if the Node contains a property that has a bit flipped that is named in the Node's Scene by the given name.
func (*Node) ReindexChild ¶ added in v0.11.2
ReindexChild moves the child in the calling Node's children slice to the specified newPosition. The function returns the old index where the child Node was, or -1 if it wasn't a child of the calling Node. The newPosition is clamped to the size of the node's children slice.
func (*Node) RemoveChildren ¶
RemoveChildren immediately removes the provided children from this object. Beware of using this in a hierarchical loop!
func (*Node) ReplaceWith ¶ added in v0.18.0
Replaces a node with the other node specified.
func (*Node) ResetWorldPosition ¶ added in v0.14.0
func (node *Node) ResetWorldPosition()
ResetWorldPosition resets the Node's local position to the value the Node had when it was first instantiated in the Scene or cloned.
func (*Node) ResetWorldRotation ¶ added in v0.14.0
func (node *Node) ResetWorldRotation()
ResetWorldRotation resets the Node's local rotation to the value the Node had when it was first instantiated in the Scene or cloned.
func (*Node) ResetWorldScale ¶ added in v0.14.0
func (node *Node) ResetWorldScale()
ResetWorldScale resets the Node's local scale to the value the Node had when it was first instantiated in the Scene or cloned.
func (*Node) ResetWorldTransform ¶ added in v0.14.0
func (node *Node) ResetWorldTransform()
ResetWorldTransform resets the Node's world transform properties (position, scale, and rotation) for the Node to the original values when the Node was first instantiated in the Scene or cloned.
func (*Node) Root ¶
Root returns the root node in the scene by recursively traversing this node's hierarchy of parents upwards. If, instead, the node this is called on is the root (and so has no parents), this function returns the node itself. If the node has no path to the scene root, this function returns nil.
func (*Node) Rotate ¶
Rotate rotates a Node on its local orientation on a vector composed of the given x, y, and z values, by the angle provided in radians.
func (*Node) RotateMatrix4 ¶ added in v0.18.0
Rotate rotates a Node on its local orientation using a Matrix4.
func (*Node) RotateVec ¶ added in v0.10.0
RotateVec rotates a Node on its local orientation on the given vector, by the angle provided in radians.
func (*Node) Scene ¶ added in v0.8.1
Scene looks for the Node's parents recursively to return what scene it exists in. If the node is not within a tree (i.e. unparented), this will return nil.
func (*Node) Search ¶ added in v0.18.0
func (n *Node) Search() SearchOptions
Creates a SearchOptions object starting with the given Node. You create a SearchOptions object with Node.Search(), specify filters like ByNames(), and then iterate over all passing Nodes with SearchOptions.ForEach, or get a slice with GetSlice(). You can also get just the first or last with GetFirst() and GetLast().
func (*Node) Sector ¶ added in v0.13.0
Sector returns the Sector this node is in hierarchically. If that fails, then Sector() will search the scene tree spatially to see which of the sectors the calling Node lies in.
func (*Node) SectorType ¶ added in v0.15.0
func (node *Node) SectorType() SectorType
SectorType returns the current SectorType of the Node.
func (*Node) SetData ¶
SetData sets user-customizeable data that could be usefully stored on this node.
func (*Node) SetLocalPosition ¶
SetLocalPosition sets the object's local position (position relative to its parent). If this object has no parent, the position should be relative to world origin (0, 0, 0). position should be a 3D vector (i.e. X, Y, and Z components).
func (*Node) SetLocalPositionVec ¶ added in v0.10.0
SetLocalPositionVec sets the object's local position (position relative to its parent). If this object has no parent, the position should be relative to world origin (0, 0, 0). position should be a 3D vector (i.e. X, Y, and Z components).
func (*Node) SetLocalRotation ¶
SetLocalRotation sets the object's local rotation Matrix4 (relative to any parent).
func (*Node) SetLocalScale ¶
SetLocalScale sets the object's local scale (scale relative to its parent). If this object has no parent, the scale would be absolute.
func (*Node) SetLocalScaleVec ¶ added in v0.10.0
SetLocalScaleVec sets the object's local scale (scale relative to its parent). If this object has no parent, the scale would be absolute. scale should be a 3D vector (i.e. X, Y, and Z components).
func (*Node) SetLocalX ¶ added in v0.16.3
SetLocalX sets the X component of the object's local position.
func (*Node) SetLocalY ¶ added in v0.16.3
SetLocalY sets the Y component of the object's local position.
func (*Node) SetLocalZ ¶ added in v0.16.3
SetLocalZ sets the Z component of the object's local position.
func (*Node) SetSectorType ¶ added in v0.15.0
func (node *Node) SetSectorType(sectorType SectorType)
SetSectorType sets the current SectorType of the Node. Note that setting this to Sector won't work.
func (*Node) SetVisible ¶
SetVisible sets the object's visibility. If recursive is true, all recursive children of this Node will have their visibility set the same way.
func (*Node) SetWorldPosition ¶
SetWorldPositionVec sets the object's world position (position relative to the world origin point of {0, 0, 0}). position needs to be a 3D vector (i.e. X, Y, and Z components).
func (*Node) SetWorldPositionVec ¶ added in v0.10.0
SetWorldPosition sets the object's world position (position relative to the world origin point of {0, 0, 0}).
func (*Node) SetWorldRotation ¶
SetWorldRotation sets an object's rotation to the provided rotation Matrix4.
func (*Node) SetWorldScale ¶
SetWorldScale sets the object's absolute world scale.
func (*Node) SetWorldScaleVec ¶ added in v0.10.0
SetWorldScaleVec sets the object's absolute world scale. scale should be a 3D vector (i.e. X, Y, and Z components).
func (*Node) SetWorldTransform ¶ added in v0.8.1
SetWorldTransform sets the Node's global (world) transform to the full 4x4 transformation matrix provided.
func (*Node) SetWorldX ¶ added in v0.11.0
SetWorldX sets the X component of the object's world position.
func (*Node) SetWorldY ¶ added in v0.11.0
SetWorldY sets the Y component of the object's world position.
func (*Node) SetWorldZ ¶ added in v0.11.0
SetWorldZ sets the Z component of the object's world position.
func (*Node) Transform ¶
Transform returns a Matrix4 indicating the global position, rotation, and scale of the object, transforming it by any parents'. If there's no change between the previous Transform() call and this one, Transform() will return a cached version of the transform for efficiency.
func (*Node) Unparent ¶
func (node *Node) Unparent()
Unparent unparents the Node from its parent, removing it from the scenegraph. Beware of using this in a hierarchical loop!
func (*Node) VectorTo ¶ added in v0.16.0
VectorTo returns a vector from one Node to another. Quick syntactic sugar for other.WorldPosition().Sub(node.WorldPosition()).
func (*Node) WorldPosition ¶
WorldPosition returns a 3D Vector consisting of the object's world position (position relative to the world origin point of {0, 0, 0}).
func (*Node) WorldRotation ¶
WorldRotation returns an absolute rotation Matrix4 representing the object's rotation. Note that this is a bit slow as it requires decomposing the node's world transform, so you want to use node.LocalRotation() if you can and performacne is a concern.
func (*Node) WorldScale ¶
WorldScale returns the object's absolute world scale as a 3D vector (i.e. X, Y, and Z components). Note that this is a bit slow as it requires decomposing the node's world transform, so you want to use node.LocalScale() if you can and performacne is a concern.
type NodeCallbacks ¶ added in v0.16.1
type NodeCallbacks struct {
OnReparent func(node, oldParent, newParent INode) // A callback to be called whenever a Node is reparented.
OnClone func(newNode INode) // A callback to be called whenever a Node is cloned (including when its owning Scene is cloned).
}
NodeCallbacks represents a set of callbacks to be called when a Node is reparented, cloned, etc.
type NodeIterator ¶ added in v0.16.0
type NodeList ¶ added in v0.18.0
type NodeList []INode
func (*NodeList) Combine ¶ added in v0.18.0
func (n *NodeList) Combine(other NodeIterator)
type NodeType ¶ added in v0.8.1
type NodeType uint32
NodeType represents a Node's type. Node types are categorized, and can be said to extend or "be of" more general types. For example, a BoundingSphere has a type of NodeTypeBoundingSphere. That type can also be said to be NodeTypeBoundingObject (because it is a bounding object). However, it is not of type NodeTypeBoundingTriangles, as that is a different category.
func (NodeType) Is ¶ added in v0.8.1
Is returns true if a NodeType satisfies another NodeType category. A specific node type can be said to contain a more general one, but not vice-versa. For example, a Model (which has type NodeTypeModel) can be said to be a Node (NodeTypeNode), but the reverse is not true (a NodeTypeNode is not a NodeTypeModel).
type Particle ¶ added in v0.10.0
type Particle struct {
ParticleSystem *ParticleSystem
ModelBank []*Model // Bank of models the particle could possibly use
Model *Model // The currently active Model
Velocity Vector3 // The constant velocity of the Particle in world-space
VelocityAdd Vector3 // The acceleration of the Particle in world-space; these values are added to the particle's velocity each frame.
ScaleAdd Vector3 // The growth of the Particle in world-space
RotationAdd Vector3 // The additive rotation of the Particle in local-space
Life float32 // How long the particle has left to live
Lifetime float32 // How long the particle lives, maximum
Data map[string]any // A custom Data map for storing and retrieving data
}
Particle represents a particle, rendered in a ParticleSystem.
func NewParticle ¶ added in v0.10.0
func NewParticle(partSystem *ParticleSystem, partModels []*Model) *Particle
NewParticle creates a new Particle for the given particle system, with the provided slice of particle factories to make particles from.
type ParticleSystem ¶ added in v0.10.0
type ParticleSystem struct {
LivingParticles []*Particle
DeadParticles []*Particle
On bool
BaseParticleModels []*Model
// contains filtered or unexported fields
}
ParticleSystem represents a collection of particles.
func NewParticleSystem ¶ added in v0.10.0
func NewParticleSystem(baseParticles ...*Model) *ParticleSystem
NewParticleSystem creates a new ParticleSystem, operating on the baseModel Model and randomly creating particles from the provided collection of particle Models.
func (*ParticleSystem) Clone ¶ added in v0.10.0
func (ps *ParticleSystem) Clone() *ParticleSystem
Clone creates a duplicate of the given ParticleSystem.
func (*ParticleSystem) Model ¶ added in v0.18.0
func (ps *ParticleSystem) Model() *Model
Returns the renderable model for the particle system - rendering this renders all particles it has spawned.
func (*ParticleSystem) Remove ¶ added in v0.10.0
func (ps *ParticleSystem) Remove(part *Particle)
Remove removes a particle from the ParticleSystem, recycling the Particle for the next time a particle is spawned.
func (*ParticleSystem) SetSettings ¶ added in v0.18.0
func (ps *ParticleSystem) SetSettings(settings ParticleSystemSettings)
func (*ParticleSystem) Settings ¶ added in v0.10.0
func (ps *ParticleSystem) Settings() ParticleSystemSettings
func (*ParticleSystem) Spawn ¶ added in v0.10.0
func (ps *ParticleSystem) Spawn()
Spawn spawns exactly one particle when called.
func (*ParticleSystem) Update ¶ added in v0.10.0
func (ps *ParticleSystem) Update(dt float32)
Update should be called once per tick.
type ParticleSystemSettings ¶ added in v0.10.0
type ParticleSystemSettings struct {
SpawnOn bool // If the particle system should spawn particles at all
SpawnRate FloatRange // SpawnRate is how often a particle is spawned in seconds
SpawnCount IntRange // SpawnCount is how many particles are spawned at a time when a particle is spawned
Lifetime FloatRange // Lifetime is how long a particle lives in seconds
SpawnOffset Vector3Range // The range indicating how far of an offset to move
Velocity Vector3Range // The range indicating how fast a particle constantly moves per frame
VelocityAdd Vector3Range // The range indicating how fast a particle accelerates per frame
Scale Vector3Range // The range indicating how large the particle should spawn in as
ScaleAdd Vector3Range // The range indicating how large the particle should grow per frame
RotationAdd Vector3Range // The range indicating how fast a particle should spin per frame
LocalPosition bool // Whether the particles' positions should be local to the system or not (if true, particles move with the system); defaults to false.
Friction float32 // Friction to apply to velocity
AllowNegativeScale bool // If negative scale should be allowed for particles. By default, this is false.
VertexSpawnMode int // VertexSpawnMode influences where a particle spawns. By default, this is ParticleVertexSpawnModeOff.
VertexSpawnModel *Model
// SpawnOffsetFunction is a function the user can use to customize spawning position of the particles within the system. This function
// is called additively to the SpawnOffset setting.
SpawnOffsetFunction func(particle *Particle)
// MovementFunction is a function the user can use to customize movement of the particles within the system. This function
// is called additively to the other movement settings.
MovementFunction func(particle *Particle)
// Todo: Add curves for all features?
ColorCurve ColorCurve // ColorCurve is a curve indicating how the spawned particles should change color as they live.
}
func NewParticleSystemSettings ¶ added in v0.10.0
func NewParticleSystemSettings() ParticleSystemSettings
NewParticleSystemSettings creates a new particle system settings.
func (*ParticleSystemSettings) Clone ¶ added in v0.10.0
func (pss *ParticleSystemSettings) Clone() ParticleSystemSettings
Clone duplicates the ParticleSystemSettings.
func (ParticleSystemSettings) WithAllowNegativeScale ¶ added in v0.18.0
func (p ParticleSystemSettings) WithAllowNegativeScale(allow bool) ParticleSystemSettings
func (ParticleSystemSettings) WithColorCurve ¶ added in v0.18.0
func (p ParticleSystemSettings) WithColorCurve(colorCurve ColorCurve) ParticleSystemSettings
func (ParticleSystemSettings) WithFriction ¶ added in v0.18.0
func (p ParticleSystemSettings) WithFriction(friction float32) ParticleSystemSettings
func (ParticleSystemSettings) WithLifetime ¶ added in v0.18.0
func (p ParticleSystemSettings) WithLifetime(lifetime FloatRange) ParticleSystemSettings
func (ParticleSystemSettings) WithLocalPosition ¶ added in v0.18.0
func (p ParticleSystemSettings) WithLocalPosition(localPosition bool) ParticleSystemSettings
func (ParticleSystemSettings) WithMovementFunction ¶ added in v0.18.0
func (p ParticleSystemSettings) WithMovementFunction(movementFunction func(p *Particle)) ParticleSystemSettings
func (ParticleSystemSettings) WithRotationAdd ¶ added in v0.18.0
func (p ParticleSystemSettings) WithRotationAdd(rotation Vector3Range) ParticleSystemSettings
func (ParticleSystemSettings) WithScale ¶ added in v0.18.0
func (p ParticleSystemSettings) WithScale(scale Vector3Range) ParticleSystemSettings
func (ParticleSystemSettings) WithScaleAdd ¶ added in v0.18.0
func (p ParticleSystemSettings) WithScaleAdd(scale Vector3Range) ParticleSystemSettings
func (ParticleSystemSettings) WithSpawnCount ¶ added in v0.18.0
func (p ParticleSystemSettings) WithSpawnCount(spawnCount IntRange) ParticleSystemSettings
func (ParticleSystemSettings) WithSpawnOffset ¶ added in v0.18.0
func (p ParticleSystemSettings) WithSpawnOffset(spawnOffset Vector3Range) ParticleSystemSettings
func (ParticleSystemSettings) WithSpawnOffsetFunction ¶ added in v0.18.0
func (p ParticleSystemSettings) WithSpawnOffsetFunction(spawnOffsetFunction func(p *Particle)) ParticleSystemSettings
func (ParticleSystemSettings) WithSpawnOn ¶ added in v0.18.0
func (p ParticleSystemSettings) WithSpawnOn(spawnOn bool) ParticleSystemSettings
func (ParticleSystemSettings) WithSpawnRate ¶ added in v0.18.0
func (p ParticleSystemSettings) WithSpawnRate(spawnRate FloatRange) ParticleSystemSettings
func (ParticleSystemSettings) WithVelocity ¶ added in v0.18.0
func (p ParticleSystemSettings) WithVelocity(velocity Vector3Range) ParticleSystemSettings
func (ParticleSystemSettings) WithVelocityAdd ¶ added in v0.18.0
func (p ParticleSystemSettings) WithVelocityAdd(velocity Vector3Range) ParticleSystemSettings
func (ParticleSystemSettings) WithVertexSpawn ¶ added in v0.18.0
func (p ParticleSystemSettings) WithVertexSpawn(model *Model, spawnMode int) ParticleSystemSettings
type Path ¶ added in v0.8.1
type Path struct {
*Node
Closed bool // Closed indicates if a Path is closed (and so going to the end will return to the start) or not.
PathIndex int // Index of the path points; used to reset the path when navigating through Path.Next().
}
A Path represents a Node that represents a sequential path. All children of the Path are considered its points, in order.
func NewPath ¶ added in v0.8.1
NewPath returns a new Path object. A Path is a Node whose children represent points on a path. A Path can be stepped through spatially using a Navigator. The passed point vectors will become Nodes, children of the Path.
func (*Path) HopCount ¶ added in v0.15.0
HopCount returns the number of hops in the path (i.e. number of nodes - 1).
func (*Path) Length ¶ added in v0.14.0
Length returns the total distance that a Path covers by stepping through all of the children under the Path.
func (*Path) Next ¶ added in v0.14.0
Next returns the next point in the path as an iterator - if the boolean value is true, you have reached the end of the path. Useful if you don't want to use a Navigator to navigate through it.
type PathStepper ¶ added in v0.14.0
type PathStepper struct {
Index int
// contains filtered or unexported fields
}
PathStepper is an object that steps through points in a set path. It returns the position of the current node and has the ability to go to the next or previous node in the path.
func NewPathStepper ¶ added in v0.14.0
func NewPathStepper(path IPath) *PathStepper
NewPathStepper returns a new PathStepper object.
func (*PathStepper) AtEnd ¶ added in v0.14.0
func (ps *PathStepper) AtEnd() bool
AtEnd returns if the PathStepper is at the end of its path.
func (*PathStepper) AtStart ¶ added in v0.14.0
func (ps *PathStepper) AtStart() bool
AtStart returns if the PathStepper is at the start of its path.
func (*PathStepper) Current ¶ added in v0.18.0
func (ps *PathStepper) Current() Vector3
Current returns the current node's world position for the PathStepper.
func (*PathStepper) GotoNext ¶ added in v0.18.0
func (ps *PathStepper) GotoNext()
Next steps to the next point in the Path for the PathStepper. If the PathStepper is at the end of the path, then it will loop through the path again.
func (*PathStepper) GotoPrev ¶ added in v0.18.0
func (ps *PathStepper) GotoPrev()
Next steps to the previous point in the Path for the PathStepper. If the PathStepper is at the beginning of the path, then it will loop through the path again.
func (*PathStepper) Next ¶ added in v0.14.0
func (ps *PathStepper) Next() Vector3
func (*PathStepper) Path ¶ added in v0.14.0
func (ps *PathStepper) Path() IPath
Path returns the path used by the PathStepper.
func (*PathStepper) Prev ¶ added in v0.14.0
func (ps *PathStepper) Prev() Vector3
func (*PathStepper) ProgressToWorldPosition ¶ added in v0.14.0
func (ps *PathStepper) ProgressToWorldPosition(perc float32) Vector3
ProgressToWorldPosition returns a position on the PathStepper's current Path, if given a percentage value that ranges from 0 to 1. The percentage is weighted for distance, not for number of points. For example, say you had a path comprised of four points: {0, 0, 0}, {9, 0, 0}, {9.5, 0, 0}, and {10, 0, 0}. If you called PathStepper.ProgressToWorldPosition(0.9), you'd get {9, 0, 0} (90% of the way through the path). If the PathStepper has a nil Path or its Path has no points, this function returns an empty Vector.
func (*PathStepper) SetIndexToEnd ¶ added in v0.14.0
func (ps *PathStepper) SetIndexToEnd()
SetIndexToEnd sets the PathStepper to the point at the end of the path.
func (*PathStepper) SetIndexToStart ¶ added in v0.14.0
func (ps *PathStepper) SetIndexToStart()
SetIndexToStart resets the PathStepper to point to the beginning of the path.
func (*PathStepper) SetPath ¶ added in v0.14.0
func (ps *PathStepper) SetPath(path IPath)
SetPath sets the path of the PathStepper; this should be called whenever the path updates. Doing this will reset the PathStepper's index to 0.
type PointLight ¶ added in v0.5.0
type PointLight struct {
*LightBase
// contains filtered or unexported fields
}
PointLight represents a point light (naturally).
func NewPointLight ¶ added in v0.5.0
func NewPointLight(name string, r, g, b, energy float32) *PointLight
NewPointLight creates a new Point light.
func (*PointLight) Clone ¶ added in v0.5.0
func (p *PointLight) Clone() INode
Clone returns a new clone of the given point light.
func (*PointLight) Light ¶ added in v0.5.0
func (p *PointLight) Light(tri *Triangle, model *Model, targetColors *VertexColorChannel)
Light returns the R, G, and B values for the PointLight for all vertices of a given Triangle.
func (*PointLight) Range ¶ added in v0.14.0
func (p *PointLight) Range() float32
func (*PointLight) SetRange ¶ added in v0.18.0
func (p *PointLight) SetRange(lightRange float32)
func (*PointLight) Type ¶ added in v0.8.1
func (p *PointLight) Type() NodeType
Type returns the NodeType for this object.
func (*PointLight) VertexLight ¶ added in v0.18.0
func (p *PointLight) VertexLight(index int, tri *Triangle, model *Model, targetColors *VertexColorChannel)
type Projection ¶ added in v0.18.0
type Projection struct {
Min, Max float32
}
Represents a distance between two points in space along a single axis.
func NewProjection ¶ added in v0.18.0
func NewProjection(axis Vector3, points ...Vector3) Projection
Projects points on an axis to create a Projection, a distance between those points. Useful for checking if zones overlap across on a single axis in 3D space. For example, you can use this to get the distance from two points on a single axis thusly:
`NewProjection(tetra3d.WorldRight, object1.WorldPosition(), object2.WorldPosition()).Distance()`
Or create two projections on the same axis and use Projection.IsOverlapping(other) to see if they overlap.
func (Projection) Distance ¶ added in v0.18.0
func (p Projection) Distance() float32
func (Projection) IsOverlapping ¶ added in v0.18.0
func (projection Projection) IsOverlapping(other Projection) bool
func (Projection) Overlap ¶ added in v0.18.0
func (projection Projection) Overlap(other Projection) float32
type Properties ¶ added in v0.11.0
type Properties struct {
// contains filtered or unexported fields
}
Properties is an ordered set of property names to values, representing a means of identifying or carrying data on resources.
func NewProperties ¶ added in v0.11.0
func NewProperties() *Properties
NewProperties returns a new Properties object.
func (*Properties) Add ¶ added in v0.15.0
func (props *Properties) Add(propName string) *Property
Add adds a property to the Properties map using the given name. If a property of the specified name already exists, it will return that property instead.
func (*Properties) Clear ¶ added in v0.11.0
func (props *Properties) Clear()
Clear clears the Properties object of all game properties.
func (*Properties) Clone ¶ added in v0.11.0
func (props *Properties) Clone() *Properties
Clone clones the Properties object.
func (*Properties) CopyFrom ¶ added in v0.16.0
func (props *Properties) CopyFrom(src *Properties, overwrite bool)
CopyFrom copies the properties from the source Properties set (src). It does not clear the properties set on props. If overwrite is true, then all properties on src will be copied over to the destination calling Properties set. If overwrite is false, then all properties on src that have not been already set on the destination calling Properties set will be copied over.
func (*Properties) Count ¶ added in v0.16.0
func (props *Properties) Count() int
Count returns the number of properties in the Properties set.
func (*Properties) ForEach ¶ added in v0.18.0
func (props *Properties) ForEach(forEach func(p *Property, index int) bool)
Iterates over each Property in the Properties set, in sequence.
func (*Properties) Get ¶ added in v0.11.0
func (props *Properties) Get(propIndex int) *Property
Returns the value associated with the property of the given index. If the property doesn't exist, the function will return nil.
func (*Properties) GetByName ¶ added in v0.18.0
func (props *Properties) GetByName(propName string) *Property
Returns the value associated with the specified property name. If a property with the passed name (propName) doesn't exist, the function will return nil.
func (*Properties) Has ¶ added in v0.11.0
func (props *Properties) Has(propName string) bool
Has returns true if the Properties object has a property by the name specified.
func (*Properties) HasBitfieldValue ¶ added in v0.18.0
func (props *Properties) HasBitfieldValue(value Bitfield) bool
Returns if the Properties object has a property of the given name with the given value.
func (*Properties) HasNameAndBitfieldValue ¶ added in v0.18.0
func (props *Properties) HasNameAndBitfieldValue(propName string, value Bitfield) bool
Returns if the Properties object has a property of the given name with the given value.
func (*Properties) HasNameAndValue ¶ added in v0.18.0
func (props *Properties) HasNameAndValue(propName string, value any) bool
Returns if the Properties object has a property of the given name with the given value.
func (*Properties) Remove ¶ added in v0.11.0
func (props *Properties) Remove(key string)
Remove removes the tag specified from the Properties object.
type Property ¶ added in v0.11.0
type Property struct {
Value any
// contains filtered or unexported fields
}
Property represents a game property on a Node or other resource.
func (*Property) AsBitfield ¶ added in v0.18.0
Returns the property as a Bitfield value.
func (*Property) AsBool ¶ added in v0.11.1
AsBool returns the value associated with the Property as a bool. Note that this does not sanity check to ensure the Property is a bool first.
func (*Property) AsColor ¶ added in v0.11.0
AsColor returns the value associated with the Property as a Color. Note that this does not sanity check to ensure the Property is a Color first.
func (*Property) AsFloat32 ¶ added in v0.16.0
AsFloat returns the value associated with the Property as a float32. Note that this does not sanity check to ensure the Property is a float32 first.
func (*Property) AsInt ¶ added in v0.11.0
AsInt returns the value associated with the Property as a float. Note that this does not sanity check to ensure the Property is an int first.
func (*Property) AsString ¶ added in v0.11.0
AsString returns the value associated with the Property as a string. Note that this does not sanity check to ensure the Property is a string first.
func (*Property) AsStringSceneObjectPair ¶ added in v0.18.0
Returns the property as two strings - a scene name and the object name.
func (*Property) AsVector2 ¶ added in v0.17.0
AsVector3 returns the value associated with the Property as a 2D Vector. Note that this does not sanity check to ensure the Property is a Vector2 first.
func (*Property) AsVector3 ¶ added in v0.16.0
AsVector3 returns the value associated with the Property as a 3D position Vector. The axes are corrected to account for the difference between Blender's axis order and Tetra3D's (i.e. Blender's +X, +Y, +Z becomes Tetra3D's +X, +Z, +Y). Note that this does not sanity check to ensure the Property is a Vector3 first.
func (*Property) IsBitfield ¶ added in v0.18.0
Returns if the Property contains a bitfield value.
type Quaternion ¶
type Quaternion struct {
X, Y, Z, W float32
}
Quaternion is a tool to rotate objects, similar to rotation Matrix4s. The main difference is that they can easily be smoothly interpolated between without losing data. If you were to lerp two rotation matrices, you can easily end up with a zero matrix, making your rotating object disappear. Instead, you can create the two Quaternions you need (either from Matrix4s or directly), and then lerp them together, then use them for rotation (either directly, or converting them into Matrix4s).
func NewQuaternion ¶
func NewQuaternion(x, y, z, w float32) Quaternion
Creates a new Quaternion of the given X, Y, Z, and W values.
func NewQuaternionFromAxisAngle ¶ added in v0.11.0
func NewQuaternionFromAxisAngle(axis Vector3, angle float32) Quaternion
NewQuaternionFromAxisAngle returns a new Quaternion from the given axis and angle combination.
func (Quaternion) Conjugate ¶ added in v0.18.0
func (quat Quaternion) Conjugate() Quaternion
func (Quaternion) Dot ¶
func (quat Quaternion) Dot(other Quaternion) float32
func (Quaternion) Inverted ¶ added in v0.18.0
func (quat Quaternion) Inverted() Quaternion
func (Quaternion) IsZero ¶ added in v0.18.0
func (quat Quaternion) IsZero() bool
Returns if the Quaternion is all zero values.
func (Quaternion) Lerp ¶ added in v0.5.0
func (quat Quaternion) Lerp(end Quaternion, percent float32) Quaternion
func (Quaternion) Magnitude ¶ added in v0.5.0
func (quat Quaternion) Magnitude() float32
func (Quaternion) Mult ¶ added in v0.10.0
func (q1 Quaternion) Mult(q2 Quaternion) Quaternion
func (Quaternion) RotateVec ¶ added in v0.11.0
func (quat Quaternion) RotateVec(v Vector3) Vector3
RotateVec rotates the given vector around using the Quaternion counter-clockwise.
func (Quaternion) Scale ¶ added in v0.18.0
func (quat Quaternion) Scale(factor float32) Quaternion
func (Quaternion) Slerp ¶
func (quat Quaternion) Slerp(end Quaternion, percent float32) Quaternion
Spherical interpolates between the starting quaternion to the ending one by the given percentage.
func (Quaternion) ToAxisAngle ¶ added in v0.11.2
func (quat Quaternion) ToAxisAngle() (Vector3, float32)
ToAxisAngle returns tha axis Vector and angle (in radians) for a quaternion's rotation.
func (Quaternion) ToMatrix4 ¶ added in v0.10.0
func (quat Quaternion) ToMatrix4() Matrix4
ToMatrix4 generates a rotation Matrx4 from the given Quaternion.
func (Quaternion) Unit ¶ added in v0.18.0
func (quat Quaternion) Unit() Quaternion
type RayHit ¶ added in v0.12.0
type RayHit struct {
Object INode // Object is a pointer to the BoundingObject that was struck by the raycast.
Position Vector3 // Position is the world position that the object was struct.
Normal Vector3 // Normal is the normal of the surface the ray struck.
// What triangle the raycast hit - note that this is only set to a non-nil value for raycasts against BoundingTriangle objects
Triangle *Triangle
// contains filtered or unexported fields
}
RayHit represents the result of a raycast test.
func RayTest ¶ added in v0.12.0
func RayTest(options RayTestOptions) *RayHit
RayTest casts a ray from the "from" world position to the "to" world position for each position pair while testing against the provided IBoundingObjects. The function returns the first struck object; if none were struck, it returns nil.
func (RayHit) Distance ¶ added in v0.13.0
Distance returns the distance from the RayHit's originating ray source point to the struck position.
func (RayHit) HitMaterialByName ¶ added in v0.18.0
Returns if the Ray hit a material by a given name or not.
func (RayHit) HitMaterialByPropName ¶ added in v0.18.0
Returns if the Ray hit a material with a property of a given name or not.
func (RayHit) Slope ¶ added in v0.12.0
Slope returns the slope of the RayHit's normal, in radians. This ranges from 0 (straight up) to pi (straight down).
func (RayHit) UV ¶ added in v0.16.0
UV returns the UV value from the position struck on the corresponding triangle for the BoundingObject struck, assuming the object struck was a BoundingTriangles. The returned UV value is linearly interpolated across the triangle just like it would be when a triangle is rendered. UV will return a zero Vector and an error if the BoundingObject hit was not a BoundingTriangles object.
func (RayHit) VertexColor ¶ added in v0.16.0
Returns the vertex color from the given channel in the position struck on the object struck. Only works when testing against BoundingTriangles objects. The returned vertex color is linearly interpolated across the triangle just like it would be when a triangle is rendered. The function will return transparent black and an error if the BoundingObject hit was not a BoundingTriangles object, or if the channel index given is higher than the number of vertex color channels on the BoundingTriangles' mesh.
type RayTestOptions ¶ added in v0.16.0
type RayTestOptions struct {
From Vector3 // The position to cast rays from.
To Vector3 // The position to cast rays to.
// The positions to cast rays from and to in pairs.
// By specifying multiple locations in this location pair set, you can cast multiple rays at the same time.
// If the number of positions provided is odd (e.g. only a From and no matching To), that ray is not cast.
// Overrides the options object's From and To properties.
Positions []Vector3
// If cast rays can strike both sides of BoundingTriangles triangles or not.
// TODO: Implement this for all collision types, not just triangles.
Doublesided bool
// TestAgainst is used to specify a selection of BoundingObjects to test against - this can be either a NodeFilter or a NodeCollection (a slice of Nodes).
TestAgainst NodeIterator
// OnHit is a callback called for each hit a cast Ray returns, sorted by distance from the starting point.
// OnHit is called for each object in order of distance to the starting point.
// OnHit is only called once for each object, apart from BoundingTriangles, as a single ray can hit multiple triangles of a BoundingTriangles mesh.
// index is the index of the hit out of the maximum number of hits found by the function (count).
// The returned boolean indicates whether to keep iterating through all found rayhits, or to stop after the current one.
OnHit func(hit RayHit, index, count int) bool
}
RayTestOptions is a struct designed to control what options to use when performing a ray test.
func (RayTestOptions) AddPosition ¶ added in v0.17.1
func (r RayTestOptions) AddPosition(from, to Vector3) RayTestOptions
AddPosition adds a position pair to cast rays from and to.
func (RayTestOptions) WithDoublesided ¶ added in v0.17.1
func (r RayTestOptions) WithDoublesided(doubleSided bool) RayTestOptions
func (RayTestOptions) WithOnHit ¶ added in v0.17.1
func (r RayTestOptions) WithOnHit(onHit func(hit RayHit, index, count int) bool) RayTestOptions
WithOnHit sets the callback to be called for each hit a cast Ray returns, sorted by distance from the starting point.
func (RayTestOptions) WithTestAgainst ¶ added in v0.17.1
func (r RayTestOptions) WithTestAgainst(iterator NodeIterator) RayTestOptions
type RenderSprite3DSettings ¶ added in v0.18.0
type RenderSprite3DSettings struct {
// The image to render
Image *ebiten.Image
// How much to offset the depth - useful if you want the object to appear at a position,
// but in front of or behind other objects. Negative is towards the camera, positive is away.
// The offset ranges from 0 to 1.
DepthOffset float32
WorldPosition Vector3 // The position of the sprite in 3D space
}
type Scene ¶
type Scene struct {
// Root indicates the root node for the scene hierarchy. For visual Models to be displayed, they must be added to the
// scene graph by simply adding them into the tree via parenting anywhere under the Root. For them to be removed from rendering,
// they simply need to be removed from the tree.
// See this page for more information on how a scene graph works: https://webglfundamentals.org/webgl/lessons/webgl-scene-graph.html
Root *Node
World *World
View3DCameras []*Camera // Any 3D view cameras that were exported from Blender
// contains filtered or unexported fields
}
Scene represents a world of sorts, and can contain a variety of Meshes and Nodes, which organize the scene into a graph of parents and children.
func (*Scene) BitfieldNameByIndex ¶ added in v0.18.0
Returns the name of the bit mask in the specified index. If it can't be found, a blank string is returned.
func (*Scene) BitfieldNameByValue ¶ added in v0.18.0
Returns the name of the bitfield for the given bit mask value. If it can't be found, a blank string is returned.
func (*Scene) BitfieldNames ¶ added in v0.18.0
Returns the names of bits for the Scene.
func (*Scene) BitfieldValueByName ¶ added in v0.18.0
Returns the bitfield value associated with the given name. If it can't be found, a bitfield with the value of 0 is returned.
func (*Scene) Callbacks ¶ added in v0.16.1
func (scene *Scene) Callbacks() *SceneCallbacks
Returns the callbacks object associated with the Scene.
func (*Scene) Get ¶ added in v0.15.0
Get searches a node's hierarchy using a string to find a specified node. The path is in the format of names of nodes, separated by forward slashes ('/'), and is relative to the node you use to call Get. As an example of Get, if you had a cup parented to a desk, which was parented to a room, that was finally parented to the root of the scene, it would be found at "Room/Desk/Cup". Note also that you can use "../" to "go up one" in the hierarchy (so cup.Get("../") would return the Desk node). Since Get uses forward slashes as path separation, it would be good to avoid using forward slashes in your Node names. Also note that Get() trims the extra spaces from the beginning and end of Node Names, so avoid using spaces at the beginning or end of your Nodes' names. Syntactic sugar for Scene.Root.Get().
func (*Scene) HandleAutobatch ¶ added in v0.11.0
func (scene *Scene) HandleAutobatch()
func (*Scene) ID ¶ added in v0.17.0
ID returns the unique ID for this specific scene. Each scene has its own ID.
func (*Scene) Library ¶ added in v0.8.1
Library returns the Library from which this Scene was loaded. If it was created through code and not associated with a Library, this function will return nil.
func (*Scene) Properties ¶ added in v0.11.0
func (scene *Scene) Properties() *Properties
func (*Scene) SetData ¶ added in v0.14.0
SetData sets the Scene's user-customizeable data pointer to whatever you specify (i.e. a backing "Level" instance or something, for example).
type SceneCallbacks ¶ added in v0.16.1
type SceneCallbacks struct {
OnClone func(newScene *Scene) // A callback to be called whenever a Scene is cloned, after all Nodes have been cloned and reparented.
}
type SearchOptions ¶ added in v0.18.0
type SearchOptions struct {
Start INode
// contains filtered or unexported fields
}
Represents a set of options to control searching through a hierarchy of nodes recursively, evaluating filters to find nodes that fit criteria, and do so lazily (e.g. one at a time as necessary). The object can also process the results and output them to a NodeSlice (a slice of Nodes). Note that the filtering options do stack (e.g. if you specify `startingNode.Search().ByNames("Player").ByPropPair("hunger", 100)“, a node would have to be a descendant of `startingNode`, be named "Player", and have a property named "hunger" that has a value of 100 to pass the filters and be considered "found").
func (SearchOptions) ByCustomFunc ¶ added in v0.18.0
func (s SearchOptions) ByCustomFunc(customFunc func(INode) bool) SearchOptions
func (SearchOptions) ByNames ¶ added in v0.18.0
func (s SearchOptions) ByNames(names ...string) SearchOptions
func (SearchOptions) ByNamesPartial ¶ added in v0.18.0
func (s SearchOptions) ByNamesPartial(names ...string) SearchOptions
func (SearchOptions) ByParentNames ¶ added in v0.18.0
func (s SearchOptions) ByParentNames(names ...string) SearchOptions
func (SearchOptions) ByParentNamesPartial ¶ added in v0.18.0
func (s SearchOptions) ByParentNamesPartial(names ...string) SearchOptions
func (SearchOptions) ByParentPropHasBitfieldValue ¶ added in v0.18.0
func (s SearchOptions) ByParentPropHasBitfieldValue(bitValue Bitfield) SearchOptions
func (SearchOptions) ByParentPropHasBitfieldValueByName ¶ added in v0.18.0
func (s SearchOptions) ByParentPropHasBitfieldValueByName(bitfieldValueName string) SearchOptions
func (SearchOptions) ByParentPropNames ¶ added in v0.18.0
func (s SearchOptions) ByParentPropNames(names ...string) SearchOptions
func (SearchOptions) ByParentPropPair ¶ added in v0.18.0
func (s SearchOptions) ByParentPropPair(name string, value any) SearchOptions
func (SearchOptions) ByParentPropValues ¶ added in v0.18.0
func (s SearchOptions) ByParentPropValues(values ...any) SearchOptions
func (SearchOptions) ByParentType ¶ added in v0.18.0
func (s SearchOptions) ByParentType(nt NodeType) SearchOptions
func (SearchOptions) ByPropHasBitfieldValue ¶ added in v0.18.0
func (s SearchOptions) ByPropHasBitfieldValue(bitValue Bitfield) SearchOptions
func (SearchOptions) ByPropHasBitfieldValueByName ¶ added in v0.18.0
func (s SearchOptions) ByPropHasBitfieldValueByName(bitfieldValueName string) SearchOptions
func (SearchOptions) ByPropNames ¶ added in v0.18.0
func (s SearchOptions) ByPropNames(names ...string) SearchOptions
func (SearchOptions) ByPropPair ¶ added in v0.18.0
func (s SearchOptions) ByPropPair(name string, value any) SearchOptions
func (SearchOptions) ByPropValues ¶ added in v0.18.0
func (s SearchOptions) ByPropValues(values ...any) SearchOptions
func (SearchOptions) ByType ¶ added in v0.18.0
func (s SearchOptions) ByType(nt NodeType) SearchOptions
func (SearchOptions) ForEach ¶ added in v0.18.0
func (s SearchOptions) ForEach(forEach func(node INode, index int) bool)
Loops through each node starting with the root node specified when creating the SearchOptions and runs the specified function on the hierarchy if the node has passed the filter options. If the function returns true, the next Node in the hierarchy is returned; if not, the loop is ended prematurely.
func (SearchOptions) Get ¶ added in v0.18.0
func (s SearchOptions) Get(index int) INode
Evaluates and returns the first Node that passes the filter set. If no nodes pass the filter set, the function returns nil.
func (SearchOptions) GetCount ¶ added in v0.18.0
func (s SearchOptions) GetCount() int
Evaluates and returns the number of Nodes that pass the filter set. If no nodes pass the filter set, the function returns 0.
func (SearchOptions) GetFirst ¶ added in v0.18.0
func (s SearchOptions) GetFirst() INode
Evaluates and returns the first Node that passes the filter set. If no nodes pass the filter set, the function returns nil.
func (SearchOptions) GetLast ¶ added in v0.18.0
func (s SearchOptions) GetLast() INode
Evaluates and returns the last Node that passes the filter set. If no nodes pass the filter set, the function returns nil.
func (SearchOptions) GetNodeList ¶ added in v0.18.0
func (s SearchOptions) GetNodeList() NodeList
Evaluates and returns all Nodes that pass the filter set in the form of a NodeList. If a NodeList `out` is passed in, it will be cleared and reused for this purpose to avoid memory allocation. Otherwise, a new one will be allocated for this purpose. If no nodes pass the filter set, the function returns a nil NodeList (slice).
func (SearchOptions) NotNode ¶ added in v0.18.0
func (s SearchOptions) NotNode(node INode) SearchOptions
Returns a copy of SearchOptions with the specified Nodes included as being precluded from testing and searching. Their descendants still are, though.
func (SearchOptions) NotNodes ¶ added in v0.18.0
func (s SearchOptions) NotNodes(nodes NodeIterator) SearchOptions
Returns a copy of SearchOptions with the specified Nodes included as being precluded from testing and searching. Their descendants still are, though.
func (SearchOptions) WithStartingNode ¶ added in v0.18.0
func (s SearchOptions) WithStartingNode(withStartingNode bool) SearchOptions
Returns a copy of SearchOptions with the option to preclude the starting node from being included in the iteration process. Its descendants still are, though.
type Sector ¶ added in v0.12.1
type Sector struct {
Model *Model // The owning Model that forms the Sector
Neighbors Set[*Sector] // The Sector's neighbors
SectorDetectionType SectorDetectionType // How the Sector is detected
// contains filtered or unexported fields
}
Sector represents an area in a game (a sector), and is used for sector-based rendering. When a camera renders a scene with sector-based rendering enabled, the Camera will render only the objects within the current sector and any neighboring sectors, up to a customizeable depth. A Sector is, spatially, an AABB, which sits next to or within other Sectors (AABBs). Logically, a Sector is determined to be a neighbor of another Sector if they either intersect, or share vertex positions. Which of these is the case depends on the Sectors' SectorDetectionType.
func (*Sector) NeighborsWithinRange ¶ added in v0.12.1
NeighborsWithinRange returns the neighboring Sectors within a certain search range. For example, given the following example:
A - B - C - D - E - F ¶
If you were to check NeighborsWithinRange(2) from E, it would return F, D, and C.
func (*Sector) Rendering ¶ added in v0.16.0
Rendering returns if the Sector was rendering as of the last time a Camera rendered Nodes in its Scene. To be rendered, a Camera would have needed to be in the Sector, or in a neighboring sector within the camera's neighbor rendering range.
func (*Sector) UpdateNeighbors ¶ added in v0.12.1
func (sector *Sector) UpdateNeighbors(otherModels NodeIterator)
UpdateNeighbors updates the Sector's neighbors to refresh it, in case it moves. The Neighbors set is updated, not replaced, by this process (so clear the Sector's NeighborSet first if you need to do so).
type SectorDetectionType ¶ added in v0.15.0
type SectorDetectionType int
type SectorType ¶ added in v0.15.0
type SectorType int
const ( SectorTypeObject SectorType = iota SectorTypeSector SectorTypeStandalone )
type Set ¶ added in v0.15.0
type Set[E comparable] map[E]struct{}
Set represents a Set of elements.
func (Set[E]) Add ¶ added in v0.15.0
func (s Set[E]) Add(element E)
Add adds the given elements to a set.
type Text ¶ added in v0.13.0
type Text struct {
Texture *ebiten.Image // The texture used to render text
// contains filtered or unexported fields
}
Text represents a helper object that writes text for display as a texture on a Model's MeshPart. Text objects use a pre-made shader to render.
func NewText ¶ added in v0.13.0
NewText creates a new Text rendering surface for typing out text and assigns the MeshPart provided to use that surface as a texture. If the MeshPart has no Material, then a new one will be created with sane default settings. NewText sets the transparency mode of the material to be transparent, as clip alpha doesn't work properly. textureWidth is how wide (in pixels) the backing texture should be for displaying the text; the height is determined by the aspect ratio of the dimensions of the meshpart given. Text objects update the mesh's material to point to an internal texture, and use a shader as well. If you want to tweak the rendering further, do so on the provided MeshPart after calling NewText(). All changes to the Text require that the Text object updates its texture, which can be costly as this means redrawing the text as necessary; this is handled automatically. Note that for this to work ideally, the mesh cannot be rotated (i.e. the mesh's faces should not be at an angle). The function will return an error if the UV values for the vertices don't cover a large enough range (i.e. if the plane doesn't cover the entire text texture, from 0,0 to 1,1). This isn't necessarily a problem, but can indicate an issue that would make text not render.
func NewTextAutoSize ¶ added in v0.13.0
NewTextAutoSize creates a new Text rendering surface for typing out text, with the backing texture's size calculated from an orthographic Camera's render scale. This is generally useful for UI Text objects. Note that for this to work ideally, the mesh cannot be rotated (i.e. the mesh's faces should not be at an angle). All changes to the Text require that the Text object updates its texture, which can be costly as this means redrawing the text as necessary; this is handled automatically. The function will return an error if the UV values for the vertices don't cover a large enough range (i.e. if the plane doesn't cover the entire text texture, from 0,0 to 1,1). This isn't necessarily a problem, but can indicate an issue that would make text not render.
func (*Text) AdvanceTypewriterIndex ¶ added in v0.13.0
AdvanceTypewriterIndex advances the scroll of the text by the number of characters given. AdvanceTypewriterIndex will return a boolean value indicating if the Text advanced to the end or not.
func (*Text) Dispose ¶ added in v0.13.0
func (text *Text) Dispose()
Dispose disposes of the text object's backing texture; this needs to be called to free VRAM, and should be called whenever the owning Model and Mesh are no longer is going to be used. This also will set the texture of the MeshPart this Text object is tied to, to nil.
func (*Text) FinishTypewriter ¶ added in v0.13.0
func (text *Text) FinishTypewriter()
FinishTypewriter finishes the typewriter effect, so that the entire message is visible.
func (*Text) SetText ¶ added in v0.13.0
SetText sets the text to be displayed for the Text object. arguments can be variables to be displayed in the text string, formatted using fmt.Sprintf()'s formatting rules. Text objects handle automatically splitting newlines based on length to the owning plane mesh's size. Setting the text to be blank clears the text, though Text.ClearText() also exists, and is just syntactic sugar for this purpose. SetText accounts for the margin set in the Text object's active TextStyle, but if it is applied prior to calling SetText().
func (*Text) SetTypewriterIndex ¶ added in v0.13.0
SetTypewriterIndex sets the typewriter scroll of the text to the value given.
func (*Text) SetTypewriterOn ¶ added in v0.15.0
SetTypewriterOn sets the typewriter effect on the Text object.
func (*Text) Text ¶ added in v0.13.0
Text returns the current text that is being displayed for the Text object.
func (*Text) TypewriterFinished ¶ added in v0.13.0
TypewriterFinished returns if the typewriter effect is finished.
func (*Text) TypewriterIndex ¶ added in v0.13.0
TypewriterIndex returns the typewriter index of the Text object.
func (*Text) TypewriterOn ¶ added in v0.15.0
TypewriterOn returns if the typewriter effect is enabled on the Text object.
type TextHorizontalAlignment ¶ added in v0.16.0
type TextHorizontalAlignment int
type TextStyle ¶ added in v0.13.0
type TextStyle struct {
Font font.Face // The font face to use for rendering the text. The size is customizeable, but the DPI should be 72.
Cursor string // A cursor string sequence is drawn at the end while typewriter-ing; defaults to a blank string ("").
LineHeightMultiplier float32 // The multiplier for line height changes.
AlignmentHorizontal TextHorizontalAlignment // How the text should be horizontally aligned in the Text texture.
AlignmentVertical TextVerticalAlignment
BGColor Color4 // The Background color for the text. Defaults to black (0, 0, 0, 1).
FGColor Color4 // The Foreground color for the text. Defaults to white (1, 1, 1, 1).
ShadowDirection Vector3 // A vector indicating direction of the shadow's heading. Defaults to down-right ( {1, 1, 0}, normalized ).
ShadowLength int // The length of the shadow in pixels. Defaults to 0 (no shadow).
ShadowColorNear Color4 // The color of the shadow near the letters. Defaults to black (0, 0, 0, 1).
ShadowColorFar Color4 // The color of the shadow towards the end of the letters. Defaults to black (0, 0, 0, 1).
OutlineThickness int // Overall thickness of the outline in pixels. Defaults to 0 (no outline).
OutlineRounded bool // If the outline is rounded or not. Defaults to false (square outlines).
OutlineColor Color4 // Color of the outline. Defaults to black (0, 0, 0, 1).
// Margin (in pixels) of space to leave around the frame of the texture (left or right, depending on HorizontalAlignment, and from the top). Defaults to 0.
MarginHorizontal, MarginVertical int
// Manual offsets to positioning
OffsetX, OffsetY int
}
func NewDefaultTextStyle ¶ added in v0.13.0
func NewDefaultTextStyle() TextStyle
type TextVerticalAlignment ¶ added in v0.16.0
type TextVerticalAlignment int
type TextureAnimation ¶ added in v0.8.1
type TextureAnimation struct {
FPS float32 // The playback frame per second (or FPS) of the animation
Frames []Vector2 // A slice of vectors, with each indicating the offset of the frame from the original position for the mesh.
}
TextureAnimation is an animation struct. The TextureAnimation.Frames value is a []Vector, with each Vector representing a frame of the animation (and the offset from the original, base position for all animated vertices).
func NewTextureAnimationPixels ¶ added in v0.9.0
func NewTextureAnimationPixels(fps float32, image *ebiten.Image, framePositions ...float32) *TextureAnimation
NewTextureAnimationPixels creates a new TextureAnimation using pixel positions instead of UV values. fps is the frames per second for the animation. image is the source texture used, and framePositions are the positions in pixels for each frame (i.e. 32, 32 instead of 0.25, 0.25 on a 128x128 spritesheet). NewTextureAnimationInPixels will panic if given less than 2 values for framePositions, or if it's an odd number of values (i.e. an X value for a frame, but no matching Y Value).
type TextureFilter ¶ added in v0.18.0
type TextureFilter int
const ( TextureFilterNearest TextureFilter = iota TextureFilterBilinear )
type TexturePlayer ¶ added in v0.8.1
type TexturePlayer struct {
Speed float32 // Speed indicates the playback speed and direction of the TexturePlayer, with a value of 1.0 being 100%.
// contains filtered or unexported fields
}
TexturePlayer is a struct that allows you to animate a collection of vertices' UV values using a TextureAnimation.
func NewTexturePlayer ¶ added in v0.8.1
func NewTexturePlayer(vertexSelection VertexSelection) *TexturePlayer
NewTexturePlayer returns a new TexturePlayer instance.
func (*TexturePlayer) Animation ¶ added in v0.8.1
func (player *TexturePlayer) Animation() *TextureAnimation
Returns the currently playing animation for the TexturePlayer.
func (*TexturePlayer) ApplyUVOffset ¶ added in v0.8.1
func (player *TexturePlayer) ApplyUVOffset(offsetX, offsetY float32)
ApplyUVOffset applies a specified UV offset to all vertices a player is assigned to. This offset is not additive, but rather is set once, regardless of how many times ApplyUVOffset is called.
func (*TexturePlayer) IsPlaying ¶ added in v0.18.0
func (player *TexturePlayer) IsPlaying() bool
func (*TexturePlayer) Play ¶ added in v0.8.1
func (player *TexturePlayer) Play(animation *TextureAnimation)
Play plays the passed TextureAnimation, resetting the playhead if the TexturePlayer is not playing an animation. If the player is not playing, it will begin playing.
func (*TexturePlayer) Reset ¶ added in v0.8.1
func (player *TexturePlayer) Reset(vertexSelection VertexSelection)
Reset resets a TexturePlayer to be ready to run on a new selection of vertices. Note that this also resets the base UV offsets to use the current values of the passed vertices in the slice.
func (*TexturePlayer) SetAnimation ¶ added in v0.18.0
func (player *TexturePlayer) SetAnimation(anim *TextureAnimation)
Sets the currently playing animation for the TexturePlayer.
func (*TexturePlayer) SetPlaying ¶ added in v0.18.0
func (player *TexturePlayer) SetPlaying(isPlaying bool)
func (*TexturePlayer) Update ¶ added in v0.8.1
func (player *TexturePlayer) Update(dt float32)
Update updates the TexturePlayer, using the passed delta time variable to animate the TexturePlayer's vertices.
type Triangle ¶
type Triangle struct {
VertexIndexA int // Vertex indices that compose the triangle
VertexIndexB int // Vertex indices that compose the triangle
VertexIndexC int // Vertex indices that compose the triangle
MaxSpan float32 // The maximum span from corner to corner of the triangle's dimensions; this is used in intersection testing.
Center Vector3 // The untransformed center of the Triangle.
Normal Vector3 // The physical normal of the triangle (i.e. the direction the triangle is facing). This is different from the visual normals of a triangle's vertices (i.e. a selection of vertices can have inverted normals to be see through, for example).
MeshPart *MeshPart // The specific MeshPart this Triangle belongs to.
// contains filtered or unexported fields
}
A Triangle represents the smallest renderable object in Tetra3D. A Triangle is mainly used to help identify triads of vertices.
func NewTriangle ¶
NewTriangle creates a new Triangle, and requires a reference to its owning MeshPart.
func (*Triangle) ForEachVertexIndex ¶ added in v0.11.0
func (*Triangle) ID ¶
ID returns the ID of the triangle in the Mesh, with 1 being the first available ID.
func (*Triangle) IsDegenerate ¶ added in v0.17.0
IsDegenerate returns if the Triangle is composed of vertices where two or more of the vertices share the same position (and so the triangle has no real normal).
func (*Triangle) RecalculateCenter ¶
func (tri *Triangle) RecalculateCenter()
RecalculateCenter recalculates the center for the Triangle. Note that this should only be called if you manually change a vertex's individual position.
func (*Triangle) RecalculateNormal ¶
func (tri *Triangle) RecalculateNormal()
RecalculateNormal recalculates the physical normal for the Triangle. Note that this should only be called if you manually change a vertex's individual position. Also note that vertex normals (visual normals) are automatically set when loading Meshes from model files.
func (*Triangle) ResetVertexNormals ¶ added in v0.16.0
func (tri *Triangle) ResetVertexNormals()
ResetVertexNormals sets all vertex normals associated with the triangle to the triangle's normal.
func (*Triangle) SharesVertexPositions ¶ added in v0.10.0
SharesVertexPosition returns the indices of the vertices of the other Triangle that share indices with the calling Triangle. The last value returned is the count, the number of vertices shared (from 0 to 3). If a vertex is not shared, the value returned for shareA, shareB, or shareC is -1.
func (*Triangle) VertexIndex ¶ added in v0.18.0
type Vector2 ¶ added in v0.16.0
type Vector2 struct {
X float32 // The X (1st) component of the Vector
Y float32 // The Y (2nd) component of the Vector
}
Vector2 represents a 2D Vector2, which can be used for usual 2D applications (position, direction, velocity, etc). Any Vector2 functions that modify the calling Vector2 return copies of the modified Vector2, meaning you can do method-chaining easily.
func NewVector2 ¶ added in v0.16.0
NewVector2 creates a new Vector with the specified x and y components.
func (Vector2) Add ¶ added in v0.16.0
Add returns a copy of the calling vector, added together with the other Vector provided.
func (Vector2) AddMagnitude ¶ added in v0.16.0
AddMagnitude adds magnitude to the Vector in the direction it's already pointing.
func (Vector2) AddX ¶ added in v0.16.0
AddX returns a copy of the calling vector with an added value to the X axis.
func (Vector2) AddY ¶ added in v0.16.0
AddY returns a copy of the calling vector with an added value to the Y axis.
func (Vector2) Angle ¶ added in v0.16.0
Angle returns the signed angle in radians between the calling Vector and the provided other Vector.
func (Vector2) AngleRotation ¶ added in v0.16.0
AngleRotation returns the angle in radians between this Vector and world right (1, 0).
func (Vector2) Ceil ¶ added in v0.17.0
Ceil ceils the Vector's components off, returning a new Vector2. For example, Vector2{0.1, 1.27}.Ceil() will return Vector2{1, 2}.
func (Vector2) ClampAngle ¶ added in v0.16.0
ClampAngle clamps the Vector such that it doesn't exceed the angle specified (in radians). This function returns a normalized (unit) Vector.
func (Vector2) ClampMagnitude ¶ added in v0.16.0
ClampMagnitude clamps the overall magnitude of the Vector to the maximum magnitude specified, returning a copy with the result.
func (Vector2) ClampToVec ¶ added in v0.18.0
ClampToVec clamps the Vector2 to the maximum values in the Vector2 provided.
func (Vector2) Clone ¶ added in v0.17.0
This clones the Vector3 - this doesn't do anything by itself, but is useful for consistency between other API elements and when used with scripting languages like goja.
func (Vector2) DistanceSquaredTo ¶ added in v0.17.0
Distance returns the squared distance from the calling Vector to the other Vector provided. This is faster than Distance(), as it avoids using math.math32.Sqrt().
func (Vector2) DistanceTo ¶ added in v0.17.0
Distance returns the distance from the calling Vector to the other Vector provided.
func (Vector2) Divide ¶ added in v0.16.0
Divide divides a Vector by the given scalar, returning a copy with the result.
func (Vector2) Equals ¶ added in v0.16.0
Equals returns true if the two Vectors are close enough in all values (excluding W).
func (Vector2) Expand ¶ added in v0.16.0
Expand expands the Vector by the margin specified, in absolute units, if each component is over the minimum argument. To illustrate: Given a Vector of {1, 0.1, -0.3}, Vector.Expand(0.5, 0.2) would give you a Vector of {1.5, 0.1, -0.8}. This function returns a copy of the Vector with the result.
func (Vector2) Floats ¶ added in v0.16.0
Floats returns a [2]float32 array consisting of the Vector's contents.
func (Vector2) Floor ¶ added in v0.17.0
Floor floors the Vector's components off, returning a new Vector2. For example, Vector2{0.1, 1.87}.Floor() will return Vector2{0, 1}.
func (Vector2) Invert ¶ added in v0.16.0
Invert returns a copy of the Vector with all components inverted.
func (Vector2) IsZero ¶ added in v0.16.0
IsZero returns true if the values in the Vector are extremely close to 0 (excluding W).
func (Vector2) Lerp ¶ added in v0.16.0
Lerp performs a linear interpolation between the starting Vector and the provided other Vector, to the given percentage (ranging from 0 to 1).
func (Vector2) MagnitudeSquared ¶ added in v0.16.0
MagnitudeSquared returns the squared length of the Vector; this is faster than Length() as it avoids using math.math32.Sqrt().
func (Vector2) Modify ¶ added in v0.18.0
func (v Vector2) Modify() *ModVector2
func (Vector2) MoveTowards ¶ added in v0.17.0
MoveTowards moves a Vector2 towards another Vector2 given a specific magnitude. If the distance is less than that magnitude, it returns the target vector.
func (Vector2) Mult ¶ added in v0.16.0
Mult performs Hadamard (component-wise) multiplication on the calling Vector with the other Vector provided, returning a copy with the result.
func (Vector2) Perp ¶ added in v0.16.0
Perp returns the right-handed perpendicular of the vector (i.e. the vector rotated 90 degrees to the right, clockwise).
func (Vector2) Reflect ¶ added in v0.16.0
Reflect reflects the vector against the given surface normal.
func (Vector2) Rotate ¶ added in v0.16.0
Rotate returns a copy of the Vector, rotated around an axis that pierces the screen by the angle provided (in radians), counter-clockwise.
func (Vector2) Round ¶ added in v0.16.0
Round rounds off the Vector's components to the given space in world unit increments, returning a clone (e.g. Vector{0.1, 1.27, 3.33}.Snap(0.25) will return Vector{0, 1.25, 3.25}).
func (Vector2) Scale ¶ added in v0.16.0
Scale scales a Vector by the given scalar, returning a copy with the result.
func (*Vector2) Set ¶ added in v0.16.0
Set sets the values in the Vector3 to the values in the other Vector2.
func (*Vector2) SetToZero ¶ added in v0.18.0
func (vec *Vector2) SetToZero()
Sets the components of the Vector2 to zero.
func (Vector2) SetX ¶ added in v0.16.0
SetX sets the X component in the vector to the value provided.
func (Vector2) SetXY ¶ added in v0.17.0
SetXY sets the values in the Vector to the x, y, and z values provided.
func (Vector2) SetY ¶ added in v0.16.0
SetY sets the Y component in the vector to the value provided.
func (Vector2) Slerp ¶ added in v0.16.0
Slerp performs a spherical linear interpolation between the starting Vector and the provided ending Vector, to the given percentage (ranging from 0 to 1). This should be done with directions, usually, rather than positions. This being the case, this normalizes both Vectors.
func (Vector2) Sub ¶ added in v0.16.0
Sub returns a copy of the calling Vector, with the other Vector subtracted from it.
func (Vector2) SubMagnitude ¶ added in v0.16.0
SubMagnitude subtracts the given magnitude from the Vector's existing magnitude. If the vector's magnitude is less than the given magnitude to subtract, a zero-length Vector will be returned.
func (Vector2) SubX ¶ added in v0.16.0
SubX returns a copy of the calling vector with an added value to the X axis.
func (Vector2) SubY ¶ added in v0.16.0
SubY returns a copy of the calling vector with an added value to the Y axis.
func (Vector2) Swizzle2 ¶ added in v0.17.0
Swizzle2 swizzles the Vector3 using the string provided, returning the swizzled copy as a Vector2. The string should be composed of the axes of a vector, i.e. 'x', 'y', 'z', or 'w'. If the string is shorter than 3 values, the remaining values are left at 0. Example: `vec := Vector{1, 2, 3}.Swizzle2("-z-x") // Returns a Vector2 of {-3, -1}.`
func (Vector2) Swizzle3 ¶ added in v0.17.0
Swizzle3 swizzles the Vector3 using the string provided, returning the swizzled copy. The string should be composed of the axes of a vector, i.e. 'x', 'y', or 'z'. If the string is shorter than 3 values, the remaining values are left at 0. '-' negates the next axis. Example: `vec := Vector{1, 2, 3}.Swizzle3("z x -y") // Returns a Vector3 of {3, 1, -2}.`
type Vector3 ¶ added in v0.16.0
type Vector3 struct {
X float32 // The X (1st) component of the Vector
Y float32 // The Y (2nd) component of the Vector
Z float32 // The Z (3rd) component of the Vector
}
Vector3 represents a 3D Vector3, which can be used for usual 3D applications (position, direction, velocity, etc). The fourth component, W, can be ignored and is used for internal Tetra3D usage. Any Vector3 functions that modify the calling Vector3 return copies of the modified Vector3, meaning you can do method-chaining easily. Vectors seem to be most efficient when copied (so try not to store pointers to them if possible, as dereferencing pointers can be more inefficient than directly acting on data, and storing pointers moves variables to heap).
func NearestPointOnLine ¶ added in v0.18.0
NearestPointOnLine returns the closest point along a line spanning from start to end.
func NewVector3 ¶ added in v0.16.0
NewVector3 creates a new Vector3 with the specified x, y, and z components. The W component is generally ignored for most purposes.
func NewVector3Random ¶ added in v0.16.0
NewVector3Random creates a new random vector with components ranging between the minimum and maximum values provided.
func (Vector3) Add ¶ added in v0.16.0
Add returns a copy of the calling vector, added together with the other Vector3 provided.
func (Vector3) AddMagnitude ¶ added in v0.17.1
AddMagnitude returns a copy of the Vector3 with the given magnitude subtracted from it. If the vector's magnitude is less than the given magnitude to subtract, a zero-length Vector3 will be returned.
func (Vector3) AddX ¶ added in v0.16.1
AddX returns a copy of the calling vector, with the value provided added to the X component.
func (Vector3) AddXYZ ¶ added in v0.18.0
Returns a copy of the calling vector, with the values provided added.
func (Vector3) AddY ¶ added in v0.16.1
AddY returns a copy of the calling vector, with the value provided added to the Y component.
func (Vector3) AddZ ¶ added in v0.16.1
AddZ returns a copy of the calling vector, with the value provided added to the Z component.
func (Vector3) Angle ¶ added in v0.16.0
Angle returns the angle in radians between the calling Vector3 and the provided other Vector3.
func (Vector3) AngleSigned ¶ added in v0.16.0
AngleSigned returns the signed angle between the calling Vector and the other Vector, with planeNormal indicating the plane that both vectors share. In other words, if you want the signed angle between Vector3 A and Vector3 B, and the vectors differ only on two axes (say, X and Z), then the planeNormal Vector3 would be the cross product of these two Vectors (a Vector3 pointing "up", or Y+).
func (Vector3) Ceil ¶ added in v0.16.0
Ceil ceils the Vector's components off, returning a new Vector. For example, Vector{0.1, 1.27, 3.33}.Ceil() will return Vector{1, 2, 4}.
func (Vector3) ClampAngle ¶ added in v0.16.0
ClampAngle clamps the Vector3 such that it doesn't exceed the angle specified (in radians) between it and the baseline Vector.
func (Vector3) ClampMagnitude ¶ added in v0.16.0
ClampMagnitude clamps the overall magnitude of the Vector3 to the maximum magnitude specified, returning a copy with the result. If the magnitude is less than that maximum magnitude, the vector is unmodified.
func (Vector3) ClampToDimensions ¶ added in v0.17.0
func (vec Vector3) ClampToDimensions(dim Dimensions) Vector3
ClampToDimensions limits the provided position vector to be within the dimensions set.
func (Vector3) ClampToVec ¶ added in v0.17.0
ClampToVec clamps the Vector3 to the maximum values in the Vector3 provided.
func (Vector3) Clone ¶ added in v0.17.0
This clones the Vector3 - this doesn't do anything by itself, but is useful for consistency between other API elements and when used with scripting languages like goja.
func (Vector3) Cross ¶ added in v0.16.0
Cross returns a new Vector, indicating the cross product of the calling Vector3 and the provided Other Vector. This function ignores the W component of both Vectors.
func (Vector3) DistanceSquaredTo ¶ added in v0.16.1
DistanceSquaredTo returns the squared distance from the calling Vector3 to the other Vector3 provided. This is faster than Distance(), as it avoids using math32.Sqrt().
func (Vector3) DistanceTo ¶ added in v0.16.1
DistanceTo returns the distance from the calling Vector3 to the other Vector3 provided.
func (Vector3) Divide ¶ added in v0.16.0
Divide divides a Vector3 by the given scalar, returning a copy with the result.
func (Vector3) Equals ¶ added in v0.16.0
Equals returns true if the two Vectors are close enough in all values (excluding W).
func (Vector3) Expand ¶ added in v0.16.0
Expand expands the Vector3 by the margin specified, in absolute units, if each component is over the minimum argument. To illustrate: Given a Vector3 of {1, 0.1, -0.3}, Vector.Expand(0.5, 0.2) would give you a Vector3 of {1.5, 0.1, -0.8}. This function returns a copy of the Vector3 with the result.
func (Vector3) Floats ¶ added in v0.16.0
Floats returns a [4]float32 array consisting of the Vector's contents.
func (Vector3) Floor ¶ added in v0.16.0
Floor floors the Vector's components off, returning a new Vector. For example, Vector{0.1, 1.87, 3.33}.Floor() will return Vector{0, 1, 3}.
func (Vector3) Invert ¶ added in v0.16.0
Invert returns a copy of the Vector3 with all components inverted (ignoring the Vector's W component).
func (Vector3) IsZero ¶ added in v0.16.0
IsZero returns true if all of the values in the Vector3 are extremely close to 0 (excluding W).
func (Vector3) Lerp ¶ added in v0.16.0
Lerp performs a linear interpolation between the starting Vector3 and the provided other Vector, to the given percentage (ranging from 0 to 1).
func (Vector3) Magnitude ¶ added in v0.16.0
Magnitude returns the length of the Vector3 (ignoring the Vector's W component).
func (Vector3) MagnitudeSquared ¶ added in v0.16.0
MagnitudeSquared returns the squared length of the Vector3 (ignoring the Vector's W component); this is faster than Length() as it avoids using math32.Sqrt().
func (*Vector3) Modify ¶ added in v0.16.0
func (vec *Vector3) Modify() *ModVector3
Modify returns a ModVector3 object (a pointer to the original vector).
func (Vector3) MoveTowards ¶ added in v0.16.0
MoveTowards moves a Vector3 towards another Vector3 given a specific magnitude. If the distance is less than that magnitude, it returns the target vector.
func (Vector3) Mult ¶ added in v0.16.0
Mult performs Hadamard (component-wise) multiplication on the calling Vector3 with the other Vector3 provided, returning a copy with the result (and ignoring the Vector's W component).
func (Vector3) Reflect ¶ added in v0.17.1
Reflect reflects the vector against the given surface normal.
func (Vector3) Rotate ¶ added in v0.16.0
Rotate returns a copy of the Vector, rotated around an axis Vector3 with the x, y, and z components provided, by the angle provided (in radians), counter-clockwise. The function is most efficient if passed an orthogonal, normalized axis (i.e. the X, Y, or Z constants).
func (Vector3) RotateVec ¶ added in v0.16.0
Rotate returns a copy of the Vector, rotated around the Vector3 axis provided by the angle provided (in radians). The function is most efficient if passed an orthogonal, normalized axis (i.e. the X, Y, or Z constants).
func (Vector3) Round ¶ added in v0.16.0
Round rounds the Vector's components off to the given increments, returning a new Vector. For example, Vector{0.1, 1.47, 3.33}.Round(0.25) will return Vector{0, 1.5, 3.25}.
func (Vector3) Scale ¶ added in v0.16.0
Scale scales a Vector3 by the given scalar, returning a copy with the result.
func (*Vector3) Set ¶ added in v0.16.0
Set sets the values in the Vector3 to the values in the other Vector3.
func (*Vector3) SetToZero ¶ added in v0.18.0
func (vec *Vector3) SetToZero()
Sets the components of the Vector3 to zero.
func (Vector3) SetX ¶ added in v0.16.0
SetX sets the X component in the vector to the value provided.
func (Vector3) SetXYZ ¶ added in v0.17.0
SetXYZ sets the values in the Vector3 to the x, y, and z values provided.
func (Vector3) SetY ¶ added in v0.16.0
SetY sets the Y component in the vector to the value provided.
func (Vector3) SetZ ¶ added in v0.16.0
SetZ sets the Z component in the vector to the value provided.
func (Vector3) Slerp ¶ added in v0.16.0
Slerp performs a spherical linear interpolation between the starting Vector3 and the provided ending Vector, to the given percentage (ranging from 0 to 1). A slerp rotates a Vector3 around to a desired end Vector, rather than linearly interpolating to it. This normalizes the resulting Vector.
func (Vector3) SlideAgainst ¶ added in v0.18.0
Returns the Vector "slid against" the reflecting normal.
func (Vector3) Slope ¶ added in v0.18.0
Slope returns the vertical slope of the vector in radians. This ranges from 0 (straight up, [0, 1, 0]) to 1 (straight down, [0, -1, 0]).
func (Vector3) String ¶ added in v0.16.0
String returns a string representation of the Vector, excluding its W component (which is primarily used for internal purposes).
func (Vector3) Sub ¶ added in v0.16.0
Sub returns a copy of the calling Vector, with the other Vector3 subtracted from it.
func (Vector3) SubMagnitude ¶ added in v0.16.0
SubMagnitude returns a copy of the Vector3 with the given magnitude subtracted from it. If the vector's magnitude is less than the given magnitude to subtract, a zero-length Vector3 will be returned.
func (Vector3) SubX ¶ added in v0.16.1
SubX returns a copy of the calling vector, with the value provided subtracted from the X component.
func (Vector3) SubXYZ ¶ added in v0.18.0
Returns a copy of the calling vector, with the value provided subtracted from the given components.
func (Vector3) SubY ¶ added in v0.16.1
SubY returns a copy of the calling vector, with the value provided subtracted from the Y component.
func (Vector3) SubZ ¶ added in v0.16.1
SubZ returns a copy of the calling vector, with the value provided subtracted from the Z component.
func (Vector3) Swizzle2 ¶ added in v0.17.0
Swizzle2 swizzles the Vector3 using the string provided, returning the swizzled copy as a Vector2. The string should be composed of the axes of a vector, i.e. 'x', 'y', 'z', or 'w'. If the string is shorter than 3 values, the remaining values are left at 0. Example: `vec := Vector{1, 2, 3}.Swizzle2("-z-x") // Returns a Vector2 of {-3, -1}.`
func (Vector3) Swizzle3 ¶ added in v0.17.0
Swizzle3 swizzles the Vector3 using the string provided, returning the swizzled copy. The string should be composed of the axes of a vector, i.e. 'x', 'y', or 'z'. If the string is shorter than 3 values, the remaining values are left at 0. '-' negates the next axis. Example: `vec := Vector{1, 2, 3}.Swizzle3("z x -y") // Returns a Vector3 of {3, 1, -2}.`
type Vector3Range ¶ added in v0.18.0
type Vector3Range struct {
Uniform bool // If the random value returned by the NumberRange should be consistent across all axes or not
Min Vector3 // Min is the set of minimum numbers allowed in the NumberRange
Max Vector3 // Max is the set of maximum numbers allowed in the NumberRange
// contains filtered or unexported fields
}
Vector3Range represents a range of possible values, and allows Tetra3D to get a random value from within that number range.
func NewVectorRange ¶ added in v0.10.0
func NewVectorRange() Vector3Range
NewVectorRange returns a new instance of a 3D NumberRange struct.
func (*Vector3Range) SetAll ¶ added in v0.18.0
func (ran *Vector3Range) SetAll(value float32)
SetAll sets the minimum and maximum values of all components of the number range at the same time to the value passed.
func (*Vector3Range) SetAxes ¶ added in v0.18.0
func (ran *Vector3Range) SetAxes(x, y, z float32)
SetAxes sets the minimum and maximum values of all components of the number range at the same time. Both minimum and maximum boundaries of the NumberRange will be the same.
func (*Vector3Range) SetCustomFunc ¶ added in v0.18.0
func (ran *Vector3Range) SetCustomFunc(customFunc func(nRange *Vector3Range) Vector3)
Sets a custom function to return a Vector3 for use with the range object. Note that you can use the range object's Value() function to get its default randomized result.
func (*Vector3Range) SetRangeX ¶ added in v0.18.0
func (ran *Vector3Range) SetRangeX(min, max float32)
SetRangeX sets the minimum and maximum values of the X component of the number range.
func (*Vector3Range) SetRangeY ¶ added in v0.18.0
func (ran *Vector3Range) SetRangeY(min, max float32)
SetRangeY sets the minimum and maximum values of the Y component of the number range.
func (*Vector3Range) SetRangeZ ¶ added in v0.18.0
func (ran *Vector3Range) SetRangeZ(min, max float32)
SetRangeZ sets the minimum and maximum values of the Z component of the number range.
func (*Vector3Range) SetRanges ¶ added in v0.18.0
func (ran *Vector3Range) SetRanges(min, max float32)
SetRanges sets the minimum and maximum values of all components (axes) of the number range.
func (Vector3Range) Value ¶ added in v0.18.0
func (ran Vector3Range) Value() Vector3
Value returns a random value from within the bounds of the NumberRange.
type Vector4 ¶ added in v0.16.0
type Vector4 struct {
X float32 // The X (1st) component of the Vector
Y float32 // The Y (2nd) component of the Vector
Z float32 // The Z (3rd) component of the Vector
W float32 // The w (4th) component of the Vector; not used for most Vector3 functions
}
func (Vector4) Invert ¶ added in v0.16.0
Invert returns a copy of the Vector3 with all components inverted (ignoring the Vector's W component).
func (Vector4) Magnitude ¶ added in v0.16.0
Magnitude returns the length of the Vector3 (ignoring the Vector's W component).
func (Vector4) Round ¶ added in v0.16.0
Round rounds the Vector's components off to the given increments, returning a new Vector. For example, Vector{0.1, 1.47, 3.33}.Round(0.25) will return Vector{0, 1.5, 3.25}.
type VertexColorChannel ¶ added in v0.16.0
type VertexColorChannel struct {
// contains filtered or unexported fields
}
VertexColorChannel represents the colors of vertices in a channel. Each value in the color channel is a color for the vertex in the associated index.
func (VertexColorChannel) Clone ¶ added in v0.17.1
func (v VertexColorChannel) Clone() *VertexColorChannel
func (VertexColorChannel) Colors ¶ added in v0.18.0
func (v VertexColorChannel) Colors() []Color4
func (VertexColorChannel) IsZero ¶ added in v0.18.0
func (v VertexColorChannel) IsZero() bool
func (VertexColorChannel) Name ¶ added in v0.18.0
func (v VertexColorChannel) Name() string
type VertexInfo ¶ added in v0.9.0
type VertexInfo struct {
ID int
X, Y, Z float32
U, V float32
NormalX, NormalY, NormalZ float32
Weights []float32
Colors []Color4
Bones []uint16
}
func NewVertex ¶
func NewVertex(x, y, z, u, v float32) VertexInfo
NewVertex creates a new vertex information struct, which is used to create new Triangles. VertexInfo is purely for getting data into Meshes' vertex buffers, so after creating the Triangle, VertexInfos can be safely discarded (i.e. the VertexInfo doesn't hold "power" over the vertex it represents after creation).
type VertexSelection ¶ added in v0.9.0
VertexSelection represents a selection of vertices on a Mesh.
func NewVertexSelection ¶ added in v0.9.0
func NewVertexSelection(mesh *Mesh) VertexSelection
NewVertexSelection allows you to select some vertices of a Mesh. By default, no vertices of the Mesh are selected.
func (VertexSelection) ApplyMatrix ¶ added in v0.9.0
func (vs VertexSelection) ApplyMatrix(matrix Matrix4)
ApplyMatrix applies a Matrix4 to the position of all vertices contained within the VertexSelection.
func (*VertexSelection) Clear ¶ added in v0.16.0
func (vs *VertexSelection) Clear()
func (VertexSelection) Clone ¶ added in v0.18.0
func (vs VertexSelection) Clone() VertexSelection
func (VertexSelection) Contains ¶ added in v0.18.0
func (vs VertexSelection) Contains(index int) bool
func (VertexSelection) Count ¶ added in v0.16.0
func (vs VertexSelection) Count() int
Count returns the number of indices selected in the VertexSelection.
func (VertexSelection) ForEachIndex ¶ added in v0.15.0
func (vs VertexSelection) ForEachIndex(forEach func(mesh *Mesh, index int))
ForEachIndex calls the provided function for each index selected in the VertexSelection.
func (VertexSelection) IsEmpty ¶ added in v0.16.0
func (vs VertexSelection) IsEmpty() bool
func (VertexSelection) Move ¶ added in v0.9.0
func (vs VertexSelection) Move(x, y, z float32)
Move moves all vertices contained within the VertexSelection by the provided x, y, and z values.
func (VertexSelection) MoveUVs ¶ added in v0.14.0
func (vs VertexSelection) MoveUVs(dx, dy float32)
MoveUVs moves the UV values by the values specified.
func (*VertexSelection) MoveUVsVec ¶ added in v0.14.0
func (vs *VertexSelection) MoveUVsVec(vec Vector2)
MoveUVsVec moves the UV values by the Vector values specified.
func (VertexSelection) MoveVec ¶ added in v0.9.0
func (vs VertexSelection) MoveVec(vec Vector3)
Move moves all vertices contained within the VertexSelection by the provided 3D vector.
func (VertexSelection) RotateUVs ¶ added in v0.14.0
func (vs VertexSelection) RotateUVs(rotation float32)
RotateUVs rotates the UV values around the center of the UV values for the mesh in radians
func (VertexSelection) ScaleUVs ¶ added in v0.16.0
func (vs VertexSelection) ScaleUVs(px, py float32)
ScaleUVs scales the UV values by the percentages specified.
func (*VertexSelection) ScaleUVsVec ¶ added in v0.17.0
func (vs *VertexSelection) ScaleUVsVec(vec Vector2)
ScaleUVsVec scales the UV values by the Vector values specified.
func (VertexSelection) SelectAll ¶ added in v0.9.0
func (vs VertexSelection) SelectAll() VertexSelection
Selects all vertices in the Mesh.
func (VertexSelection) SelectByFunc ¶ added in v0.18.0
func (vs VertexSelection) SelectByFunc(function func(index int) bool) VertexSelection
Selects vertex indices for vertices that pass a custom callback function. Vertices be added to the selection only if the function returns true.
func (VertexSelection) SelectByNormal ¶ added in v0.18.0
func (vs VertexSelection) SelectByNormal(normal Vector3) VertexSelection
Selects vertex indices that belong to vertices that point in a specific direction.
func (VertexSelection) SelectIndices ¶ added in v0.15.0
func (vs VertexSelection) SelectIndices(indices ...int) VertexSelection
Selects the passed vertex indices in the Mesh.
func (VertexSelection) SelectMaterialName ¶ added in v0.18.0
func (vs VertexSelection) SelectMaterialName(materialNames ...string) VertexSelection
SelectMaterialName selects all vertices in the Mesh belonging to mesh parts with materials with any of the specified names.
func (VertexSelection) SelectMeshPart ¶ added in v0.9.0
func (vs VertexSelection) SelectMeshPart(meshParts ...*MeshPart) VertexSelection
Selects all vertices in the Mesh belonging to any of the specified MeshParts.
func (VertexSelection) SelectMeshPartIndex ¶ added in v0.18.0
func (vs VertexSelection) SelectMeshPartIndex(meshpartIndex int) VertexSelection
Selects all vertices in the Mesh belonging to the specified MeshPart by index. If a MeshPart with the given index doesn't exist, this function will do nothing.
func (VertexSelection) SelectRange ¶ added in v0.18.0
func (vs VertexSelection) SelectRange(start, end int) VertexSelection
Selects the vertex indices in the given range in the Mesh.
func (VertexSelection) SelectSharedVertices ¶ added in v0.16.0
func (vs VertexSelection) SelectSharedVertices() VertexSelection
Selects vertices that share positions with already-selected vertices.
func (VertexSelection) SelectTriangles ¶ added in v0.16.0
func (vs VertexSelection) SelectTriangles(triangles ...*Triangle) VertexSelection
Selects the vertex indices composing the triangles passed.
func (VertexSelection) SelectVertexColorChannelNames ¶ added in v0.18.0
func (vs VertexSelection) SelectVertexColorChannelNames(channelNames ...string) VertexSelection
Selects all vertices in the Mesh that have a non-pure black color in the vertex color channel with any of the specified names.
func (VertexSelection) SelectVertexGroupNames ¶ added in v0.18.0
func (vs VertexSelection) SelectVertexGroupNames(vertexGroupNames ...string) VertexSelection
Selects all vertices in the Mesh that are assigned to the specified vertex groups. If a vertex group name is not found, the function will continue. Vertex groups are only exported through Tetra3D if the mesh is skinned / assigned to an armature.
func (VertexSelection) SetColor ¶ added in v0.9.0
func (vs VertexSelection) SetColor(channel *VertexColorChannel, color Color4)
SetColor sets the color of the specified channel in all vertices contained within the VertexSelection to the provided Color. If the channelIndex provided is greater than the number of channels in the Mesh minus one, vertex color channels will be created for all vertices up to the index provided (e.g. VertexSelection.SetColor(2, colors.White()) will make it so that the mesh has at least three color channels - 0, 1, and 2).
func (VertexSelection) SetNormal ¶ added in v0.10.0
func (vs VertexSelection) SetNormal(normal Vector3)
SetNormal sets the normal of all vertices contained within the VertexSelection to the provided normal vector.
func (VertexSelection) SetPositionOffset ¶ added in v0.18.0
func (vs VertexSelection) SetPositionOffset(x, y, z float32)
Moves all vertex position values for vertices selected to be offset by the values specified, with [0, 0, 0] being their original locations.
func (VertexSelection) SetPositionOffsetVec ¶ added in v0.18.0
func (vs VertexSelection) SetPositionOffsetVec(vec Vector3)
Moves all vertex position values for vertices selected to be offset by the values specified, with [0, 0, 0] being their original locations.
func (VertexSelection) SetUVOffset ¶ added in v0.16.0
func (vs VertexSelection) SetUVOffset(x, y float32)
SetUVOffset moves all UV values for vertices selected to be offset by the values specified, with [0, 0] being their original locations.
func (VertexSelection) SetUVOffsetVec ¶ added in v0.17.0
func (vs VertexSelection) SetUVOffsetVec(vec Vector2)
SetUVOffsetVec moves all UV values for vertices selected to be offset by the values specified, with [0, 0] being their original locations.
type World ¶ added in v0.10.0
type World struct {
Name string
ClearColor Color4 // The clear color of the screen; note that this doesn't clear the color of the camera buffer or screen automatically;
// this is just what the color is if the scene was exported using the Tetra3D addon from Blender. It's up to you as to how you'd like to
// use it.
FogColor Color4 // The Color of any fog present in the Scene.
FogMode FogBlendMode // The FogMode, indicating how the fog color is blended if it's on (not FogOff).
// FogRange is the depth range at which the fog is active. FogRange consists of two numbers,
// ranging from 0 to 1. The first indicates the start of the fog, and the second the end, in
// terms of total depth of the near / far clipping plane. The default is [0, 1].
FogOn bool
DitheredFogSize float32 // If greater than zero, how large the dithering effect is for transparent fog. If <= 0, dithering is disabled.
FogRange []float32 // The distances at which the fog is at 0% and 100%, respectively.
FogCurve FogCurve
LightingOn bool // If lighting is enabled when rendering the scene.
AmbientLight *AmbientLight // Ambient lighting for this world
// contains filtered or unexported fields
}
World represents a collection of settings that one uses to control lighting and ambience. This includes the screen clear color, fog color, mode, and range, whether lighting is globally enabled or not, and finally the ambient lighting level (using the World's AmbientLight).
func NewWorld ¶ added in v0.10.0
NewWorld creates a new World with the specified name and default values for fog, lighting, etc).
Source Files
¶
- animation.go
- bounds.go
- boundsAABB.go
- boundsCapsule.go
- boundsSphere.go
- boundsTriangles.go
- broadphase.go
- callbacks.go
- camera.go
- color.go
- gltf.go
- grid.go
- library.go
- light.go
- lightGroup.go
- material.go
- matrix.go
- mesh.go
- model.go
- node.go
- nodesearch.go
- particles.go
- path.go
- properties.go
- quaternion.go
- ray.go
- scene.go
- sector.go
- sortingTriangles.go
- tetra3d.go
- text.go
- textureAnimation.go
- utils.go
- vector.go
- world.go
Directories
¶
| Path | Synopsis |
|---|---|
|
package colors contains functions to quickly and easily generate tetra3d.Color instances by name (i.e.
|
package colors contains functions to quickly and easily generate tetra3d.Color instances by name (i.e. |
|
3dSprite
command
|
|
|
animatedTextures
command
|
|
|
animation
command
|
|
|
animation_queueing
command
|
|
|
autoBatch
command
|
|
|
baking
command
|
|
|
blendmodes
command
|
|
|
bounds
command
|
|
|
cameraTest
command
|
|
|
collections
command
|
|
|
engine
command
|
|
|
grids
command
|
|
|
grids2
command
|
|
|
lightgroups
command
|
|
|
lighting
command
|
|
|
lightvolume
command
|
|
|
offscreen
command
|
|
|
orthographic
command
|
|
|
parenting
command
|
|
|
particles
command
|
|
|
paths
command
|
|
|
properties
command
|
|
|
rays
command
|
|
|
sectors
command
|
|
|
shader
command
|
|
|
shapes
command
|
|
|
simple
command
|
|
|
skeletal2d
command
|
|
|
stress
command
|
|
|
stress2
command
|
|
|
text
command
|
|
|
transparency
command
|
|
|
vertexSelection
command
|
|
|
worlds
command
|
|
|
math32 is a stand-in for the built-in math package, but the functions take at least float32s (if not all comparable numbers) instead of float64s.
|
math32 is a stand-in for the built-in math package, but the functions take at least float32s (if not all comparable numbers) instead of float64s. |
