raSystem  1.0 bata
raRFMaterial.cpp
Go to the documentation of this file.
1 #include "..\include\raMain.h"
2 
3 namespace System
4 {
5  raRFMaterial::raRFMaterial(raSmartPointer<raDirectX> dx, LPCSTR techniqueName, int envMapWidth, int envMapHeight)
6  : raRTTMaterial(dx, "raEffects\\Reflection.fx",
7  techniqueName, D3D11_SRV_DIMENSION_TEXTURECUBE, envMapWidth, envMapHeight,
8  1, DXGI_FORMAT_R16G16B16A16_FLOAT,
9  "g_cubeMapTexture", 6)
10  {
11  m_r = 0.9f; // Verhältnis der Brechungsindizes
12  m_pow = 5.0f;
13  m_reflectivity = 0.5f;
14  }
16  {
18 
19  m_pR = m_pEffect->GetVariableByName("r")->AsScalar();
20  m_pR3 = m_pEffect->GetVariableByName("r3")->AsVector();
21  m_pFres0 = m_pEffect->GetVariableByName("fres0")->AsScalar();
22  m_pFresPow = m_pEffect->GetVariableByName("fresPow")->AsScalar();
23  m_pRefl = m_pEffect->GetVariableByName("reflectivity")->AsScalar();
24 
25  ROK("Reflectirendes Material erstellt");
26  return true;
27  }
28 
30  {
32 
33  if(m_pR) m_pR->SetFloat(m_r);
34  if(m_pR3)
35  m_pR3->SetFloatVector(raVector3(m_r, m_r + 0.01f, m_r + 0.02f));
36 
37  float fres0 = ((1 - m_r) * (1 - m_r)) / ((1 + m_r) * (1 + m_r));
38  if(m_pFres0) m_pFres0->SetFloat(fres0);
39  if(m_pFresPow) m_pFresPow->SetFloat(m_pow);
40  if(m_pRefl) m_pRefl->SetFloat(m_reflectivity);
41  }
42 };
virtual bool Create()
ID3DX11Effect * m_pEffect
Definition: raMaterial.h:57
virtual void Setup()
void RAPI ROK(raString x)
Definition: raMain.cpp:114
raRFMaterial(raSmartPointer< raDirectX >, LPCSTR techniqueName="Reflection", int envMapWidth=128, int envMapHeight=128)
Definition: raRFMaterial.cpp:5
virtual bool Create()