Documentation ¶
Overview ¶
Package material contains several types of materials which can be used to set the appearance of graphic object
Index ¶
- type Basic
- type Blending
- type IMaterial
- type Material
- func (mat *Material) AddTexture(tex *texture.Texture2D)
- func (mat *Material) Dispose()
- func (mat *Material) GetMaterial() *Material
- func (mat *Material) HasTexture(tex *texture.Texture2D) bool
- func (mat *Material) Incref() *Material
- func (mat *Material) Init() *Material
- func (mat *Material) RemoveTexture(tex *texture.Texture2D)
- func (mat *Material) RenderSetup(gs *gls.GLS)
- func (mat *Material) SetBlending(blending Blending)
- func (mat *Material) SetDepthMask(state bool)
- func (mat *Material) SetDepthTest(state bool)
- func (mat *Material) SetLineWidth(width float32)
- func (mat *Material) SetPolygonOffset(factor, units float32)
- func (mat *Material) SetShader(sname string)
- func (mat *Material) SetShaderUnique(unique bool)
- func (mat *Material) SetSide(side Side)
- func (mat *Material) SetUseLights(lights UseLights)
- func (mat *Material) SetWireframe(state bool)
- func (mat *Material) Shader() string
- func (mat *Material) ShaderUnique() bool
- func (mat *Material) Side() Side
- func (mat *Material) TextureCount() int
- func (mat *Material) UseLights() UseLights
- type Phong
- type Point
- type Side
- type Standard
- func (ms *Standard) AmbientColor() math32.Color
- func (ms *Standard) EmissiveColor() math32.Color
- func (ms *Standard) Init(shader string, color *math32.Color)
- func (ms *Standard) RenderSetup(gs *gls.GLS)
- func (ms *Standard) SetAmbientColor(color *math32.Color)
- func (ms *Standard) SetColor(color *math32.Color)
- func (ms *Standard) SetEmissiveColor(color *math32.Color)
- func (ms *Standard) SetOpacity(opacity float32)
- func (ms *Standard) SetShininess(shininess float32)
- func (ms *Standard) SetSpecularColor(color *math32.Color)
- type UseLights
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Material ¶
type Material struct {
// contains filtered or unexported fields
}
Base Material
func (*Material) AddTexture ¶
AddTexture adds the specified Texture2d to the material
func (*Material) Dispose ¶
func (mat *Material) Dispose()
Dispose decrements this material reference count and if necessary releases OpenGL resources, C memory and textures 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) Incref ¶
Incref increments the reference count for this material and returns a pointer to the material. It should be used when this material is shared by another Graphic object.
func (*Material) RemoveTexture ¶
RemoveTexture removes the specified Texture2d from the material
func (*Material) RenderSetup ¶
func (*Material) SetBlending ¶
func (*Material) SetDepthMask ¶
func (*Material) SetDepthTest ¶
func (*Material) SetLineWidth ¶
func (*Material) SetPolygonOffset ¶
func (*Material) SetShaderUnique ¶
SetShaderUnique sets indication that this material shader is unique and does not depend on the number of lights in the scene and/or the number of textures in the material.
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 ¶
func (*Material) ShaderUnique ¶
ShaderUnique returns this material shader is unique.
func (*Material) TextureCount ¶
TextureCount returns the current number of textures
type Phong ¶
type Phong struct {
Standard // Embedded standard material
}
Phong material is identical to the Standard material but the calculation of the lighting model is done in the fragment shader.
type Point ¶
type Point struct {
Standard // Embedded standard material
}
Point material is normally used for single point sprites
func (*Point) RenderSetup ¶
RenderSetup is called by the engine before drawing the object which uses this material
func (*Point) SetEmissiveColor ¶
SetEmissiveColor sets the material 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 material supports the classic lighting model with ambient, diffuse, specular and emissive lights. The lighting calculation is implemented in the vertex shader.
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) Init ¶
Init initializes the material setting the specified shader and color It is used mainly when the material is embedded in another type
func (*Standard) RenderSetup ¶
RenderSetup is called by the engine 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). Default is 1.0.
func (*Standard) SetShininess ¶
SetShininess sets the specular highlight factor. Default is 30.
func (*Standard) SetSpecularColor ¶
SetSpecularColor sets the material specular color reflectivity. The default is {0.5, 0.5, 0.5}