LuxCore
2.0
|
Scene stores textures, materials and objects definitions. More...
#include <luxcore.h>
Public Types | |
enum | ChannelSelectionType { DEFAULT, RED, GREEN, BLUE, ALPHA, MEAN, WEIGHTED_MEAN, RGB } |
Types of image map channel selection. More... | |
enum | WrapType { REPEAT, BLACK, WHITE, CLAMP } |
Types of image map wrap mode. More... | |
enum | StrandsTessellationType { TESSEL_RIBBON, TESSEL_RIBBON_ADAPTIVE, TESSEL_SOLID, TESSEL_SOLID_ADAPTIVE } |
Types of strands tessellation. More... | |
Public Member Functions | |
virtual | ~Scene () |
virtual void | GetBBox (float min[3], float max[3]) const =0 |
Returns the bounding box of the complete scene (as minimum and maximum point). It is available only during the rendering (i.e. after a RenderSession::Start()). More... | |
virtual const Camera & | GetCamera () const =0 |
Returns the Camera of the scene. More... | |
template<class T > | |
void | DefineImageMap (const std::string &imgMapName, T *pixels, const float gamma, const unsigned int channels, const unsigned int width, const unsigned int height, ChannelSelectionType selectionType=DEFAULT, WrapType wrapType=REPEAT) |
Defines an image map (to be later used in textures, infinite lights, etc.). The memory allocated for pixels array is NOT freed by the Scene class nor is used after the execution of this method. The types supported are "unsigned char", "unsigned short" (as a place holder for half type) and "float". More... | |
virtual bool | IsImageMapDefined (const std::string &imgMapName) const =0 |
Check if an image map with the given name has been defined. More... | |
virtual void | SetDeleteMeshData (const bool v)=0 |
Sets if the Scene class destructor will delete the arrays pointed to by the defined meshes. More... | |
virtual void | DefineMesh (const std::string &meshName, const long plyNbVerts, const long plyNbTris, float *p, unsigned int *vi, float *n, float *uv, float *cols, float *alphas)=0 |
Defines a mesh (to be later used in one or more scene objects). The memory allocated for the ExtTriangleMesh is always freed by the Scene class, however freeing of memory for the vertices, triangle indices, etc. depends on the setting of SetDeleteMeshData(). NOTE: vertices and triangles buffers MUST be allocated with Scene::AllocVerticesBuffer() and Scene::AllocTrianglesBuffer(). More... | |
virtual void | SaveMesh (const std::string &meshName, const std::string &fileName)=0 |
Save a previously defined mesh to file system in PLY or BPY format. More... | |
virtual void | DefineStrands (const std::string &shapeName, const luxrays::cyHairFile &strandsFile, const StrandsTessellationType tesselType, const unsigned int adaptiveMaxDepth, const float adaptiveError, const unsigned int solidSideCount, const bool solidCapBottom, const bool solidCapTop, const bool useCameraPosition)=0 |
Defines a mesh (to be later used in one or more scene objects) starting from the strands/hairs definition included in strandsFile. More... | |
virtual bool | IsMeshDefined (const std::string &meshName) const =0 |
Check if a mesh with the given name has been defined. More... | |
virtual bool | IsTextureDefined (const std::string &texName) const =0 |
Check if a texture with the given name has been defined. More... | |
virtual bool | IsMaterialDefined (const std::string &matName) const =0 |
Check if a material with the given name has been defined. More... | |
virtual const unsigned int | GetLightCount () const =0 |
Returns the number of light sources in the Scene. More... | |
virtual const unsigned int | GetObjectCount () const =0 |
Returns the number of objects in the Scene. More... | |
virtual void | Parse (const luxrays::Properties &props)=0 |
Edits or creates camera, textures, materials and/or objects based on the Properties defined. If the scene is in use by a RenderSession, it must be called between a RenderSession::BeginSceneEdit() and RenderSession::EndSceneEdit(). More... | |
virtual void | DuplicateObject (const std::string &srcObjName, const std::string &dstObjName, const float *transMat)=0 |
Duplicate an object in an instance using the passed transformation. More... | |
virtual void | DuplicateObject (const std::string &srcObjName, const std::string &dstObjNamePrefix, const unsigned int count, const float *transMat)=0 |
Duplicate an object multiple times in instances using the passed transformations. Mostly useful for fast creating many copies of the same object (for instance for particles). More... | |
virtual void | DuplicateObject (const std::string &srcObjName, const std::string &dstObjName, const unsigned int steps, const float *times, const float *transMat)=0 |
Duplicate an object in a motion blur instance using the passed transformation. More... | |
virtual void | DuplicateObject (const std::string &srcObjName, const std::string &dstObjNamePrefix, const unsigned int count, const unsigned int steps, const float *times, const float *transMat)=0 |
Duplicate an object multiple times in a motion blur instance using the passed transformations. Mostly useful for fast creating many copies of the same object (for instance for particles). More... | |
virtual void | UpdateObjectTransformation (const std::string &objName, const float *transMat)=0 |
Apply a transformation to an object. More... | |
virtual void | UpdateObjectMaterial (const std::string &objName, const std::string &matName)=0 |
Apply a new material to an object. More... | |
virtual void | DeleteObject (const std::string &objName)=0 |
Deletes an object from the scene. More... | |
virtual void | DeleteLight (const std::string &lightName)=0 |
Deletes a light from the scene. More... | |
virtual void | RemoveUnusedImageMaps ()=0 |
Removes all unused image maps. More... | |
virtual void | RemoveUnusedTextures ()=0 |
Removes all unused textures. More... | |
virtual void | RemoveUnusedMaterials ()=0 |
Removes all unused materials. More... | |
virtual void | RemoveUnusedMeshes ()=0 |
Removes all unused meshes. More... | |
virtual const luxrays::Properties & | ToProperties () const =0 |
Returns all the Properties required to define this Scene. More... | |
virtual void | Save (const std::string &fileName) const =0 |
Serializes a Scene in a file. More... | |
template<> | |
void CPP_API | DefineImageMap (const std::string &imgMapName, unsigned char *pixels, const float gamma, const unsigned int channels, const unsigned int width, const unsigned int height, Scene::ChannelSelectionType selectionType, Scene::WrapType wrapType) |
template<> | |
void CPP_API | DefineImageMap (const std::string &imgMapName, unsigned short *pixels, const float gamma, const unsigned int channels, const unsigned int width, const unsigned int height, Scene::ChannelSelectionType selectionType, Scene::WrapType wrapType) |
template<> | |
void CPP_API | DefineImageMap (const std::string &imgMapName, float *pixels, const float gamma, const unsigned int channels, const unsigned int width, const unsigned int height, Scene::ChannelSelectionType selectionType, Scene::WrapType wrapType) |
Static Public Member Functions | |
static Scene * | Create (const float imageScale=1.f) |
Create a new empty Scene. More... | |
static Scene * | Create (const luxrays::Properties &props, const float imageScale=1.f) |
Creates a new Scene as defined by props. More... | |
static Scene * | Create (const std::string &fileName, const float imageScale=1.f) |
Creates a new Scene as defined in fileName file. More... | |
static float * | AllocVerticesBuffer (const unsigned int meshVertCount) |
This must be used to allocate Mesh vertices buffer. More... | |
static unsigned int * | AllocTrianglesBuffer (const unsigned int meshTriCount) |
This must be used to allocate Mesh triangles buffer. More... | |
Protected Member Functions | |
virtual void | DefineImageMapUChar (const std::string &imgMapName, unsigned char *pixels, const float gamma, const unsigned int channels, const unsigned int width, const unsigned int height, ChannelSelectionType selectionType, WrapType wrapType)=0 |
virtual void | DefineImageMapHalf (const std::string &imgMapName, unsigned short *pixels, const float gamma, const unsigned int channels, const unsigned int width, const unsigned int height, ChannelSelectionType selectionType, WrapType wrapType)=0 |
virtual void | DefineImageMapFloat (const std::string &imgMapName, float *pixels, const float gamma, const unsigned int channels, const unsigned int width, const unsigned int height, ChannelSelectionType selectionType, WrapType wrapType)=0 |
|
virtual |
|
static |
This must be used to allocate Mesh triangles buffer.
|
static |
This must be used to allocate Mesh vertices buffer.
|
static |
Create a new empty Scene.
imageScale | defines the scale used for storing any kind of image in memory. |
|
static |
|
static |
Creates a new Scene as defined in fileName file.
fileName | is the name of the file with the scene description to read. It can be a text SDL file or a serialized binary file. The extension for the binary format must be ".bsc". |
imageScale | defines the scale used for storing any kind of image in memory. This parameter has no effect when loading binary serialized binary file. |
|
inline |
Defines an image map (to be later used in textures, infinite lights, etc.). The memory allocated for pixels array is NOT freed by the Scene class nor is used after the execution of this method. The types supported are "unsigned char", "unsigned short" (as a place holder for half type) and "float".
imgMapName | is the name of the defined image map. |
pixels | is a pointer to an array of image map pixels. |
gamma | is the gamma correction value of the image. |
channels | is the number of data used for each pixel (1 or 3). |
width | is the width of the image map. |
height | is the height of the image map. |
void CPP_API luxcore::Scene::DefineImageMap | ( | const std::string & | imgMapName, |
unsigned char * | pixels, | ||
const float | gamma, | ||
const unsigned int | channels, | ||
const unsigned int | width, | ||
const unsigned int | height, | ||
Scene::ChannelSelectionType | selectionType, | ||
Scene::WrapType | wrapType | ||
) |
void CPP_API luxcore::Scene::DefineImageMap | ( | const std::string & | imgMapName, |
unsigned short * | pixels, | ||
const float | gamma, | ||
const unsigned int | channels, | ||
const unsigned int | width, | ||
const unsigned int | height, | ||
Scene::ChannelSelectionType | selectionType, | ||
Scene::WrapType | wrapType | ||
) |
void CPP_API luxcore::Scene::DefineImageMap | ( | const std::string & | imgMapName, |
float * | pixels, | ||
const float | gamma, | ||
const unsigned int | channels, | ||
const unsigned int | width, | ||
const unsigned int | height, | ||
Scene::ChannelSelectionType | selectionType, | ||
Scene::WrapType | wrapType | ||
) |
|
protectedpure virtual |
|
protectedpure virtual |
|
protectedpure virtual |
|
pure virtual |
Defines a mesh (to be later used in one or more scene objects). The memory allocated for the ExtTriangleMesh is always freed by the Scene class, however freeing of memory for the vertices, triangle indices, etc. depends on the setting of SetDeleteMeshData(). NOTE: vertices and triangles buffers MUST be allocated with Scene::AllocVerticesBuffer() and Scene::AllocTrianglesBuffer().
meshName | is the name of the defined mesh. |
plyNbVerts | is the number of mesh vertices. |
plyNbTris | is the number of mesh triangles. |
p | is a pointer to an array of vertices. Embree accelerator has a very special requirement. The 4 bytes after the z-coordinate of the last vertex have to be readable memory, thus padding is required. |
vi | is a pointer to an array of triangles. |
n | is a pointer to an array of normals. It can be NULL. |
uv | is a pointer to an array of UV coordinates. It can be NULL. |
cols | is a pointer to an array of vertices colors. It can be NULL. |
alphas | is a pointer to an array of vertices alphas. It can be NULL. |
|
pure virtual |
Defines a mesh (to be later used in one or more scene objects) starting from the strands/hairs definition included in strandsFile.
shapeName | is the name of the defined shape. |
strandsFile | includes all information about the strands . |
tesselType | is the tessellation used to transform the strands in a triangle mesh. |
adaptiveMaxDepth | is maximum number of subdivisions for adaptive tessellation. |
adaptiveError | is the error threshold for adaptive tessellation. |
solidSideCount | is the number of sides for solid tessellation. |
solidCapBottom | is a flag to set if strands has to have a bottom cap. |
solidCapTop | is a flag to set if strands has to have a top cap. |
useCameraPosition | is a flag to set if ribbon tessellation has to be faced toward the camera. |
|
pure virtual |
Deletes a light from the scene.
lightName | is the name of the object to delete. Note: to delete area lights, use DeleteObject(). |
|
pure virtual |
Deletes an object from the scene.
objName | is the name of the object to delete. |
|
pure virtual |
Duplicate an object in an instance using the passed transformation.
srcObjName | is the name of the object to duplicate. |
dstObjName | is the name of the object to create. |
transMat | is the transformation 4x4 matrix to use. |
|
pure virtual |
Duplicate an object multiple times in instances using the passed transformations. Mostly useful for fast creating many copies of the same object (for instance for particles).
srcObjName | is the name of the object to duplicate. |
dstObjNamePrefix | is the prefix of the names of the object to create. The number of the copy will be appended. |
count | is the number of the object to create. |
transMat | is an array of transformation 4x4 matrices to use. |
|
pure virtual |
Duplicate an object in a motion blur instance using the passed transformation.
srcObjName | is the name of the object to duplicate. |
dstObjName | is the name of the object to create. |
steps | is the number of motion blur steps. |
times | is an array of times to use |
transMat | is an array of the transformation 4x4 matrix to use. |
|
pure virtual |
Duplicate an object multiple times in a motion blur instance using the passed transformations. Mostly useful for fast creating many copies of the same object (for instance for particles).
srcObjName | is the name of the object to duplicate. |
dstObjNamePrefix | is the name of the object to create. |
dstObjNamePrefix | is the prefix of the names of the object to create. The number of the copy will be appended. |
count | is the number of the object to create. |
steps | is the number of motion blur steps. |
times | is an array of times to use |
transMat | is an array of the transformation 4x4 matrix to use. |
|
pure virtual |
Returns the bounding box of the complete scene (as minimum and maximum point). It is available only during the rendering (i.e. after a RenderSession::Start()).
|
pure virtual |
Returns the Camera of the scene.
|
pure virtual |
|
pure virtual |
|
pure virtual |
Check if an image map with the given name has been defined.
imgMapName | is the name to check. |
|
pure virtual |
Check if a material with the given name has been defined.
matName | is the name to check. |
|
pure virtual |
Check if a mesh with the given name has been defined.
meshName | is the name to check. |
|
pure virtual |
Check if a texture with the given name has been defined.
texName | is the name to check. |
|
pure virtual |
Edits or creates camera, textures, materials and/or objects based on the Properties defined. If the scene is in use by a RenderSession, it must be called between a RenderSession::BeginSceneEdit() and RenderSession::EndSceneEdit().
props | are the Properties with the definition of camera, textures, materials and/or objects. |
|
pure virtual |
Removes all unused image maps.
|
pure virtual |
Removes all unused materials.
|
pure virtual |
Removes all unused meshes.
|
pure virtual |
Removes all unused textures.
|
pure virtual |
Serializes a Scene in a file.
fileName | is the name of the file where to serialize the scene. |
|
pure virtual |
Save a previously defined mesh to file system in PLY or BPY format.
meshName | is the name of the defined mesh to be saved. |
fileName | is the name of the file where to save the mesh. If it has the extension ".ply", the text PLY format will be used. If it has the extension ".bpy", the text PLY format will be used. |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Apply a new material to an object.
objName | is the name of the object to apply the material to. |
matName | is the new material name. |
|
pure virtual |
Apply a transformation to an object.
objName | is the name of the object to transform. |
transMat | is the transformation 4x4 matrix to apply. |