Advertisement
Zgragselus

Shader fun

Oct 11th, 2024
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.65 KB | None | 0 0
  1.     // Attempt to get shader from shader manager, if not present - create a new node and load the shader
  2.     mShader = mRenderer->GetShaderManager()->GetNode("Wireframe");
  3.     if (mShader == nullptr)
  4.     {
  5.         D3DShader* shader = new D3DShader(mLog, "../Data/Shaders/Geometry/Wireframe.hlsl",
  6.             std::vector<D3DShader::ShaderEntryPoint>
  7.             {
  8.                 Engine::D3DShader::ShaderEntryPoint(Engine::D3DShader::AMPLIFICATION_SHADER, L"AS"),
  9.                 Engine::D3DShader::ShaderEntryPoint(Engine::D3DShader::MESH_SHADER, L"MS"),
  10.                 Engine::D3DShader::ShaderEntryPoint(Engine::D3DShader::PIXEL_SHADER, L"PS")
  11.             },
  12.             std::vector<D3DShader::ShaderDefine>
  13.             {
  14.                 Engine::D3DShader::ShaderDefine(L"USE_MESH_SHADERS", std::to_wstring(1)),
  15.                 Engine::D3DShader::ShaderDefine(L"VERTEX_SIZE", std::to_wstring(16)),
  16.                 Engine::D3DShader::ShaderDefine(L"VERTEX_POSITION_OFFSET", std::to_wstring(0)),
  17.                 Engine::D3DShader::ShaderDefine(L"VERTEX_TEXCOORD_OFFSET", std::to_wstring(12)),
  18.                 Engine::D3DShader::ShaderDefine(L"VERTEX_NORMAL_OFFSET", std::to_wstring(3)),
  19.                 Engine::D3DShader::ShaderDefine(L"VERTEX_TANGENT_OFFSET", std::to_wstring(6)),
  20.                 Engine::D3DShader::ShaderDefine(L"VERTEX_BITANGENT_OFFSET", std::to_wstring(9)),
  21. #ifdef USE_QUANTIZED_MESHLET_INDICES
  22.                 Engine::D3DShader::ShaderDefine(L"USE_QUANTIZED_MESHLET_INDICES", L"1"),
  23. #else
  24.                 Engine::D3DShader::ShaderDefine(L"USE_QUANTIZED_MESHLET_INDICES", L"0"),
  25. #endif
  26.                 Engine::D3DShader::ShaderDefine(L"DEBUG_CLUSTERS", L"0")
  27.             });
  28.         mRenderer->GetShaderManager()->Insert("Wireframe", shader);
  29.         mShader = mRenderer->GetShaderManager()->GetNode("Wireframe");
  30.     }
  31.     mRenderer->RegisterShaderMapping(mShader->Get(), this);
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement