basicClouds.h

Engine/source/environment/basicClouds.h

More...

Classes:

Public Defines

define

Detailed Description

Public Defines

TEX_COUNT() 3
  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _BASICCLOUDS_H_
 25#define _BASICCLOUDS_H_
 26
 27#ifndef _SCENEOBJECT_H_
 28#include "scene/sceneObject.h"
 29#endif
 30#ifndef _GFXTEXTUREHANDLE_H_
 31#include "gfx/gfxTextureHandle.h"
 32#endif
 33#ifndef _GFXVERTEXBUFFER_H_
 34#include "gfx/gfxVertexBuffer.h"
 35#endif
 36#ifndef _GFXPRIMITIVEBUFFER_H_
 37#include "gfx/gfxPrimitiveBuffer.h"
 38#endif
 39#ifndef _GFXSTATEBLOCK_H_
 40#include "gfx/gfxStateBlock.h"
 41#endif
 42#ifndef _GFXSHADER_H_
 43#include "gfx/gfxShader.h"
 44#endif
 45
 46class BaseMatInstance;
 47
 48
 49class BasicClouds : public SceneObject
 50{
 51   typedef SceneObject Parent;
 52
 53   enum 
 54   { 
 55      BasicCloudsMask = Parent::NextFreeMask,      
 56      NextFreeMask = Parent::NextFreeMask << 1,
 57   };  
 58
 59   #define TEX_COUNT 3
 60
 61public:
 62
 63   BasicClouds();
 64   virtual ~BasicClouds() {}
 65
 66   DECLARE_CONOBJECT( BasicClouds );
 67
 68   // ConsoleObject
 69   virtual bool onAdd();
 70   virtual void onRemove();
 71   static void initPersistFields();
 72   virtual void inspectPostApply();   
 73
 74   // NetObject
 75   virtual U32 packUpdate( NetConnection *conn, U32 mask, BitStream *stream );
 76   virtual void unpackUpdate( NetConnection *conn, BitStream *stream );
 77
 78   // SceneObject
 79   virtual void prepRenderImage( SceneRenderState *state );
 80   void renderObject( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *mi );
 81
 82protected:
 83
 84   void _initTexture();
 85   void _initBuffers();
 86   void _initBuffer( F32 height, GFXVertexBufferHandle<GFXVertexPT> *vb, GFXPrimitiveBufferHandle *pb );
 87
 88protected: 
 89
 90   static U32 smVertStride;
 91   static U32 smStrideMinusOne;
 92   static U32 smVertCount;
 93   static U32 smTriangleCount;
 94
 95   GFXTexHandle mTexture[TEX_COUNT];
 96
 97   GFXStateBlockRef mStateblock;
 98
 99   GFXShaderRef mShader;
100
101   GFXShaderConstBufferRef mShaderConsts;
102   GFXShaderConstHandle *mTimeSC; 
103   GFXShaderConstHandle *mModelViewProjSC; 
104   GFXShaderConstHandle *mTexScaleSC;
105   GFXShaderConstHandle *mTexDirectionSC;
106   GFXShaderConstHandle *mTexOffsetSC;
107   GFXShaderConstHandle *mDiffuseMapSC;
108
109   GFXVertexBufferHandle<GFXVertexPT> mVB[TEX_COUNT];
110   GFXPrimitiveBufferHandle mPB;    
111
112   // Fields...
113
114   bool mLayerEnabled[TEX_COUNT];
115   String mTexName[TEX_COUNT];
116   F32 mTexScale[TEX_COUNT];
117   Point2F mTexDirection[TEX_COUNT];
118   F32 mTexSpeed[TEX_COUNT];   
119   Point2F mTexOffset[TEX_COUNT];
120   F32 mHeight[TEX_COUNT];
121};
122
123
124#endif // _BASICCLOUDS_H_
125