Support Forum       G3D Web Page     
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
G3D::VoxelModel Class Reference

Inherits G3D::Model.

Classes

class  Specification
 

Public Member Functions

virtual const StringclassName () const override
 Name of the G3D::Model subclass. More...
 
bool intersect (const Ray &R, const CoordinateFrame &cframe, float &maxDistance, Model::HitInfo &info=Model::HitInfo::ignore, const Entity *entity=nullptr, const Model::Pose *pose=nullptr) const override
 Determines if the ray intersects the heightfield and fills the info with the proper information. More...
 
virtual const Stringname () const override
 Name of the instance (usually based on the filename it is loaded from) More...
 
int64 numVoxels () const
 
void pose (Array< shared_ptr< Surface > > &surfaceArray, const CFrame &rootFrame, const CFrame &prevFrame, const shared_ptr< Entity > &entity, const Model::Pose *pose, const Model::Pose *prevPose, const Surface::ExpressiveLightScatteringProperties &e) override
 This will be replaced soon with a version that takes a shared_ptr<Pose>. More...
 
void pose (Array< shared_ptr< Surface >> &surfaceArray, const shared_ptr< Entity > &entity=nullptr) const
 
float voxelRadius () const
 in meters More...
 

Static Public Member Functions

static shared_ptr< VoxelModelcreate (const String &name, const Specification &specification)
 
static lazy_ptr< ModellazyCreate (const String &name, const Any &a)
 
static lazy_ptr< ModellazyCreate (const VoxelModel::Specification &specification, const String &name)
 
static void setUseOptimizedIntersect (bool b)
 If true, complex models should use TriTree to accelerate intersect() calls where possible. More...
 
static bool useOptimizedIntersect ()
 

Static Public Attributes

static int64 voxelsRendered
 For debugging. More...
 

Protected Member Functions

 VoxelModel (const String &name)
 
void addVoxel (const Point3int16 position, const Color4unorm8 color)
 Only call during loading. More...
 
void addVoxels (const ParseSchematic::ColorVoxels &voxels, Point3int32 minBound, Point3int32 maxBound, const Specification &specification)
 
void centerModel (const Point3int16 originOffset)
 
void computeBounds ()
 
void copyToGPU ()
 
void load (const Specification &spec)
 
void loadSchematic (const Specification &specification)
 
void loadVOX (const Specification &spec)
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

AABox m_boxBounds
 In object space (not voxel space) More...
 
Array< Color4unorm8m_cpuColor
 sRGBA8 More...
 
Array< Point3int16m_cpuPosition
 Integers in voxel space. More...
 
AttributeArray m_gpuColor
 sRGBA8 More...
 
AttributeArray m_gpuPosition
 Integers TODO: Store in RGB16I. More...
 
String m_name
 
Sphere m_sphereBounds
 In object space (not voxel space) More...
 
float m_voxelRadius
 Meters. More...
 

Static Protected Attributes

static const int CURRENT_CACHE_FORMAT = 3
 

Friends

class VoxelSurface
 

Detailed Description

See also
VoxelSurface

Constructor & Destructor Documentation

◆ VoxelModel()

G3D::VoxelModel::VoxelModel ( const String name)
inlineprotected

Member Function Documentation

◆ addVoxel()

void G3D::VoxelModel::addVoxel ( const Point3int16  position,
const Color4unorm8  color 
)
protected

Only call during loading.

Called by addVoxels

◆ addVoxels()

void G3D::VoxelModel::addVoxels ( const ParseSchematic::ColorVoxels voxels,
Point3int32  minBound,
Point3int32  maxBound,
const Specification specification 
)
protected

◆ centerModel()

void G3D::VoxelModel::centerModel ( const Point3int16  originOffset)
protected

◆ className()

virtual const String& G3D::VoxelModel::className ( ) const
inlineoverridevirtual

Name of the G3D::Model subclass.

Implements G3D::Model.

◆ computeBounds()

void G3D::VoxelModel::computeBounds ( )
protected

◆ copyToGPU()

void G3D::VoxelModel::copyToGPU ( )
protected

◆ create()

static shared_ptr<VoxelModel> G3D::VoxelModel::create ( const String name,
const Specification specification 
)
static
Parameters
filename.points or .ply file, or a directory containing multiple .ply files

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ intersect()

