raSystem  1.0 bata
raGPUHeightmap.cpp
Go to the documentation of this file.
1 #include "..\include\raMain.h"
2 namespace System
3 {
4  raGPUHeightmap::raGPUHeightmap(raDirectX *dx, int width, int depth,
5  raMaterial *mat, float tileSize)
6  : raHoehenfeld(dx, width, depth, mat, tileSize)
7  {
8  }
9 
10  float raGPUHeightmap::h(float x, float z)
11  {
12  return 0;
13  }
14  raVector3 raGPUHeightmap::normal(float x, float z)
15  {
16  return raVector3(0.0f, 1.0f, 0.0f);
17  }
18 
19  //--------------------
21  LPCSTR techniqueName, LPCSTR texture,
22  LPCSTR heightmap, LPCSTR heightmapBump)
23  : raTexturedMaterial(dx, effectFile, techniqueName,
24  texture)
25  {
26  m_HeightTextureFileName = heightmap;
27  m_BumMapFileName = heightmapBump;
28 
29  m_pRVHeight = NULL;
30  m_pRVBump = NULL;
31  }
33  {
35 
38 
41 
42  m_ptxHeight = m_pEffect->GetVariableByName("g_HeightTexture")->AsShaderResource();
43  m_ptxBumpMap = m_pEffect->GetVariableByName("g_NormalMap")->AsShaderResource();
44 
45  return true;
46  }
48  {
50 
51  if(m_pRVHeight) m_pRVHeight->Release();
52  if(m_pRVBump) m_pRVBump->Release();
53 
54  return true;
55  }
57  {
59 
60  if(m_ptxHeight) m_ptxHeight->SetResource(m_pRVHeight);
61  if(m_ptxBumpMap) m_ptxBumpMap->SetResource(m_pRVBump);
62  }
63 };
static raResource & Instance()
Definition: raResource.cpp:38
HRESULT CreateTextureFromFile(raSmartPointer< raDirectX > dx, raString pSrcFile, ID3D11ShaderResourceView **ppOutputRV, bool bSRGB=false)
Definition: raResource.h:25
ID3D11ShaderResourceView * m_pRVBump
ID3DX11Effect * m_pEffect
Definition: raMaterial.h:57
ID3DX11EffectShaderResourceVariable * m_ptxBumpMap
ID3D11ShaderResourceView * m_pRVHeight
ID3DX11EffectShaderResourceVariable * m_ptxHeight
raGPUHeightmap(raDirectX *dx, int width, int depth, raMaterial *mat, float tileSize=1.0f)
raGPUHeightmapMaterial(raDirectX *dx, LPCSTR effectFile="raEffects\eightmapEffect.fx", LPCSTR techniqueName="RenderWithHeightMapAndBumpMap", LPCSTR texture="raGrafik\orest Flood.jpg", LPCSTR heightmap="raGrafik\eightmap.dds", LPCSTR heightmapBump="raGrafik\eightmapNormals.dds")
raSmartPointer< raDirectX > m_dx
Definition: raMaterial.h:53