Documentation
¶
Overview ¶
Package material contains virtual materials which specify the appearance of graphic objects.
Index ¶
- Constants
- type Basic
- type Blending
- type IMaterial
- type Material
- func (m *Material) AddTexture(tex *texture.Texture2D)
- func (m *Material) Dispose()
- func (m *Material) GetMaterial() *Material
- func (m *Material) HasTexture(tex *texture.Texture2D) bool
- func (m *Material) InitMaterial() *Material
- func (m *Material) RemoveTexture(tex *texture.Texture2D)
- func (m *Material) RenderSetup(gs *gls.GLS)
- func (m *Material) SetBlending(blending Blending)
- func (m *Material) SetDepthFunc(state uint32)
- func (m *Material) SetDepthMask(state bool)
- func (m *Material) SetDepthTest(state bool)
- func (m *Material) SetLineWidth(width float32)
- func (m *Material) SetPolygonOffset(factor, units float32)
- func (m *Material) SetShader(sname string)
- func (m *Material) SetSide(side Side)
- func (m *Material) SetTransparent(state bool)
- func (m *Material) SetUseLights(lights UseLights)
- func (m *Material) SetWireframe(state bool)
- func (m *Material) Shader() string
- func (m *Material) Side() Side
- func (m *Material) TextureCount() int
- func (m *Material) Textures() []*texture.Texture2D
- func (m *Material) Transparent() bool
- func (m *Material) UseLights() UseLights
- func (m *Material) Wireframe() bool
- type Physical
- func (m *Physical) InitPhysical()
- func (m *Physical) RenderSetup(gl *gls.GLS)
- func (m *Physical) SetBaseColorFactor(c math32.Color4)
- func (m *Physical) SetBaseColorMap(tex *texture.Texture2D)
- func (m *Physical) SetEmissiveFactor(c math32.Color)
- func (m *Physical) SetEmissiveMap(tex *texture.Texture2D)
- func (m *Physical) SetMetallicFactor(v float32)
- func (m *Physical) SetMetallicRoughnessMap(tex *texture.Texture2D)
- func (m *Physical) SetNormalMap(tex *texture.Texture2D)
- func (m *Physical) SetOcclusionMap(tex *texture.Texture2D)
- func (m *Physical) SetRoughnessFactor(v float32)
- type Point
- type Side
- type Standard
- func (m *Standard) AmbientColor() math32.Color
- func (m *Standard) EmissiveColor() math32.Color
- func (m *Standard) InitStandard(color math32.Color)
- func (m *Standard) RenderSetup(gs *gls.GLS)
- func (m *Standard) SetAmbientColor(color math32.Color)
- func (m *Standard) SetColor(color math32.Color)
- func (m *Standard) SetEmissiveColor(color math32.Color)
- func (m *Standard) SetOpacity(opacity float32)
- func (m *Standard) SetShininess(shininess float32)
- func (m *Standard) SetSpecularColor(color math32.Color)
- type UseLights
Constants ¶
const ( SideFront = Side(iota) SideBack SideDouble )
The face side(s) to be rendered. The non-rendered side will be culled to improve performance.
const ( BlendNone = Blending(iota) BlendNormal BlendAdditive BlendSubtractive BlendMultiply BlendCustom )
The various blending types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Basic ¶
type Basic struct {
Material
}
Basic is a simple material that uses the 'basic' shader.
type IMaterial ¶
type IMaterial interface { core.IRefCount GetMaterial() *Material RenderSetup(gs *gls.GLS) Dispose() }
IMaterial is the interface for all materials.
type Material ¶
type Material struct { core.RefCount ShaderDefines gls.MaterialDefines // shader defines // contains filtered or unexported fields }
Material is the base material.
func (*Material) AddTexture ¶
AddTexture adds the specified texture to the material
func (*Material) Dispose ¶
func (m *Material) Dispose()
Dispose releases OpenGL resources associated with this material.
func (*Material) GetMaterial ¶
GetMaterial satisfies the IMaterial interface.
func (*Material) HasTexture ¶
HasTexture checks if the material contains the specified texture
func (*Material) InitMaterial ¶ added in v0.2.69
InitMaterial initializes the material.
func (*Material) RemoveTexture ¶
RemoveTexture removes the specified texture from the material
func (*Material) RenderSetup ¶
RenderSetup is called by the renderer before drawing objects with this material.
func (*Material) SetBlending ¶
func (*Material) SetDepthFunc ¶
func (*Material) SetDepthMask ¶
func (*Material) SetDepthTest ¶
func (*Material) SetLineWidth ¶
func (*Material) SetPolygonOffset ¶
func (*Material) SetTransparent ¶
SetTransparent sets whether this material is transparent.
func (*Material) SetUseLights ¶
SetUseLights sets the material use lights bit mask specifying which light types will be used when rendering the material By default the material will use all lights
func (*Material) SetWireframe ¶
SetWireframe sets whether only the wireframe is rendered.
func (*Material) TextureCount ¶
TextureCount returns the current number of textures
func (*Material) Transparent ¶
Transparent returns whether this material has been set as transparent.
type Physical ¶
type Physical struct { Material // Embedded material // contains filtered or unexported fields }
Physical is a physically based rendered material which uses the metallic-roughness model.
func (*Physical) InitPhysical ¶ added in v0.2.69
func (m *Physical) InitPhysical()
InitPhysical initializes the material.
func (*Physical) RenderSetup ¶
RenderSetup transfers this material's uniforms and textures to the shader.
func (*Physical) SetBaseColorFactor ¶
SetBaseColorFactor sets this material's base color. Its default value is {1,1,1,1}.
func (*Physical) SetBaseColorMap ¶
SetBaseColorMap sets this material's optional texture base color.
func (*Physical) SetEmissiveFactor ¶
SetEmissiveFactor sets this material's emissive. Its default is {1, 1, 1}.
func (*Physical) SetEmissiveMap ¶
SetEmissiveMap sets this material's optional emissive texture.
func (*Physical) SetMetallicFactor ¶
SetMetallicFactor sets this material's metallic factor. Its default value is 1.
func (*Physical) SetMetallicRoughnessMap ¶
SetMetallicRoughnessMap sets this material's optional metallic-roughness texture.
func (*Physical) SetNormalMap ¶
SetNormalMap sets this material's optional normal texture.
func (*Physical) SetOcclusionMap ¶
SetOcclusionMap sets this material's optional occlusion texture.
func (*Physical) SetRoughnessFactor ¶
SetRoughnessFactor sets this material's roughness factor. Its default value is 1.
type Point ¶
type Point struct {
Standard
}
Point material is normally used for single point sprites.
func (*Point) InitPoint ¶ added in v0.2.69
InitPoint initializes the material setting the specified color.
func (*Point) SetEmissiveColor ¶
SetEmissiveColor sets the material's emissive color. The default is {0,0,0}.
func (*Point) SetRotationZ ¶
SetRotationZ sets the point rotation around the Z axis.
type Standard ¶
type Standard struct { Material // Embedded material // contains filtered or unexported fields }
Standard is a material that supports the classic lighting model with ambient, diffuse, specular and emissive lights. The lighting calculation is implemented in the vertex shader.
func NewBlinnPhong ¶
NewBlinnPhong creates and returns a pointer to a new Standard material using Blinn-Phong model. It is very close to Standard (Phong) model so we need only pass a parameter.
func NewStandard ¶
NewStandard creates and returns a pointer to a new standard material.
func (*Standard) AmbientColor ¶
AmbientColor returns the material ambient color reflectivity.
func (*Standard) EmissiveColor ¶
EmissiveColor returns the material current emissive color.
func (*Standard) InitStandard ¶ added in v0.2.69
InitStandard initializes the material setting the specified color.
func (*Standard) RenderSetup ¶
RenderSetup is called before drawing the object which uses this material.
func (*Standard) SetAmbientColor ¶
SetAmbientColor sets the material ambient color reflectivity. The default is the same as the diffuse color.
func (*Standard) SetColor ¶
SetColor sets the material diffuse color and also the material ambient color reflectivity.
func (*Standard) SetEmissiveColor ¶
SetEmissiveColor sets the material emissive color. The default is {0,0,0}.
func (*Standard) SetOpacity ¶
SetOpacity sets the material opacity (alpha). The default is 1.0.
func (*Standard) SetShininess ¶
SetShininess sets the specular highlight factor. The default is 30.
func (*Standard) SetSpecularColor ¶
SetSpecularColor sets the material specular color reflectivity. The default is {0.5, 0.5, 0.5}.