Documentation
¶
Index ¶
- Variables
- type AmbientLight
- type AmbientLightInfo
- type Armature
- type ArmatureInfo
- type Camera
- func (c *Camera) AspectRatio() float32
- func (c *Camera) AutoExposure() bool
- func (c *Camera) AutoExposureSpeed() float32
- func (c *Camera) AutoFocus() bool
- func (c *Camera) Delete()
- func (c *Camera) Exposure() float32
- func (c *Camera) FoV() sprec.Angle
- func (c *Camera) FoVMode() FoVMode
- func (c *Camera) FocusRange() (float32, float32)
- func (c *Camera) MaximumExposure() float32
- func (c *Camera) MinimumExposure() float32
- func (c *Camera) SetAspectRatio(ratio float32)
- func (c *Camera) SetAutoExposure(enabled bool)
- func (c *Camera) SetAutoExposureSpeed(speed float32)
- func (c *Camera) SetAutoFocus(enabled bool)
- func (c *Camera) SetExposure(exposure float32)
- func (c *Camera) SetFoV(angle sprec.Angle)
- func (c *Camera) SetFoVMode(mode FoVMode)
- func (c *Camera) SetFocusRange(near, far float32)
- func (c *Camera) SetMaximumExposure(maxExposure float32)
- func (c *Camera) SetMinimumExposure(minExposure float32)
- type CubeTexture
- type CubeTextureDefinition
- type DataFormat
- type Debug
- type DirectionalLight
- func (l *DirectionalLight) Active() bool
- func (l *DirectionalLight) Delete()
- func (l *DirectionalLight) EmitColor() dprec.Vec3
- func (l *DirectionalLight) EmitRange() float64
- func (l *DirectionalLight) Position() dprec.Vec3
- func (l *DirectionalLight) Rotation() dprec.Quat
- func (l *DirectionalLight) SetActive(active bool)
- func (l *DirectionalLight) SetEmitColor(color dprec.Vec3)
- func (l *DirectionalLight) SetEmitRange(emitRange float64)
- func (l *DirectionalLight) SetPosition(position dprec.Vec3)
- func (l *DirectionalLight) SetRotation(rotation dprec.Quat)
- type DirectionalLightInfo
- type Engine
- func (e *Engine) Create()
- func (e *Engine) CreateCubeTexture(definition CubeTextureDefinition) *CubeTexture
- func (e *Engine) CreateMaterialDefinition(info MaterialDefinitionInfo) *MaterialDefinition
- func (e *Engine) CreateMeshDefinition(info MeshDefinitionInfo) *MeshDefinition
- func (e *Engine) CreatePBRMaterialDefinition(info PBRMaterialInfo) *MaterialDefinition
- func (e *Engine) CreateScene() *Scene
- func (e *Engine) CreateShading(info ShadingInfo) Shading
- func (e *Engine) CreateTwoDTexture(definition TwoDTextureDefinition) *TwoDTexture
- func (e *Engine) Debug() *Debug
- func (e *Engine) Destroy()
- func (e *Engine) PBRShading() Shading
- type Filter
- type FoVMode
- type IndexFormat
- type InternalFormat
- type Material
- type MaterialDefinition
- func (d *MaterialDefinition) AlphaBlending() bool
- func (d *MaterialDefinition) AlphaTesting() bool
- func (d *MaterialDefinition) AlphaThreshold() float32
- func (d *MaterialDefinition) BackfaceCulling() bool
- func (d *MaterialDefinition) SetAlphaBlending(blending bool)
- func (d *MaterialDefinition) SetAlphaTesting(testing bool)
- func (d *MaterialDefinition) SetAlphaThreshold(threshold float32)
- func (d *MaterialDefinition) SetBackfaceCulling(culling bool)
- type MaterialDefinitionInfo
- type Mesh
- type MeshConfig
- type MeshDefinition
- type MeshDefinitionInfo
- type MeshFragmentDefinitionInfo
- type MeshInfo
- type Node
- type PBRGeometryShaderConfig
- type PBRMaterialInfo
- type PointLight
- func (l *PointLight) Active() bool
- func (l *PointLight) Delete()
- func (l *PointLight) EmitColor() dprec.Vec3
- func (l *PointLight) EmitRange() float64
- func (l *PointLight) Position() dprec.Vec3
- func (l *PointLight) SetActive(active bool)
- func (l *PointLight) SetEmitColor(color dprec.Vec3)
- func (l *PointLight) SetEmitRange(emitRange float64)
- func (l *PointLight) SetPosition(position dprec.Vec3)
- type PointLightInfo
- type PostprocessingShaderConfig
- type Primitive
- type Scene
- func (s *Scene) ActiveCamera() *Camera
- func (s *Scene) CreateAmbientLight(info AmbientLightInfo) *AmbientLight
- func (s *Scene) CreateArmature(info ArmatureInfo) *Armature
- func (s *Scene) CreateCamera() *Camera
- func (s *Scene) CreateDirectionalLight(info DirectionalLightInfo) *DirectionalLight
- func (s *Scene) CreateMesh(info MeshInfo) *Mesh
- func (s *Scene) CreatePointLight(info PointLightInfo) *PointLight
- func (s *Scene) CreateSpotLight(info SpotLightInfo) *SpotLight
- func (s *Scene) CreateStaticMesh(info StaticMeshInfo)
- func (s *Scene) Delete()
- func (s *Scene) Point(viewport Viewport, camera *Camera, position dprec.Vec3) dprec.Vec2
- func (s *Scene) Ray(viewport Viewport, camera *Camera, x, y int) (dprec.Vec3, dprec.Vec3)
- func (s *Scene) Render(viewport Viewport)
- func (s *Scene) RenderFramebuffer(framebuffer render.Framebuffer, viewport Viewport)
- func (s *Scene) SetActiveCamera(camera *Camera)
- func (s *Scene) Sky() *Sky
- type ShaderCollection
- type Shading
- type ShadingInfo
- type ShadowMappingShaderConfig
- type Sky
- type SpotLight
- func (l *SpotLight) Active() bool
- func (l *SpotLight) Delete()
- func (l *SpotLight) EmitColor() dprec.Vec3
- func (l *SpotLight) EmitRange() float64
- func (l *SpotLight) Position() dprec.Vec3
- func (l *SpotLight) Rotation() dprec.Quat
- func (l *SpotLight) SetActive(active bool)
- func (l *SpotLight) SetEmitColor(color dprec.Vec3)
- func (l *SpotLight) SetEmitRange(emitRange float64)
- func (l *SpotLight) SetPosition(position dprec.Vec3)
- func (l *SpotLight) SetRotation(rotation dprec.Quat)
- type SpotLightInfo
- type StaticMesh
- type StaticMeshInfo
- type ToneMapping
- type TwoDTexture
- type TwoDTextureDefinition
- type VertexFormat
- type Viewport
- type Wrap
Constants ¶
This section is empty.
Variables ¶
var ShowLightView bool
Functions ¶
This section is empty.
Types ¶
type AmbientLight ¶
type AmbientLight struct {
// contains filtered or unexported fields
}
func (*AmbientLight) Active ¶ added in v0.10.0
func (l *AmbientLight) Active() bool
func (*AmbientLight) SetActive ¶ added in v0.10.0
func (l *AmbientLight) SetActive(active bool)
type AmbientLightInfo ¶ added in v0.10.0
type AmbientLightInfo struct { Position dprec.Vec3 // TODO: Use a Box shape instead InnerRadius float64 OuterRadius float64 ReflectionTexture *CubeTexture RefractionTexture *CubeTexture }
type ArmatureInfo ¶ added in v0.9.0
type Camera ¶
type Camera struct { Node // contains filtered or unexported fields }
Camera represents a 3D camera.
func (*Camera) AspectRatio ¶
AspectRatio returns the aspect ratio to be maintained when rendering with this camera. This setting works in combination with FoVMode and FoV settings.
func (*Camera) AutoExposure ¶
AutoExposure returns whether this camera will try and automatically adjust the exposure setting to maintain a proper brightness of the final image.
func (*Camera) AutoExposureSpeed ¶ added in v0.9.0
AutoExposureSpeed returns how fast the camera will adjust its exposure.
func (*Camera) AutoFocus ¶
AutoFocus returns whether this camera will try and automatically focus on objects.
func (*Camera) FoVMode ¶
FoVMode returns the mode of field-of-view. This determines how the FoV setting is used to calculate the final image in the vertical and horizontal directions.
func (*Camera) FocusRange ¶
FocusRange changes the range from near to far in which the image will be in focus.
func (*Camera) MaximumExposure ¶ added in v0.3.0
MaximumExposure returns the maximum exposure that the camera may use during AutoExposure.
func (*Camera) MinimumExposure ¶ added in v0.3.0
MinimumExposure returns the maximum exposure that the camera may use during AutoExposure.
func (*Camera) SetAspectRatio ¶
SetAspectRatio changes the aspect ratio of this camera.
func (*Camera) SetAutoExposure ¶
SetAutoExposure changes whether this cammera should attempt to do automatic exposure adjustment.
func (*Camera) SetAutoExposureSpeed ¶ added in v0.9.0
SetAutoExposureSpeed changes the speed at which the camera will automatically adjust its exposure.
func (*Camera) SetAutoFocus ¶
SetAutoFocus changes whether this camera should attempt to automatically focus on object in the scene.
func (*Camera) SetExposure ¶
SetExposure changes the exposure setting of this camera. Smaller values mean that the final image will be darker and higher values mean that the final image will be brighter with 1.0 being the starting point.
func (*Camera) SetFoVMode ¶
SetFoVMode changes the field-of-view mode of this camera.
func (*Camera) SetFocusRange ¶
SetFocusRange changes the focus range for this camera.
func (*Camera) SetMaximumExposure ¶ added in v0.3.0
SetMaximumExposure changes the maximum exposure for this camera.
func (*Camera) SetMinimumExposure ¶ added in v0.3.0
SetMinimumExposure changes the maximum exposure for this camera.
type CubeTexture ¶
type CubeTexture struct {
// contains filtered or unexported fields
}
CubeTexture represents a cube texture.
func (*CubeTexture) Delete ¶
func (t *CubeTexture) Delete()
Delete releases any resources allocated for this texture.
type CubeTextureDefinition ¶
type CubeTextureDefinition struct { Dimension int Filtering Filter GenerateMipmaps bool GammaCorrection bool InternalFormat InternalFormat DataFormat DataFormat FrontSideData []byte BackSideData []byte LeftSideData []byte RightSideData []byte TopSideData []byte BottomSideData []byte }
CubeTextureDefinition contains all the information needed to create a CubeTexture.
type DataFormat ¶
type DataFormat int
const ( DataFormatRGBA8 DataFormat = 1 + iota DataFormatRGBA16F DataFormatRGBA32F )
type DirectionalLight ¶
type DirectionalLight struct {
// contains filtered or unexported fields
}
func (*DirectionalLight) Active ¶ added in v0.10.0
func (l *DirectionalLight) Active() bool
Active returns whether this light will be applied.
func (*DirectionalLight) Delete ¶ added in v0.10.0
func (l *DirectionalLight) Delete()
Delete removes this light from the scene.
func (*DirectionalLight) EmitColor ¶ added in v0.14.0
func (l *DirectionalLight) EmitColor() dprec.Vec3
EmitColor returns the linear color of this light.
func (*DirectionalLight) EmitRange ¶ added in v0.14.0
func (l *DirectionalLight) EmitRange() float64
EmitRange returns the distance that this light source covers.
func (*DirectionalLight) Position ¶ added in v0.14.0
func (l *DirectionalLight) Position() dprec.Vec3
Position returns the location of this light source.
func (*DirectionalLight) Rotation ¶ added in v0.14.0
func (l *DirectionalLight) Rotation() dprec.Quat
Rotation returns the orientation of this light source.
func (*DirectionalLight) SetActive ¶ added in v0.10.0
func (l *DirectionalLight) SetActive(active bool)
SetActive changes whether this light will be applied.
func (*DirectionalLight) SetEmitColor ¶ added in v0.14.0
func (l *DirectionalLight) SetEmitColor(color dprec.Vec3)
SetEmitColor changes the linear color of this light. The values can be outside the [0.0, 1.0] range for higher intensity.
func (*DirectionalLight) SetEmitRange ¶ added in v0.14.0
func (l *DirectionalLight) SetEmitRange(emitRange float64)
SetEmitRange changes the distance that this light source covers.
func (*DirectionalLight) SetPosition ¶ added in v0.14.0
func (l *DirectionalLight) SetPosition(position dprec.Vec3)
SetPosition changes the position of this light source.
func (*DirectionalLight) SetRotation ¶ added in v0.14.0
func (l *DirectionalLight) SetRotation(rotation dprec.Quat)
SetRotation changes the orientation of this light source.
type DirectionalLightInfo ¶ added in v0.10.0
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine represents an entrypoint to 3D graphics rendering.
func (*Engine) CreateCubeTexture ¶
func (e *Engine) CreateCubeTexture(definition CubeTextureDefinition) *CubeTexture
CreateCubeTexture creates a new CubeTexture using the specified definition.
func (*Engine) CreateMaterialDefinition ¶ added in v0.9.0
func (e *Engine) CreateMaterialDefinition(info MaterialDefinitionInfo) *MaterialDefinition
CreateMaterialDefinition creates a new MaterialDefinition from the specified info object.
func (*Engine) CreateMeshDefinition ¶ added in v0.9.0
func (e *Engine) CreateMeshDefinition(info MeshDefinitionInfo) *MeshDefinition
CreateMeshDefinition creates a new MeshDefinition using the specified info object.
func (*Engine) CreatePBRMaterialDefinition ¶ added in v0.9.0
func (e *Engine) CreatePBRMaterialDefinition(info PBRMaterialInfo) *MaterialDefinition
CreatePBRMaterialDefinition creates a new Material that is based on PBR definition. TODO: Remove this and create a PBR builder over MaterialDefinitionInfo.
func (*Engine) CreateScene ¶
CreateScene creates a new 3D Scene. Entities managed within a given scene are isolated within that scene.
func (*Engine) CreateShading ¶ added in v0.16.0
func (e *Engine) CreateShading(info ShadingInfo) Shading
func (*Engine) CreateTwoDTexture ¶
func (e *Engine) CreateTwoDTexture(definition TwoDTextureDefinition) *TwoDTexture
CreateTwoDTexture creates a new TwoDTexture using the specified definition.
func (*Engine) Destroy ¶
func (e *Engine) Destroy()
Destroy releases resources allocated by this 3D engine.
func (*Engine) PBRShading ¶ added in v0.9.0
PBRShading returns the Shading implementaton for phisically-based rendering.
type FoVMode ¶
type FoVMode string
FoVMode determines how the camera field of view is calculated in the horizontal and vertical directions.
const ( // FoVModeAnamorphic will abide to the aspect ratio setting // and will pillerbox the image if necessary. FoVModeAnamorphic FoVMode = "anamorphic" // FoVModeHorizontalPlus will apply the FoV setting to the // vertical direction and will adjust the horizontal direction // accordingly to preserve the screen's aspect ratio. FoVModeHorizontalPlus FoVMode = "horizontal-plus" // FoVModeVertialMinus will apply the FoV setting to the // horizontal direction and will adjust the vertical direction // accordingly to preserve the screen's aspect ratio. FoVModeVertialMinus FoVMode = "vertical-minus" // FoVModePixelBased will use an orthogonal projection that // will match in side the screen pixel size. FoVModePixelBased FoVMode = "pixel-based" )
type IndexFormat ¶
type IndexFormat int
IndexFormat specifies the data type that is used to represent individual indices.
const ( IndexFormatU16 IndexFormat = 1 + iota IndexFormatU32 )
type InternalFormat ¶
type InternalFormat int
const ( InternalFormatRGBA8 InternalFormat = 1 + iota InternalFormatRGBA16F InternalFormatRGBA32F )
type Material ¶
type Material struct {
// contains filtered or unexported fields
}
Material determines the appearance of a mesh on the screen.
type MaterialDefinition ¶ added in v0.9.0
type MaterialDefinition struct {
// contains filtered or unexported fields
}
MaterialDefinition represents a particular material template. Multiple meshes can share the same MaterialDefinition though their Material instances will differ.
func (*MaterialDefinition) AlphaBlending ¶ added in v0.9.0
func (d *MaterialDefinition) AlphaBlending() bool
AlphaBlending returns whether the mesh will be checked for translucency and will be mixed with the background.
func (*MaterialDefinition) AlphaTesting ¶ added in v0.9.0
func (d *MaterialDefinition) AlphaTesting() bool
AlphaTesting returns whether the mesh will be checked for transparent sections.
func (*MaterialDefinition) AlphaThreshold ¶ added in v0.9.0
func (d *MaterialDefinition) AlphaThreshold() float32
AlphaThreshold returns the alpha value below which a pixel will be considered transparent.
func (*MaterialDefinition) BackfaceCulling ¶ added in v0.9.0
func (d *MaterialDefinition) BackfaceCulling() bool
BackfaceCulling returns whether the back face of triangles should be skipped during rendering.
func (*MaterialDefinition) SetAlphaBlending ¶ added in v0.9.0
func (d *MaterialDefinition) SetAlphaBlending(blending bool)
SetAlphaBlending changes whether alpha blending will be performed.
func (*MaterialDefinition) SetAlphaTesting ¶ added in v0.9.0
func (d *MaterialDefinition) SetAlphaTesting(testing bool)
SetAlphaTesting changes whether alpha testing will be performed.
func (*MaterialDefinition) SetAlphaThreshold ¶ added in v0.9.0
func (d *MaterialDefinition) SetAlphaThreshold(threshold float32)
SetAlphaThreshold changes the alpha threshold.
func (*MaterialDefinition) SetBackfaceCulling ¶ added in v0.9.0
func (d *MaterialDefinition) SetBackfaceCulling(culling bool)
SetBackfaceCulling changes the back face culling configuration of this material definition.
type MaterialDefinitionInfo ¶ added in v0.9.0
type MaterialDefinitionInfo struct { BackfaceCulling bool AlphaTesting bool AlphaBlending bool AlphaThreshold float32 Vectors []sprec.Vec4 TwoDTextures []render.Texture CubeTextures []render.Texture Shading Shading }
MaterialDefinitionInfo contains the information needed to create a MaterialDefinition.
type Mesh ¶
type Mesh struct { Node // contains filtered or unexported fields }
Mesh represents an instance of a 3D mesh.
type MeshConfig ¶ added in v0.16.0
type MeshConfig struct {
HasArmature bool
}
type MeshDefinition ¶ added in v0.9.0
type MeshDefinition struct {
// contains filtered or unexported fields
}
MeshDefinition represents the definition of a mesh. Multiple mesh instances can be created off of one template reusing resources.
func (*MeshDefinition) Delete ¶ added in v0.9.0
func (t *MeshDefinition) Delete()
Delete releases any resources owned by this MeshDefinition.
type MeshDefinitionInfo ¶ added in v0.9.0
type MeshDefinitionInfo struct { VertexData []byte VertexFormat VertexFormat IndexData []byte IndexFormat IndexFormat Fragments []MeshFragmentDefinitionInfo BoundingSphereRadius float64 }
MeshDefinitionInfo contains everything needed to create a new MeshDefinition.
func (*MeshDefinitionInfo) NeedsArmature ¶ added in v0.9.0
func (i *MeshDefinitionInfo) NeedsArmature() bool
NeedsArmature returns whether the mesh described by this info object will require an Armature to be visualized.
type MeshFragmentDefinitionInfo ¶ added in v0.9.0
type MeshFragmentDefinitionInfo struct { Primitive Primitive IndexOffset int IndexCount int Material *MaterialDefinition }
MeshFragmentDefinitionInfo represents the definition of a portion of a mesh that is drawn with a specific material and primitives.
type MeshInfo ¶ added in v0.9.0
type MeshInfo struct { Definition *MeshDefinition Armature *Armature }
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a positioning of some entity in the 3D scene.
func (*Node) SetMatrix ¶ added in v0.9.0
SetMatrix changes the model matrix of this node. Keep in mind that this is a somewhat slow operation and should only be performed only once per frame. This is also the reason why there is no getter for this method. Clients are expected to track matrices outside this type if needed.
type PBRGeometryShaderConfig ¶ added in v0.9.0
type PBRMaterialInfo ¶ added in v0.9.0
type PBRMaterialInfo struct { BackfaceCulling bool AlphaBlending bool AlphaTesting bool AlphaThreshold float32 Metallic float32 Roughness float32 MetallicRoughnessTexture *TwoDTexture AlbedoColor sprec.Vec4 AlbedoTexture *TwoDTexture NormalScale float32 NormalTexture *TwoDTexture }
PBRMaterialInfo contains the information needed to create a PBR Material.
type PointLight ¶ added in v0.10.0
type PointLight struct {
// contains filtered or unexported fields
}
PointLight represents a light source that is positioned at a point in space and emits light evenly in all directions up to a range.
func (*PointLight) Active ¶ added in v0.10.0
func (l *PointLight) Active() bool
Active returns whether this light will be applied.
func (*PointLight) Delete ¶ added in v0.10.0
func (l *PointLight) Delete()
Delete removes this light from the scene.
func (*PointLight) EmitColor ¶ added in v0.10.0
func (l *PointLight) EmitColor() dprec.Vec3
EmitColor returns the linear color of this light.
func (*PointLight) EmitRange ¶ added in v0.10.0
func (l *PointLight) EmitRange() float64
EmitRange returns the distance that this light source covers.
func (*PointLight) Position ¶ added in v0.10.0
func (l *PointLight) Position() dprec.Vec3
Position returns the location of this light source.
func (*PointLight) SetActive ¶ added in v0.10.0
func (l *PointLight) SetActive(active bool)
SetActive changes whether this light will be applied.
func (*PointLight) SetEmitColor ¶ added in v0.10.0
func (l *PointLight) SetEmitColor(color dprec.Vec3)
SetEmitColor changes the linear color of this light. The values can be outside the [0.0, 1.0] range for higher intensity.
func (*PointLight) SetEmitRange ¶ added in v0.10.0
func (l *PointLight) SetEmitRange(emitRange float64)
SetEmitRange changes the distance that this light source covers.
func (*PointLight) SetPosition ¶ added in v0.10.0
func (l *PointLight) SetPosition(position dprec.Vec3)
SetPosition changes the position of this light source.
type PointLightInfo ¶ added in v0.10.0
PointLightInfo contains the information needed to create a PointLight.
type PostprocessingShaderConfig ¶ added in v0.9.0
type PostprocessingShaderConfig struct {
ToneMapping ToneMapping
}
type Primitive ¶
type Primitive int
Primitive represents the basic shape unit that is described by indices (for example: triangles).
type Scene ¶
type Scene struct {
// contains filtered or unexported fields
}
Scene represents a collection of 3D render entities that comprise a single visual scene.
func (*Scene) ActiveCamera ¶ added in v0.9.0
ActiveCamera returns the currently active camera for this scene.
func (*Scene) CreateAmbientLight ¶
func (s *Scene) CreateAmbientLight(info AmbientLightInfo) *AmbientLight
CreateAmbientLight creates a new AmbientLight object to be used within this scene.
func (*Scene) CreateArmature ¶ added in v0.9.0
func (s *Scene) CreateArmature(info ArmatureInfo) *Armature
CreateArmature creates an armature to be used with meshes.
func (*Scene) CreateCamera ¶
CreateCamera creates a new camera object to be used with this scene.
func (*Scene) CreateDirectionalLight ¶
func (s *Scene) CreateDirectionalLight(info DirectionalLightInfo) *DirectionalLight
CreateDirectionalLight creates a new DirectionalLight object to be used within this scene.
func (*Scene) CreateMesh ¶
CreateMesh creates a new mesh instance from the specified template and places it in the scene.
func (*Scene) CreatePointLight ¶ added in v0.9.0
func (s *Scene) CreatePointLight(info PointLightInfo) *PointLight
CreatePointLight creates a new PointLight object to be used within this scene.
func (*Scene) CreateSpotLight ¶ added in v0.10.0
func (s *Scene) CreateSpotLight(info SpotLightInfo) *SpotLight
CreateSpotLight creates a new SpotLight object to be used within this scene.
func (*Scene) CreateStaticMesh ¶ added in v0.11.0
func (s *Scene) CreateStaticMesh(info StaticMeshInfo)
CreateStaticMesh creates a new static mesh to be rendered in this scene.
Static meshes cannot be removed from a scene but are rendered more efficiently.
func (*Scene) Delete ¶
func (s *Scene) Delete()
Delete removes this scene and releases all entities allocated for it.
func (*Scene) Render ¶
Render draws this scene to the specified viewport looking through the specified camera.
func (*Scene) RenderFramebuffer ¶ added in v0.4.0
func (s *Scene) RenderFramebuffer(framebuffer render.Framebuffer, viewport Viewport)
Render draws this scene to the specified viewport looking through the specified camera.
func (*Scene) SetActiveCamera ¶ added in v0.9.0
SetActiveCamera changes the active camera for this scene.
type ShaderCollection ¶ added in v0.4.0
type ShaderCollection struct { BuildGeometry func(meshConfig MeshConfig, fn shading.GeometryFunc) render.ProgramCode BuildForward func(meshConfig MeshConfig, fn shading.ForwardFunc) render.ProgramCode ShadowMappingSet func(cfg ShadowMappingShaderConfig) render.ProgramCode PBRGeometrySet func(cfg PBRGeometryShaderConfig) render.ProgramCode DirectionalLightSet func() render.ProgramCode AmbientLightSet func() render.ProgramCode PointLightSet func() render.ProgramCode SpotLightSet func() render.ProgramCode SkyboxSet func() render.ProgramCode SkycolorSet func() render.ProgramCode DebugSet func() render.ProgramCode ExposureSet func() render.ProgramCode PostprocessingSet func(cfg PostprocessingShaderConfig) render.ProgramCode }
type Shading ¶ added in v0.9.0
type Shading interface { // ShadowPipeline constructs a render Pipeline for the specified mesh and // material definitions to be used in the shadow pass. ShadowPipeline(meshDef *MeshDefinition, fragmentDef *meshFragmentDefinition) render.Pipeline // GeometryPipeline constructs a render Pipeline for the specified mesh and // material definitions to be used in the geometry pass. GeometryPipeline(meshDef *MeshDefinition, fragmentDef *meshFragmentDefinition) render.Pipeline // EmissivePipeline constructs a render Pipeline for the specified mesh and // material definitions to be used in the emissive pass. EmissivePipeline(meshDef *MeshDefinition, fragmentDef *meshFragmentDefinition) render.Pipeline // ForwardPipeline constructs a render Pipeline for the specified mesh and // material definitions to be used in the forward pass. ForwardPipeline(meshDef *MeshDefinition, fragmentDef *meshFragmentDefinition) render.Pipeline }
Shading represents an algorithm for shading a particular mesh and material.
type ShadingInfo ¶ added in v0.16.0
type ShadingInfo struct { ShadowFunc shading.ShadowFunc GeometryFunc shading.GeometryFunc EmissiveFunc shading.EmissiveFunc ForwardFunc shading.ForwardFunc LightingFunc shading.LightingFunc }
type ShadowMappingShaderConfig ¶ added in v0.9.0
type ShadowMappingShaderConfig struct {
HasArmature bool
}
type Sky ¶
type Sky struct {
// contains filtered or unexported fields
}
Sky represents the Scene's background.
func (*Sky) BackgroundColor ¶
BackgroundColor returns the color of the background.
func (*Sky) SetBackgroundColor ¶
SetBackgroundColor changes the color of the background.
func (*Sky) SetSkybox ¶
func (s *Sky) SetSkybox(skybox *CubeTexture)
SetSkybox sets a cube texture to be used as the background. If nil is specified, then a texture will not be used and instead the background color will be drawn instead.
func (*Sky) Skybox ¶
func (s *Sky) Skybox() *CubeTexture
// Skybox returns the cube texture to be used as the background. // If one has not been set, this method returns nil.
type SpotLight ¶ added in v0.10.0
type SpotLight struct {
// contains filtered or unexported fields
}
SpotLight represents a light source that is positioned at a point in space and emits a light cone in down the -Z axis up to a range.
func (*SpotLight) Delete ¶ added in v0.10.0
func (l *SpotLight) Delete()
Delete removes this light from the scene.
func (*SpotLight) EmitRange ¶ added in v0.10.0
EmitRange returns the distance that this light source covers.
func (*SpotLight) Rotation ¶ added in v0.14.0
Rotation returns the orientation of this light source.
func (*SpotLight) SetActive ¶ added in v0.10.0
SetActive changes whether this light will be applied.
func (*SpotLight) SetEmitColor ¶ added in v0.10.0
SetEmitColor changes the linear color of this light. The values can be outside the [0.0, 1.0] range for higher intensity.
func (*SpotLight) SetEmitRange ¶ added in v0.10.0
SetEmitRange changes the distance that this light source covers.
func (*SpotLight) SetPosition ¶ added in v0.10.0
SetPosition changes the position of this light source.
func (*SpotLight) SetRotation ¶ added in v0.10.0
SetRotation changes the orientation of this light source.
type SpotLightInfo ¶ added in v0.10.0
type SpotLightInfo struct { Position dprec.Vec3 Rotation dprec.Quat EmitRange float64 EmitOuterConeAngle dprec.Angle EmitInnerConeAngle dprec.Angle EmitColor dprec.Vec3 }
SpotLightInfo contains the information needed to create a SpotLight.
type StaticMesh ¶ added in v0.11.0
type StaticMesh struct {
// contains filtered or unexported fields
}
type StaticMeshInfo ¶ added in v0.11.0
type StaticMeshInfo struct { Definition *MeshDefinition Matrix dprec.Mat4 }
type ToneMapping ¶ added in v0.4.0
type ToneMapping string
const ( ReinhardToneMapping ToneMapping = "reinhard" ExponentialToneMapping ToneMapping = "exponential" )
type TwoDTexture ¶
type TwoDTexture struct {
// contains filtered or unexported fields
}
TwoDTexture represents a two-dimensional texture.
func (*TwoDTexture) Delete ¶
func (t *TwoDTexture) Delete()
Delete releases any resources allocated for this texture.
type TwoDTextureDefinition ¶
type TwoDTextureDefinition struct { Width int Height int Wrapping Wrap Filtering Filter GenerateMipmaps bool GammaCorrection bool InternalFormat InternalFormat DataFormat DataFormat Data []byte }
TwoDTextureDefinition contains all the information needed to create a TwoDTexture.
type VertexFormat ¶
type VertexFormat struct { HasCoord bool CoordOffsetBytes int CoordStrideBytes int HasNormal bool NormalOffsetBytes int NormalStrideBytes int HasTangent bool TangentOffsetBytes int TangentStrideBytes int HasTexCoord bool TexCoordOffsetBytes int TexCoordStrideBytes int HasColor bool ColorOffsetBytes int ColorStrideBytes int HasWeights bool WeightsOffsetBytes int WeightsStrideBytes int HasJoints bool JointsOffsetBytes int JointsStrideBytes int }
VertexFormat describes the data that is contained in a single vertex.
type Viewport ¶
Viewport represents an area on the screen to which rendering will occur.
func NewViewport ¶
NewViewport creates a new Viewport with the specified parameters.