# I3DShPrimitive Struct Reference
[Shell Interfaces]

Inheritance diagram for I3DShPrimitive:

List of all members.

## Public Member Functions
virtual boolean MCCOMAPI | IsPatchBased ()=0
virtual MCCOMErr MCCOMAPI | EnumPatches (EnumPatchesCallback callback, void *privData, boolean &closed)=0
virtual MCCOMErr MCCOMAPI | ChangedData ()=0
virtual MCCOMErr MCCOMAPI | PostPrimitiveChange (int32 inChangeID)=0
virtual MCCOMErr MCCOMAPI | GetFMesh (real lod, FacetMesh **mesh)=0
virtual boolean MCCOMAPI | RenderingFacetMeshDifferentFromLodZero ()=0
virtual void MCCOMAPI | GetRenderingFacetMesh (FacetMesh **mesh)=0
virtual void MCCOMAPI | GetRenderingMesh (MeshDataStructure::TMeshList **meshList)=0
virtual void MCCOMAPI | GetFaceSetList (TMCCountedPtrArray< TFaceSet > &faceSetList)=0
virtual boolean MCCOMAPI | IsVolumic ()=0
virtual void MCCOMAPI | BeginUV2XYZ ()=0
virtual boolean MCCOMAPI | UV2XYZ (const TVector2 &uv, uint32 uvSpaceID, TVector3 &thePos3D, TVector3 *normal)=0
virtual void MCCOMAPI | EndUV2XYZ ()=0
virtual I3DShObject *MCCOMAPI | GetI3DShObject ()=0
virtual int16 MCCOMAPI | GetNbrLOD () const =0
virtual real MCCOMAPI | GetLOD (int16 index) const =0
virtual void MCCOMAPI | SetChildPrimitive (I3DShPrimitive *primitive)=0
virtual I3DShPrimitive *MCCOMAPI | GetChildPrimitive ()=0
virtual boolean MCCOMAPI | GetRayHit (RayHitParameters &params)=0
virtual boolean MCCOMAPI | RayHitFacet (RayHitParameters &params, uint32 facetIndex, real lod)=0
virtual void MCCOMAPI | BeginUV2XYZForShadingDomain (int32 shadingDomain)=0
virtual I3DExGeometricPrimitive *MCCOMAPI | GetPrimitiveExtension ()=0
virtual boolean MCCOMAPI | IsSelfRaytracablePrimitive ()=0

## Detailed Description

A Primitive is a geometric Object that can be instantiated multiple time in a scene.

Most primitives created in Carrara are external primitives (see I3DShExternalPrimitive for a more information on external primitives).

A primitive always supports the following interfaces: I3DShObject, I3DShMaster.

## Member Function Documentation

virtual void MCCOMAPI I3DShPrimitive::BeginUV2XYZ | ( |  | ) | `[pure virtual]`

Call this function before UV2XYZ().

virtual void MCCOMAPI I3DShPrimitive::BeginUV2XYZForShadingDomain | ( | int32 | shadingDomain | ) | `[pure virtual]`

Call this function before UV2XYZ() if you are only going to call it for a given shading domain. (It is faster that BeginUV2XYZ()).

Parameters:

  | shadingDomain | The ID of the shading domain. (-1 means all shadingDomains)

virtual MCCOMErr MCCOMAPI I3DShPrimitive::ChangedData | ( |  | ) | `[pure virtual]`

Call this if you changed some data of the Primitive, so the Shell hear about it

virtual void MCCOMAPI I3DShPrimitive::EndUV2XYZ | ( |  | ) | `[pure virtual]`

Call this function after UV2XYZ() to delete caches.

virtual MCCOMErr MCCOMAPI I3DShPrimitive::EnumPatches | ( | EnumPatchesCallback | callback,
|  | void * | privData,
|  | boolean & | closed |
| ) |  |  | `[pure virtual]`

Enumerates the list of patches that compose the primitive.

Parameters:

  | callback | A callback function.
  | privData | Data that are passed to the callback
  | closed | True if the primitive is closed (used for backface culling).

virtual I3DShPrimitive* MCCOMAPI I3DShPrimitive::GetChildPrimitive | ( |  | ) | `[pure virtual]`

Returns a pointer to the child primitive of this primitive. Returns NULL if there is no child primitive.

virtual void MCCOMAPI I3DShPrimitive::GetFaceSetList | ( | TMCCountedPtrArray< TFaceSet > & | faceSetList | ) | `[pure virtual]`

Gets the list of face sets associated with the primitive.

Parameters:

  | faceSetList | The face set list that is returned.

virtual MCCOMErr MCCOMAPI I3DShPrimitive::GetFMesh | ( | real | lod,
|  | FacetMesh ** | mesh |
| ) |  |  | `[pure virtual]`

Returns the facet mesh for a given level of detail. (This is the quality that is used for the 3D view. To get the full detail mesh, call GetRenderingFacetMesh()).

Parameters:

  | lod | The level of detail (0 is the most precise)
  | mesh | A pointer to the facetmesh.

virtual I3DShObject* MCCOMAPI I3DShPrimitive::GetI3DShObject | ( |  | ) | `[pure virtual]`

Returns a pointer to I3DShObject. (This method is faster than calling QueryInterface).

virtual real MCCOMAPI I3DShPrimitive::GetLOD | ( | int16 | index | ) | const`[pure virtual]`

Returns the precision for a given Level of Detail.

Parameters:

  | index | The index of the LOD.

virtual int16 MCCOMAPI I3DShPrimitive::GetNbrLOD | ( |  | ) | const`[pure virtual]`

Returns the number of LOD (level of details) that are supported by this primitive.

virtual I3DExGeometricPrimitive* MCCOMAPI I3DShPrimitive::GetPrimitiveExtension | ( |  | ) | `[pure virtual]`

Returns a pointer to the primitive extension if there is one. Returns NULL if this primitive is an internal primitive.

virtual boolean MCCOMAPI I3DShPrimitive::GetRayHit | ( | RayHitParameters & | params | ) | `[pure virtual]`

Calculates the intersection of a ray and this primitive

virtual void MCCOMAPI I3DShPrimitive::GetRenderingFacetMesh | ( | FacetMesh ** | mesh | ) | `[pure virtual]`

Returns the facet mesh associated with the primitive that should be used for the final rendering.

Parameters:

  | mesh | A pointer to the facetmesh

virtual void MCCOMAPI I3DShPrimitive::GetRenderingMesh | ( | MeshDataStructure::TMeshList ** | meshList | ) | `[pure virtual]`

Returns a pointer to the rendering mesh associated with the primitive. Note that the mesh should not be cached by the primitive so it can be modified by the caller.

It is the caller responsability to call release on the mesh once it is not used anymore.

Parameters:

  | meshList | The mesh list that is returned. NULL if this call is not supported (in which case the caller can use the facet mesh)

virtual boolean MCCOMAPI I3DShPrimitive::IsPatchBased | ( |  | ) | `[pure virtual]`

Returns true if the primitive is composed of Beziers patches.

virtual boolean MCCOMAPI I3DShPrimitive::IsSelfRaytracablePrimitive | ( |  | ) | `[pure virtual]`

Returns true if the primitive is a self raytraceable (ie. the facet mesh may not be the geometry that is rendered).

virtual boolean MCCOMAPI I3DShPrimitive::IsVolumic | ( |  | ) | `[pure virtual]`

Returns true if the primitive is a volumic primitive (see IVolumePrimitive).

virtual MCCOMErr MCCOMAPI I3DShPrimitive::PostPrimitiveChange | ( | int32 | inChangeID | ) | `[pure virtual]`

Post a change message for this primitive.

virtual boolean MCCOMAPI I3DShPrimitive::RayHitFacet | ( | RayHitParameters & | params,
|  | uint32 | facetIndex,
|  | real | lod |
| ) |  |  | `[pure virtual]`

calculates the intersection between a ray and a triangle of a primitive. Note that if the primitive is self-Raytracable, the facetIndex is ignored and the intersection is calculated with the whole primitive.

Parameters:

  | params | the raytracing parameters (ray, hit...)
  | facetIndex | the index of the facet to intersect
  | lod | the lod of the primitive from which the facet is coming from

virtual boolean MCCOMAPI I3DShPrimitive::RenderingFacetMeshDifferentFromLodZero | ( |  | ) | `[pure virtual]`

Returns true if the lod 0 and the rendering facet are different.

virtual void MCCOMAPI I3DShPrimitive::SetChildPrimitive | ( | I3DShPrimitive * | primitive | ) | `[pure virtual]`

Sets a child primitive for this primitive

Parameters:

  | primitive | A pointer to the child primitive

virtual boolean MCCOMAPI I3DShPrimitive::UV2XYZ | ( | const TVector2 & | uv,
|  | uint32 | uvSpaceID,
|  | TVector3 & | thePos3D,
|  | TVector3 * | normal |
| ) |  |  | `[pure virtual]`

Returns the 3D position of a point given it's uv coordinates. Note that if the uv coordinates are degenerated, there might be several points on the mesh that could be returned...

Parameters:

  | uv | The texture coordinates
  | uvSpaceID | The ID of the uvspace
  | thePos3D | The returned position in local coordinates.
  | normal | The normal at that point.

The documentation for this struct was generated from the following file:

- I3dShObject.h