131 ,
public SLOptixAccelStruct
163 const std::function<
void(
SLMesh*)>& cbInformNodes);
167 void allocAndUploadData();
169 virtual void createMeshAccelerationStructure();
170 virtual void updateMeshAccelerationStructure();
171 virtual ortHitData createHitData();
172 unsigned int sbtIndex()
const {
return _sbtIndex; }
173 static unsigned int meshIndex;
245 SLOptixCudaBuffer<SLVec3f> _vertexBuffer;
246 SLOptixCudaBuffer<SLVec3f> _normalBuffer;
247 SLOptixCudaBuffer<SLVec2f> _textureBuffer;
248 SLOptixCudaBuffer<SLushort> _indexShortBuffer;
249 SLOptixCudaBuffer<SLuint> _indexIntBuffer;
250 unsigned int _sbtIndex;
vector< vector< SLfloat > > SLVVfloat
vector< SLushort > SLVushort
vector< vector< SLuchar > > SLVVuchar
Wrapper class around OpenGL Vertex Array Objects (VAO)
vector< SLMat4f > SLVMat4f
vector< SLMesh * > SLVMesh
vector< SLVec2f > SLVVec2f
vector< SLVec3f > SLVVec3f
vector< SLVec4f > SLVVec4f
vector< SLCol4f > SLVCol4f
Defines an axis aligned bounding box.
SLAccelStruct is an abstract base class for acceleration structures.
SLAnimSkeleton keeps track of a skeletons joints and animations.
Toplevel holder of the assets meshes, materials, textures and shaders.
Encapsulation of an OpenGL shader program object.
Singleton class holding all OpenGL states.
SLGLVertexArray adds Helper Functions for quick Line & Point Drawing.
SLGLVertexArray encapsulates the core OpenGL drawing.
Defines a standard CG material with textures and a shader program.
An SLMesh object is a triangulated mesh, drawn with one draw call.
SLMesh(SLAssetManager *assetMgr, const SLstring &name="Mesh")
Construct a new SLMesh::SLMesh object.
SLfloat edgeWidth() const
SLVec3f maxP
max. vertex in OS
void handleRectangleSelection(SLSceneView *sv, SLGLState *stateGL, SLNode *node)
Handles the rectangle section of mesh vertices (partial selection)
SLVuint IS32
Vector of rectangle selected vertex indices 32 bit.
SLVuint I32
Vector of vertex indices 32 bit.
SLGLPrimitiveType primitive() const
SLVushort I16
Vector of vertex indices 16 bit.
virtual void calcNormals()
SLMesh::calcNormals recalculates vertex normals for triangle meshes.
void isSelected(bool isSelected)
void deselectPartialSelection()
void vertexPosEpsilon(SLfloat eps)
SLbool _isVolume
Flag for RT if mesh is a closed volume.
SLGLVertexArrayExt _vaoT
OpenGL VAO for optional tangent drawing.
SLVVec4f T
Vector of vertex tangents (opt.) layout (location = 5)
void transformSkin(bool forceCPUSkinning, const std::function< void(SLMesh *)> &cbInformNodes)
Transforms the vertex positions and normals with by joint weights.
virtual void calcMinMax()
SLVuint IE32
Vector of hard edges vertex indices 32 bit (see computeHardEdgesIndices)
SLfloat _edgeAngleDEG
Edge crease angle in degrees between face normals (30 deg. default)
virtual void init(SLNode *node)
SLMesh::shapeInit sets the transparency flag of the AABB.
SLbool accelStructIsOutOfDate()
virtual void draw(SLSceneView *sv, SLNode *node, SLuint intances=0)
void calcCenterRad(SLVec3f ¢er, SLfloat &radius)
SLbool hit(SLRay *ray, SLNode *node)
SLbool _isSelected
Flag if mesh is partially of fully selected.
SLfloat _vertexPosEpsilon
Vertex position epsilon used in computeHardEdgesIndices.
SLVCol4f C
Vector of vertex colors (opt.) layout (location = 4)
SLVVec3f skinnedN
temp. vector for CPU skinned vertex normals
void computeHardEdgesIndices(float angleRAD, float epsilon)
computes the hard edges and stores the vertex indexes separately
void deleteSelected(SLNode *node)
Deletes the rectangle selected vertices and the dependent triangles.
void edgeAngleDEG(SLfloat ea)
void drawSelectedVertices()
virtual void deleteDataGpu()
void addStats(SLNodeStats &stats)
SLVushort IE16
Vector of hard edges vertex indices 16 bit (see computeHardEdgesIndices)
SLGLPrimitiveType _primitive
Primitive type (default triangles)
virtual void generateVAO(SLGLVertexArray &vao)
Generate the Vertex Array Object for a specific shader program.
SLVVec3f * _finalN
pointer to final vertex normal vector
static void calcTex3DMatrix(SLNode *node)
SLfloat _edgeWidth
Line width for hard edge drawing.
SLGLVertexArrayExt _vaoN
OpenGL VAO for optional normal drawing.
SLAnimSkeleton * _skeleton
The skeleton this mesh is bound to.
SLVVec3f N
Vector for vertex normals (opt.) layout (location = 1)
SLVec3f minP
min. vertex in OS
SLCol4f edgeColor() const
virtual void deleteData()
SLMesh::deleteData deletes all mesh data and vbo's.
void calcTangents()
SLMesh::calcTangents computes the tangents per vertex for triangle meshes.
SLVVec2f UV[2]
Array of 2 Vectors for tex. coords. (opt.) layout (location = 2)
SLVMat4f _jointMatrices
Joint matrix vector for this mesh.
SLVVec3f * _finalP
Pointer to final vertex position vector.
void primitive(SLGLPrimitiveType pt)
void matOut(SLMaterial *m)
SLbool hitTriangleOS(SLRay *ray, SLNode *node, SLuint iT)
void drawIntoDepthBuffer(SLSceneView *sv, SLNode *node, SLMaterial *depthMat)
Simplified drawing method for shadow map creation.
void edgeWidth(SLfloat ew)
SLVVuchar Ji
2D Vector of per vertex joint ids (opt.) layout (location = 6)
SLCol4f _edgeColor
Color for hard edge drawing.
virtual void buildAABB(SLAABBox &aabb, const SLMat4f &wmNode)
void deleteUnused()
Deletes unused vertices (= vertices that are not indexed in I16 or I32)
SLfloat edgeAngleDEG() const
SLGLVertexArrayExt _vaoS
OpenGL VAO for optional selection drawing.
SLbool _accelStructIsOutOfDate
Flag if accel. struct needs update.
SLbool isSelected() const
SLGLVertexArray _vao
Main OpenGL Vertex Array Object for drawing.
~SLMesh() override
The destructor deletes everything by calling deleteData.
SLVVec3f skinnedP
temp. vector for CPU skinned vertex positions
SLVVfloat Jw
2D Vector of per vertex joint weights (opt.) layout (location = 7)
const SLAnimSkeleton * skeleton() const
SLAccelStruct * _accelStruct
KD-tree or uniform grid.
SLVVec3f P
Vector for vertex positions layout (location = 0)
SLMaterial * _matOut
Pointer to the outside material.
SLMaterial * matOut() const
void edgeColor(const SLCol4f &ec)
void skeleton(SLAnimSkeleton *skel)
virtual void preShade(SLRay *ray)
SLbool _isCPUSkinned
Flag if mesh has been skinned on CPU during update.
SLMaterial * _mat
Pointer to the inside material.
SLNode represents a node in a hierarchical scene graph.
Base class for all other classes.
const SLstring & name() const
Ray class with ray and intersection properties.
SceneView class represents a dynamic real time 3D view onto the scene.
Struct for scene graph statistics.