Documentation ¶
Index ¶
- Constants
- func LightmapCoordsForFaceFromTexInfo(vertexes []float32, faceInfo *face.Face, tx *texinfo.TexInfo, ...) []float32
- func LoadProp(path string, fs virtualFileSystem) (*mesh.Model, error)
- func TexCoordsForFaceFromTexInfo(vertexes []float32, tx *texinfo.TexInfo, width int, height int) []float32
- func VertexDataForModel(studioModel *studiomodel.StudioModel, lodIdx int) ([]float32, []float32, []float32, [][]uint32, error)
- type AtlasTexture
- type Bsp
- func (bsp *Bsp) Camera() *Camera
- func (bsp *Bsp) DispFaces() []int
- func (bsp *Bsp) Faces() []BspFace
- func (bsp *Bsp) File() *bsp.Bsp
- func (bsp *Bsp) LightmapAtlas() *TextureAtlas
- func (bsp *Bsp) MaterialDictionary() map[string]*Material
- func (bsp *Bsp) Mesh() *mesh2.BasicMesh
- func (bsp *Bsp) SetCamera(camera *Camera)
- func (bsp *Bsp) TexInfos() []texinfo.TexInfo
- type BspFace
- type Camera
- func (camera *Camera) AspectRatio() float32
- func (camera *Camera) Backwards(dt float64)
- func (camera *Camera) Forwards(dt float64)
- func (camera *Camera) Fov() float32
- func (camera *Camera) Left(dt float64)
- func (camera *Camera) ModelMatrix() mgl32.Mat4
- func (camera *Camera) ProjectionMatrix() mgl32.Mat4
- func (camera *Camera) Right(dt float64)
- func (camera *Camera) Rotate(x, y, z float32)
- func (camera *Camera) Transform() *Transform
- func (camera *Camera) Update(dt float64)
- func (camera *Camera) ViewMatrix() mgl32.Mat4
- type Frustum
- type Material
- type StaticProp
- type Texture
- type Texture2D
- type TextureAtlas
- func (atlas *TextureAtlas) AddRaw(width, height int, colour []uint8) *AtlasTexture
- func (atlas *TextureAtlas) AtlasEntry(index int) *AtlasTexture
- func (atlas *TextureAtlas) Format() uint32
- func (atlas *TextureAtlas) Height() int
- func (atlas *TextureAtlas) Image() []uint8
- func (atlas *TextureAtlas) Pack() []AtlasTexture
- func (atlas *TextureAtlas) PopulatedHeight() int
- func (atlas *TextureAtlas) PopulatedWidth() int
- func (texture *TextureAtlas) Release()
- func (atlas *TextureAtlas) Width() int
- type Transform
- type VirtualFileSystem
Constants ¶
const ( ExtensionVtf = ".vtf" BasePathMaterial = "materials/" BasePathModel = "models/" )
Variables ¶
This section is empty.
Functions ¶
func LightmapCoordsForFaceFromTexInfo ¶
func LightmapCoordsForFaceFromTexInfo(vertexes []float32, faceInfo *face.Face, tx *texinfo.TexInfo, lightmapWidth float32, lightmapHeight float32, lightmapOffsetX float32, lightmapOffsetY float32) []float32
LightmapCoordsForFaceFromTexInfo create lightmap coordinates from TexInfo
func TexCoordsForFaceFromTexInfo ¶
func TexCoordsForFaceFromTexInfo(vertexes []float32, tx *texinfo.TexInfo, width int, height int) []float32
TexCoordsForFaceFromTexInfo Generate texturecoordinates for face data
func VertexDataForModel ¶
func VertexDataForModel(studioModel *studiomodel.StudioModel, lodIdx int) ([]float32, []float32, []float32, [][]uint32, error)
VertexDataForModel loads model vertex data
Types ¶
type AtlasTexture ¶
func (*AtlasTexture) Release ¶
func (atlasTexture *AtlasTexture) Release()
type Bsp ¶
type Bsp struct { StaticPropDictionary map[string]*mesh2.Model StaticProps []StaticProp EntityPropDictionary map[string]*mesh2.Model // contains filtered or unexported fields }
Bsp
func NewBsp ¶
func NewBsp( file *bsp.Bsp, mesh *mesh2.BasicMesh, faces []BspFace, dispFaces []int, materialDictionary map[string]*Material, textureInfos []texinfo.TexInfo, lightmapAtlas *TextureAtlas) *Bsp
NewBsp
func (*Bsp) LightmapAtlas ¶
func (bsp *Bsp) LightmapAtlas() *TextureAtlas
func (*Bsp) MaterialDictionary ¶
MaterialDictionary
type BspFace ¶
type BspFace struct {
// contains filtered or unexported fields
}
BspFace
func NewMeshFace ¶
NewFace
func (*BspFace) SetMaterial ¶
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
Camera
func (*Camera) ModelMatrix ¶
ModelMatrix returns identity matrix (camera model is our position!)
func (*Camera) ProjectionMatrix ¶
ProjectionMatrix calculates projection matrix. This is unlikely to change throughout program lifetime, but could do
func (*Camera) ViewMatrix ¶
ViewMatrix calculates the cameras View matrix
type Frustum ¶
type Frustum struct {
// contains filtered or unexported fields
}
Frustum based on https://gist.github.com/jimmikaelkael/2e4ffa5712d61816c7ca
func (*Frustum) IsCuboidInFrustum ¶
IsCuboidInFrustum NOTE: This fails for leafs where all points sit outside the frustum but the contents is actually inside it
func (*Frustum) IsLeafInFrustum ¶
IsCuboidInFrustum
func (*Frustum) IsPointInFrustum ¶
type Material ¶
type Material struct { // ShaderName ShaderName string // BaseTextureName BaseTextureName string // Skip Skip bool // Alpha Alpha float32 // Translucent Translucent bool // contains filtered or unexported fields }
Material
func LoadMaterial ¶
func LoadMaterial(fs VirtualFileSystem, filePath string) (mat *Material, err error)
func NewMaterial ¶
type StaticProp ¶
type StaticProp struct { Transform Transform // contains filtered or unexported fields }
StaticProp is a somewhat specialised model that implements a few core entity features (largely because it is basically a renderable entity that cannot do anything or be reference)
func NewStaticProp ¶
func NewStaticProp(lumpProp game.IStaticPropDataLump, propLeafs *game.StaticPropLeafLump, renderable *mesh.Model) *StaticProp
NewStaticProp returns new StaticProp
func (*StaticProp) FadeMaxDistance ¶
func (prop *StaticProp) FadeMaxDistance() float32
func (*StaticProp) FadeMinDistance ¶
func (prop *StaticProp) FadeMinDistance() float32
func (*StaticProp) LeafList ¶
func (prop *StaticProp) LeafList() []uint16
LeafList returrns all leafs that this props is in
func (*StaticProp) Model ¶
func (prop *StaticProp) Model() *mesh.ModelInstance
Model returns props model
type Texture2D ¶
type Texture2D struct {
// contains filtered or unexported fields
}
Texture2D is a material defined by raw/computed colour data
func LoadTexture ¶
func LoadTexture(fs VirtualFileSystem, filePath string) (*Texture2D, error)
LoadTexture
func NewErrorTexture ¶
NewError returns new Error material
func NewTexture ¶
type TextureAtlas ¶
type TextureAtlas struct {
// contains filtered or unexported fields
}
TextureAtlas is a simple 2d texture atlas. Does NOT support transparency
func NewTextureAtlas ¶
func NewTextureAtlas(width, height int) *TextureAtlas
func (*TextureAtlas) AddRaw ¶
func (atlas *TextureAtlas) AddRaw(width, height int, colour []uint8) *AtlasTexture
func (*TextureAtlas) AtlasEntry ¶
func (atlas *TextureAtlas) AtlasEntry(index int) *AtlasTexture
func (*TextureAtlas) Format ¶
func (atlas *TextureAtlas) Format() uint32
func (*TextureAtlas) Height ¶
func (atlas *TextureAtlas) Height() int
func (*TextureAtlas) Image ¶
func (atlas *TextureAtlas) Image() []uint8
func (*TextureAtlas) Pack ¶
func (atlas *TextureAtlas) Pack() []AtlasTexture
func (*TextureAtlas) PopulatedHeight ¶
func (atlas *TextureAtlas) PopulatedHeight() int
func (*TextureAtlas) PopulatedWidth ¶
func (atlas *TextureAtlas) PopulatedWidth() int
func (*TextureAtlas) Width ¶
func (atlas *TextureAtlas) Width() int
type Transform ¶
type Transform struct { Translation mgl32.Vec3 Orientation mgl32.Quat Scale mgl32.Vec3 Velocity mgl32.Vec3 // contains filtered or unexported fields }
Transform Represents the transformation of an entity in a 3-dimensional space: position, rotation and scale. Note: Orientation is measured in degrees
func (*Transform) TransformationMatrix ¶
TransformationMatrix computes object transformation matrix