diff options
| author | git perforce import user <a@b> | 2016-10-25 12:29:14 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees> | 2016-10-25 18:56:37 -0500 |
| commit | 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch) | |
| tree | fa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/include/RenderMesh.h | |
| download | physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip | |
Initial commit:
PhysX 3.4.0 Update @ 21294896
APEX 1.4.0 Update @ 21275617
[CL 21300167]
Diffstat (limited to 'APEX_1.4/include/RenderMesh.h')
| -rw-r--r-- | APEX_1.4/include/RenderMesh.h | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/APEX_1.4/include/RenderMesh.h b/APEX_1.4/include/RenderMesh.h new file mode 100644 index 00000000..e666d00a --- /dev/null +++ b/APEX_1.4/include/RenderMesh.h @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef RENDER_MESH_H +#define RENDER_MESH_H + +/*! +\file +\brief classes RenderSubmesh, VertexBuffer, and MaterialNamingConvention enums +*/ + +#include "ApexUsingNamespace.h" +#include "VertexFormat.h" + +namespace nvidia +{ +namespace apex +{ + +PX_PUSH_PACK_DEFAULT + +class RenderMeshActor; +class Context; +struct VertexUV; + + +/** +\brief a vertex buffer that supports multiple formats + */ +class VertexBuffer +{ +public: + /** + \brief Returns the number of vertices in the buffer + */ + virtual uint32_t getVertexCount() const = 0; + + /** + \brief Returns the data format. See VertexFormat. + */ + virtual const VertexFormat& getFormat() const = 0; + + /** + \brief Returns the data format. See VertexFormat. Can be changed. + */ + virtual VertexFormat& getFormatWritable() = 0; + + /** + \brief Accessor for the data buffer indexed by bufferIndex. To get the buffer format, use getFormat().getBufferFormat( index ). + If the data channel doesn't exist then this function returns NULL. + */ + virtual const void* getBuffer(uint32_t bufferIndex) const = 0; + + /** + \brief Like getBuffer(), but also returns the buffer's format. + */ + virtual const void* getBufferAndFormat(RenderDataFormat::Enum& format, uint32_t bufferIndex) const = 0; + + /** + \brief Like getBuffer(), but also returns the buffer's format. Can be changed. + */ + virtual void* getBufferAndFormatWritable(RenderDataFormat::Enum& format, uint32_t bufferIndex) = 0; + + /** + \brief Accessor for data in a desired format from the buffer indexed by bufferIndex. If the channel does not exist, or if it is in + a format for which there is not presently a converter to the the desired format dstBufferFormat, this function returns false. + The dstBufferStride field must be at least the size of the dstBufferFormat data, or zero (in which case the stride is assumed to be + the size of the dstBufferFormat data). If neither of these conditions hold, this function returns false. + Otherwise, dstBuffer is filled in with elementCount elements of the converted data, starting from startVertexIndex, withe the given stride. + */ + virtual bool getBufferData(void* dstBuffer, nvidia::RenderDataFormat::Enum dstBufferFormat, uint32_t dstBufferStride, uint32_t bufferIndex, + uint32_t startVertexIndex, uint32_t elementCount) const = 0; + +protected: + /* Do not allow class to be created directly */ + VertexBuffer() {} +}; + + +/** +\brief a mesh that has only one material (or render state, in general) + */ +class RenderSubmesh +{ +public: + virtual ~RenderSubmesh() {} + + /** + Returns the number of vertices associated with the indexed part. + */ + virtual uint32_t getVertexCount(uint32_t partIndex) const = 0; + + /** + Returns the submesh's vertex buffer (contains all parts' vertices) + */ + virtual const VertexBuffer& getVertexBuffer() const = 0; + + /** + Returns the submesh's index buffer (contains all parts' vertices). Can be changed. + */ + virtual VertexBuffer& getVertexBufferWritable() = 0; + + /** + Vertices for a given part are contiguous within the vertex buffer. This function + returns the first vertex index for the indexed part. + */ + virtual uint32_t getFirstVertexIndex(uint32_t partIndex) const = 0; + + /** + Returns the number of indices in the part's index buffer. + */ + virtual uint32_t getIndexCount(uint32_t partIndex) const = 0; + + /** + Returns the index buffer associated with the indexed part. + */ + virtual const uint32_t* getIndexBuffer(uint32_t partIndex) const = 0; + + /** + Returns an array of smoothing groups for the given part, if one exists. Otherwise, returns NULL. + If not NULL, the size of the array is the number of triangles in the part. Since only triangle + lists are currently supported, the size of this array is getIndexCount(partIndex)/3. + */ + virtual const uint32_t* getSmoothingGroups(uint32_t partIndex) const = 0; + +protected: + RenderSubmesh() {} +}; + +PX_POP_PACK + +} +} // end namespace nvidia::apex + +#endif // RENDER_MESH_H |