bool G3D::VoxelModel::intersect ( const Ray ray,
const CoordinateFrame cframe,
float &  maxDistance,
Model::HitInfo info = Model::HitInfo::ignore,
const Entity entity = nullptr,
const Model::Pose pose = nullptr 
) const
overridevirtual

Determines if the ray intersects the heightfield and fills the info with the proper information.

Parameters
maxDistanceMax distance to trace to on input, hit distance written on output if hit

Reimplemented from G3D::Model.

◆ lazyCreate() [1/2]

static lazy_ptr<Model> G3D::VoxelModel::lazyCreate ( const String name,
const Any a 
)
static

◆ lazyCreate() [2/2]

static lazy_ptr<Model> G3D::VoxelModel::lazyCreate ( const VoxelModel::Specification specification,
const String name 
)
static

◆ load()

void G3D::VoxelModel::load ( const Specification spec)
protected

◆ loadSchematic()

void G3D::VoxelModel::loadSchematic ( const Specification specification)
protected

◆ loadVOX()

void G3D::VoxelModel::loadVOX ( const Specification spec)
protected

◆ name()

virtual const String& G3D::VoxelModel::name ( ) const
inlineoverridevirtual

Name of the instance (usually based on the filename it is loaded from)

Implements G3D::Model.

◆ numVoxels()

int64 G3D::VoxelModel::numVoxels ( ) const
inline

◆ pose() [1/2]

void G3D::VoxelModel::pose ( Array< shared_ptr< Surface > > &  surfaceArray,
const CFrame rootFrame,
const CFrame prevFrame,
const shared_ptr< Entity > &  entity,
const Model::Pose pose,
const Model::Pose prevPose,
const Surface::ExpressiveLightScatteringProperties e 
)
overridevirtual

This will be replaced soon with a version that takes a shared_ptr<Pose>.

Parameters
poseMust have the subclass of Model::Pose appropriate to the Model subclass.

Implements G3D::Model.

◆ pose() [2/2]

void G3D::VoxelModel::pose ( Array< shared_ptr< Surface >> &  surfaceArray,
const shared_ptr< Entity > &  entity = nullptr 
) const

◆ setUseOptimizedIntersect()

static void G3D::Model::setUseOptimizedIntersect ( bool  b)
inlinestaticinherited

If true, complex models should use TriTree to accelerate intersect() calls where possible.

This can make the first intersect() call very slow for the tree build and can make loading slow. It may not affect performance of skinned or articulated models that animate.

This value should be set before the models are loaded. If it is changed after a model is loaded, the Model is not required to respond to it.

Default: false

◆ useOptimizedIntersect()

static bool G3D::Model::useOptimizedIntersect ( )
inlinestaticinherited

◆ voxelRadius()

float G3D::VoxelModel::voxelRadius ( ) const
inline

in meters

Friends And Related Function Documentation

◆ VoxelSurface

VoxelSurface
friend

Member Data Documentation

◆ CURRENT_CACHE_FORMAT

const int G3D::VoxelModel::CURRENT_CACHE_FORMAT = 3
staticprotected

◆ m_boxBounds

AABox G3D::VoxelModel::m_boxBounds
protected

In object space (not voxel space)

◆ m_cpuColor

Array<Color4unorm8> G3D::VoxelModel::m_cpuColor
protected

sRGBA8

◆ m_cpuPosition

Array<Point3int16> G3D::VoxelModel::m_cpuPosition
protected

Integers in voxel space.

Referenced by numVoxels().

◆ m_gpuColor

AttributeArray G3D::VoxelModel::m_gpuColor
protected

sRGBA8

◆ m_gpuPosition

AttributeArray G3D::VoxelModel::m_gpuPosition
protected

Integers TODO: Store in RGB16I.

◆ m_name

String G3D::VoxelModel::m_name
protected

Referenced by name().

◆ m_sphereBounds

Sphere G3D::VoxelModel::m_sphereBounds
protected

In object space (not voxel space)

◆ m_voxelRadius

float G3D::VoxelModel::m_voxelRadius
protected

Meters.

Referenced by voxelRadius().

◆ voxelsRendered

int64 G3D::VoxelModel::voxelsRendered
static

For debugging.


documentation generated on Wed Nov 24 2021 08:02:02 using doxygen 1.8.15