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

Inherits G3D::Model.

Classes

class  PointArray
 A single Model stores multiple PointArrays so that they can become different Surfaces and culled (or possibly in the future, rigid-body animated) More...
 
class  Specification
 

Public Member Functions

virtual const StringclassName () const override
 Name of the G3D::Model subclass. More...
 
bool 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 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 numPoints () const
 
float pointRadius () const
 in meters More...
 
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=shared_ptr< Entity >()) const
 
bool renderAsDisk () const
 

Static Public Member Functions

static shared_ptr< PointModelcreate (const String &name, const Specification &specification)
 
static lazy_ptr< ModellazyCreate (const String &name, const Any &a)
 
static lazy_ptr< ModellazyCreate (const PointModel::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 ()
 

Protected Member Functions

 PointModel (const String &name)
 
void addPoint (const Point3 &position, const Color4unorm8 radiance)
 Only call during loading. More...
 
void buildGrid (const Vector3 &cellSize)
 Divides pointArrayArray[0] into multiple arrays. More...
 
void computeBounds ()
 Called after loading to compute bounds on all point arrays. More...
 
void copyToGPU ()
 Called after loading to upload all point arrays to the GPU. More...
 
void load (const Specification &spec)
 
bool loadCache (const String &filename)
 Returns false if the cache load fails. More...
 
void loadPLY (const Specification &spec)
 
void loadVOX (const Specification &spec)
 
void loadXYZ (const Specification &spec)
 
void saveCache (const String &filename) const
 

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...
 
static String makeCacheFilename (const String &filename)
 
Returns a binary cache file for filename if it exists and is not out of date. More...
 
static String manglePathToFilename (const String &filename)
 Given a full path (in either Windows or Unix format), mangles it into a name that can be used as a legal filename. More...
 

Protected Attributes

String m_name
 
int64 m_numPoints
 
Array< shared_ptr< PointArray > > m_pointArrayArray
 
float m_pointRadius
 Meters. More...
 
bool m_renderAsDisk
 

Static Protected Attributes

static const int CURRENT_CACHE_FORMAT = 3
 

Friends

class PointSurface
 

Detailed Description

See also
PointSurface

Constructor & Destructor Documentation

◆ PointModel()

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

Member Function Documentation

◆ addPoint()

void G3D::PointModel::addPoint ( const Point3 position,
const Color4unorm8  radiance 
)
protected

Only call during loading.

Write to pointArrayArray[0]

◆ buildGrid()

void G3D::PointModel::buildGrid ( const Vector3 cellSize)
protected

Divides pointArrayArray[0] into multiple arrays.

◆ className()

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

Name of the G3D::Model subclass.

Implements G3D::Model.

◆ computeBounds()

void G3D::PointModel::computeBounds ( )
protected

Called after loading to compute bounds on all point arrays.

◆ copyToGPU()

void G3D::PointModel::copyToGPU ( )
protected

Called after loading to upload all point arrays to the GPU.

◆ create()

static shared_ptr<PointModel> G3D::PointModel::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::PointModel::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::PointModel::lazyCreate ( const String name,
const Any a 
)
static

◆ lazyCreate() [2/2]

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

◆ load()

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

◆ loadCache()

bool G3D::PointModel::loadCache ( const String filename)
protected

Returns false if the cache load fails.

◆ loadPLY()

void G3D::PointModel::loadPLY ( const Specification spec)
protected

◆ loadVOX()

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

◆ loadXYZ()

void G3D::PointModel::loadXYZ ( const Specification spec)
protected

◆ makeCacheFilename()

static String G3D::PointModel::makeCacheFilename ( const String filename)
staticprotected


Returns a binary cache file for filename if it exists and is not out of date.

Otherwise returns "".

◆ manglePathToFilename()

static String G3D::PointModel::manglePathToFilename ( const String filename)
staticprotected

Given a full path (in either Windows or Unix format), mangles it into a name that can be used as a legal filename.

e.g.:

"C:/foo/bar/baz_bat/file.ply" ==> "C_c_sfoo_bbar_sbaz_ubat_sfile_pply"

By the transformation: ':' ==> 'c' '/' ==> '_s' '\' ==> '_b' '.' ==> '_p' '?' ==> '_q' '*' ==> '_a' '' ==> '_u'

◆ name()

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

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

Implements G3D::Model.

◆ numPoints()

int64 G3D::PointModel::numPoints ( ) const
inline

◆ pointRadius()

float G3D::PointModel::pointRadius ( ) const
inline

in meters

◆ pose() [1/2]

void G3D::PointModel::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::PointModel::pose ( Array< shared_ptr< Surface >> &  surfaceArray,
const shared_ptr< Entity > &  entity = shared_ptr< Entity >() 
) const

◆ renderAsDisk()

bool G3D::PointModel::renderAsDisk ( ) const
inline

◆ saveCache()

void G3D::PointModel::saveCache ( const String filename) const
protected

◆ 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

Friends And Related Function Documentation

◆ PointSurface

friend class PointSurface
friend

Member Data Documentation

◆ CURRENT_CACHE_FORMAT

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

◆ m_name

String G3D::PointModel::m_name
protected

Referenced by name().

◆ m_numPoints

int64 G3D::PointModel::m_numPoints
protected

Referenced by numPoints().

◆ m_pointArrayArray

Array<shared_ptr<PointArray> > G3D::PointModel::m_pointArrayArray
protected

◆ m_pointRadius

float G3D::PointModel::m_pointRadius
protected

Meters.

Referenced by pointRadius().

◆ m_renderAsDisk

bool G3D::PointModel::m_renderAsDisk
protected

Referenced by renderAsDisk().


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