bool Create(Device& device) { if (failed(Renderer::Create(device))) { return false; } // シェーダの作成。 const TCHAR* SHADER_FILE_PATH = _T("..\\Rakugaki_MikuMikuDance_2\\pmd.sh"); _shaderDependencyObjects.resize(SHADER_KIND_MAX); ShaderDependencyObjects& shaderDefault = _shaderDependencyObjects[PMD_DEFAULT]; shaderDefault._shader = device.CreateShader( SHADER_FILE_PATH, "VS", "vs_4_0", NULL, NULL, "PS_default", "ps_4_0" ); if (shaderDefault._shader == ShaderHandle::INVALID) { return false; } ShaderDependencyObjects& shaderTexture = _shaderDependencyObjects[PMD_TEXTURE]; shaderTexture._shader = device.CreateShader( SHADER_FILE_PATH, "VS", "vs_4_0", NULL, NULL, "PS_texture", "ps_4_0" ); if (shaderTexture._shader == ShaderHandle::INVALID) { return false; } // 入力レイアウトの作成。 D3D10_INPUT_ELEMENT_DESC layout[] = { {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, offsetof(ShaderInput, position), D3D10_INPUT_PER_VERTEX_DATA, 0}, {"COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, offsetof(ShaderInput, color), D3D10_INPUT_PER_VERTEX_DATA, 0}, {"TEXTURE", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(ShaderInput, uv), D3D10_INPUT_PER_VERTEX_DATA, 0}, }; InputLayoutHandle inputLayout = device.CreateInputLayout( layout, _countof(layout), shaderDefault._shader ); if (inputLayout == InputLayoutHandle::INVALID) return false; shaderDefault._inputLayout = inputLayout; shaderTexture._inputLayout = inputLayout; return true; }
bool CreateShader() { const TCHAR* SHADER_FILE_PATH = _T("..\\Rakugaki_Direct3D10_2\\D3D10Sample12.sh"); _shader = _device.CreateShader( SHADER_FILE_PATH, "VS", "vs_4_0", "GS", "gs_4_0", "PS", "ps_4_0" ); if (_shader == ShaderHandle::INVALID) { return false; } return true; }