Advertisement
Guest User

decalInstance.h

a guest
Jul 27th, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.92 KB | None | 0 0
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22.  
  23. #ifndef _DECALINSTANCE_H_
  24. #define _DECALINSTANCE_H_
  25.  
  26. #ifndef _GFXVERTEXBUFFER_H_
  27. #include "gfx/gfxVertexBuffer.h"
  28. #endif
  29.  
  30. #ifndef _DECALDATA_H_
  31. #include "T3D/decal/decalData.h"
  32. #endif
  33.  
  34. struct DecalVertex;
  35. class SceneRenderState;
  36.  
  37. /// DecalInstance represents a rendering decal in the scene.
  38. /// You should not allocate this yourself, add new decals to the scene
  39. /// via the DecalManager.
  40. /// All data is public, change it if you wish, but be sure to inform
  41. /// the DecalManager.
  42. class DecalInstance
  43. {
  44.    public:
  45.  
  46.       DecalData *mDataBlock;
  47.      
  48.       S32 surfaceObject;
  49.  
  50.       Point3F mPosition;
  51.       Point3F mNormal;
  52.       Point3F mTangent;
  53.       F32 mRotAroundNormal;  
  54.       F32 mSize;
  55.  
  56.       U32 mCreateTime;
  57.       F32 mVisibility;
  58.  
  59.       F32 mLastAlpha;
  60.  
  61.       U32 mTextureRectIdx;      
  62.  
  63.       DecalVertex *mVerts;
  64.       U16 *mIndices;
  65.  
  66.       U32 mVertCount;
  67.       U32 mIndxCount;
  68.  
  69.       U8 mFlags;
  70.  
  71.       U8 mRenderPriority;
  72.  
  73.       S32 mId;
  74.  
  75.       GFXTexHandle *mCustomTex;
  76.  
  77.       void getWorldMatrix( MatrixF *outMat, bool flip = false );
  78.      
  79.       Box3F getWorldBox() const
  80.       {
  81.          return Box3F( mPosition - Point3F( mSize / 2.f ), mPosition + Point3F( mSize / 2.f ) );
  82.       }
  83.  
  84.       U8 getRenderPriority() const
  85.       {
  86.          return mRenderPriority == 0 ? mDataBlock->renderPriority : mRenderPriority;
  87.       }
  88.  
  89.       /// Calculates the size of this decal onscreen in pixels, used for LOD.
  90.       F32 calcPixelSize( U32 viewportHeight, const Point3F &cameraPos, F32 worldToScreenScaleY ) const;
  91.        
  92.        DecalInstance() : mId(-1), surfaceObject(0) {}  
  93. };
  94.  
  95. #endif // _DECALINSTANCE_H_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement