raSystem  1.0 bata
raWater.h
Go to the documentation of this file.
1 #pragma once
2 
3  class RAPI raWater : public raVisual
4  {
5  public:
6  raWater(raSmartPointer<raDirectX> dx, int width, int depth, raMaterial *mat);
7  ~raWater(void);
8 
9  virtual bool RenderMesh(LPCSTR techniqueName = "");
10  virtual bool Update(float fTime, float fRunTime);
11 
12  void push(float x, float y, float depth);
13  void pushX(float depth);
14  void pushZ(float deth);
15  void _PREP(float depth, float x, float y, int addx, int addy);
16 
17  virtual bool Intersects(const raVector3* pRayPos,
18  const raVector3* pRayDir,
19  float* pDist){return false; }
20 
21  virtual bool CreateMesh()
22  {
23  CreateVertexBuffer();
24  CreateIndexBuffer();
25  return true;
26  };
27 
28  virtual bool DestroyMesh()
29  {
30  for(int i = 0; i < 3; i++)
31  {
32  SAFE_RELEASE (m_pVB[i]);
33  }
34  SAFE_RELEASE(m_pIB);
35  return true;
36  };
37 
38  virtual ID3D11Buffer* GetVertexBuffer() { return m_pVB[m_curBuffNo];}
39  virtual ID3D11Buffer* GetIndexBuffer() { return m_pIB;}
40  virtual D3D11_PRIMITIVE_TOPOLOGY GetPrimitiveTopology(UINT n) { return (D3D11_PRIMITIVE_TOPOLOGY) m_pSubsets[n].PrimitiveType; }
41  virtual DXGI_FORMAT GetIndexBufferFormat() { return DXGI_FORMAT_R16_UINT; }
42  virtual UINT GetNumSubsets() { return m_numSubsets;}
43  virtual SDKMESH_SUBSET* GetSubset(UINT n) { return NULL;} //Keine Subsets
44  virtual UINT GetNumMaterials() { return m_numMaterials; }
45  virtual raMaterial* GetMaterial(UINT n) { return m_pMaterials[n]; }
46 
47  protected:
48  virtual void SetupVertices();
49  virtual void SetupIndices();
50  virtual bool CreateVertexLayout();
51  virtual void CreateVertexBuffer();
52  virtual void CreateIndexBuffer();
53 
54  private:
55  void CalculateNormals();
56  private:
57  LPCSTR m_TextureFile;
58  LPCSTR m_CubeTextureFile;
59 
60  ID3D11Buffer* m_pVB[3]; // Position, Normale, TexCoord
61  ID3D11Buffer* m_pIB;
62 
63  UINT m_nVertices;
64  UINT m_nIndices;
65  int m_width, m_depth;
66 
67  raVector3* m_pVertices[3];
68  raVector3* m_pNormals;
69  raVector2* m_pTexcoords;
70  UINT16* m_pIndices;
71  int m_curBuffNo;
72 
73  float m_lastTimeStamp;
74  float m_lastAnimationTimeStamp;
75  float m_lastFrameTime;
76 
77  static const int ANIMATIONS_PER_SECOND = 15;
78  };
virtual D3D11_PRIMITIVE_TOPOLOGY GetPrimitiveTopology(UINT n)
Definition: raWater.h:40
virtual ID3D11Buffer * GetIndexBuffer()
Definition: raWater.h:39
virtual bool DestroyMesh()
Definition: raWater.h:28
virtual ID3D11Buffer * GetVertexBuffer()
Definition: raWater.h:38
#define RAPI
Definition: raMain.h:11
unsigned short UINT16
Definition: d3dx11dbg.h:35
virtual bool CreateVertexLayout()
Definition: raVisual.cpp:156
virtual bool RenderMesh(LPCSTR techniqueName="")=0
DWORD m_numSubsets
Definition: raVisual.h:120
virtual DXGI_FORMAT GetIndexBufferFormat()
Definition: raWater.h:41
virtual SDKMESH_SUBSET * GetSubset(UINT n)
Definition: raWater.h:43
virtual UINT GetNumMaterials()
Definition: raWater.h:44
Definition: raWater.h:3
virtual bool Update(float fTime, float fRunTime)
Definition: raRender.h:17
virtual UINT GetNumSubsets()
Definition: raWater.h:42
virtual bool CreateMesh()
Definition: raWater.h:21
virtual bool Intersects(const raVector3 *pRayPos, const raVector3 *pRayDir, float *pDist)
Definition: raWater.h:17
virtual raMaterial * GetMaterial(UINT n)
Definition: raWater.h:45
#define SAFE_RELEASE(p)
Definition: d3dxGlobal.h:22
DWORD m_numMaterials
Definition: raVisual.h:96