Tramway SDK v0.1.1
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
tram::Render::Model Class Reference

#include <model.h>

Inheritance diagram for tram::Render::Model:
tram::Resource

Public Member Functions

 Model (name_t name)
 
void LoadFromDisk ()
 
void LoadFromMemory ()
 
void Unload ()
 
vertexformat_t GetVertexFormat () const
 
vertexarray_t GetVertexArray () const
 
indexarray_t GetIndexArray () const
 
const std::vector< Bone > & GetArmature () const
 
const std::vector< Material * > & GetMaterials () const
 
const std::vector< IndexRange > & GetIndexRanges () const
 
void DrawAABB (vec3 position, quat rotation)
 Draws the AABB tree. More...
 
void FindAllFromRay (vec3 ray_pos, vec3 ray_dir, std::vector< AABBTriangle > &result)
 Finds triangles that intersect ray. More...
 
void FindAllFromAABB (vec3 min, vec3 max, std::vector< AABBTriangle > &result)
 
vec3 GetAABBMin () const
 
vec3 GetAABBMax () const
 
vec3 GetOrigin () const
 
float GetNearDistance () const
 
float GetFarDistance () const
 
void SetNearDistance (float dist)
 
void SetFarDistance (float dist)
 
- Public Member Functions inherited from tram::Resource
 Resource (name_t name)
 
Resource::Status GetStatus () const
 
name_t GetName () const
 
size_t GetReferences () const
 
bool IsLoadFailed () const
 
void AddReference ()
 
void RemoveReference ()
 
void Load ()
 

Static Public Member Functions

static ModelFind (name_t name)
 

Protected Attributes

vertexformat_t vertex_format = VERTEX_STATIC
 
vertexarray_t vertex_array = {}
 
indexarray_t index_array = {}
 
std::vector< IndexRangeindex_ranges
 
vec3 aabb_min = {0.0f, 0.0f, 0.0f}
 
vec3 aabb_max = {0.0f, 0.0f, 0.0f}
 
float fade_near = 0.0f
 
float fade_far = INFINITY
 
vec3 origin = {0.0f, 0.0f, 0.0f}
 
std::vector< Material * > materials
 
Modelsource = nullptr
 
std::vector< Bonearmature
 
ModelDatamodel_data = nullptr
 
ModelAABBmodel_aabb = nullptr
 
size_t approx_vram_usage = 0
 
- Protected Attributes inherited from tram::Resource
Status status = UNLOADED
 
name_t name
 
bool load_fail = false
 
size_t references = 0
 

Additional Inherited Members

- Public Types inherited from tram::Resource
enum  Status { UNLOADED , LOADED , READY }
 

Constructor & Destructor Documentation

◆ Model()

tram::Render::Model::Model ( name_t  name)
inline

Member Function Documentation

◆ DrawAABB()

void tram::Render::Model::DrawAABB ( vec3  position,
quat  rotation 
)

Draws the AABB tree.

Draws the AABB tree of the 3D model using debug lines. This might be useful for debugging if raycasts or some other lookups fail on the 3D model.

Parameters
positionPosition of the 3D model in the scene.
rotationRotation of the 3D model in the scene.

◆ Find()

Model * tram::Render::Model::Find ( name_t  name)
static

◆ FindAllFromAABB()

void tram::Render::Model::FindAllFromAABB ( vec3  min,
vec3  max,
std::vector< AABBTriangle > &  result 
)

◆ FindAllFromRay()

void tram::Render::Model::FindAllFromRay ( vec3  ray_pos,
vec3  ray_dir,
std::vector< AABBTriangle > &  result 
)

Finds triangles that intersect ray.

Finds the triangles that intersect the given ray. The ray's origin and direction must be provided in the local model coordinates.

◆ GetAABBMax()

vec3 tram::Render::Model::GetAABBMax ( ) const
inline

◆ GetAABBMin()

vec3 tram::Render::Model::GetAABBMin ( ) const
inline

◆ GetArmature()

const std::vector< Bone > & tram::Render::Model::GetArmature ( ) const
inline

◆ GetFarDistance()

float tram::Render::Model::GetFarDistance ( ) const
inline

◆ GetIndexArray()

indexarray_t tram::Render::Model::GetIndexArray ( ) const
inline

◆ GetIndexRanges()

const std::vector< IndexRange > & tram::Render::Model::GetIndexRanges ( ) const
inline

◆ GetMaterials()

const std::vector< Material * > & tram::Render::Model::GetMaterials ( ) const
inline

◆ GetNearDistance()

float tram::Render::Model::GetNearDistance ( ) const
inline

◆ GetOrigin()

vec3 tram::Render::Model::GetOrigin ( ) const
inline

◆ GetVertexArray()

vertexarray_t tram::Render::Model::GetVertexArray ( ) const
inline

◆ GetVertexFormat()

vertexformat_t tram::Render::Model::GetVertexFormat ( ) const
inline

◆ LoadFromDisk()

void tram::Render::Model::LoadFromDisk ( )
virtual

Implements tram::Resource.

◆ LoadFromMemory()

void tram::Render::Model::LoadFromMemory ( )
virtual

Implements tram::Resource.

◆ SetFarDistance()

void tram::Render::Model::SetFarDistance ( float  dist)
inline

◆ SetNearDistance()

void tram::Render::Model::SetNearDistance ( float  dist)
inline

◆ Unload()

void tram::Render::Model::Unload ( )
inlinevirtual

Implements tram::Resource.

Member Data Documentation

◆ aabb_max

vec3 tram::Render::Model::aabb_max = {0.0f, 0.0f, 0.0f}
protected

◆ aabb_min

vec3 tram::Render::Model::aabb_min = {0.0f, 0.0f, 0.0f}
protected

◆ approx_vram_usage

size_t tram::Render::Model::approx_vram_usage = 0
protected

◆ armature

std::vector<Bone> tram::Render::Model::armature
protected

◆ fade_far

float tram::Render::Model::fade_far = INFINITY
protected

◆ fade_near

float tram::Render::Model::fade_near = 0.0f
protected

◆ index_array

indexarray_t tram::Render::Model::index_array = {}
protected

◆ index_ranges

std::vector<IndexRange> tram::Render::Model::index_ranges
protected

◆ materials

std::vector<Material*> tram::Render::Model::materials
protected

◆ model_aabb

ModelAABB* tram::Render::Model::model_aabb = nullptr
protected

◆ model_data

ModelData* tram::Render::Model::model_data = nullptr
protected

◆ origin

vec3 tram::Render::Model::origin = {0.0f, 0.0f, 0.0f}
protected

◆ source

Model* tram::Render::Model::source = nullptr
protected

◆ vertex_array

vertexarray_t tram::Render::Model::vertex_array = {}
protected

◆ vertex_format

vertexformat_t tram::Render::Model::vertex_format = VERTEX_STATIC
protected

The documentation for this class was generated from the following files: