Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Friends | List of all members
PolyMesh Class Reference

Class defining the PolyMesh object. The PolyMesh is the geometry used in Clarisse to define a mesh. More...

Inheritance diagram for PolyMesh:
PolyMeshBase GeometryObject ResourceData EventObject CoreCustomData CoreBaseObject CoreBaseType

Public Types

enum  CompressionMode {
  COMPRESSION_DISABLED,
  COMPRESSION_ENABLED,
  COMPRESSION_AUTOMATIC
}
 

Public Member Functions

 PolyMesh (const PolyMesh &other)
 
GeometryObjectget_copy () const override
 Get a copy of the current geometry.
 
GMathBbox3d get_bbox () const override
 Get bounding box of the geometry.
 
GMathBbox3d get_bbox_at (const CtxEval &eval_ctx, const double &time) const override
 Get the bounding box of the geometry for the given time.
 
GMathBbox3d get_shading_group_bbox (const unsigned int &id) const override
 Get the bounding box of a shading group.
 
const CoreBasicArray
< CoreString > & 
get_shading_group_names () const override
 Get the list of shading groups defined in the geometry.
 
unsigned int get_uv_map_count () const override
 
const CoreStringget_uv_map_name (const unsigned int &uv_map_index) const override
 
bool get_uv_map_data (const unsigned int &uv_map_index, CoreArray< GMathVec3f > &uvs, CoreArray< unsigned int > &indices) const override
 
bool get_polygon_uv_map_data (const unsigned int &index, CoreArray< GMathVec3f > &uvs, CoreArray< unsigned int > &indices, const bool &force_indices) const override
 
void compute_fragment_uvw (const CtxEval &eval_ctx, const GeometryFragment &fragment, const unsigned int &uv_map_index, GMathVec3d &coord, GMathVec3d &dcdu, GMathVec3d &dcdv) const override
 Compute UVW coordinates and derivatives in a UV map for the requested fragment.
 
void compute_edge_uvw (const CtxEval &eval_ctx, const unsigned int &primitive_index, const unsigned int &edge_index, const unsigned int &uv_map_index, const double &t, GMathVec3d &coord) const override
 Compute UVW coordinates and derivatives in a UV map on an edge.
 
unsigned int get_color_map_count () const override
 
const CoreStringget_color_map_name (const unsigned int &color_map_index) const override
 
bool get_color_map_data (const unsigned int &color_map_index, CoreArray< GMathVec4uc > &colors, CoreArray< unsigned int > &indices) const override
 
bool get_polygon_color_map_data (const unsigned int &index, CoreArray< GMathVec4uc > &colors, CoreArray< unsigned int > &indices, const bool &force_indices) const override
 
void compute_fragment_color (const CtxEval &eval_ctx, const GeometryFragment &fragment, const unsigned int &color_map_index, GMathVec4f &color) const override
 Compute the value of a color map for the requested fragment.
 
unsigned int get_normal_map_count () const override
 
const CoreStringget_normal_map_name (const unsigned int &normal_map_index) const override
 
bool get_normal_map_data (const unsigned int &normal_map_index, CoreArray< GMathVec3f > &normals, CoreArray< unsigned int > &indices) const override
 
bool get_polygon_normal_map_data (const unsigned int &normal_map_index, CoreArray< GMathVec3f > &normals, CoreArray< unsigned int > &indices) const override
 
bool is_primitive_uv_mapped (const unsigned int &primitive_id, const unsigned int &uv_map_index) const override
 Tell if a primitive has a representation in a UV map.
 
bool is_primitive_edge_visible (const unsigned int &primitive_index, const unsigned int &edge_index) const override
 Tell if an edge is visible.
 
bool is_geometry_linear () const override
 Tell if the geometry is linear.
 
bool is_primitive_linear (const unsigned int &primitive_index) const override
 Tell if a primitive is linear.
 
bool is_primitive_edge_linear (const unsigned int &primitive_index, const unsigned int &edge_index) const override
 Tell if an edge on a primitive is linear.
 
void get_primitive_indices (CoreArray< unsigned int > &indices) const override
 Get the list of vertex indices that define all primitives.
 
bool is_animated () const override
 Indicate if the geometry has an animation for the current frame.
 
const GeometryPointCloudget_point_cloud () const override
 Get the point cloud defined by the geometry.
 
bool set_point_cloud (const GeometryPointCloud &point_cloud, AppProgressBar *progress_bar=0) override
 Replace the point cloud.
 
unsigned int get_vertex_count () const override
 Get the number of vertices in the geometry.
 
unsigned int get_primitive_count () const override
 Get the number of primitives in the geometry.
 
unsigned int get_primitive_index_count () const
 
unsigned int get_polygon_index_count () const
 
unsigned int get_primitive_edge_count (const unsigned int &id) const override
 Get the number of edges of a primitive.
 
unsigned int get_primitive_shading_group_index (const unsigned int &id) const override
 Get the ID of the shading group to which belongs a primitive.
 
unsigned int get_primitive_polygon_id (const unsigned int &id) const
 Get the ID of the original polygon from which the primitive has been created.
 
void compute_primitive_bbox (const CtxEval &eval_ctx, const unsigned int &id, GMathBbox3d &bbox) const override
 Compute the bounding box of a primitive.
 
void compute_primitive_bbox_at (const CtxEval &eval_ctx, const unsigned int &id, const double &time, GMathBbox3d &bbox) const override
 Compute the bounding box of a primitive at a given time.
 
double estimate_area (const CtxEval &eval_ctx, const GMathMatrix4x4d &xform) const override
 Compute an estimation of the area of the geometry.
 
double estimate_shading_group_area (const CtxEval &eval_ctx, const unsigned int &id, const GMathMatrix4x4d &xform) const override
 Compute an estimation of the area of a shading group.
 
double estimate_primitive_area (const CtxEval &eval_ctx, const unsigned int &id, const GMathMatrix4x4d &xform) const override
 Compute an estimation of the area of a primitive.
 
void compute_fragment_sample (const CtxEval &eval_ctx, const GeometryFragment &fragment, GeometrySample &sample) const override
 Compute a sample (position, derivatives, normals) on the geometry for a given fragment.
 
void intersect_primitive (const CtxEval &eval_ctx, const unsigned int &id, GeometryRaytraceCtx &raytrace_ctx) const override
 Compute the list of intersections between rays and a primitive.
 
void intersect_primitive (const CtxEval &eval_ctx, const unsigned int &id, GeometryFrustumCtx &frustum_ctx) const override
 Compute the intersection between a frustum and a primitive.
 
size_t get_memory_size () const override
 Get the amount of memory occupied by the resource.
 
void print_stats () const
 Print some statistics about the mesh (vertex count, primitive count, uv maps, etc...)
 
void set_uv_map_compression_mode (const CompressionMode &mode)
 Set the compression mode to use when storing UV maps.
 
const CompressionMode & get_uv_map_compression_mode () const
 Get the compression mode used to store UV maps.
 
bool import_from_file (const CoreString &filename, const CoreString &object_name, const double &current_time=0, AppProgressBar *load_progress_bar=0, AppProgressBar *build_progress_bar=0)
 Load the mesh from a file.
 
void set (const CoreBasicArray< GMathVec3f > &vertices, const CoreBasicArray< GMathVec3f > &velocities, const CoreBasicArray< unsigned int > &polygon_indices, const CoreBasicArray< unsigned int > &polygon_vertex_count, const CoreBasicArray< unsigned int > &polygon_shading_groups, const CoreBasicArray< CoreString > &shading_group_names, const CoreBasicArray< GeometryUvMap > &uv_maps, const CoreBasicArray< GeometryNormalMap > &normal_maps, const CoreBasicArray< GeometryColorMap > &color_maps, bool handle_degenerated_quad=true, AppProgressBar *progress_bar=0)
 Build the mesh from external data, if HANDLE_DEGENERATE_QUADS is true then the degenerate quads will be split into triangles, else the degenerated quad will not be handle and leave as it is in the mesh.
 
void set_creases (const CoreArray< int > &polygon_crease_indices, const CoreArray< float > &polygon_crease_length)
 
void set_primitive_edge_visibility (const unsigned int &primitive_index, const unsigned int &edge_index, const bool &is_visible)
 Set the visibility of an edge.
 
void set_normal_maps (const CoreBasicArray< GeometryNormalMap > &normal_maps, AppProgressBar *progress_bar=0)
 Set normal maps.
 
unsigned int get_polygon_count () const
 Get the number of polygons that were used to build the mesh.
 
void get_polygon_vertex_indices (CoreArray< unsigned int > &polygon_vertex_indices) const
 Get the list of vertex indices that define all polygons.
 
void get_polygon_vertex_count (CoreArray< unsigned int > &polygon_vertex_count) const
 Get the array of vertex count for all polygons.
 
void get_polygon_shading_groups (CoreArray< unsigned int > &polygon_shading_groups) const
 Get the shading group IDs for each polygon.
 
void get_polygon_creases_indice (CoreArray< int > &polygon_creases_indice) const
 Get the indices of the subdivision creases.
 
void get_polygon_creases_sharpnesses (CoreArray< float > &polygon_creases_length) const
 Get the sharpness values of the subdivision creases.
 
const CoreBasicArray< int > & get_polygon_creases_indice (void) const
 Get the indices of the subdivision creases.
 
const CoreBasicArray< float > & get_polygon_creases_sharpnesses (void) const
 Get the sharpness values of the subdivision creases.
 
bool is_serializable () const override
 Tell if the resource can be serialized or not.
 
void * serialize (size_t &serial_size) const override
 Serialize the resource data.
 
bool deserialize (void *serial, const size_t &serial_size) override
 Deserialize the resource data.
 
Core128BitHashKey get_hash_key () const override
 Get the hash key of the resource.
 
- Public Member Functions inherited from PolyMeshBase
bool get_polygon_normal_map (const unsigned int &index, GeometryNormalMap &map) const
 
void get_polygon_normal_maps (CoreArray< GeometryNormalMap > &maps) const
 
bool get_polygon_uv_map (const unsigned int &index, GeometryUvMap &map, const bool &force_indices=false) const
 
void get_polygon_uv_maps (CoreArray< GeometryUvMap > &maps, const bool &force_indices=false) const
 
bool get_polygon_color_map (const unsigned int &index, GeometryColorMap &map, const bool &force_indices=false) const
 
void get_polygon_color_maps (CoreArray< GeometryColorMap > &maps, const bool &force_indices=false) const
 
- Public Member Functions inherited from GeometryObject
 GeometryObject (const GeometryObject &other)
 
virtual void compute_primitive_space (const CtxEval &eval_ctx, const unsigned int &id, GMathLinearSpace3d &space) const
 Compute the space of a primitive.
 
virtual void compute_primitive_bbox (const CtxEval &eval_ctx, const unsigned int &id, const GMathLinearSpace3d &xform, GMathBbox3d &bbox) const
 Compute the bounding box of a primitive.
 
virtual void compute_primitive_bbox_at (const CtxEval &eval_ctx, const unsigned int &id, const GMathLinearSpace3d &xform, const double &time, GMathBbox3d &bbox) const
 Compute the bounding box of a primitive at a given time.
 
const CoreStringget_primitive_shading_group_name (const unsigned int &id) const
 Get the name of the shading group to which belongs a primitive.
 
bool get_uv_map_index (const CoreString &uv_map_name, unsigned int &uv_map_index) const
 Get the index of a UV map by name.
 
bool get_uv_map (const unsigned int &uv_map_index, GeometryUvMap &uv_map) const
 Get a UV map.
 
void get_uv_maps (CoreArray< GeometryUvMap > &uv_maps) const
 Get all UV maps.
 
bool get_color_map (const unsigned int &color_map_index, GeometryColorMap &color_map) const
 Get a color map.
 
void get_color_maps (CoreArray< GeometryColorMap > &color_maps) const
 Get all color maps.
 
bool get_normal_map (const unsigned int &normal_map_index, GeometryNormalMap &normal_map) const
 Get a normal map.
 
void get_normal_maps (CoreArray< GeometryNormalMap > &normal_maps) const
 Get all normal maps.
 
virtual void compute_edge_sample (const CtxEval &eval_ctx, const unsigned int &primitive_id, const unsigned int &edge_index, const double &t, const GMathVec3d &eye_dir, GeometrySample &sample) const
 Compute a sample (position, derivatives, normals) on an edge of the geometry.
 
virtual double get_primitive_intersection_cost () const
 Return an estimation of the intersection cost of primitives.
 
void get_uv_tiles (const GeometryUvMap &uv_map, CoreArray< GeometryUvTile > &tiles) const
 Get the non empty UV tiles from a uv map.
 
void get_uv_tiles (const int &index, CoreArray< GeometryUvTile > &tiles) const
 Get the non empty UV tiles from the geometry's uv map at an index.
 
GMathVec4f get_uv_range (const GeometryUvMap &uv_map) const
 
GMathVec4f get_uv_range (const unsigned int &uv_map_index) const
 
- Public Member Functions inherited from ResourceData
 ResourceData (const ResourceData &other)
 
ResourceImportDataget_import_data () const
 
void set_import_data (ResourceImportData *data)
 
void advert_memory_changed () const
 Adverts that the memory usage of the resource has changed.
 
bool is_protected () const
 
- Public Member Functions inherited from EventObject
 EventObject ()
 Constructor.
 
 EventObject (const EventObject &src)
 Copy Constructor.
 
virtual ~EventObject () override
 Destructor.
 
void connect (EventObject &sender, const CoreString &event_id, EventInfoMethod event_cb, void *data=0)
 Connects this to an object to listen to a specific event.
 
void connect (EventObject &sender, EventInfoMethod event_cb, void *data=0)
 Connects this to an object to listen any of its events.
 
bool disconnect (EventObject &sender, const CoreString &event_id, EventInfoMethod event_cb, void *data=0)
 
bool disconnect_all (EventObject &sender)
 Disconnects from all objects sender was listening on.
 
void disconnect_all ()
 Disconnects from all objects we were listening on.
 
void remove_all_connection ()
 Disconnects object from other objects it is listening to, and also disconnects all objects listening to it.
 
void raise_event (const CoreString &event_id) const
 sends an event
 
void raise_event (const EventInfo &event_info) const
 sends an event
 
bool is_connected (EventObject &sender, const CoreString &event_id, void *data)
 
void set_mute (const bool &mute)
 Asks for object muting. This will increase or decrease the muting counter. Unmuting may not be immediat since it will happen only when counter reaches 0.
 
bool is_mute () const
 Returns if object is muted.
 
CoreArray< EventObject * > get_senders () const
 
unsigned int get_sender_count () const
 
unsigned int get_receiver_count () const
 
void connect (EventObject &sender, const CoreString &event_id, EventMethod event_cb, void *data=0)
 Connects this to an object to listen to a specific event.
 
void connect (EventObject &sender, EventMethod event_cb, void *data=0)
 Connects this to an object to listen any of its events.
 
bool disconnect (EventObject &sender, const CoreString &event_id, EventMethod event_cb, void *data=0)
 Disconnects this from an object for a specific event.
 
- Public Member Functions inherited from CoreCustomData
 CoreCustomData (const CoreCustomData &src)
 
void add_custom_data (void *key, const bool &data)
 
void add_custom_data (void *key, const int &data)
 
void add_custom_data (void *key, const unsigned int &data)
 
void add_custom_data (void *key, const char *data)
 
void add_custom_data (void *key, const CoreString &data)
 
void add_custom_data (void *key, const double &data)
 
void add_custom_data (void *key, void *data)
 
void remove_custom_data (void *key)
 
void remove_all_custom_data ()
 
void set_custom_data (void *key, const bool &data)
 
void set_custom_data (void *key, const int &data)
 
void set_custom_data (void *key, const unsigned int &data)
 
void set_custom_data (void *key, const double &data)
 
void set_custom_data (void *key, const char *data)
 
void set_custom_data (void *key, const CoreString &data)
 
void set_custom_data (void *key, void *data)
 
void get_custom_data (void *key, bool &data) const
 
void get_custom_data (void *key, int &data) const
 
void get_custom_data (void *key, unsigned int &data) const
 
void get_custom_data (void *key, double &data) const
 
void get_custom_data (void *key, CoreString &data) const
 
void get_custom_data (void *key, void *&data) const
 
- Public Member Functions inherited from CoreBaseObject
bool is_kindof (const CoreBaseObject &object) const
 
CoreString get_class_info_name () const
 
const unsigned long & get_class_info_id () const
 
virtual bool is_kindof (const CoreClassInfo &cinfo) const
 
virtual const CoreClassInfoget_class_info () const
 
template<class T >
T * cast ()
 
template<class T >
const T * cast () const
 
- Public Member Functions inherited from CoreBaseType
bool is_kindof (const CoreClassInfo &cinfo) const
 

Friends

class PolyMeshSmoothed
 
class PolyMeshProperty
 

Additional Inherited Members

- Static Public Member Functions inherited from EventObject
static void connect (EventObject &sender, const CoreString &event_id, EventObject &receiver, EventInfoMethod event_cb, void *data=0)
 Static version of the above function.
 
static void connect (EventObject &sender, EventObject &receiver, EventInfoMethod event_cb, void *data=0)
 Static version of the above function.
 
static void connect (EventObject &sender, const CoreString &event_id, EventInfoFunction event_cb, void *data=0)
 Connects to an object to listen to a specific event.
 
static void connect (EventObject &sender, EventInfoFunction event_cb, void *data=0)
 Connects to an object to listen any of its events.
 
static bool disconnect (EventObject &sender, const CoreString &event_id, EventInfoFunction event_cb, void *data=0)
 
static void raise_event (EventObject &sender, const CoreString &event_id)
 Sends an event.
 
static void raise_event (EventObject &sender, const EventInfo &event_info)
 Sends an event.
 
static void connect (EventObject &sender, const CoreString &event_id, EventFunction event_cb, void *data=0)
 Connects to an object to listen to a specific event.
 
static void connect (EventObject &sender, EventFunction event_cb, void *data=0)
 Connects to an object to listen any of its events.
 
static void connect (EventObject &sender, const CoreString &event_id, EventObject &receiver, EventMethod event_cb, void *data=0)
 Static version of the above function.
 
static void connect (EventObject &sender, EventObject &receiver, EventMethod event_cb, void *data=0)
 Static version of the above function.
 
static bool disconnect (EventObject &sender, const CoreString &event_id, EventFunction event_cb, void *data=0)
 Disconnects this from an object for a specific event.
 

Detailed Description

Class defining the PolyMesh object. The PolyMesh is the geometry used in Clarisse to define a mesh.

Member Function Documentation

void PolyMesh::compute_edge_uvw ( const CtxEval eval_ctx,
const unsigned int &  primitive_index,
const unsigned int &  edge_index,
const unsigned int &  uv_map_index,
const double &  t,
GMathVec3d &  coord 
) const
overridevirtual

Compute UVW coordinates and derivatives in a UV map on an edge.

Parameters
[in]eval_ctxa valid evaluation context
[in]primitive_indexthe ID of the primitive to which the edge belongs
[in]edge_indexthe ID of the edge on the primitive
[in]uv_map_indexthe ID of the UV map to use
[in]tposition on the edge [0 - 1.0]
[out]coordoutput UVW coordinates in the UV map

Reimplemented from GeometryObject.

void PolyMesh::compute_fragment_color ( const CtxEval eval_ctx,
const GeometryFragment fragment,
const unsigned int &  color_map_index,
GMathVec4f &  color 
) const
overridevirtual

Compute the value of a color map for the requested fragment.

Parameters
[in]eval_ctxa valid evaluation context
[in]fragmentthe requested fragment
[in]color_map_indexthe ID of the color map to use
[out]coloroutput value

Reimplemented from GeometryObject.

void PolyMesh::compute_fragment_sample ( const CtxEval eval_ctx,
const GeometryFragment fragment,
GeometrySample sample 
) const
overridevirtual

Compute a sample (position, derivatives, normals) on the geometry for a given fragment.

Parameters
[in]eval_ctxa valid evaluation context
[in]fragmentthe requested fragment
[out]sampleoutput sample

Implements GeometryObject.

void PolyMesh::compute_fragment_uvw ( const CtxEval eval_ctx,
const GeometryFragment fragment,
const unsigned int &  uv_map_index,
GMathVec3d &  coord,
GMathVec3d &  dcdu,
GMathVec3d &  dcdv 
) const
overridevirtual

Compute UVW coordinates and derivatives in a UV map for the requested fragment.

Parameters
[in]eval_ctxa valid evaluation context
[in]fragmentthe requested fragment
[in]uv_map_indexthe ID of the UV map to use
[out]coordoutput UVW coordinates in the UV map
[out]dcducoordinates derivative along the primitive parametric U axis
[out]dcdvcoordinates derivative along the primitive parametric V axis

Reimplemented from GeometryObject.

void PolyMesh::compute_primitive_bbox ( const CtxEval eval_ctx,
const unsigned int &  id,
GMathBbox3d &  bbox 
) const
overridevirtual

Compute the bounding box of a primitive.

Parameters
[in]eval_ctxa valid evaluation context
[in]idthe ID of the primitive
[out]bboxthe returned bounding box

Implements GeometryObject.

void PolyMesh::compute_primitive_bbox_at ( const CtxEval eval_ctx,
const unsigned int &  id,
const double &  time,
GMathBbox3d &  bbox 
) const
overridevirtual

Compute the bounding box of a primitive at a given time.

Parameters
[in]eval_ctxa valid evaluation context
[in]idthe ID of the primitive
[in]timethe local time (relative to the current frame)
[out]bboxthe returned bounding box

Reimplemented from GeometryObject.

bool PolyMesh::deserialize ( void *  serial,
const size_t &  serial_size 
)
overridevirtual

Deserialize the resource data.

Parameters
[in]serialthe serialized data
[in]serial_sizethe size of the serialized data
Returns
true on success, else false

Reimplemented from ResourceData.

double PolyMesh::estimate_area ( const CtxEval eval_ctx,
const GMathMatrix4x4d &  xform 
) const
overridevirtual

Compute an estimation of the area of the geometry.

Parameters
[in]eval_ctxa valid evaluation context
[in]xformthe transformation matrix of the geometry
Returns
an estimation of the area

Reimplemented from GeometryObject.

double PolyMesh::estimate_primitive_area ( const CtxEval eval_ctx,
const unsigned int &  id,
const GMathMatrix4x4d &  xform 
) const
overridevirtual

Compute an estimation of the area of a primitive.

Parameters
[in]eval_ctxa valid evaluation context
[in]idthe ID of the primitive
[in]xformthe transformation matrix of the geometry
Returns
an estimation of the area

Reimplemented from GeometryObject.

