Documentation
¶
Overview ¶
Package simd_vector 提供SIMD优化的向量计算功能
Index ¶
- Constants
- Variables
- func AbsInt(x int) int
- func ApplyUVModifierToMesh(mesh *Mesh, modifier *UVModifier)
- func ApplyUVRelaxation(mesh *Mesh, settings *UVRelaxationSettings) error
- func Clamp(x, lo, hi float64) float64
- func ClampInt(x, lo, hi int) int
- func Degrees(radians float64) float64
- func InterpolateFloats(v1, v2, v3 float64, b VectorW) float64
- func IsKTX2File(data []byte) bool
- func LoadImage(path string) (image.Image, error)
- func PrintUVModifierInfo(modifier *UVModifier)
- func Radians(degrees float64) float64
- func RelaxUVs(island *UVIsland, settings *UVRelaxationSettings)
- func Round(a float64) int
- func RoundPlaces(a float64, places int) float64
- func SIMDVectorDistance(a, b Vector) float64
- func SIMDVectorDot(a, b Vector) float64
- func SavePNG(path string, im image.Image) error
- func UVToCanvas(uv Vector2, canvasWidth, canvasHeight int) (int, int)
- type AdvancedTexture
- func (t *AdvancedTexture) BilinearSample(u, v float64) Color
- func (t *AdvancedTexture) GenerateMipmaps()
- func (t *AdvancedTexture) Sample(u, v float64) Color
- func (t *AdvancedTexture) SampleHeight(u, v float64) float64
- func (t *AdvancedTexture) SampleNormal(u, v float64) Vector
- func (t *AdvancedTexture) SampleSingleChannel(u, v float64, channel int) float64
- func (t *AdvancedTexture) SampleWithFilter(u, v float64, filter TextureFilter) Color
- type AlphaMode
- type Animation
- type AnimationChannel
- type AnimationPlayer
- func (player *AnimationPlayer) AddAnimation(name string, animation *Animation)
- func (player *AnimationPlayer) Pause()
- func (player *AnimationPlayer) Play(name string) bool
- func (player *AnimationPlayer) Resume()
- func (player *AnimationPlayer) SetPlaySpeed(speed float64)
- func (player *AnimationPlayer) Stop()
- func (player *AnimationPlayer) Update(deltaTime float64)
- type AnimationProperty
- type BloomEffect
- type BlurEffect
- type Box
- func (a Box) Anchor(anchor Vector) Vector
- func (a Box) Center() Vector
- func (a Box) Contains(b Vector) bool
- func (a Box) Extend(b Box) Box
- func (a Box) Intersection(b Box) Box
- func (a Box) Intersects(b Box) bool
- func (a Box) Offset(x float64) Box
- func (a Box) Size() Vector
- func (a Box) Transform(m Matrix) Box
- func (a Box) Translate(v Vector) Box
- type Camera
- type CascadeShadowMap
- type ChannelTypeQualifiers
- type ChromaticAberrationEffect
- type Color
- func (a Color) Add(b Color) Color
- func (a Color) AddScalar(b float64) Color
- func (a Color) Alpha(alpha float64) Color
- func (a Color) Div(b Color) Color
- func (a Color) DivScalar(b float64) Color
- func (a Color) Lerp(b Color, t float64) Color
- func (a Color) Max(b Color) Color
- func (a Color) Min(b Color) Color
- func (a Color) Mul(b Color) Color
- func (a Color) MulScalar(b float64) Color
- func (a Color) NRGBA() color.NRGBA
- func (a Color) Opaque() Color
- func (a Color) Pow(b float64) Color
- func (a Color) Sub(b Color) Color
- func (a Color) SubScalar(b float64) Color
- type ColorGradingEffect
- type ColorModel
- type ColorPrimaries
- type CompositeEffect
- type Context
- func (dc *Context) ClearColorBuffer()
- func (dc *Context) ClearColorBufferWith(color Color)
- func (dc *Context) ClearDepthBuffer()
- func (dc *Context) ClearDepthBufferWith(value float64)
- func (dc *Context) DepthImage() image.Image
- func (dc *Context) DrawLine(t *Line) RasterizeInfo
- func (dc *Context) DrawLines(lines []*Line) RasterizeInfo
- func (dc *Context) DrawMesh(mesh *Mesh) RasterizeInfo
- func (dc *Context) DrawTriangle(t *Triangle) RasterizeInfo
- func (dc *Context) DrawTriangles(triangles []*Triangle) RasterizeInfo
- func (dc *Context) Image() image.Image
- type CubeMapTexture
- type Cull
- type CullingSceneRenderer
- type DFDBlock
- type DFDBlockHeaderBasic
- type DFDHeader
- type DataFormatFlags
- type DepthOfFieldEffect
- type EXTMeshGPUInstancingExtension
- type EXTTextureWebPExtension
- type EnvironmentShader
- type ExtensionRegistry
- type FXAAEffect
- type Face
- type FirstPersonCamera
- type Format
- type GLTFExtension
- type GLTFExtensionHandler
- type GLTFLoader
- type Header
- type Index
- type InterpolationType
- type Joint
- type KHRAnimationPointerExtension
- type KHRLightsPunctualExtension
- type KHRMaterialsAnisotropyExtension
- type KHRMaterialsClearcoatExtension
- type KHRMaterialsDispersionExtension
- type KHRMaterialsEmissiveStrengthExtension
- type KHRMaterialsIORExtension
- type KHRMaterialsIridescenceExtension
- type KHRMaterialsPBRSpecularGlossinessExtension
- type KHRMaterialsSheenExtension
- type KHRMaterialsSpecularExtension
- type KHRMaterialsTransmissionExtension
- type KHRMaterialsUnlitExtension
- type KHRMaterialsVariantsExtension
- type KHRMaterialsVolumeExtension
- type KHRMeshQuantizationExtension
- type KHRTextureBasisuExtension
- type KHRTextureTransformExtension
- type KHRXMPJsonLdExtension
- type KTX2TextureLoader
- type KeyValuePair
- type Keyframe
- type Level
- type LevelIndex
- type Light
- type LightType
- type Line
- type Matrix
- func Frustum(l, r, b, t, n, f float64) Matrix
- func Identity() Matrix
- func LookAt(eye, center, up Vector) Matrix
- func LookAtDirection(forward, up Vector) Matrix
- func Orient(position, size, up Vector, rotation float64) Matrix
- func Orthographic(l, r, b, t, n, f float64) Matrix
- func Perspective(fovy, aspect, near, far float64) Matrix
- func Rotate(v Vector, a float64) Matrix
- func RotateTo(a, b Vector) Matrix
- func Scale(v Vector) Matrix
- func Screen(w, h int) Matrix
- func Translate(v Vector) Matrix
- func Viewport(x, y, w, h float64) Matrix
- func (a Matrix) Determinant() float64
- func (a Matrix) Frustum(l, r, b, t, n, f float64) Matrix
- func (a Matrix) Inverse() Matrix
- func (a Matrix) LookAt(eye, center, up Vector) Matrix
- func (a Matrix) Mul(b Matrix) Matrix
- func (a Matrix) MulBox(box Box) Box
- func (a Matrix) MulDirection(b Vector) Vector
- func (a Matrix) MulPosition(b Vector) Vector
- func (a Matrix) MulPositionW(b Vector) VectorW
- func (a Matrix) Orthographic(l, r, b, t, n, f float64) Matrix
- func (a Matrix) Perspective(fovy, aspect, near, far float64) Matrix
- func (a Matrix) Rotate(v Vector, f float64) Matrix
- func (a Matrix) RotateTo(b, c Vector) Matrix
- func (a Matrix) Scale(v Vector) Matrix
- func (a Matrix) Translate(v Vector) Matrix
- func (a Matrix) Transpose() Matrix
- type Mesh
- func ApplyMorphTargets(baseMesh *Mesh, targets *MorphTargets) *Mesh
- func NewCapsule(radius, height float64, radialSegments, heightSegments, capSegments int) *Mesh
- func NewCone(step int, capped bool) *Mesh
- func NewCube() *Mesh
- func NewCubeForBox(box Box) *Mesh
- func NewCubeOutlineForBox(box Box) *Mesh
- func NewCylinder(radius, height float64, radialSegments, heightSegments int, openEnded bool) *Mesh
- func NewEmptyMesh() *Mesh
- func NewIcosahedron() *Mesh
- func NewLineMesh(lines []*Line) *Mesh
- func NewMesh(triangles []*Triangle, lines []*Line) *Mesh
- func NewPlane(width, height float64) *Mesh
- func NewSphere(detail int) *Mesh
- func NewTorus(radius, tubeRadius float64, radialSegments, tubularSegments int) *Mesh
- func NewTriangleMesh(triangles []*Triangle) *Mesh
- func (m *Mesh) Add(b *Mesh)
- func (m *Mesh) BiUnitCube() Matrix
- func (m *Mesh) BoundingBox() Box
- func (m *Mesh) Center() Matrix
- func (m *Mesh) Copy() *Mesh
- func (m *Mesh) FitInside(box Box, anchor Vector) Matrix
- func (m *Mesh) MoveTo(position, anchor Vector) Matrix
- func (m *Mesh) ReverseWinding()
- func (m *Mesh) SharpEdges(angleThreshold float64) *Mesh
- func (m *Mesh) Simplify(factor float64)
- func (m *Mesh) Smooth(iterations int) *Mesh
- func (m *Mesh) SmoothNormals()
- func (m *Mesh) SmoothNormalsThreshold(radians float64)
- func (m *Mesh) SplitTriangles(maxEdgeLength float64)
- func (m *Mesh) Subdivide() *Mesh
- func (m *Mesh) SurfaceArea() float64
- func (m *Mesh) Tessellate(maxEdgeLength float64) *Mesh
- func (m *Mesh) Transform(matrix Matrix)
- func (m *Mesh) UnitCube() Matrix
- func (m *Mesh) Volume() float64
- func (m *Mesh) WeldVertices(threshold float64)
- type MetallicRoughnessShader
- type MorphTarget
- type MorphTargets
- type MotionBlurEffect
- type OmniShadowMap
- type OrbitCamera
- type PBRLighting
- type PBRMaterial
- type PBRShader
- type PBRWorkflow
- type PCSShadowReceiverShader
- type ParseError
- type PhongShader
- type Plane
- type PostProcessingEffect
- type PostProcessingPipeline
- type ProjectionType
- type Quaternion
- type RasterizeInfo
- type Reader
- type SIMDMat4
- type SIMDTriangle
- type SIMDVector4
- func (sv SIMDVector4) Add(other SIMDVector4) SIMDVector4
- func (sv SIMDVector4) Cross(other SIMDVector4) SIMDVector4
- func (sv SIMDVector4) DivScalar(scalar float64) SIMDVector4
- func (sv SIMDVector4) Dot(other SIMDVector4) float64
- func (sv SIMDVector4) Length() float64
- func (sv SIMDVector4) Max(other SIMDVector4) SIMDVector4
- func (sv SIMDVector4) Min(other SIMDVector4) SIMDVector4
- func (sv SIMDVector4) MulScalar(scalar float64) SIMDVector4
- func (sv SIMDVector4) Normalize() SIMDVector4
- func (sv SIMDVector4) Sub(other SIMDVector4) SIMDVector4
- func (sv SIMDVector4) ToVector() Vector
- type SIMDVector4Batch
- type SIMDVertex
- type SampleInformation
- type SampledMaterial
- type Scene
- func (scene *Scene) AddAmbientLight(color Color, intensity float64)
- func (scene *Scene) AddAnimation(name string, animation *Animation)
- func (scene *Scene) AddCamera(camera *Camera)
- func (scene *Scene) AddDirectionalLight(direction Vector, color Color, intensity float64)
- func (scene *Scene) AddLight(light Light)
- func (scene *Scene) AddMaterial(name string, material *PBRMaterial)
- func (scene *Scene) AddMesh(name string, mesh *Mesh)
- func (scene *Scene) AddMorphTargets(name string, targets *MorphTargets)
- func (scene *Scene) AddPointLight(position Vector, color Color, intensity, range_ float64)
- func (scene *Scene) AddSkin(name string, skin *Skin)
- func (scene *Scene) AddSpotLight(position, direction Vector, color Color, ...)
- func (scene *Scene) AddTexture(name string, texture *AdvancedTexture)
- func (scene *Scene) ApplyMorphTargetsToMeshes()
- func (scene *Scene) ClearLights()
- func (scene *Scene) CreateMeshNode(name, meshName, materialName string) *SceneNode
- func (scene *Scene) CreateMorphTargetMeshNode(name, meshName, materialName, morphTargetName string) *SceneNode
- func (scene *Scene) CreateSkinnedMeshNode(name, meshName, materialName, skinName string) *SceneNode
- func (scene *Scene) GetAnimation(name string) *Animation
- func (scene *Scene) GetBounds() Box
- func (scene *Scene) GetLightsByType(lightType LightType) []Light
- func (scene *Scene) GetMaterial(name string) *PBRMaterial
- func (scene *Scene) GetMesh(name string) *Mesh
- func (scene *Scene) GetMorphTargets(name string) *MorphTargets
- func (scene *Scene) GetSkin(name string) *Skin
- func (scene *Scene) GetSupportedGLTFExtensions() []string
- func (scene *Scene) GetTexture(name string) *AdvancedTexture
- func (scene *Scene) ProcessGLTFExtensions(extensions map[string]interface{}) error
- func (scene *Scene) SetActiveCamera(name string) bool
- func (scene *Scene) UpdateSkinnedMeshes()
- type SceneNode
- func (node *SceneNode) AddChild(child *SceneNode)
- func (node *SceneNode) FindChild(name string) *SceneNode
- func (node *SceneNode) GetRenderableNodes() []*SceneNode
- func (node *SceneNode) GetWorldPosition() Vector
- func (node *SceneNode) RemoveChild(child *SceneNode)
- func (node *SceneNode) Rotate(axis Vector, angle float64)
- func (node *SceneNode) Scale(scale Vector)
- func (node *SceneNode) SetTransform(transform Matrix)
- func (node *SceneNode) Translate(translation Vector)
- func (node *SceneNode) UpdateWorldTransform()
- func (node *SceneNode) VisitNodes(visitor func(*SceneNode))
- type SceneRenderer
- type Shader
- type ShadowMap
- type ShadowMapRenderer
- type ShadowMapShader
- type ShadowReceiverShader
- type ShadowRenderer
- type ShadowTechnique
- type Skin
- type SoftShadowReceiverShader
- type SolidColorShader
- type SupercompressionScheme
- type Texture
- type TextureAtlas
- type TextureFilter
- type TextureRegion
- type TextureShader
- type TextureType
- type TextureWrap
- type ToneMappingEffect
- type TransferFunction
- type Triangle
- type UVBlendMode
- type UVIsland
- type UVMapping
- type UVMaskType
- type UVModifier
- func (modifier *UVModifier) AddMapping(mapping *UVMapping)
- func (modifier *UVModifier) EnableAnimation(enabled bool)
- func (modifier *UVModifier) GetMapping(name string) *UVMapping
- func (modifier *UVModifier) RemoveMapping(name string) bool
- func (modifier *UVModifier) SetGlobalTransform(transform *UVTransform)
- func (modifier *UVModifier) TransformUV(u, v float64) (float64, float64)
- func (modifier *UVModifier) UpdateAnimation(deltaTime float64)
- type UVRegion
- type UVRelaxationSettings
- type UVSeam
- type UVTransform
- type Vector
- func InterpolateVectors(v1, v2, v3 Vector, b VectorW) Vector
- func LatLngToXYZ(lat, lng float64) Vector
- func SIMDAddVectors(a, b []Vector) []Vector
- func SIMDMulScalarVectors(vectors []Vector, scalar float64) []Vector
- func SIMDNormalizeVectors(vectors []Vector) []Vector
- func SIMDVectorCross(a, b Vector) Vector
- func V(x, y, z float64) Vector
- func (a Vector) Abs() Vector
- func (a Vector) Add(b Vector) Vector
- func (a Vector) AddScalar(b float64) Vector
- func (a Vector) Ceil() Vector
- func (a Vector) Cross(b Vector) Vector
- func (a Vector) Distance(b Vector) float64
- func (a Vector) DistanceSq(b Vector) float64
- func (a Vector) DistanceSquared(b Vector) float64
- func (a Vector) Div(b Vector) Vector
- func (a Vector) DivScalar(b float64) Vector
- func (a Vector) Dot(b Vector) float64
- func (a Vector) Floor() Vector
- func (a Vector) IsDegenerate() bool
- func (a Vector) Length() float64
- func (a Vector) LengthSquared() float64
- func (a Vector) Lerp(b Vector, t float64) Vector
- func (a Vector) LerpDistance(b Vector, d float64) Vector
- func (a Vector) Less(b Vector) bool
- func (a Vector) Max(b Vector) Vector
- func (a Vector) MaxComponent() float64
- func (a Vector) Min(b Vector) Vector
- func (a Vector) MinComponent() float64
- func (a Vector) Mul(b Vector) Vector
- func (a Vector) MulScalar(b float64) Vector
- func (a Vector) Negate() Vector
- func (a Vector) Normalize() Vector
- func (a Vector) Perpendicular() Vector
- func (a Vector) PowScalar(b float64) Vector
- func (a Vector) Reflect(n Vector) Vector
- func (a Vector) Round() Vector
- func (a Vector) RoundPlaces(n int) Vector
- func (a Vector) SegmentDistance(v Vector, w Vector) float64
- func (a Vector) Sub(b Vector) Vector
- func (a Vector) SubScalar(b float64) Vector
- func (a Vector) VectorW() VectorW
- type Vector2
- func (a Vector2) Add(b Vector2) Vector2
- func (a Vector2) ApproxEqual(b Vector2, epsilon float64) bool
- func (a Vector2) DivScalar(s float64) Vector2
- func (a Vector2) Dot(b Vector2) float64
- func (a Vector2) Length() float64
- func (a Vector2) MulScalar(s float64) Vector2
- func (a Vector2) Normalize() Vector2
- func (a Vector2) Sub(b Vector2) Vector2
- type VectorW
- type Vertex
- type ViewFrustum
- type VignetteEffect
Constants ¶
const DFDBlockHeaderBasicLength = 16
const DFDHeaderLength = 8
const HeaderLength = 80
const LevelIndexLength = 24
const SampleInformationLength = 16
Variables ¶
var ( // Discard empty color Discard = Color{} // Transparent transparent color Transparent = Color{} // Black black color Black = Color{0, 0, 0, 1} // White white color White = Color{1, 1, 1, 1} )
var DFDHeaderBasic = DFDHeader{
VendorID: 0,
DescriptorType: 0,
VersionNumber: 2,
}
var EmptyBox = Box{}
var KTX2_MAGIC = [12]byte{0xAB, 0x4B, 0x54, 0x58, 0x20, 0x32, 0x30, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A}
KTX2魔数标识符,出现在文件开头
Functions ¶
func ApplyUVModifierToMesh ¶
func ApplyUVModifierToMesh(mesh *Mesh, modifier *UVModifier)
ApplyUVModifierToMesh applies UV modifications to all triangles in a mesh
func ApplyUVRelaxation ¶
func ApplyUVRelaxation(mesh *Mesh, settings *UVRelaxationSettings) error
ApplyUVRelaxation 应用UV松弛到网格
func InterpolateFloats ¶
func IsKTX2File ¶
IsKTX2File checks if the given data represents a KTX2 file
func PrintUVModifierInfo ¶
func PrintUVModifierInfo(modifier *UVModifier)
PrintUVModifierInfo prints detailed information about a UV modifier
func RelaxUVs ¶
func RelaxUVs(island *UVIsland, settings *UVRelaxationSettings)
RelaxUVs 对UV岛屿执行松弛操作,类似Blender的Seam Relaxation
func RoundPlaces ¶
func SIMDVectorDistance ¶
SIMDVectorDistance 计算两个向量之间的距离(SIMD优化)
Types ¶
type AdvancedTexture ¶
type AdvancedTexture struct {
Image image.Image
Width int
Height int
Type TextureType
WrapS TextureWrap
WrapT TextureWrap
MinFilter TextureFilter
MagFilter TextureFilter
MipLevels []image.Image // For mipmap support
Transform Matrix // Texture coordinate transformation
// **新增**: UV修改器支持
UVModifier *UVModifier // 动态UV修改器
}
AdvancedTexture extends the basic texture interface with advanced features
func LoadAdvancedTexture ¶
func LoadAdvancedTexture(path string, textureType TextureType) (*AdvancedTexture, error)
LoadAdvancedTexture loads an advanced texture from a file path
func LoadKTX2Texture ¶
func LoadKTX2Texture(data []byte) (*AdvancedTexture, error)
LoadKTX2Texture loads a KTX2 texture from file data
func LoadKTX2TextureFromFile ¶
func LoadKTX2TextureFromFile(path string) (*AdvancedTexture, error)
LoadKTX2TextureFromFile loads a KTX2 texture from a file path
func NewAdvancedTexture ¶
func NewAdvancedTexture(img image.Image, textureType TextureType) *AdvancedTexture
NewAdvancedTexture creates a new advanced texture from an image
func (*AdvancedTexture) BilinearSample ¶
func (t *AdvancedTexture) BilinearSample(u, v float64) Color
BilinearSample performs bilinear sampling
func (*AdvancedTexture) GenerateMipmaps ¶
func (t *AdvancedTexture) GenerateMipmaps()
GenerateMipmaps generates mipmap levels for the texture
func (*AdvancedTexture) Sample ¶
func (t *AdvancedTexture) Sample(u, v float64) Color
Sample samples the texture with basic UV coordinates
func (*AdvancedTexture) SampleHeight ¶
func (t *AdvancedTexture) SampleHeight(u, v float64) float64
SampleHeight samples a height map and returns the height value
func (*AdvancedTexture) SampleNormal ¶
func (t *AdvancedTexture) SampleNormal(u, v float64) Vector
SampleNormal samples a normal map and returns the normal in tangent space
func (*AdvancedTexture) SampleSingleChannel ¶
func (t *AdvancedTexture) SampleSingleChannel(u, v float64, channel int) float64
SampleSingleChannel samples a single channel texture (metallic, roughness, etc.)
func (*AdvancedTexture) SampleWithFilter ¶
func (t *AdvancedTexture) SampleWithFilter(u, v float64, filter TextureFilter) Color
SampleWithFilter samples the texture with specified filtering
type Animation ¶
type Animation struct {
Name string
Duration float64
Channels []AnimationChannel
}
Animation represents a collection of animation channels
func NewAnimation ¶
NewAnimation creates a new animation
func (*Animation) AddChannel ¶
func (anim *Animation) AddChannel(channel AnimationChannel)
AddChannel adds an animation channel to the animation
type AnimationChannel ¶
type AnimationChannel struct {
Target *SceneNode
Property AnimationProperty
Keyframes []Keyframe
Interpolation InterpolationType
}
AnimationChannel represents animation data for a specific node and property
func (*AnimationChannel) Evaluate ¶
func (channel *AnimationChannel) Evaluate(time float64)
Evaluate evaluates the animation channel at a specific time
type AnimationPlayer ¶
type AnimationPlayer struct {
// contains filtered or unexported fields
}
AnimationPlayer handles playback of animations
func NewAnimationPlayer ¶
func NewAnimationPlayer() *AnimationPlayer
NewAnimationPlayer creates a new animation player
func (*AnimationPlayer) AddAnimation ¶
func (player *AnimationPlayer) AddAnimation(name string, animation *Animation)
AddAnimation adds an animation to the player
func (*AnimationPlayer) Pause ¶
func (player *AnimationPlayer) Pause()
Pause pauses the current animation
func (*AnimationPlayer) Play ¶
func (player *AnimationPlayer) Play(name string) bool
Play starts playing an animation
func (*AnimationPlayer) Resume ¶
func (player *AnimationPlayer) Resume()
Resume resumes the paused animation
func (*AnimationPlayer) SetPlaySpeed ¶
func (player *AnimationPlayer) SetPlaySpeed(speed float64)
SetPlaySpeed sets the playback speed
func (*AnimationPlayer) Stop ¶
func (player *AnimationPlayer) Stop()
Stop stops the current animation
func (*AnimationPlayer) Update ¶
func (player *AnimationPlayer) Update(deltaTime float64)
Update updates the animation player
type AnimationProperty ¶
type AnimationProperty int
AnimationProperty represents what property is being animated
const ( // Translation animates node translation Translation AnimationProperty = iota // Rotation animates node rotation Rotation // ScaleProperty animates node scale ScaleProperty // Weights animates morph target weights Weights // Joints animates skinned mesh joints Joints )
type BloomEffect ¶
BloomEffect implements a bloom effect
func NewBloomEffect ¶
func NewBloomEffect(threshold float64, blurRadius int, intensity float64) *BloomEffect
NewBloomEffect creates a new bloom effect
type BlurEffect ¶
type BlurEffect struct {
Radius int
}
BlurEffect implements a simple blur effect
func NewBlurEffect ¶
func NewBlurEffect(radius int) *BlurEffect
NewBlurEffect creates a new blur effect
type Camera ¶
type Camera struct {
Name string
Position Vector
Target Vector
Up Vector
FOV float64 // Field of view in radians
AspectRatio float64
NearPlane float64
FarPlane float64
ProjectionType ProjectionType
OrthoSize float64 // For orthographic projection
}
Camera represents a camera in the scene
func NewOrthographicCamera ¶
func NewOrthographicCamera(name string, position, target, up Vector, orthoSize, aspectRatio, near, far float64) *Camera
NewOrthographicCamera creates a new orthographic camera
func NewPerspectiveCamera ¶
func NewPerspectiveCamera(name string, position, target, up Vector, fov, aspectRatio, near, far float64) *Camera
NewPerspectiveCamera creates a new perspective camera
func (*Camera) GetCameraMatrix ¶
GetCameraMatrix returns the combined view-projection matrix
func (*Camera) GetProjectionMatrix ¶
GetProjectionMatrix returns the projection matrix for the camera
func (*Camera) GetViewMatrix ¶
GetViewMatrix returns the view matrix for the camera
func (*Camera) OrbitAroundTarget ¶
OrbitAroundTarget orbits the camera around its target
type CascadeShadowMap ¶
type CascadeShadowMap struct {
ShadowMaps []*ShadowMap
LightMatrices []Matrix
SplitDistances []float64
}
CascadeShadowMap implements cascaded shadow maps for large scenes
func NewCascadeShadowMap ¶
func NewCascadeShadowMap(numCascades int, shadowMapSize int) *CascadeShadowMap
NewCascadeShadowMap creates a new cascaded shadow map system
type ChannelTypeQualifiers ¶
type ChannelTypeQualifiers uint8
ChannelTypeQualifiers 通道类型限定符
const ( QualifierLinear ChannelTypeQualifiers = 1 << 0 QualifierExponent ChannelTypeQualifiers = 1 << 1 QualifierSigned ChannelTypeQualifiers = 1 << 2 QualifierFloat ChannelTypeQualifiers = 1 << 3 )
type ChromaticAberrationEffect ¶
ChromaticAberrationEffect implements chromatic aberration
func NewChromaticAberrationEffect ¶
func NewChromaticAberrationEffect(redOffset, greenOffset, blueOffset Vector) *ChromaticAberrationEffect
NewChromaticAberrationEffect creates a new chromatic aberration effect
type Color ¶
type Color struct {
R, G, B, A float64
}
Color color struct
func InterpolateColors ¶
type ColorGradingEffect ¶
type ColorGradingEffect struct {
Brightness float64
Contrast float64
Saturation float64
HueShift float64
}
ColorGradingEffect implements color grading
func NewColorGradingEffect ¶
func NewColorGradingEffect(brightness, contrast, saturation, hueShift float64) *ColorGradingEffect
NewColorGradingEffect creates a new color grading effect
type ColorModel ¶
type ColorModel uint8
ColorModel 颜色模型
const ( ColorModelUnspecified ColorModel = 0 ColorModelRGBSDA ColorModel = 1 ColorModelYUVSDA ColorModel = 2 ColorModelYIQSDA ColorModel = 3 ColorModelLabSDA ColorModel = 4 ColorModelCMYKA ColorModel = 5 ColorModelXYZSDA ColorModel = 6 ColorModelHSVSDA ColorModel = 7 ColorModelHSLSDA ColorModel = 8 ColorModelBC7M6 ColorModel = 9 )
func NewColorModel ¶
func NewColorModel(value uint8) *ColorModel
func (ColorModel) Value ¶
func (c ColorModel) Value() uint8
type ColorPrimaries ¶
type ColorPrimaries uint8
ColorPrimaries 颜色原色
const ( ColorPrimariesUnspecified ColorPrimaries = 0 ColorPrimariesBT709 ColorPrimaries = 1 ColorPrimariesBT2020 ColorPrimaries = 2 ColorPrimariesACES ColorPrimaries = 3 )
func NewColorPrimaries ¶
func NewColorPrimaries(value uint8) *ColorPrimaries
func (ColorPrimaries) Value ¶
func (c ColorPrimaries) Value() uint8
type CompositeEffect ¶
type CompositeEffect struct {
Effects []PostProcessingEffect
}
CompositeEffect combines multiple effects
func NewCompositeEffect ¶
func NewCompositeEffect(effects ...PostProcessingEffect) *CompositeEffect
NewCompositeEffect creates a new composite effect
type Context ¶
type Context struct {
Width int
Height int
ColorBuffer *image.NRGBA
DepthBuffer []float64
ClearColor Color
Shader Shader
ReadDepth bool
WriteDepth bool
WriteColor bool
AlphaBlend bool
Wireframe bool
FrontFace Face
Cull Cull
LineWidth float64
DepthBias float64
// contains filtered or unexported fields
}
func NewContext ¶
func (*Context) ClearColorBuffer ¶
func (dc *Context) ClearColorBuffer()
func (*Context) ClearColorBufferWith ¶
func (*Context) ClearDepthBuffer ¶
func (dc *Context) ClearDepthBuffer()
func (*Context) ClearDepthBufferWith ¶
func (*Context) DepthImage ¶
func (*Context) DrawLine ¶
func (dc *Context) DrawLine(t *Line) RasterizeInfo
func (*Context) DrawLines ¶
func (dc *Context) DrawLines(lines []*Line) RasterizeInfo
func (*Context) DrawMesh ¶
func (dc *Context) DrawMesh(mesh *Mesh) RasterizeInfo
func (*Context) DrawTriangle ¶
func (dc *Context) DrawTriangle(t *Triangle) RasterizeInfo
func (*Context) DrawTriangles ¶
func (dc *Context) DrawTriangles(triangles []*Triangle) RasterizeInfo
type CubeMapTexture ¶
type CubeMapTexture struct {
Faces [6]*AdvancedTexture // +X, -X, +Y, -Y, +Z, -Z
}
CubeMapTexture represents a cube map texture for environment mapping
func NewCubeMapTexture ¶
func NewCubeMapTexture(faces [6]*AdvancedTexture) *CubeMapTexture
NewCubeMapTexture creates a new cube map texture
func (*CubeMapTexture) SampleCubeMap ¶
func (cubemap *CubeMapTexture) SampleCubeMap(direction Vector) Color
SampleCubeMap samples the cube map using a direction vector
type Cull ¶
type Cull int
Cull f
const ( // CullNone f CullNone Cull // CullFront f CullFront // CullBack f CullBack )
type CullingSceneRenderer ¶
type CullingSceneRenderer struct {
*SceneRenderer
}
CullingSceneRenderer extends SceneRenderer with frustum culling
func NewCullingSceneRenderer ¶
func NewCullingSceneRenderer(context *Context) *CullingSceneRenderer
NewCullingSceneRenderer creates a new culling scene renderer
func (*CullingSceneRenderer) RenderNodeWithCulling ¶
func (csr *CullingSceneRenderer) RenderNodeWithCulling(node *SceneNode, cameraMatrix Matrix, lights []Light, frustum *ViewFrustum, cameraPos Vector)
RenderNodeWithCulling renders a single scene node with frustum culling
func (*CullingSceneRenderer) RenderScene ¶
func (csr *CullingSceneRenderer) RenderScene(scene *Scene)
RenderScene renders a complete scene with frustum culling
type DFDBlockHeaderBasic ¶
type DFDBlockHeaderBasic struct {
ColorModel *ColorModel // 颜色模型
ColorPrimaries *ColorPrimaries // 颜色原色
TransferFunction *TransferFunction // 传输函数
Flags DataFormatFlags // 标志
TexelBlockDimensions [4]uint8 // 纹素块维度 (每个值+1)
BytesPlanes [8]uint8 // 字节平面
}
DFDBlockHeaderBasic 基本数据格式描述符块头部
func DFDBlockHeaderBasicFromBytes ¶
func DFDBlockHeaderBasicFromBytes(data []byte) (*DFDBlockHeaderBasic, error)
FromBytes 从字节数组解析基本DFD块头部
func (*DFDBlockHeaderBasic) AsBytes ¶
func (d *DFDBlockHeaderBasic) AsBytes() []byte
AsBytes 将基本DFD块头部转换为字节数组
type DFDHeader ¶
type DFDHeader struct {
VendorID uint32 // 供应商ID (17位)
DescriptorType uint32 // 描述符类型 (15位)
VersionNumber uint16 // 版本号 (16位)
}
DFDHeader 数据格式描述符头部
func ParseDFDHeader ¶
ParseDFDHeader 解析DFD头部
type DataFormatFlags ¶
type DataFormatFlags uint8
DataFormatFlags 数据格式标志
const ( StraightAlpha DataFormatFlags = 0 AlphaPremultiplied DataFormatFlags = 1 << 0 )
type DepthOfFieldEffect ¶
DepthOfFieldEffect implements depth of field
func NewDepthOfFieldEffect ¶
func NewDepthOfFieldEffect(focusDepth, aperture float64, samples int) *DepthOfFieldEffect
NewDepthOfFieldEffect creates a new depth of field effect
type EXTMeshGPUInstancingExtension ¶
type EXTMeshGPUInstancingExtension struct{}
EXTMeshGPUInstancingExtension handles GPU instancing
func (*EXTMeshGPUInstancingExtension) GetName ¶
func (ext *EXTMeshGPUInstancingExtension) GetName() string
type EXTTextureWebPExtension ¶
type EXTTextureWebPExtension struct{}
EXTTextureWebPExtension handles WebP textures
func (*EXTTextureWebPExtension) GetName ¶
func (ext *EXTTextureWebPExtension) GetName() string
type EnvironmentShader ¶
type EnvironmentShader struct {
Matrix Matrix
CubeMap *CubeMapTexture
CameraPosition Vector
Reflectance float64
}
EnvironmentShader renders environment mapping and reflections
func NewEnvironmentShader ¶
func NewEnvironmentShader(matrix Matrix, cubeMap *CubeMapTexture, cameraPos Vector) *EnvironmentShader
NewEnvironmentShader creates a new environment shader
func (*EnvironmentShader) Fragment ¶
func (shader *EnvironmentShader) Fragment(v Vertex) Color
Fragment performs environment mapping
func (*EnvironmentShader) Vertex ¶
func (shader *EnvironmentShader) Vertex(v Vertex) Vertex
Vertex processes vertices for environment mapping
type ExtensionRegistry ¶
type ExtensionRegistry struct {
// contains filtered or unexported fields
}
ExtensionRegistry manages GLTF extensions
func NewExtensionRegistry ¶
func NewExtensionRegistry() *ExtensionRegistry
NewExtensionRegistry creates a new extension registry
func (*ExtensionRegistry) GetSupportedExtensions ¶
func (reg *ExtensionRegistry) GetSupportedExtensions() []string
GetSupportedExtensions returns a list of supported extension names
func (*ExtensionRegistry) ProcessExtensions ¶
func (reg *ExtensionRegistry) ProcessExtensions(extensions map[string]interface{}, scene *Scene) error
ProcessExtensions processes GLTF extensions
func (*ExtensionRegistry) RegisterHandler ¶
func (reg *ExtensionRegistry) RegisterHandler(handler GLTFExtensionHandler)
RegisterHandler registers an extension handler
type FXAAEffect ¶
FXAAEffect implements Fast Approximate Anti-Aliasing
type FirstPersonCamera ¶
FirstPersonCamera implements a first-person camera controller
func NewFirstPersonCamera ¶
func NewFirstPersonCamera(name string, position Vector, fov, aspectRatio, near, far float64) *FirstPersonCamera
NewFirstPersonCamera creates a new first-person camera
func (*FirstPersonCamera) Move ¶
func (fpc *FirstPersonCamera) Move(direction Vector)
Move moves the camera in the specified direction
func (*FirstPersonCamera) Rotate ¶
func (fpc *FirstPersonCamera) Rotate(yawDelta, pitchDelta float64)
Rotate rotates the camera view
func (*FirstPersonCamera) Update ¶
func (fpc *FirstPersonCamera) Update()
Update updates the first-person camera orientation
type GLTFExtension ¶
GLTFExtension represents a GLTF extension
type GLTFExtensionHandler ¶
type GLTFExtensionHandler interface {
GetName() string
Process(data map[string]interface{}, scene *Scene) error
}
GLTFExtensionHandler handles specific GLTF extensions
type GLTFLoader ¶
type GLTFLoader struct {
// contains filtered or unexported fields
}
GLTFLoader handles loading of GLTF files
type Header ¶
type Header struct {
Format *Format // VkFormat
TypeSize uint32 // 类型大小
PixelWidth uint32 // 像素宽度
PixelHeight uint32 // 像素高度
PixelDepth uint32 // 像素深度
LayerCount uint32 // 层数
FaceCount uint32 // 面数
LevelCount uint32 // 级别数
SupercompressionScheme *SupercompressionScheme // 超级压缩方案
Index Index // 索引信息
}
Header KTX2容器级元数据
func GetKTX2Info ¶
GetKTX2Info extracts basic information from KTX2 file without full parsing
type Index ¶
type Index struct {
DFDByteOffset uint32 // 数据格式描述符字节偏移量
DFDByteLength uint32 // 数据格式描述符字节长度
KVDByteOffset uint32 // 键值数据字节偏移量
KVDByteLength uint32 // 键值数据字节长度
SGDByteOffset uint64 // 超级压缩全局数据字节偏移量
SGDByteLength uint64 // 超级压缩全局数据字节长度
}
Index KTX2文件各部分的字节偏移量和大小索引
type InterpolationType ¶
type InterpolationType int
InterpolationType represents how values are interpolated between keyframes
const ( // Linear interpolation Linear InterpolationType = iota // Step interpolation (no interpolation) Step // CubicSpline interpolation CubicSpline )
type Joint ¶
type Joint struct {
Node *SceneNode
InverseBindMatrix Matrix
JointMatrix Matrix // Computed joint matrix
}
Joint represents a joint/bone in skeletal animation
type KHRAnimationPointerExtension ¶
type KHRAnimationPointerExtension struct{}
KHRAnimationPointerExtension handles animation pointer targeting
func (*KHRAnimationPointerExtension) GetName ¶
func (ext *KHRAnimationPointerExtension) GetName() string
type KHRLightsPunctualExtension ¶
type KHRLightsPunctualExtension struct{}
KHRLightsPunctualExtension handles KHR_lights_punctual extension
func (*KHRLightsPunctualExtension) GetName ¶
func (ext *KHRLightsPunctualExtension) GetName() string
type KHRMaterialsAnisotropyExtension ¶
type KHRMaterialsAnisotropyExtension struct{}
KHRMaterialsAnisotropyExtension handles anisotropic materials
func (*KHRMaterialsAnisotropyExtension) GetName ¶
func (ext *KHRMaterialsAnisotropyExtension) GetName() string
type KHRMaterialsClearcoatExtension ¶
type KHRMaterialsClearcoatExtension struct{}
KHRMaterialsClearcoatExtension handles clearcoat materials
func (*KHRMaterialsClearcoatExtension) GetName ¶
func (ext *KHRMaterialsClearcoatExtension) GetName() string
type KHRMaterialsDispersionExtension ¶
type KHRMaterialsDispersionExtension struct{}
KHRMaterialsDispersionExtension handles chromatic dispersion
func (*KHRMaterialsDispersionExtension) GetName ¶
func (ext *KHRMaterialsDispersionExtension) GetName() string
type KHRMaterialsEmissiveStrengthExtension ¶
type KHRMaterialsEmissiveStrengthExtension struct{}
KHRMaterialsEmissiveStrengthExtension handles enhanced emissive strength
func (*KHRMaterialsEmissiveStrengthExtension) GetName ¶
func (ext *KHRMaterialsEmissiveStrengthExtension) GetName() string
type KHRMaterialsIORExtension ¶
type KHRMaterialsIORExtension struct{}
KHRMaterialsIORExtension handles index of refraction
func (*KHRMaterialsIORExtension) GetName ¶
func (ext *KHRMaterialsIORExtension) GetName() string
type KHRMaterialsIridescenceExtension ¶
type KHRMaterialsIridescenceExtension struct{}
KHRMaterialsIridescenceExtension handles iridescent materials
func (*KHRMaterialsIridescenceExtension) GetName ¶
func (ext *KHRMaterialsIridescenceExtension) GetName() string
type KHRMaterialsPBRSpecularGlossinessExtension ¶
type KHRMaterialsPBRSpecularGlossinessExtension struct{}
KHRMaterialsPBRSpecularGlossinessExtension handles PBR specular-glossiness workflow
func (*KHRMaterialsPBRSpecularGlossinessExtension) GetName ¶
func (ext *KHRMaterialsPBRSpecularGlossinessExtension) GetName() string
type KHRMaterialsSheenExtension ¶
type KHRMaterialsSheenExtension struct{}
KHRMaterialsSheenExtension handles fabric sheen effect
func (*KHRMaterialsSheenExtension) GetName ¶
func (ext *KHRMaterialsSheenExtension) GetName() string
type KHRMaterialsSpecularExtension ¶
type KHRMaterialsSpecularExtension struct{}
KHRMaterialsSpecularExtension handles enhanced specular reflection
func (*KHRMaterialsSpecularExtension) GetName ¶
func (ext *KHRMaterialsSpecularExtension) GetName() string
type KHRMaterialsTransmissionExtension ¶
type KHRMaterialsTransmissionExtension struct{}
KHRMaterialsTransmissionExtension handles material transmission
func (*KHRMaterialsTransmissionExtension) GetName ¶
func (ext *KHRMaterialsTransmissionExtension) GetName() string
type KHRMaterialsUnlitExtension ¶
type KHRMaterialsUnlitExtension struct{}
KHRMaterialsUnlitExtension handles KHR_materials_unlit extension
func (*KHRMaterialsUnlitExtension) GetName ¶
func (ext *KHRMaterialsUnlitExtension) GetName() string
type KHRMaterialsVariantsExtension ¶
type KHRMaterialsVariantsExtension struct{}
KHRMaterialsVariantsExtension handles material variants
func (*KHRMaterialsVariantsExtension) GetName ¶
func (ext *KHRMaterialsVariantsExtension) GetName() string
type KHRMaterialsVolumeExtension ¶
type KHRMaterialsVolumeExtension struct{}
KHRMaterialsVolumeExtension handles volumetric materials
func (*KHRMaterialsVolumeExtension) GetName ¶
func (ext *KHRMaterialsVolumeExtension) GetName() string
type KHRMeshQuantizationExtension ¶
type KHRMeshQuantizationExtension struct{}
KHRMeshQuantizationExtension handles mesh quantization
func (*KHRMeshQuantizationExtension) GetName ¶
func (ext *KHRMeshQuantizationExtension) GetName() string
type KHRTextureBasisuExtension ¶
type KHRTextureBasisuExtension struct{}
KHRTextureBasisuExtension handles KTX2/Basis Universal textures
func (*KHRTextureBasisuExtension) GetName ¶
func (ext *KHRTextureBasisuExtension) GetName() string
type KHRTextureTransformExtension ¶
type KHRTextureTransformExtension struct{}
KHRTextureTransformExtension handles texture coordinate transformations
func (*KHRTextureTransformExtension) GetName ¶
func (ext *KHRTextureTransformExtension) GetName() string
type KHRXMPJsonLdExtension ¶
type KHRXMPJsonLdExtension struct{}
KHRXMPJsonLdExtension handles XMP metadata
func (*KHRXMPJsonLdExtension) GetName ¶
func (ext *KHRXMPJsonLdExtension) GetName() string
type KTX2TextureLoader ¶
type KTX2TextureLoader struct {
// contains filtered or unexported fields
}
KTX2TextureLoader handles loading of KTX2 format textures
type Keyframe ¶
type Keyframe struct {
Time float64
Value interface{} // Can be Vector, Quaternion, float64, etc.
}
Keyframe represents a single keyframe in an animation
type LevelIndex ¶
type LevelIndex struct {
ByteOffset uint64 // 字节偏移量
ByteLength uint64 // 字节长度
UncompressedByteLength uint64 // 未压缩字节长度
}
LevelIndex 级别索引信息
func LevelIndexFromBytes ¶
func LevelIndexFromBytes(data []byte) (*LevelIndex, error)
FromBytes 从字节数组解析级别索引
type Light ¶
type Light struct {
Type LightType
Position Vector
Direction Vector
Color Color
Intensity float64
Range float64
InnerCone float64 // For spot lights
OuterCone float64 // For spot lights
}
Light represents a light source
type Matrix ¶
type Matrix struct {
X00, X01, X02, X03 float64
X10, X11, X12, X13 float64
X20, X21, X22, X23 float64
X30, X31, X32, X33 float64
}
Matrix f
func (Matrix) Orthographic ¶
Orthographic f
func (Matrix) Perspective ¶
Perspective f
type Mesh ¶
Mesh f
func ApplyMorphTargets ¶
func ApplyMorphTargets(baseMesh *Mesh, targets *MorphTargets) *Mesh
ApplyMorphTargets applies morph target deformation to mesh
func NewCapsule ¶
NewCapsule creates a capsule (cylinder with hemispherical caps)
func NewCylinder ¶
NewCylinder creates a cylinder with the specified parameters
func NewTriangleMesh ¶
NewTriangleMesh returns a mesh with given data
func (*Mesh) SharpEdges ¶
func (*Mesh) SmoothNormalsThreshold ¶
SmoothNormalsThreshold f
func (*Mesh) SplitTriangles ¶
func (*Mesh) Tessellate ¶
Tessellate tessellates a mesh by splitting triangles
func (*Mesh) WeldVertices ¶
WeldVertices welds vertices that are very close to each other
type MetallicRoughnessShader ¶
type MetallicRoughnessShader struct {
*PBRShader
BaseColorTexture *AdvancedTexture
MetallicRoughnessTexture *AdvancedTexture
NormalTexture *AdvancedTexture
OcclusionTexture *AdvancedTexture
EmissiveTexture *AdvancedTexture
}
MetallicRoughnessShader is a specialized PBR shader for metallic-roughness workflow
func NewMetallicRoughnessShader ¶
func NewMetallicRoughnessShader(matrix Matrix, lights []Light, cameraPos Vector) *MetallicRoughnessShader
NewMetallicRoughnessShader creates a metallic-roughness PBR shader
func (*MetallicRoughnessShader) Fragment ¶
func (shader *MetallicRoughnessShader) Fragment(v Vertex) Color
Fragment performs metallic-roughness PBR shading
type MorphTarget ¶
type MorphTarget struct {
Name string
Positions []Vector // Target positions
Normals []Vector // Target normals (optional)
Tangents []Vector // Target tangents (optional)
}
MorphTarget represents a morph target for shape interpolation
func NewMorphTarget ¶
func NewMorphTarget(name string, vertexCount int) *MorphTarget
NewMorphTarget creates a new morph target
type MorphTargets ¶
type MorphTargets struct {
Targets []MorphTarget
Weights []float64
}
MorphTargets represents a collection of morph targets
type MotionBlurEffect ¶
MotionBlurEffect implements motion blur
func NewMotionBlurEffect ¶
func NewMotionBlurEffect(angle, length float64, samples int) *MotionBlurEffect
NewMotionBlurEffect creates a new motion blur effect
type OmniShadowMap ¶
type OmniShadowMap struct {
ShadowMaps []*ShadowMap // 6 shadow maps for cube faces
LightPosition Vector
LightMatrices []Matrix
}
OmniShadowMap implements omnidirectional shadow mapping for point lights
func NewOmniShadowMap ¶
func NewOmniShadowMap(shadowMapSize int, lightPosition Vector) *OmniShadowMap
NewOmniShadowMap creates a new omnidirectional shadow map for point lights
type OrbitCamera ¶
type OrbitCamera struct {
*Camera
Target Vector
Distance float64
HorizontalAngle float64
VerticalAngle float64
}
OrbitCamera implements an orbiting camera controller
func NewOrbitCamera ¶
func NewOrbitCamera(name string, target Vector, distance, fov, aspectRatio, near, far float64) *OrbitCamera
NewOrbitCamera creates a new orbit camera
func (*OrbitCamera) Rotate ¶
func (oc *OrbitCamera) Rotate(horizontalDelta, verticalDelta float64)
Rotate rotates the camera around the target
func (*OrbitCamera) Update ¶
func (oc *OrbitCamera) Update()
Update updates the orbit camera position based on angles
func (*OrbitCamera) Zoom ¶
func (oc *OrbitCamera) Zoom(delta float64)
Zoom zooms the camera in or out
type PBRLighting ¶
type PBRLighting struct{}
PBRLighting contains PBR lighting calculation functions
func (*PBRLighting) CalculatePBR ¶
func (pbrL *PBRLighting) CalculatePBR( material *SampledMaterial, worldPos Vector, worldNormal Vector, viewDir Vector, lights []Light, ambientColor Color, ) Color
CalculatePBR performs PBR lighting calculation
type PBRMaterial ¶
type PBRMaterial struct {
// Base color and alpha
BaseColorFactor Color
BaseColorTexture Texture
// Metallic-Roughness workflow
MetallicFactor float64
RoughnessFactor float64
MetallicRoughnessTexture Texture
// Specular-Glossiness workflow (legacy support)
DiffuseFactor Color
SpecularFactor Color
GlossinessFactor float64
DiffuseTexture Texture
SpecularGlossinessTexture Texture
// Normal mapping
NormalTexture Texture
NormalScale float64
// Occlusion mapping
OcclusionTexture Texture
OcclusionStrength float64
// Emissive mapping
EmissiveFactor Color
EmissiveTexture Texture
// Extended material properties (GLTF Extensions)
// KHR_materials_emissive_strength
EmissiveStrength float64
// KHR_materials_ior
IOR float64 // Index of Refraction
// KHR_materials_specular
SpecularColorFactor Color
SpecularColorTexture Texture
SpecularTexture Texture
// KHR_materials_transmission
TransmissionFactor float64
TransmissionTexture Texture
// KHR_materials_volume
ThicknessFactor float64
ThicknessTexture Texture
AttenuationDistance float64
AttenuationColor Color
// KHR_materials_anisotropy
AnisotropyStrength float64
AnisotropyRotation float64
AnisotropyTexture Texture
// KHR_materials_sheen
SheenColorFactor Color
SheenRoughnessFactor float64
SheenColorTexture Texture
SheenRoughnessTexture Texture
// KHR_materials_iridescence
IridescenceFactor float64
IridescenceIor float64
IridescenceThicknessMinimum float64
IridescenceThicknessMaximum float64
IridescenceTexture Texture
IridescenceThicknessTexture Texture
// KHR_materials_dispersion
DispersionFactor float64
// KHR_materials_clearcoat
ClearcoatFactor float64
ClearcoatRoughnessFactor float64
ClearcoatTexture Texture
ClearcoatRoughnessTexture Texture
ClearcoatNormalTexture Texture
// Additional properties
AlphaCutoff float64
AlphaMode AlphaMode
DoubleSided bool
Workflow PBRWorkflow
}
PBRMaterial represents a physically-based rendering material
func NewPBRMaterial ¶
func NewPBRMaterial() *PBRMaterial
NewPBRMaterial creates a new PBR material with default values
func (*PBRMaterial) Sample ¶
func (m *PBRMaterial) Sample(u, v float64) *SampledMaterial
Sample samples the material at given texture coordinates
type PBRShader ¶
type PBRShader struct {
Matrix Matrix
Material *PBRMaterial
Lights []Light
AmbientColor Color
CameraPosition Vector
// contains filtered or unexported fields
}
PBRShader implements physically-based rendering
func NewPBRShader ¶
func NewPBRShader(matrix Matrix, material *PBRMaterial, lights []Light, cameraPos Vector) *PBRShader
NewPBRShader creates a new PBR shader
type PBRWorkflow ¶
type PBRWorkflow int
PBRWorkflow represents the type of PBR workflow
const ( // MetallicRoughness is the metallic-roughness workflow MetallicRoughness PBRWorkflow = iota // SpecularGlossiness is the specular-glossiness workflow (legacy) SpecularGlossiness )
type PCSShadowReceiverShader ¶
type PCSShadowReceiverShader struct {
*ShadowReceiverShader
BlockerSearchSamples int
PCFSamples int
LightSize float64
}
PCSShadowReceiverShader implements Percentage Closer Soft Shadows
func NewPCSShadowReceiverShader ¶
func NewPCSShadowReceiverShader(matrix, lightMatrix Matrix, lightDirection, cameraPosition Vector, shadowMap *ShadowMap) *PCSShadowReceiverShader
NewPCSShadowReceiverShader creates a new PCSS shadow receiver shader
type ParseError ¶
type ParseError int
ParseError KTX2解析错误类型
const ( UnexpectedEnd ParseError = iota BadMagic ZeroWidth ZeroFaceCount InvalidSampleBitLength )
func (ParseError) Error ¶
func (e ParseError) Error() string
type PhongShader ¶
type PhongShader struct {
Matrix Matrix
LightDirection Vector
CameraPosition Vector
ObjectColor Color
AmbientColor Color
DiffuseColor Color
SpecularColor Color
Texture Texture
SpecularPower float64
}
PhongShader implements Phong shading with an optional texture.
func NewPhongShader ¶
func NewPhongShader(matrix Matrix, lightDirection, cameraPosition Vector) *PhongShader
NewPhongShader f
func (*PhongShader) Fragment ¶
func (shader *PhongShader) Fragment(v Vertex) Color
type PostProcessingEffect ¶
PostProcessingEffect represents a post-processing effect
type PostProcessingPipeline ¶
type PostProcessingPipeline struct {
Effects []PostProcessingEffect
}
PostProcessingPipeline represents a chain of post-processing effects
func NewPostProcessingPipeline ¶
func NewPostProcessingPipeline() *PostProcessingPipeline
NewPostProcessingPipeline creates a new post-processing pipeline
func (*PostProcessingPipeline) AddEffect ¶
func (pp *PostProcessingPipeline) AddEffect(effect PostProcessingEffect)
AddEffect adds an effect to the pipeline
type ProjectionType ¶
type ProjectionType int
ProjectionType represents the type of camera projection
const ( // PerspectiveProjection uses perspective projection PerspectiveProjection ProjectionType = iota // OrthographicProjection uses orthographic projection OrthographicProjection )
type Quaternion ¶
type Quaternion struct {
X, Y, Z, W float64
}
Quaternion represents a rotation quaternion
func IdentityQuaternion ¶
func IdentityQuaternion() Quaternion
Identity returns the identity quaternion
func NewQuaternion ¶
func NewQuaternion(x, y, z, w float64) Quaternion
NewQuaternion creates a new quaternion
func QuaternionFromAxisAngle ¶
func QuaternionFromAxisAngle(axis Vector, angle float64) Quaternion
FromAxisAngle creates a quaternion from axis and angle
func (Quaternion) Normalize ¶
func (q Quaternion) Normalize() Quaternion
Normalize normalizes the quaternion
func (Quaternion) Slerp ¶
func (q1 Quaternion) Slerp(q2 Quaternion, t float64) Quaternion
Slerp performs spherical linear interpolation between two quaternions
func (Quaternion) ToMatrix ¶
func (q Quaternion) ToMatrix() Matrix
ToMatrix converts quaternion to rotation matrix
type RasterizeInfo ¶
RasterizeInfo f
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader KTX2解码器
func (*Reader) KeyValueData ¶
func (r *Reader) KeyValueData() ([]*KeyValuePair, error)
KeyValueData 返回键值对数据迭代器
func (*Reader) SupercompressionGlobalData ¶
SupercompressionGlobalData 返回超级压缩全局数据
type SIMDMat4 ¶
type SIMDMat4 [16]float64
SIMDMat4 表示一个4x4 SIMD优化矩阵
func NewSIMDMat4 ¶
func NewSIMDMat4( m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33 float64) SIMDMat4
NewSIMDMat4 创建新的SIMD矩阵
func (SIMDMat4) MulPositionSIMD ¶
func (m SIMDMat4) MulPositionSIMD(v SIMDVector4) SIMDVector4
MulPositionSIMD 向量变换(SIMD优化)
func (SIMDMat4) TransposeSIMD ¶
TransposeSIMD 矩阵转置(SIMD优化)
type SIMDTriangle ¶
type SIMDTriangle struct {
V1, V2, V3 *SIMDVertex
}
SIMDTriangle SIMD三角形结构
func NewSIMDTriangle ¶
func NewSIMDTriangle(v1, v2, v3 *SIMDVertex) *SIMDTriangle
NewSIMDTriangle 创建新的SIMD三角形
type SIMDVector4 ¶
type SIMDVector4 [4]float64
SIMDVector4 表示一个SIMD优化的4元素向量
func NewSIMDVector4FromVector ¶
func NewSIMDVector4FromVector(v Vector) SIMDVector4
NewSIMDVector4FromVector 从Vector创建SIMD向量
func (SIMDVector4) Cross ¶
func (sv SIMDVector4) Cross(other SIMDVector4) SIMDVector4
Cross SIMD向量叉积(仅适用于3D向量)
func (SIMDVector4) DivScalar ¶
func (sv SIMDVector4) DivScalar(scalar float64) SIMDVector4
DivScalar SIMD标量除法
func (SIMDVector4) MulScalar ¶
func (sv SIMDVector4) MulScalar(scalar float64) SIMDVector4
MulScalar SIMD标量乘法
type SIMDVector4Batch ¶
type SIMDVector4Batch struct {
Vectors []SIMDVector4
}
SIMDVector4Batch 批量SIMD向量操作
func NewSIMDVector4Batch ¶
func NewSIMDVector4Batch(vectors []SIMDVector4) *SIMDVector4Batch
NewSIMDVector4Batch 创建新的批量向量操作对象
func (*SIMDVector4Batch) AddBatch ¶
func (batch *SIMDVector4Batch) AddBatch(other []SIMDVector4) []SIMDVector4
AddBatch 批量向量加法
func (*SIMDVector4Batch) MulScalarBatch ¶
func (batch *SIMDVector4Batch) MulScalarBatch(scalar float64) []SIMDVector4
MulScalarBatch 批量标量乘法
func (*SIMDVector4Batch) NormalizeBatch ¶
func (batch *SIMDVector4Batch) NormalizeBatch() []SIMDVector4
NormalizeBatch 批量向量归一化
type SIMDVertex ¶
type SIMDVertex struct {
Position SIMDVector4
Normal SIMDVector4
Color SIMDVector4
TexCoord SIMDVector4
}
SIMDVertex SIMD顶点结构
func NewSIMDVertex ¶
func NewSIMDVertex(position, normal, texture Vector, color Color) *SIMDVertex
NewSIMDVertex 创建新的SIMD顶点
type SampleInformation ¶
type SampleInformation struct {
BitOffset uint16 // 位偏移量
BitLength uint8 // 位长度 (实际值+1)
ChannelType uint8 // 通道类型
ChannelTypeQualifiers ChannelTypeQualifiers // 通道类型限定符
SamplePositions [4]uint8 // 采样位置
Lower uint32 // 下限
Upper uint32 // 上限
}
SampleInformation 采样信息
func SampleInformationFromBytes ¶
func SampleInformationFromBytes(data []byte) (*SampleInformation, error)
FromBytes 从字节数组解析采样信息
func (*SampleInformation) AsBytes ¶
func (s *SampleInformation) AsBytes() []byte
AsBytes 将采样信息转换为字节数组
type SampledMaterial ¶
type SampledMaterial struct {
BaseColor Color
Metallic float64
Roughness float64
Normal Vector
Occlusion float64
Emissive Color
// Extended properties
EmissiveStrength float64
IOR float64
SpecularColor Color
Transmission float64
Thickness float64
AttenuationColor Color
AttenuationDistance float64
// Advanced material properties
AnisotropyStrength float64
AnisotropyRotation float64
SheenColor Color
SheenRoughness float64
Iridescence float64
IridescenceIor float64
IridescenceThickness float64
Dispersion float64
Clearcoat float64
ClearcoatRoughness float64
ClearcoatNormal Vector
}
SampledMaterial represents material properties sampled at a specific point
type Scene ¶
type Scene struct {
RootNode *SceneNode
Cameras []*Camera
Lights []Light
Materials map[string]*PBRMaterial
Textures map[string]*AdvancedTexture
Meshes map[string]*Mesh
Animations map[string]*Animation
Skins map[string]*Skin // Skinned animation support
MorphTargets map[string]*MorphTargets // Morph targets support
Extensions *ExtensionRegistry // GLTF extensions support
ActiveCamera *Camera
Name string
}
Scene represents a 3D scene with a hierarchy of nodes
func LoadGLTFScene ¶
LoadGLTFScene loads a complete GLTF scene with materials, cameras, lights, etc.
func (*Scene) AddAmbientLight ¶
AddAmbientLight adds an ambient light to the scene Ambient light provides uniform illumination to all surfaces
func (*Scene) AddAnimation ¶
AddAnimation adds an animation to the scene animation library
func (*Scene) AddDirectionalLight ¶
AddDirectionalLight adds a directional light to the scene
func (*Scene) AddMaterial ¶
func (scene *Scene) AddMaterial(name string, material *PBRMaterial)
AddMaterial adds a material to the scene material library
func (*Scene) AddMorphTargets ¶
func (scene *Scene) AddMorphTargets(name string, targets *MorphTargets)
AddMorphTargets adds morph targets to the scene morph target library
func (*Scene) AddPointLight ¶
AddPointLight adds a point light to the scene
func (*Scene) AddSpotLight ¶
func (scene *Scene) AddSpotLight(position, direction Vector, color Color, intensity, range_, innerCone, outerCone float64)
AddSpotLight adds a spot light to the scene
func (*Scene) AddTexture ¶
func (scene *Scene) AddTexture(name string, texture *AdvancedTexture)
AddTexture adds a texture to the scene texture library
func (*Scene) ApplyMorphTargetsToMeshes ¶
func (scene *Scene) ApplyMorphTargetsToMeshes()
ApplyMorphTargetsToMeshes applies morph targets to all relevant meshes in the scene
func (*Scene) ClearLights ¶
func (scene *Scene) ClearLights()
ClearLights removes all lights from the scene
func (*Scene) CreateMeshNode ¶
CreateMeshNode creates a new scene node with a mesh and material
func (*Scene) CreateMorphTargetMeshNode ¶
func (scene *Scene) CreateMorphTargetMeshNode(name, meshName, materialName, morphTargetName string) *SceneNode
CreateMorphTargetMeshNode creates a scene node with mesh, material, and morph targets
func (*Scene) CreateSkinnedMeshNode ¶
CreateSkinnedMeshNode creates a scene node with mesh, material, and skin
func (*Scene) GetAnimation ¶
GetAnimation gets an animation from the scene animation library
func (*Scene) GetLightsByType ¶
GetLightsByType returns all lights of a specific type
func (*Scene) GetMaterial ¶
func (scene *Scene) GetMaterial(name string) *PBRMaterial
GetMaterial gets a material from the scene material library
func (*Scene) GetMorphTargets ¶
func (scene *Scene) GetMorphTargets(name string) *MorphTargets
GetMorphTargets gets morph targets from the scene morph target library
func (*Scene) GetSupportedGLTFExtensions ¶
GetSupportedGLTFExtensions returns supported GLTF extensions
func (*Scene) GetTexture ¶
func (scene *Scene) GetTexture(name string) *AdvancedTexture
GetTexture gets a texture from the scene texture library
func (*Scene) ProcessGLTFExtensions ¶
ProcessGLTFExtensions processes GLTF extensions for the scene
func (*Scene) SetActiveCamera ¶
SetActiveCamera sets the active camera by name
func (*Scene) UpdateSkinnedMeshes ¶
func (scene *Scene) UpdateSkinnedMeshes()
UpdateSkinnedMeshes updates all skinned meshes in the scene
type SceneNode ¶
type SceneNode struct {
Name string
LocalTransform Matrix
WorldTransform Matrix
Parent *SceneNode
Children []*SceneNode
Mesh *Mesh
Material *PBRMaterial
Skin *Skin // Skinned mesh support
MorphTargets *MorphTargets // Morph target support
Visible bool
CastShadows bool
ReceiveShadows bool
}
SceneNode represents a node in the scene hierarchy
func (*SceneNode) GetRenderableNodes ¶
GetRenderableNodes returns all nodes that have both mesh and material
func (*SceneNode) GetWorldPosition ¶
GetWorldPosition returns the world position of the node
func (*SceneNode) RemoveChild ¶
RemoveChild removes a child node from this node
func (*SceneNode) SetTransform ¶
SetTransform sets the local transform of the node
func (*SceneNode) UpdateWorldTransform ¶
func (node *SceneNode) UpdateWorldTransform()
UpdateWorldTransform updates the world transform based on parent transforms
func (*SceneNode) VisitNodes ¶
VisitNodes visits all nodes in the hierarchy with the given function
type SceneRenderer ¶
type SceneRenderer struct {
// contains filtered or unexported fields
}
SceneRenderer handles rendering of scenes
func NewSceneRenderer ¶
func NewSceneRenderer(context *Context) *SceneRenderer
NewSceneRenderer creates a new scene renderer
func (*SceneRenderer) RenderNode ¶
func (renderer *SceneRenderer) RenderNode(node *SceneNode, cameraMatrix Matrix, lights []Light, cameraPos Vector)
RenderNode renders a single scene node
func (*SceneRenderer) RenderScene ¶
func (renderer *SceneRenderer) RenderScene(scene *Scene)
RenderScene renders a complete scene
type ShadowMap ¶
ShadowMap represents a shadow map for a light source
func NewShadowMap ¶
NewShadowMap creates a new shadow map with the specified dimensions
type ShadowMapRenderer ¶
type ShadowMapRenderer struct {
// contains filtered or unexported fields
}
ShadowMapRenderer handles advanced shadow mapping techniques
func NewShadowMapRenderer ¶
func NewShadowMapRenderer(context *Context, shadowMapSize int, light Light, technique ShadowTechnique) *ShadowMapRenderer
NewShadowMapRenderer creates a new shadow map renderer with the specified technique
func (*ShadowMapRenderer) GenerateShadowMap ¶
func (sr *ShadowMapRenderer) GenerateShadowMap(scene *Scene) *ShadowMap
GenerateShadowMap generates a shadow map using the specified technique
func (*ShadowMapRenderer) GetLightMatrix ¶
func (sr *ShadowMapRenderer) GetLightMatrix() Matrix
GetLightMatrix returns the light's view-projection matrix
func (*ShadowMapRenderer) GetTechnique ¶
func (sr *ShadowMapRenderer) GetTechnique() ShadowTechnique
GetTechnique returns the shadow mapping technique being used
type ShadowMapShader ¶
type ShadowMapShader struct {
Matrix Matrix
}
ShadowMapShader is a shader that renders depth information for shadow mapping
func NewShadowMapShader ¶
func NewShadowMapShader(matrix Matrix) *ShadowMapShader
NewShadowMapShader creates a new shadow map shader
func (*ShadowMapShader) Fragment ¶
func (shader *ShadowMapShader) Fragment(v Vertex) Color
Fragment returns the depth value for shadow mapping
func (*ShadowMapShader) Vertex ¶
func (shader *ShadowMapShader) Vertex(v Vertex) Vertex
Vertex processes a vertex for shadow mapping
type ShadowReceiverShader ¶
type ShadowReceiverShader struct {
Matrix Matrix
LightDirection Vector
CameraPosition Vector
ObjectColor Color
Texture Texture
ShadowMap *ShadowMap
LightMatrix Matrix
ShadowBias float64
ShadowStrength float64
PCFSize int // Percentage Closer Filtering size
}
ShadowReceiverShader is a shader that receives shadows
func NewShadowReceiverShader ¶
func NewShadowReceiverShader(matrix, lightMatrix Matrix, lightDirection, cameraPosition Vector, shadowMap *ShadowMap) *ShadowReceiverShader
NewShadowReceiverShader creates a new shadow receiver shader
func (*ShadowReceiverShader) Fragment ¶
func (shader *ShadowReceiverShader) Fragment(v Vertex) Color
Fragment performs shading with shadow calculation
func (*ShadowReceiverShader) Vertex ¶
func (shader *ShadowReceiverShader) Vertex(v Vertex) Vertex
Vertex processes a vertex for shadow receiving
type ShadowRenderer ¶
type ShadowRenderer struct {
// contains filtered or unexported fields
}
ShadowRenderer handles shadow map generation and rendering
func NewShadowRenderer ¶
func NewShadowRenderer(context *Context, shadowMapSize int, light Light) *ShadowRenderer
NewShadowRenderer creates a new shadow renderer
func (*ShadowRenderer) ExtractDepthFromBuffer ¶
func (sr *ShadowRenderer) ExtractDepthFromBuffer()
ExtractDepthFromBuffer extracts depth values from the depth buffer to the shadow map
func (*ShadowRenderer) GenerateShadowMap ¶
func (sr *ShadowRenderer) GenerateShadowMap(scene *Scene) *ShadowMap
GenerateShadowMap generates a shadow map from the light's perspective
func (*ShadowRenderer) GetLightMatrix ¶
func (sr *ShadowRenderer) GetLightMatrix() Matrix
GetLightMatrix returns the light's view-projection matrix
type ShadowTechnique ¶
type ShadowTechnique int
ShadowTechnique represents the type of shadow mapping technique to use
const ( // SimpleShadow uses basic shadow mapping SimpleShadow ShadowTechnique = iota // PCFShadow uses Percentage Closer Filtering PCFShadow // PCSSShadow uses Percentage Closer Soft Shadows PCSSShadow // VSMShadow uses Variance Shadow Maps VSMShadow )
type Skin ¶
type Skin struct {
Name string
Joints []*SceneNode // Joint nodes
InverseBindMatrices []Matrix // Inverse bind pose matrices
Skeleton *SceneNode // Root skeleton node (optional)
}
Skin represents a skin for skeletal animation
func (*Skin) UpdateJointMatrices ¶
func (skin *Skin) UpdateJointMatrices()
UpdateJointMatrices updates all joint matrices for the current pose
type SoftShadowReceiverShader ¶
type SoftShadowReceiverShader struct {
Matrix Matrix
LightDirection Vector
CameraPosition Vector
ObjectColor Color
Texture Texture
ShadowMap *ShadowMap
LightMatrix Matrix
ShadowBias float64
ShadowStrength float64
SoftShadowTechnique ShadowTechnique
FilterSize int
}
SoftShadowReceiverShader implements advanced soft shadow techniques
func NewSoftShadowReceiverShader ¶
func NewSoftShadowReceiverShader(matrix, lightMatrix Matrix, lightDirection, cameraPosition Vector, shadowMap *ShadowMap, technique ShadowTechnique) *SoftShadowReceiverShader
NewSoftShadowReceiverShader creates a new soft shadow receiver shader
func (*SoftShadowReceiverShader) Fragment ¶
func (shader *SoftShadowReceiverShader) Fragment(v Vertex) Color
Fragment performs shading with advanced shadow calculation
func (*SoftShadowReceiverShader) Vertex ¶
func (shader *SoftShadowReceiverShader) Vertex(v Vertex) Vertex
Vertex processes a vertex
type SolidColorShader ¶
SolidColorShader renders with a single, solid color.
func NewSolidColorShader ¶
func NewSolidColorShader(matrix Matrix, color Color) *SolidColorShader
func (*SolidColorShader) Fragment ¶
func (shader *SolidColorShader) Fragment(v Vertex) Color
func (*SolidColorShader) Vertex ¶
func (shader *SolidColorShader) Vertex(v Vertex) Vertex
type SupercompressionScheme ¶
type SupercompressionScheme uint32
SupercompressionScheme 超级压缩方案
const ( SupercompressionNone SupercompressionScheme = 0 SupercompressionBasisLZ SupercompressionScheme = 1 SupercompressionZstd SupercompressionScheme = 2 SupercompressionZLIB SupercompressionScheme = 3 )
func NewSupercompressionScheme ¶
func NewSupercompressionScheme(value uint32) *SupercompressionScheme
func (SupercompressionScheme) Value ¶
func (s SupercompressionScheme) Value() uint32
type Texture ¶
type Texture interface {
// BilinearSample samples the texture using bilinear interpolation
BilinearSample(u, v float64) Color
}
Texture interface defines the basic texture functionality This interface provides backward compatibility with the old texture system
func LoadTexture ¶
LoadTexture loads a texture from a file path (legacy compatibility)
type TextureAtlas ¶
type TextureAtlas struct {
Image image.Image
Width int
Height int
Regions map[string]TextureRegion
}
TextureAtlas represents a texture atlas for batching multiple textures
func NewTextureAtlas ¶
func NewTextureAtlas(img image.Image) *TextureAtlas
NewTextureAtlas creates a new texture atlas
func (*TextureAtlas) AddRegion ¶
func (atlas *TextureAtlas) AddRegion(name string, x, y, width, height int)
AddRegion adds a texture region to the atlas
func (*TextureAtlas) SampleRegion ¶
func (atlas *TextureAtlas) SampleRegion(regionName string, u, v float64) Color
SampleRegion samples a specific region in the atlas
type TextureFilter ¶
type TextureFilter int
TextureFilter defines texture filtering method
const ( // FilterNearest - nearest neighbor filtering FilterNearest TextureFilter = iota // FilterLinear - bilinear filtering FilterLinear // FilterMipmap - mipmap filtering FilterMipmap )
type TextureRegion ¶
type TextureRegion struct {
Name string
X, Y int
Width int
Height int
U0, V0 float64 // Top-left UV
U1, V1 float64 // Bottom-right UV
}
TextureRegion represents a region within a texture atlas
type TextureShader ¶
TextureShader renders with a texture and no lighting.
func NewTextureShader ¶
func NewTextureShader(matrix Matrix, texture Texture) *TextureShader
func (*TextureShader) Fragment ¶
func (shader *TextureShader) Fragment(v Vertex) Color
func (*TextureShader) Vertex ¶
func (shader *TextureShader) Vertex(v Vertex) Vertex
type TextureType ¶
type TextureType int
TextureType represents different types of textures
const ( // BaseColorTexture - diffuse/albedo texture BaseColorTexture TextureType = iota // NormalTexture - normal map for surface detail NormalTexture // MetallicTexture - metallic values MetallicTexture // RoughnessTexture - surface roughness RoughnessTexture // OcclusionTexture - ambient occlusion OcclusionTexture // EmissiveTexture - emissive/glow texture EmissiveTexture // HeightTexture - height/displacement map HeightTexture // SpecularTexture - specular values (legacy) SpecularTexture // GlossinessTexture - glossiness values (legacy) GlossinessTexture // KTX2Texture - KTX2 container format texture KTX2Texture )
type TextureWrap ¶
type TextureWrap int
TextureWrap defines texture wrapping behavior
const ( // WrapRepeat - repeat the texture WrapRepeat TextureWrap = iota // WrapClamp - clamp to edge WrapClamp // WrapMirror - mirror repeat WrapMirror )
type ToneMappingEffect ¶
ToneMappingEffect implements tone mapping
func NewToneMappingEffect ¶
func NewToneMappingEffect(exposure, gamma float64) *ToneMappingEffect
NewToneMappingEffect creates a new tone mapping effect
type TransferFunction ¶
type TransferFunction uint8
TransferFunction 传输函数
const ( TransferFunctionUnspecified TransferFunction = 0 TransferFunctionLinear TransferFunction = 1 TransferFunctionSRGB TransferFunction = 2 TransferFunctionITU TransferFunction = 3 )
func NewTransferFunction ¶
func NewTransferFunction(value uint8) *TransferFunction
func (TransferFunction) Value ¶
func (t TransferFunction) Value() uint8
type Triangle ¶
type Triangle struct {
V1, V2, V3 Vertex
}
Triangle f
func ClipTriangle ¶
ClipTriangle clips a triangle against the viewing frustum
func NewTriangleForPoints ¶
NewTriangleForPoints f
type UVBlendMode ¶
type UVBlendMode int
UVBlendMode defines how UV transformations are blended
const ( UVBlendReplace UVBlendMode = iota // 替换模式 UVBlendAdd // 加法混合 UVBlendMultiply // 乘法混合 UVBlendOverlay // 叠加模式 )
type UVIsland ¶
type UVIsland struct {
Vertices []Vector2 // UV坐标
Indices []int // 三角形索引 (3个一组)
OriginalUVs []Vector2 // 原始UV坐标
Seams []UVSeam // 接缝列表
BoundaryVerts []int // 边界顶点
PinnedVerts []int // 固定顶点
}
UVIsland 表示一个UV岛屿
type UVMapping ¶
type UVMapping struct {
Name string // 映射名称
Enabled bool // 是否启用
Region UVRegion // UV区域定义
Transform *UVTransform // UV变换
BlendMode UVBlendMode // 混合模式
Priority int // 优先级(数值越高优先级越高)
}
UVMapping defines a UV mapping configuration
func CreateRotatingUVMapping ¶
func CreateRotatingUVMapping(name string, speed float64, pivotU, pivotV float64, region UVRegion) *UVMapping
CreateRotatingUVMapping creates a rotating UV animation mapping
func CreateScalingUVMapping ¶
CreateScalingUVMapping creates a scaling UV mapping
type UVMaskType ¶
type UVMaskType int
UVMaskType defines the type of UV region mask
const ( UVMaskRectangle UVMaskType = iota // 矩形遮罩 UVMaskCircle // 圆形遮罩 UVMaskGradient // 渐变遮罩 )
type UVModifier ¶
type UVModifier struct {
// contains filtered or unexported fields
}
UVModifier provides dynamic UV coordinate modification capabilities
func (*UVModifier) AddMapping ¶
func (modifier *UVModifier) AddMapping(mapping *UVMapping)
AddMapping adds a UV mapping configuration
func (*UVModifier) EnableAnimation ¶
func (modifier *UVModifier) EnableAnimation(enabled bool)
EnableAnimation enables/disables UV animation
func (*UVModifier) GetMapping ¶
func (modifier *UVModifier) GetMapping(name string) *UVMapping
GetMapping gets a mapping by name
func (*UVModifier) RemoveMapping ¶
func (modifier *UVModifier) RemoveMapping(name string) bool
RemoveMapping removes a mapping by name
func (*UVModifier) SetGlobalTransform ¶
func (modifier *UVModifier) SetGlobalTransform(transform *UVTransform)
SetGlobalTransform sets the global UV transformation
func (*UVModifier) TransformUV ¶
func (modifier *UVModifier) TransformUV(u, v float64) (float64, float64)
TransformUV applies all UV transformations to input coordinates
func (*UVModifier) UpdateAnimation ¶
func (modifier *UVModifier) UpdateAnimation(deltaTime float64)
UpdateAnimation updates animation time for all transforms
type UVRegion ¶
type UVRegion struct {
MinU, MaxU float64 // U坐标范围 [0.0, 1.0]
MinV, MaxV float64 // V坐标范围 [0.0, 1.0]
MaskType UVMaskType // 区域遮罩类型
}
UVRegion defines a UV coordinate region
type UVRelaxationSettings ¶
type UVRelaxationSettings struct {
Iterations int // 松弛迭代次数
StepSize float64 // 松弛步长
PinBoundary bool // 是否固定边界
PreserveArea bool // 是否保持面积
PreserveAngles bool // 是否保持角度
EnableSeams bool // 是否启用接缝
}
UVRelaxationSettings 平面展开算法的设置
func NewUVRelaxationSettings ¶
func NewUVRelaxationSettings() *UVRelaxationSettings
NewUVRelaxationSettings 创建默认的UV松弛设置
type UVSeam ¶
type UVSeam struct {
Edge [2]Vector // 接缝边的两个顶点
Strength float64 // 接缝强度 (0-1)
Fixed bool // 是否固定(不参与松弛)
}
UVSeam 表示UV展开的接缝
type UVTransform ¶
type UVTransform struct {
// Basic transformations
OffsetU, OffsetV float64 // UV偏移
ScaleU, ScaleV float64 // UV缩放
Rotation float64 // 旋转角度(弧度)
// Advanced transformations
SkewU, SkewV float64 // UV剪切
PivotU, PivotV float64 // 旋转中心点
// Animation parameters
AnimationTime float64 // 动画时间
RotationSpeed float64 // 旋转速度
ScrollSpeedU float64 // U方向滚动速度
ScrollSpeedV float64 // V方向滚动速度
}
UVTransform represents a UV coordinate transformation
func NewUVTransform ¶
func NewUVTransform() *UVTransform
NewUVTransform creates a new UV transform with default values
type Vector ¶
type Vector struct {
X, Y, Z float64
}
func InterpolateVectors ¶
func LatLngToXYZ ¶
func SIMDMulScalarVectors ¶
SIMDMulScalarVectors 批量向量标量乘法
func SIMDNormalizeVectors ¶
SIMDNormalizeVectors 批量向量归一化
func (Vector) DistanceSq ¶
DistanceSq returns the square of the distance between two vectors
func (Vector) DistanceSquared ¶
func (Vector) IsDegenerate ¶
func (Vector) LengthSquared ¶
func (Vector) MaxComponent ¶
func (Vector) MinComponent ¶
func (Vector) Perpendicular ¶
func (Vector) RoundPlaces ¶
type Vector2 ¶
type Vector2 struct {
X, Y float64
}
Vector2 表示一个二维向量
func CanvasToUV ¶
CanvasToUV 将画布坐标转换为UV坐标
func (Vector2) ApproxEqual ¶
ApproxEqual 近似相等比较
type VectorW ¶
type VectorW struct {
X, Y, Z, W float64
}
VectorW 表示齐次坐标向量
func Barycentric ¶
func InterpolateVectorWs ¶
type Vertex ¶
func InterpolateVertexes ¶
type ViewFrustum ¶
type ViewFrustum struct {
Planes [6]Plane
}
ViewFrustum represents a camera viewing frustum for culling
func NewViewFrustumFromMatrix ¶
func NewViewFrustumFromMatrix(matrix Matrix) *ViewFrustum
NewViewFrustumFromMatrix creates a frustum from a projection-view matrix
func (*ViewFrustum) IntersectsBox ¶
func (f *ViewFrustum) IntersectsBox(box Box) bool
IntersectsBox checks if a box intersects with the frustum
type VignetteEffect ¶
type VignetteEffect struct {
Strength float64
}
VignetteEffect implements a vignette effect
func NewVignetteEffect ¶
func NewVignetteEffect(strength float64) *VignetteEffect
NewVignetteEffect creates a new vignette effect