Documentation
¶
Overview ¶
Package mtl provides APIs through which one can parse Wavefront MTL resources. The MTL file format is quite common and is used to store material data for OBJ 3D models.
The parsers provided by this library do not support the full MTL spec, which is quite lengthy, but rather only the most essential and common features.
Index ¶
- func NewScanner() common.Scanner
- type AmbientTextureEvent
- type BumpTextureEvent
- type DiffuseTextureEvent
- type DissolveEvent
- type DissolveTextureEvent
- type EmissiveTextureEvent
- type MaterialEvent
- type RGBAmbientColorEvent
- type RGBColorEvent
- type RGBDiffuseColorEvent
- type RGBEmissiveColorEvent
- type RGBSpecularColorEvent
- type RGBTransmissionFilterEvent
- type SpecularExponentEvent
- type SpecularExponentTextureEvent
- type SpecularTextureEvent
- type TextureEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewScanner ¶
NewScanner creates a new Scanner object that can scan through Wavefront MTL resources.
Types ¶
type AmbientTextureEvent ¶
type AmbientTextureEvent TextureEvent
AmbientTextureEvent indicates that an ambient texture declaration (`map_Ka`) has been scanned.
type BumpTextureEvent ¶
type BumpTextureEvent TextureEvent
BumpTextureEvent indicates that a bump texture declaration (`map_Bump`) has been scanned.
type DiffuseTextureEvent ¶
type DiffuseTextureEvent TextureEvent
DiffuseTextureEvent indicates that a diffuse texture declaration (`map_Kd`) has been scanned.
type DissolveEvent ¶
type DissolveEvent struct { // Amount indicates the amount of dissolve, where 1.0 indicates fully // opaque objects and 0.0 fully transparent. Amount float64 }
DissolveEvent indicates that a dissolve declaration (`d`) has been scanned.
type DissolveTextureEvent ¶
type DissolveTextureEvent TextureEvent
DissolveTextureEvent indicates that a dissolve texture declaration (`map_d`) has been scanned.
type EmissiveTextureEvent ¶
type EmissiveTextureEvent TextureEvent
EmissiveTextureEvent indicates that an emissive texture declaration (`map_Ke`) has been scanned.
type MaterialEvent ¶
type MaterialEvent struct { // MaterialName holds the name of the material in the declaration MaterialName string }
MaterialEvent indicates that a material declaration (`newmtl`) has been scanned.
type RGBAmbientColorEvent ¶
type RGBAmbientColorEvent RGBColorEvent
RGBAmbientColorEvent indicates that an ambient color declaration (`Ka`) has been scanned.
type RGBColorEvent ¶
type RGBColorEvent struct { // Specifies the amount of Red this color has. Usually this is in the // range 0.0 to 1.0. R float64 // Specifies the amount of Green this color has. Usually this is in the // range 0.0 to 1.0. G float64 // Specifies the amount of Blue this color has. Usually this is in the // range 0.0 to 1.0. B float64 }
RGBColorEvent indicates that some type of RGB color declaration has been scanned. You will likely receive a subtype of this structure so you will likely need to do a type-switch.
type RGBDiffuseColorEvent ¶
type RGBDiffuseColorEvent RGBColorEvent
RGBDiffuseColorEvent indicates that a diffuse color declaration (`Kd`) has been scanned.
type RGBEmissiveColorEvent ¶
type RGBEmissiveColorEvent RGBColorEvent
RGBEmissiveColorEvent indicates that an emissive color declaration (`Ke`) has been scanned.
type RGBSpecularColorEvent ¶
type RGBSpecularColorEvent RGBColorEvent
RGBSpecularColorEvent indicates that a specular color declaration (`Ks`) has been scanned.
type RGBTransmissionFilterEvent ¶
type RGBTransmissionFilterEvent RGBColorEvent
RGBTransmissionFilterEvent indicates that a specular color declaration (`Tf`) has been scanned.
type SpecularExponentEvent ¶
type SpecularExponentEvent struct { // Amount specifies the specular exponent amount, which defines the focus of // the specular highlight. The value ranges between 0.0 and 1000.0, where the // former results in a wide highlight and the latter in a tight one. Amount float64 }
SpecularExponentEvent indicates that a specular exponent declaration (`Ns`) has been scanned.
type SpecularExponentTextureEvent ¶
type SpecularExponentTextureEvent TextureEvent
SpecularExponentTextureEvent indicates that a specular exponent texture declaration (`map_Ns`) has been scanned.
type SpecularTextureEvent ¶
type SpecularTextureEvent TextureEvent
SpecularTextureEvent indicates that a specular texture declaration (`map_Ks`) has been scanned.
type TextureEvent ¶
type TextureEvent struct { // TexturePath specifies the location of the texture on the filesystem. TexturePath string }
TextureEvent indicates that a texture declaration has been scanned. You will likely receive a subtype of this structure so you will likely need to type-switch on this.