double PolyMesh::estimate_shading_group_area ( const CtxEval eval_ctx,
const unsigned int &  id,
const GMathMatrix4x4d &  xform 
) const
overridevirtual

Compute an estimation of the area of a shading group.

Parameters
[in]eval_ctxa valid evaluation context
[in]idthe ID of the shading group
[in]xformthe transformation matrix of the geometry
Returns
an estimation of the area

Reimplemented from GeometryObject.

GMathBbox3d PolyMesh::get_bbox ( ) const
overridevirtual

Get bounding box of the geometry.

Returns
the bounding box

Implements GeometryObject.

GMathBbox3d PolyMesh::get_bbox_at ( const CtxEval eval_ctx,
const double &  time 
) const
overridevirtual

Get the bounding box of the geometry for the given time.

Parameters
[in]eval_ctxa valid evaluation context
[in]timethe local time (relative to the current frame)
Returns
the bounding box

Reimplemented from GeometryObject.

unsigned int PolyMesh::get_color_map_count ( ) const
overridevirtual
bool PolyMesh::get_color_map_data ( const unsigned int &  color_map_index,
CoreArray< GMathVec4uc > &  colors,
CoreArray< unsigned int > &  indices 
) const
overridevirtual
const CoreString & PolyMesh::get_color_map_name ( const unsigned int &  color_map_index) const
overridevirtual
GeometryObject * PolyMesh::get_copy ( ) const
overridevirtual

Get a copy of the current geometry.

Returns
a new object that is the copy of the current one

Implements GeometryObject.

Core128BitHashKey PolyMesh::get_hash_key ( ) const
overridevirtual

Get the hash key of the resource.

Returns
the hash key

Reimplemented from ResourceData.

size_t PolyMesh::get_memory_size ( void  ) const
overridevirtual

Get the amount of memory occupied by the resource.

Returns an estimate in bytes of the data allocated by the object.

Reimplemented from ResourceData.

unsigned int PolyMesh::get_normal_map_count ( ) const
overridevirtual
bool PolyMesh::get_normal_map_data ( const unsigned int &  normal_map_index,
CoreArray< GMathVec3f > &  normals,
CoreArray< unsigned int > &  indices 
) const
overridevirtual
const CoreString & PolyMesh::get_normal_map_name ( const unsigned int &  normal_map_index) const
overridevirtual
const GeometryPointCloud * PolyMesh::get_point_cloud ( ) const
overridevirtual

Get the point cloud defined by the geometry.

Returns
the point cloud or null if there's none
Note
The point cloud contains the list of all vertices with some associated properties.

Reimplemented from GeometryObject.

bool PolyMesh::get_polygon_color_map_data ( const unsigned int &  index,
CoreArray< GMathVec4uc > &  colors,
CoreArray< unsigned int > &  indices,
const bool &  force_indices 
) const
overridevirtual
unsigned int PolyMesh::get_polygon_count ( ) const

Get the number of polygons that were used to build the mesh.

Returns
the number of polygons
void PolyMesh::get_polygon_creases_indice ( CoreArray< int > &  polygon_creases_indice) const

Get the indices of the subdivision creases.

Note
This method copies the data. When possible, prefer using get_polygon_creases_indice(void)
void PolyMesh::get_polygon_creases_sharpnesses ( CoreArray< float > &  polygon_creases_length) const

Get the sharpness values of the subdivision creases.

Note
This method copies the data. When possible, prefer using get_polygon_creases_sharpnesses(void)
bool PolyMesh::get_polygon_normal_map_data ( const unsigned int &  normal_map_index,
CoreArray< GMathVec3f > &  normals,
CoreArray< unsigned int > &  indices 
) const
overridevirtual
See Also
PolyMeshBase::get_normal_map_data

Reimplemented from PolyMeshBase.

void PolyMesh::get_polygon_shading_groups ( CoreArray< unsigned int > &  polygon_shading_groups) const

Get the shading group IDs for each polygon.

Parameters
[out]polygon_shading_groupsthe list of shading group IDs
bool PolyMesh::get_polygon_uv_map_data ( const unsigned int &  index,
CoreArray< GMathVec3f > &  uvs,
CoreArray< unsigned int > &  indices,
const bool &  force_indices 
) const
overridevirtual
void PolyMesh::get_polygon_vertex_count ( CoreArray< unsigned int > &  polygon_vertex_count) const

Get the array of vertex count for all polygons.

Parameters
[out]poylgon_vertex_countthe list of vertex count
void PolyMesh::get_polygon_vertex_indices ( CoreArray< unsigned int > &  polygon_vertex_indices) const

Get the list of vertex indices that define all polygons.

Parameters
[out]polygon_vertex_indicesthe list of vertex indices
Note
Polygons are following each others, there are no seperator in the list. The number of index for each polygon can be known with the get_polygon_vertex_count() method.
unsigned int PolyMesh::get_primitive_count ( ) const
overridevirtual

Get the number of primitives in the geometry.

Returns
the number of primitives

Implements GeometryObject.

unsigned int PolyMesh::get_primitive_edge_count ( const unsigned int &  id) const
overridevirtual

Get the number of edges of a primitive.

Parameters
[in]idthe ID of the primitive
Returns
the number of edges for the given primitive

Implements GeometryObject.

void PolyMesh::get_primitive_indices ( CoreArray< unsigned int > &  indices) const
overridevirtual

Get the list of vertex indices that define all primitives.

Parameters
[out]indicesthe list of vertex indices
Note
Primitives are following each others, there are no seperator in the list. The number of index for each primitive can be known with the get_primitive_edge_count() method.

Reimplemented from GeometryObject.

unsigned int PolyMesh::get_primitive_polygon_id ( const unsigned int &  id) const

Get the ID of the original polygon from which the primitive has been created.

Returns
the ID of the original polygon
unsigned int PolyMesh::get_primitive_shading_group_index ( const unsigned int &  id) const
overridevirtual

Get the ID of the shading group to which belongs a primitive.

Parameters
[in]idthe ID of the primitive
Returns
the ID of the shading group

Implements GeometryObject.

GMathBbox3d PolyMesh::get_shading_group_bbox ( const unsigned int &  id) const
overridevirtual

Get the bounding box of a shading group.

Parameters
[in]idthe ID of the shading group
Returns
the bounding box of the shading group

Reimplemented from GeometryObject.

const CoreBasicArray< CoreString > & PolyMesh::get_shading_group_names ( ) const
overridevirtual

Get the list of shading groups defined in the geometry.

Returns
the array of shading group names

Implements GeometryObject.

unsigned int PolyMesh::get_uv_map_count ( ) const
overridevirtual
See Also
GeometryObject::get_uv_map_count

Reimplemented from GeometryObject.

bool PolyMesh::get_uv_map_data ( const unsigned int &  uv_map_index,
CoreArray< GMathVec3f > &  uvs,
CoreArray< unsigned int > &  indices 
) const
overridevirtual
See Also
GeometryObject::get_uv_map_data

Reimplemented from GeometryObject.

const CoreString & PolyMesh::get_uv_map_name ( const unsigned int &  uv_map_index) const
overridevirtual
See Also
GeometryObject::get_uv_map_name

Reimplemented from GeometryObject.

unsigned int PolyMesh::get_vertex_count ( ) const
overridevirtual

Get the number of vertices in the geometry.

Returns
the number of vertices

Reimplemented from GeometryObject.

bool PolyMesh::import_from_file ( const CoreString filename,
const CoreString object_name,
const double &  current_time = 0,
AppProgressBar load_progress_bar = 0,
AppProgressBar build_progress_bar = 0 
)

Load the mesh from a file.

Parameters
filenamefile full path
object_nameobject name (identifier) of the mesh in the file (if needed)
load_progress_barprogress bar for the loading part (optional)
build_progress_barprogress bar for the building part (optional)
Returns
true on success, else false
Note
Supported formats include Alembic, OBJ, LWO.
void PolyMesh::intersect_primitive ( const CtxEval eval_ctx,
const unsigned int &  id,
GeometryRaytraceCtx raytrace_ctx 
) const
overridevirtual

Compute the list of intersections between rays and a primitive.

Parameters
[in]eval_ctxa valid evaluation context
[in]idthe ID of the primitive
[in,out]raytrace_ctxthe context containing rays information and output results

Implements GeometryObject.

void PolyMesh::intersect_primitive ( const CtxEval eval_ctx,
const unsigned int &  id,
GeometryFrustumCtx frustum_ctx 
) const
overridevirtual

Compute the intersection between a frustum and a primitive.

Parameters
[in]eval_ctxa valid evaluation context
[in]idthe ID of the primitive
[in,out]frustum_ctxthe context containing the frustum information and the output result

Reimplemented from GeometryObject.

bool PolyMesh::is_animated ( ) const
overridevirtual

Indicate if the geometry has an animation for the current frame.

Returns
true if the geometry is animated, else false

Reimplemented from GeometryObject.

bool PolyMesh::is_geometry_linear ( ) const
inlineoverridevirtual

Tell if the geometry is linear.

Returns
true if the geometry is linear, else false

Reimplemented from GeometryObject.

bool PolyMesh::is_primitive_edge_linear ( const unsigned int &  primitive_index,
const unsigned int &  edge_index 
) const
inlineoverridevirtual

Tell if an edge on a primitive is linear.

Parameters
[in]primitive_indexthe ID of the primitive to which the edge belongs
[in]edge_indexthe ID of the edge in the primitive
Returns
true if the edge is linear, else false

Reimplemented from GeometryObject.

bool PolyMesh::is_primitive_edge_visible ( const unsigned int &  primitive_index,
const unsigned int &  edge_index 
) const
overridevirtual

Tell if an edge is visible.

Parameters
[in]primitive_indexthe ID of the primitive to which the edge belongs
[in]edge_indexthe ID of the edge in the primitive
Returns
true if the edge is visible, else false

Reimplemented from GeometryObject.

bool PolyMesh::is_primitive_linear ( const unsigned int &  primitive_index) const
inlineoverridevirtual

Tell if a primitive is linear.

Parameters
[in]primitive_indexthe ID of the primitive
Returns
true if the primitive is linear, else false

Reimplemented from GeometryObject.

bool PolyMesh::is_primitive_uv_mapped ( const unsigned int &  primitive_id,
const unsigned int &  uv_map_index 
) const
overridevirtual

Tell if a primitive has a representation in a UV map.

Parameters
[in]primitive_idthe ID of the primitive
Returns
true if the primitive if mapped, else false

Reimplemented from GeometryObject.

bool PolyMesh::is_serializable ( ) const
inlineoverridevirtual

Tell if the resource can be serialized or not.

Returns
true if the resource is serializable, else false

Reimplemented from ResourceData.

void * PolyMesh::serialize ( size_t &  serial_size) const
overridevirtual

Serialize the resource data.

Parameters
[out]serial_sizethe size of the serialized data
Returns
the serialized data

Note
Only geometric data is serialized. UVmaps, shading groups, etc... are ignored.

Reimplemented from ResourceData.

void PolyMesh::set ( const CoreBasicArray< GMathVec3f > &  vertices,
const CoreBasicArray< GMathVec3f > &  velocities,
const CoreBasicArray< unsigned int > &  polygon_indices,
const CoreBasicArray< unsigned int > &  polygon_vertex_count,
const CoreBasicArray< unsigned int > &  polygon_shading_groups,
const CoreBasicArray< CoreString > &  shading_group_names,
const CoreBasicArray< GeometryUvMap > &  uv_maps,
const CoreBasicArray< GeometryNormalMap > &  normal_maps,
const CoreBasicArray< GeometryColorMap > &  color_maps,
bool  handle_degenerated_quad = true,
AppProgressBar progress_bar = 0 
)

Build the mesh from external data, if HANDLE_DEGENERATE_QUADS is true then the degenerate quads will be split into triangles, else the degenerated quad will not be handle and leave as it is in the mesh.

Parameters
verticeslist of vertices of the geometry
velocitieslist of velocity values for each vertex (it corresponds to the position delta between 2 frames)
polygon_vertex_indiceslist of vertex indices for all polygons of the geometry
polygon_vertex_countnumber of vertices for each polygon of the geometry
polygon_shading_groupsshading group index for each polygon
shading_group_namesshading group names
uv_mapslist of UV maps
normal_mapslist of normal maps
color_mapslist of color maps
progress_bara progress bar to know the progress (optional)
Note
The resulting number of primitives is not necessarily the same as the number of polygons. Triangles and quads are kept and all polygons with more than 4 edges are triangulated.
void PolyMesh::set_normal_maps ( const CoreBasicArray< GeometryNormalMap > &  normal_maps,
AppProgressBar progress_bar = 0 
)

Set normal maps.

Parameters
normal_mapsthe list of normal maps
progress_bara progress bar to know the progress (optional)
bool PolyMesh::set_point_cloud ( const GeometryPointCloud point_cloud,
AppProgressBar progress_bar = 0 
)
overridevirtual

Replace the point cloud.

Parameters
[in]point_cloudthe new point cloud
[in]progress_bara progress bar (optional)
Returns
true on success (the point cloud must be compatible, i.e. it must contain the same number of vertices), else false

Reimplemented from GeometryObject.

void PolyMesh::set_primitive_edge_visibility ( const unsigned int &  primitive_index,
const unsigned int &  edge_index,
const bool &  is_visible 
)

Set the visibility of an edge.

Parameters
primitive_indexthe index of the primitive
edge_indexthe index of the edge on the primitive
is_visibletrue if the edge must be visible, else false
void PolyMesh::set_uv_map_compression_mode ( const CompressionMode &  mode)

Set the compression mode to use when storing UV maps.

Parameters
modethe compression mode
Note
Compression is enabled by default. This must be called before import_from_file() and set() methods in order to be taken in account.