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 /PhysX_3.4/Samples/SampleFramework/renderer/src/null | |
| 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 'PhysX_3.4/Samples/SampleFramework/renderer/src/null')
18 files changed, 1437 insertions, 0 deletions
diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.cpp new file mode 100644 index 00000000..323bde15 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.cpp @@ -0,0 +1,292 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> +#include "NULLRenderer.h" + +#include <RendererDesc.h> + +#include "NULLRendererDirectionalLight.h" +#include "NULLRendererIndexBuffer.h" +#include "NULLRendererInstanceBuffer.h" +#include "NULLRendererMaterial.h" +#include "NULLRendererMesh.h" +#include "NULLRendererSpotLight.h" +#include "NULLRendererTexture2D.h" +#include "NULLRendererVertexBuffer.h" + +#include "RendererVertexBufferDesc.h" +#include "RendererIndexBufferDesc.h" +#include "RendererInstanceBufferDesc.h" +#include "RendererTexture2DDesc.h" +#include "RendererMaterialDesc.h" +#include "RendererDirectionalLightDesc.h" +#include "RendererSpotLightDesc.h" +#include "RendererMeshDesc.h" + +using namespace SampleRenderer; + +NullRenderer::NullRenderer(const RendererDesc &desc, const char* assetDir) : +Renderer(DRIVER_NULL, desc.errorCallback, assetDir) +{ + +} + +NullRenderer::~NullRenderer(void) +{ +} + +void NullRenderer::finishRendering() +{ +} + +bool NullRenderer::captureScreen(const char* filename) +{ + return false; +} + +// clears the offscreen buffers. +void NullRenderer::clearBuffers(void) +{ +} + +// presents the current color buffer to the screen. +// returns true on device reset and if buffers need to be rewritten. +bool NullRenderer::swapBuffers(void) +{ + return false; +} + +RendererVertexBuffer *NullRenderer::createVertexBuffer(const RendererVertexBufferDesc &desc) +{ + NullRendererVertexBuffer *vb = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Vertex Buffer Descriptor."); + if(desc.isValid()) + { + vb = new NullRendererVertexBuffer(desc); + } + return vb; +} + +RendererIndexBuffer *NullRenderer::createIndexBuffer(const RendererIndexBufferDesc &desc) +{ + NullRendererIndexBuffer *ib = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Index Buffer Descriptor."); + if(desc.isValid()) + { + ib = new NullRendererIndexBuffer(desc); + } + return ib; +} + +void* NullRenderer::getDevice() +{ + return NULL; +} + +void NullRenderer::getWindowSize(PxU32 &width, PxU32 &height) const +{ + width = 640; + height = 480; +} + +void NullRenderer::renderLines2D(const void* vertices, PxU32 nbVerts) +{ + +} + +RendererInstanceBuffer *NullRenderer::createInstanceBuffer(const RendererInstanceBufferDesc &desc) +{ + NullRendererInstanceBuffer *ib = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Instance Buffer Descriptor."); + if(desc.isValid()) + { + ib = new NullRendererInstanceBuffer(desc); + } + return ib; +} + +RendererTexture2D *NullRenderer::createTexture2D(const RendererTexture2DDesc &desc) +{ + RendererTexture2D *texture = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Texture 2D Descriptor."); + if(desc.isValid()) + { + texture = new NullRendererTexture2D(desc); + } + return texture; +} + +RendererTexture3D *NullRenderer::createTexture3D(const RendererTexture3DDesc &desc) +{ + RendererTexture3D *texture = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Texture 3D Descriptor."); + if(desc.isValid()) + { + // TODO: implement + texture = NULL; + } + return texture; +} + +RendererTarget *NullRenderer::createTarget(const RendererTargetDesc &desc) +{ + RENDERER_ASSERT(0, "Not Implemented."); + return 0; +} + +RendererMaterial *NullRenderer::createMaterial(const RendererMaterialDesc &desc) +{ + NullRendererMaterial *mat = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Material Descriptor."); + if(desc.isValid()) + { + mat = new NullRendererMaterial(*this, desc); + } + return mat; +} + +RendererMesh *NullRenderer::createMesh(const RendererMeshDesc &desc) +{ + NullRendererMesh *mesh = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Mesh Descriptor."); + if(desc.isValid()) + { + mesh = new NullRendererMesh(*this,desc); + } + return mesh; +} + +RendererLight *NullRenderer::createLight(const RendererLightDesc &desc) +{ + RendererLight *light = 0; + RENDERER_ASSERT(desc.isValid(), "Invalid Light Descriptor."); + if(desc.isValid()) + { + switch(desc.type) + { + case RendererLight::TYPE_DIRECTIONAL: + light = new NullRendererDirectionalLight(*static_cast<const RendererDirectionalLightDesc*>(&desc)); + break; + case RendererLight::TYPE_SPOT: + { + light = new NullRendererSpotLight(*static_cast<const RendererSpotLightDesc*>(&desc)); + } + break; + default: + break; + } + + } + return light; +} + +void NullRenderer::bindViewProj(const physx::PxMat44 &eye, const RendererProjection &proj) +{ + +} + +void NullRenderer::bindFogState(const RendererColor &fogColor, float fogDistance) +{ +} + +void NullRenderer::bindAmbientState(const RendererColor &ambientColor) +{ + +} + +void NullRenderer::bindDeferredState(void) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +void NullRenderer::bindMeshContext(const RendererMeshContext &context) +{ + +} + +void NullRenderer::beginMultiPass(void) +{ +} + +void NullRenderer::endMultiPass(void) +{ +} + +void NullRenderer::renderDeferredLight(const RendererLight &/*light*/) +{ + RENDERER_ASSERT(0, "Not implemented!"); +} + +PxU32 NullRenderer::convertColor(const RendererColor& color) const +{ + return color.a << 24 | color.b << 16 | color.g << 8 | color.r; +} + + +bool NullRenderer::isOk(void) const +{ + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NullRenderer::setupTextRenderStates() +{ +} + +void NullRenderer::resetTextRenderStates() +{ + +} + +bool NullRenderer::initTexter() +{ + + return true; +} + +void NullRenderer::renderTextBuffer(const void* verts, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material) +{ + +} + +void NullRenderer::renderLines2D(const void* vertices, PxU32 nbPassedVerts, RendererMaterial* material) +{ + +} + +void NullRenderer::setupScreenquadRenderStates() +{ + +} + +void NullRenderer::resetScreenquadRenderStates() +{ + +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.h new file mode 100644 index 00000000..9ca77a08 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRenderer.h @@ -0,0 +1,102 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_H +#define NULL_RENDERER_H + +#include <RendererConfig.h> + +#include <Renderer.h> + +namespace SampleRenderer +{ + + class NullRenderer : public Renderer + { + public: + NullRenderer(const RendererDesc &desc, const char* assetDir); + virtual ~NullRenderer(void); + + public: + // clears the offscreen buffers. + virtual void clearBuffers(void); + + // presents the current color buffer to the screen. + // returns true on device reset and if buffers need to be rewritten. + virtual bool swapBuffers(void); + + // get the device pointer (void * abstraction) + virtual void *getDevice(); + + virtual void finishRendering(); + + virtual void getWindowSize(PxU32 &width, PxU32 &height) const; + + virtual RendererVertexBuffer *createVertexBuffer( const RendererVertexBufferDesc &desc); + virtual RendererIndexBuffer *createIndexBuffer( const RendererIndexBufferDesc &desc); + virtual RendererInstanceBuffer *createInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual RendererTexture2D *createTexture2D( const RendererTexture2DDesc &desc); + virtual RendererTexture3D *createTexture3D( const RendererTexture3DDesc &desc); + virtual RendererTarget *createTarget( const RendererTargetDesc &desc); + virtual RendererMaterial *createMaterial( const RendererMaterialDesc &desc); + virtual RendererMesh *createMesh( const RendererMeshDesc &desc); + virtual RendererLight *createLight( const RendererLightDesc &desc); + + virtual bool captureScreen(const char* filename); + + virtual void renderLines2D(const void* vertices, PxU32 nbVerts); + + private: + virtual void bindViewProj(const physx::PxMat44 &eye, const RendererProjection &proj); + virtual void bindAmbientState(const RendererColor &ambientColor); + virtual void bindFogState(const RendererColor &fogColor, float fogDistance); + virtual void bindDeferredState(void); + virtual void bindMeshContext(const RendererMeshContext &context); + virtual void beginMultiPass(void); + virtual void endMultiPass(void); + virtual void renderDeferredLight(const RendererLight &light); + virtual PxU32 convertColor(const RendererColor& color) const; + virtual void beginTransparentMultiPass(void) {} + virtual void endTransparentMultiPass(void) {} + virtual void setVsync(bool on) {} + virtual bool captureScreen(PxU32 &width, PxU32& height, PxU32& sizeInBytes, const void*& screenshotData) { return false; } + + virtual bool isOk(void) const; + + virtual void setupTextRenderStates(); + virtual void resetTextRenderStates(); + virtual void renderTextBuffer(const void* vertices, PxU32 nbVerts, const PxU16* indices, PxU32 nbIndices, RendererMaterial* material); + virtual void renderLines2D(const void* vertices, PxU32 nbVerts, RendererMaterial* material); + virtual void setupScreenquadRenderStates(); + virtual void resetScreenquadRenderStates(); + virtual bool initTexter(); + + private: + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.cpp new file mode 100644 index 00000000..d5ff3852 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.cpp @@ -0,0 +1,48 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + + + +#include "NULLRendererDirectionalLight.h" + +using namespace SampleRenderer; + +NullRendererDirectionalLight::NullRendererDirectionalLight(const RendererDirectionalLightDesc &desc) : + RendererDirectionalLight(desc) +{ +} + +NullRendererDirectionalLight::~NullRendererDirectionalLight(void) +{ +} + +void NullRendererDirectionalLight::bind(void) const +{ +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.h new file mode 100644 index 00000000..ba38aeb9 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererDirectionalLight.h @@ -0,0 +1,54 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_DIRECTIONAL_LIGHT_H +#define NULL_RENDERER_DIRECTIONAL_LIGHT_H + +#include <RendererConfig.h> + + +#include <RendererDirectionalLight.h> + +namespace SampleRenderer +{ + + class RendererDirectionalLightDesc; + + class NullRendererDirectionalLight : public RendererDirectionalLight + { + public: + NullRendererDirectionalLight(const RendererDirectionalLightDesc &desc); + virtual ~NullRendererDirectionalLight(void); + + virtual void bind(void) const; + + private: + + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.cpp new file mode 100644 index 00000000..b57108a6 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.cpp @@ -0,0 +1,74 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + + +#include "NULLRendererIndexBuffer.h" +#include <RendererIndexBufferDesc.h> + +using namespace SampleRenderer; + +NullRendererIndexBuffer::NullRendererIndexBuffer(const RendererIndexBufferDesc &desc) : + RendererIndexBuffer(desc), m_Buffer(0) +{ + PxU32 indexSize = getFormatByteSize(getFormat()); + + RENDERER_ASSERT(desc.maxIndices > 0 && desc.maxIndices > 0, "Cannot create zero size Index Buffer."); + if(indexSize && desc.maxIndices > 0) + { + m_Buffer = new PxU8[indexSize*desc.maxIndices]; + m_maxIndices = desc.maxIndices; + } + +} + +NullRendererIndexBuffer::~NullRendererIndexBuffer(void) +{ + if(m_Buffer) + { + delete [] m_Buffer; + m_Buffer = NULL; + } +} + +void *NullRendererIndexBuffer::lock(void) +{ + return m_Buffer; +} + +void NullRendererIndexBuffer::unlock(void) +{ +} + +void NullRendererIndexBuffer::bind(void) const +{ +} + +void NullRendererIndexBuffer::unbind(void) const +{ +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.h new file mode 100644 index 00000000..07551449 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererIndexBuffer.h @@ -0,0 +1,57 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_INDEXBUFFER_H +#define NULL_RENDERER_INDEXBUFFER_H + +#include <RendererConfig.h> + +#include <RendererIndexBuffer.h> + +namespace SampleRenderer +{ + + class NullRendererIndexBuffer : public RendererIndexBuffer + { + public: + NullRendererIndexBuffer(const RendererIndexBufferDesc &desc); + virtual ~NullRendererIndexBuffer(void); + + public: + virtual void *lock(void); + virtual void unlock(void); + + private: + virtual void bind(void) const; + virtual void unbind(void) const; + + private: + PxU8* m_Buffer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.cpp new file mode 100644 index 00000000..bc5244c7 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.cpp @@ -0,0 +1,74 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#include "NULLRendererInstanceBuffer.h" +#include <RendererInstanceBufferDesc.h> + +using namespace SampleRenderer; + +NullRendererInstanceBuffer::NullRendererInstanceBuffer(const RendererInstanceBufferDesc &desc) : + RendererInstanceBuffer(desc) +{ + m_bufferSize = (PxU32)(desc.maxInstances * m_stride); + m_buffer = new PxU8[m_bufferSize]; + + RENDERER_ASSERT(m_buffer, "Failed to create Vertex Buffer Object."); + + m_maxInstances = desc.maxInstances; +} + +NullRendererInstanceBuffer::~NullRendererInstanceBuffer(void) +{ + if(m_buffer) + { + delete [] m_buffer; + m_buffer = NULL; + } +} + + +void *NullRendererInstanceBuffer::lock(void) +{ + return m_buffer; +} + +void NullRendererInstanceBuffer::unlock(void) +{ + +} + +void NullRendererInstanceBuffer::bind(PxU32 streamID, PxU32 firstInstance) const +{ +} + +void NullRendererInstanceBuffer::unbind(PxU32 streamID) const +{ + +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.h new file mode 100644 index 00000000..68d9178e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererInstanceBuffer.h @@ -0,0 +1,58 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_INSTANCEBUFFER_H +#define NULL_RENDERER_INSTANCEBUFFER_H + +#include <RendererConfig.h> + +#include <RendererInstanceBuffer.h> + +namespace SampleRenderer +{ + + class NullRendererInstanceBuffer : public RendererInstanceBuffer + { + public: + NullRendererInstanceBuffer(const RendererInstanceBufferDesc &desc); + virtual ~NullRendererInstanceBuffer(void); + + public: + + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstInstance) const; + virtual void unbind(PxU32 streamID) const; + + private: + PxU8 *m_buffer; + PxU32 m_bufferSize; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.cpp new file mode 100644 index 00000000..89540069 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.cpp @@ -0,0 +1,78 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. + +#include "RendererConfig.h" + +#include "NULLRendererMaterial.h" + +#include <RendererMaterialDesc.h> + +#include <SamplePlatform.h> + +// for PsString.h +namespace physx +{ + namespace string + {} +} +#include <PsString.h> +#include <PxTkFile.h> + +using namespace SampleRenderer; + +NullRendererMaterial::NullRendererMaterial(NullRenderer &renderer, const RendererMaterialDesc &desc) : + RendererMaterial(desc, renderer.getEnableMaterialCaching()), + m_renderer(renderer) +{ +} + +NullRendererMaterial::~NullRendererMaterial(void) +{ +} + + +void NullRendererMaterial::bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const +{ + RendererMaterial::bind(pass, materialInstance, instanced); +} + +void NullRendererMaterial::bindMeshState(bool instanced) const +{ + +} + +void NullRendererMaterial::unbind(void) const +{ + +} + + +void NullRendererMaterial::bindVariable(Pass pass, const Variable &variable, const void *data) const +{ +} + + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.h new file mode 100644 index 00000000..88674136 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMaterial.h @@ -0,0 +1,66 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_MATERIAL_H +#define NULL_RENDERER_MATERIAL_H + +#include <RendererConfig.h> + +#include <RendererMaterial.h> + +#include "NULLRenderer.h" + +namespace SampleRenderer +{ + + class NullRendererMaterial : public RendererMaterial + { + public: + NullRendererMaterial(NullRenderer &renderer, const RendererMaterialDesc &desc); + virtual ~NullRendererMaterial(void); + virtual void setModelMatrix(const float *matrix) + { + PX_UNUSED(matrix); + PX_ALWAYS_ASSERT(); + } + + private: + virtual const Renderer& getRenderer() const { return m_renderer; } + virtual void bind(RendererMaterial::Pass pass, RendererMaterialInstance *materialInstance, bool instanced) const; + virtual void bindMeshState(bool instanced) const; + virtual void unbind(void) const; + virtual void bindVariable(Pass pass, const Variable &variable, const void *data) const; + + private: + NullRendererMaterial &operator=(const NullRendererMaterial&) { return *this; } + + private: + NullRenderer & m_renderer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.cpp new file mode 100644 index 00000000..6d2a7e20 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.cpp @@ -0,0 +1,72 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#include "NULLRendererMesh.h" + +using namespace SampleRenderer; + + +NullRendererMesh::NullRendererMesh(NullRenderer &renderer, const RendererMeshDesc &desc) : +RendererMesh(desc), +mRenderer(renderer) +{ +} + +NullRendererMesh::~NullRendererMesh(void) +{ + + + +} + +void NullRendererMesh::renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const +{ + +} + +bool NullRendererMesh::willRender() const +{ + return true; + +} + +void NullRendererMesh::renderVertices(PxU32 numVertices, RendererMaterial *material) const +{ + +} + +void NullRendererMesh::renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const +{ +} + +void NullRendererMesh::renderVerticesInstanced(PxU32 numVertices,RendererMaterial *material) const +{ +} + + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.h new file mode 100644 index 00000000..b0b87ba0 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererMesh.h @@ -0,0 +1,62 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_MESH_H +#define NULL_RENDERER_MESH_H + +#include <RendererConfig.h> +#include <RendererMesh.h> +#include "NULLRenderer.h" + +namespace SampleRenderer +{ + + class NullRendererMesh : public RendererMesh + { + public: + NullRendererMesh(NullRenderer &renderer, const RendererMeshDesc &desc); + virtual ~NullRendererMesh(void); + + virtual bool willRender() const; + + public: + virtual void renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const; + virtual void renderVertices(PxU32 numVertices, RendererMaterial *material) const; + + virtual void renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat,RendererMaterial *material) const; + virtual void renderVerticesInstanced(PxU32 numVertices,RendererMaterial *material) const; + + protected: + void operator=(const NullRendererMesh &){} + Renderer& renderer() { return mRenderer; } + + private: + NullRenderer& mRenderer; + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.cpp new file mode 100644 index 00000000..22a3d032 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.cpp @@ -0,0 +1,46 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +#include <RendererConfig.h> + +#include "NULLRendererSpotLight.h" + +using namespace SampleRenderer; + +NullRendererSpotLight::NullRendererSpotLight(const RendererSpotLightDesc &desc) : + RendererSpotLight(desc) +{ + +} + +NullRendererSpotLight::~NullRendererSpotLight(void) +{ + +} + +void NullRendererSpotLight::bind(void) const +{ +} diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.h new file mode 100644 index 00000000..f349e98e --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererSpotLight.h @@ -0,0 +1,51 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. + +#ifndef NULL_RENDERER_SPOT_LIGHT_H +#define NULL_RENDERER_SPOT_LIGHT_H + +#include <RendererConfig.h> +#include <RendererSpotLight.h> + + +namespace SampleRenderer +{ + + class NullRendererSpotLight : public RendererSpotLight + { + public: + NullRendererSpotLight (const RendererSpotLightDesc &desc); + virtual ~NullRendererSpotLight (void); + + virtual void bind(void) const; + + private: + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.cpp new file mode 100644 index 00000000..d0a19ac1 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.cpp @@ -0,0 +1,100 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. + +#include <RendererConfig.h> + +#include "NULLRendererTexture2D.h" +#include <RendererTexture2DDesc.h> + +using namespace SampleRenderer; + +NullRendererTexture2D::NullRendererTexture2D(const RendererTexture2DDesc &desc) : +RendererTexture2D(desc) +{ + PxU32 width = desc.width; + PxU32 height = desc.height; + + m_numLevels = desc.numLevels; + m_data = new PxU8*[m_numLevels]; + m_width = new PxU32[m_numLevels]; + memset(m_data, 0, sizeof(PxU8*)*m_numLevels); + + for(PxU32 i=0; i<desc.numLevels; i++) + { + PxU32 w = getLevelDimension(width, i); + m_width[i] = w; + PxU32 h = getLevelDimension(height, i); + PxU32 levelSize = computeImageByteSize(w, h, 1, desc.format); + + // allocate memory + m_data[i] = new PxU8[levelSize]; + + memset(m_data[i], 0, levelSize); + } +} + +NullRendererTexture2D::~NullRendererTexture2D(void) +{ + for(PxU32 i=0; i<m_numLevels; i++) + { + delete [] m_data[i]; + } + + if(m_data) + { + delete [] m_data; + } + + if(m_width) + { + delete [] m_width; + } +} + +void *NullRendererTexture2D::lockLevel(PxU32 level, PxU32 &pitch) +{ + void *buffer = 0; + pitch = 0; + RENDERER_ASSERT(level < m_numLevels, "Level out of range!"); + if(level < m_numLevels) + { + buffer = m_data[level]; + PxU32 w = SampleRenderer::RendererTexture2D::getFormatNumBlocks(m_width[level], getFormat()); + pitch = w * getBlockSize(); + } + return buffer; +} + +void NullRendererTexture2D::unlockLevel(PxU32 level) +{ + RENDERER_ASSERT(level < m_numLevels, "Level out of range!"); +} + +void NullRendererTexture2D::bind(PxU32 textureUnit) +{ +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.h new file mode 100644 index 00000000..e4fa175b --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererTexture2D.h @@ -0,0 +1,63 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_TEXTURE_2D_H +#define NULL_RENDERER_TEXTURE_2D_H + +#include <RendererConfig.h> + +#include <RendererTexture2D.h> + +namespace SampleRenderer +{ + + class NullRendererTexture2D : public RendererTexture2D + { + public: + NullRendererTexture2D(const RendererTexture2DDesc &desc); + virtual ~NullRendererTexture2D(void); + + public: + virtual void *lockLevel(PxU32 level, PxU32 &pitch); + virtual void unlockLevel(PxU32 level); + + void bind(PxU32 textureUnit); + + virtual void select(PxU32 stageIndex) + { + bind(stageIndex); + } + + private: + PxU8** m_data; + PxU32 m_numLevels; + PxU32* m_width; + + }; + +} // namespace SampleRenderer + +#endif diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.cpp b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.cpp new file mode 100644 index 00000000..a7a73e3c --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.cpp @@ -0,0 +1,82 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. + +#include "RendererConfig.h" +#include <SamplePlatform.h> + +#include "NULLRendererVertexBuffer.h" + +#include <RendererVertexBufferDesc.h> + + +using namespace SampleRenderer; + +NullRendererVertexBuffer::NullRendererVertexBuffer(const RendererVertexBufferDesc &desc) + :RendererVertexBuffer(desc),m_buffer(0) +{ + RENDERER_ASSERT(m_stride && desc.maxVertices, "Unable to create Vertex Buffer of zero size."); + if(m_stride && desc.maxVertices) + { + m_buffer = new PxU8[m_stride * desc.maxVertices]; + + RENDERER_ASSERT(m_buffer, "Failed to create Vertex Buffer Object."); + + m_maxVertices = desc.maxVertices; + } +} + +NullRendererVertexBuffer::~NullRendererVertexBuffer(void) +{ + if(m_buffer) + { + delete [] m_buffer; + m_buffer = NULL; + } +} + +void NullRendererVertexBuffer::swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat) +{ +} + +void *NullRendererVertexBuffer::lock(void) +{ + return m_buffer; +} + +void NullRendererVertexBuffer::unlock(void) +{ +} + + +void NullRendererVertexBuffer::bind(PxU32 streamID, PxU32 firstVertex) +{ +} + +void NullRendererVertexBuffer::unbind(PxU32 streamID) +{ +} + diff --git a/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.h b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.h new file mode 100644 index 00000000..5a27c512 --- /dev/null +++ b/PhysX_3.4/Samples/SampleFramework/renderer/src/null/NULLRendererVertexBuffer.h @@ -0,0 +1,58 @@ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and 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. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +#ifndef NULL_RENDERER_VERTEXBUFFER_H +#define NULL_RENDERER_VERTEXBUFFER_H + +#include <RendererConfig.h> + +#include <RendererVertexBuffer.h> + +namespace SampleRenderer +{ + + class NullRendererVertexBuffer : public RendererVertexBuffer + { + public: + NullRendererVertexBuffer(const RendererVertexBufferDesc &desc); + virtual ~NullRendererVertexBuffer(void); + + protected: + virtual void swizzleColor(void *colors, PxU32 stride, PxU32 numColors, RendererVertexBuffer::Format inFormat); + + virtual void *lock(void); + virtual void unlock(void); + + virtual void bind(PxU32 streamID, PxU32 firstVertex); + virtual void unbind(PxU32 streamID); + + private: + PxU8* m_buffer; + }; + +} // namespace SampleRenderer + +#endif |