RenderDebugInterface.h
Go to the documentation of this file.
00001 //
00002 // Redistribution and use in source and binary forms, with or without
00003 // modification, are permitted provided that the following conditions
00004 // are met:
00005 //  * Redistributions of source code must retain the above copyright
00006 //    notice, this list of conditions and the following disclaimer.
00007 //  * Redistributions in binary form must reproduce the above copyright
00008 //    notice, this list of conditions and the following disclaimer in the
00009 //    documentation and/or other materials provided with the distribution.
00010 //  * Neither the name of NVIDIA CORPORATION nor the names of its
00011 //    contributors may be used to endorse or promote products derived
00012 //    from this software without specific prior written permission.
00013 //
00014 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
00015 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017 // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00018 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 //
00026 // Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
00027 
00028 
00029 
00030 #ifndef RENDER_DEBUG_INTERFACE_H
00031 #define RENDER_DEBUG_INTERFACE_H
00032 
00038 #include "ApexDefs.h"
00039 #include "RenderDebugTyped.h" // include the header file containing the base class
00040 #include "ApexInterface.h"
00041 #include "Renderable.h"
00042 
00043 #if PX_PHYSICS_VERSION_MAJOR == 3
00044 #include "common/PxRenderBuffer.h"
00045 #endif
00046 
00048 #define RENDER_DEBUG_IFACE(ptr) ((ptr)->getRenderDebugInterface())
00049 
00050 namespace nvidia
00051 {
00052 
00053 namespace apex
00054 {
00055 class UserRenderer;
00056 class UserRenderResourceManager;
00057 
00058 PX_PUSH_PACK_DEFAULT
00059 
00060 #if PX_PHYSICS_VERSION_MAJOR == 3
00061 
00067 class PhysXRenderBuffer : public PxRenderBuffer
00068 {
00069 public:
00070     PhysXRenderBuffer()
00071     {
00072         clear();
00073     }
00074 
00078     virtual uint32_t getNbPoints() const 
00079     {
00080         return mNbPoints;
00081     }
00082 
00086     virtual const PxDebugPoint* getPoints() const
00087     {
00088         return mPoints;
00089     }
00090 
00094     virtual uint32_t getNbLines() const
00095     {
00096         return mNbLines;
00097     }
00098 
00102     virtual const PxDebugLine* getLines() const 
00103     {
00104         return mLines;
00105     }
00106 
00110     virtual uint32_t getNbTriangles() const 
00111     {
00112         return mNbTriangles;
00113     }
00114 
00118     virtual const PxDebugTriangle* getTriangles() const 
00119     {
00120         return mTriangles;
00121     }
00122 
00126     virtual uint32_t getNbTexts() const 
00127     {
00128         return mNbTexts;
00129     }
00130 
00134     virtual const PxDebugText* getTexts() const 
00135     {
00136         return mTexts;
00137     }
00138 
00142     virtual void append(const PxRenderBuffer& other)
00143     {
00144         PX_UNUSED(other);
00145         PX_ALWAYS_ASSERT(); // this method not implemented!
00146     }
00147 
00151     virtual void clear() 
00152     {
00153         mNbPoints = 0;
00154         mPoints = NULL;
00155         mNbLines = 0;
00156         mLines = NULL;
00157         mNbTriangles = 0;
00158         mTriangles = NULL;
00159         mNbTexts = 0;
00160         mTexts = NULL;
00161     }
00162 
00166     uint32_t        mNbPoints;
00170     PxDebugPoint    *mPoints;
00174     uint32_t        mNbLines;
00178     PxDebugLine     *mLines;
00182     uint32_t        mNbTriangles;
00186     PxDebugTriangle *mTriangles;
00190     uint32_t        mNbTexts;
00194     PxDebugText     *mTexts;
00195 };
00196 #endif
00197 
00201 class RenderDebugInterface : public ApexInterface, public Renderable
00202 {
00203 public:
00212     virtual void    setUseDebugRenderable(bool state) = 0;
00213 
00214 
00215 #if PX_PHYSICS_VERSION_MAJOR == 3
00216 
00224     virtual void    getRenderBuffer(PhysXRenderBuffer& renderable) = 0;
00225 
00234     virtual void    getRenderBufferScreenSpace(PhysXRenderBuffer& renderable) = 0;
00235 
00242     virtual void    addDebugRenderable(const physx::PxRenderBuffer& renderBuffer) = 0;
00243 
00244 #endif //PX_PHYSICS_VERSION_MAJOR == 3
00245 
00246     virtual void release() = 0;
00247 
00251     virtual RENDER_DEBUG::RenderDebugTyped* getRenderDebugInterface() = 0;
00252     
00253 protected:
00254 
00255     virtual ~RenderDebugInterface(void) { };
00256 
00257 };
00258 
00259 PX_POP_PACK
00260 
00261 }
00262 } // end namespace nvidia::apex
00263 
00264 #endif // RENDER_DEBUG_INTERFACE_H

Generated on Sat Dec 1 2018 15:52:06

Copyright © 2012-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.