material

package
v0.0.0-...-a112006 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2017 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package material contains several types of materials which can be used to set the appearance of graphic object

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Basic

type Basic struct {
	Material // Embedded material
}

func NewBasic

func NewBasic() *Basic

type Blending

type Blending int

Blending

const (
	BlendingNone        Blending = 0
	BlendingNormal      Blending = 1
	BlendingAdditive    Blending = 2
	BlendingSubtractive Blending = 3
	BlendingMultiply    Blending = 4
	BlendingCustom      Blending = 5
)

type IMaterial

type IMaterial interface {
	GetMaterial() *Material
	RenderSetup(gs *gls.GLS)
	Dispose()
}

Interface for all materials

type Material

type Material struct {
	// contains filtered or unexported fields
}

Base Material

func NewMaterial

func NewMaterial() *Material

NewMaterial returns a pointer to a new material

func (*Material) AddTexture

func (mat *Material) AddTexture(tex *texture.Texture2D)

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

func (mat *Material) GetMaterial() *Material

GetMaterial satisfies the IMaterial interface

func (*Material) HasTexture

func (mat *Material) HasTexture(tex *texture.Texture2D) bool

HasTexture checks if the material contains the specified texture

func (*Material) Incref

func (mat *Material) Incref() *Material

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) Init

func (mat *Material) Init() *Material

func (*Material) RemoveTexture

func (mat *Material) RemoveTexture(tex *texture.Texture2D)

RemoveTexture removes the specified Texture2d from the material

func (*Material) RenderSetup

func (mat *Material) RenderSetup(gs *gls.GLS)

func (*Material) SetBlending

func (mat *Material) SetBlending(blending Blending)

func (*Material) SetDepthMask

func (mat *Material) SetDepthMask(state bool)

func (*Material) SetDepthTest

func (mat *Material) SetDepthTest(state bool)

func (*Material) SetLineWidth

func (mat *Material) SetLineWidth(width float32)

func (*Material) SetPolygonOffset

func (mat *Material) SetPolygonOffset(factor, units float32)

func (*Material) SetShader

func (mat *Material) SetShader(sname string)

SetShader sets the name of the shader program for this material

func (*Material) SetSide

func (mat *Material) SetSide(side Side)

Sets the visible side(s) (SideFront | SideBack | SideDouble)

func (*Material) SetUseLights

func (mat *Material) SetUseLights(lights UseLights)

SetUseLights sets the material use lights bit mask specifying which light types will be used when rendering the material

func (*Material) SetWireframe

func (mat *Material) SetWireframe(state bool)

func (*Material) Shader

func (mat *Material) Shader() string

Shader returns the current name of the shader program for this material

func (*Material) Side

func (mat *Material) Side() Side

Side returns the current side visibility for this material

func (*Material) TextureCount

func (mat *Material) TextureCount() int

TextureCount returns the current number of textures

func (*Material) UseLights

func (mat *Material) UseLights() UseLights

type Phong

type Phong struct {
	Standard // Embedded standard material
}

func NewPhong

func NewPhong(color *math32.Color) *Phong

NewPhong creates and returns a pointer to a new phong material

type Point

type Point struct {
	Material // Embedded base material
	// contains filtered or unexported fields
}

func NewPoint

func NewPoint(color *math32.Color) *Point

NewPoint creates and returns a pointer to a new point material

func (*Point) EmissiveColor

func (pm *Point) EmissiveColor() math32.Color

EmissiveColor returns the material current emissive color

func (*Point) RenderSetup

func (pm *Point) RenderSetup(gs *gls.GLS)

func (*Point) SetEmissiveColor

func (pm *Point) SetEmissiveColor(color *math32.Color)

SetEmissiveColor sets the material emissive color The default is {0,0,0}

func (*Point) SetOpacity

func (pm *Point) SetOpacity(opacity float32)

func (*Point) SetRotationZ

func (pm *Point) SetRotationZ(rot float32)

func (*Point) SetSize

func (pm *Point) SetSize(size float32)

type Side

type Side int

Material visible side(s)

const (
	SideFront  Side = 0
	SideBack   Side = 1
	SideDouble Side = 2
)

type Standard

type Standard struct {
	Material // Embedded material
	// contains filtered or unexported fields
}

func NewStandard

func NewStandard(color *math32.Color) *Standard

NewStandard creates and returns a pointer to a new standard material

func (*Standard) AmbientColor

func (ms *Standard) AmbientColor() math32.Color

AmbientColor returns the material ambient color reflectivity.

func (*Standard) EmissiveColor

func (ms *Standard) EmissiveColor() math32.Color

EmissiveColor returns the material current emissive color

func (*Standard) Init

func (ms *Standard) Init(shader string, color *math32.Color)

func (*Standard) RenderSetup

func (ms *Standard) RenderSetup(gs *gls.GLS)

func (*Standard) SetAmbientColor

func (ms *Standard) SetAmbientColor(color *math32.Color)

SetAmbientColor sets the material ambient color reflectivity. The default is the same as the diffuse color

func (*Standard) SetColor

func (ms *Standard) SetColor(color *math32.Color)

SetColor sets the material diffuse color and also the material ambient color reflectivity

func (*Standard) SetEmissiveColor

func (ms *Standard) SetEmissiveColor(color *math32.Color)

SetEmissiveColor sets the material emissive color The default is {0,0,0}

func (*Standard) SetOpacity

func (ms *Standard) SetOpacity(opacity float32)

SetOpacity sets the material opacity (alpha). Default is 1.0.

func (*Standard) SetShininess

func (ms *Standard) SetShininess(shininess float32)

SetShininess sets the specular highlight factor. Default is 30.

func (*Standard) SetSpecularColor

func (ms *Standard) SetSpecularColor(color *math32.Color)

SetSpecularColor sets the material specular color reflectivity. The default is {0.5, 0.5, 0.5}

type UseLights

type UseLights int

Use lights flags

const (
	UseLightAmbient     UseLights = 0
	UseLightDirectional UseLights = 1
	UseLightPoint       UseLights = 2
	UseLightSpot        UseLights = 3
	UseLightAll         UseLights = 4
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL