BOOL CShaderConverter::ExportTexture() { VRETURN(_ExportChunkHeader(m_Out, izanagi::shader::SHD_CHUNK_MAGIC_NUMBER_TEX)); izanagi::shader::S_SHD_TEXTRUE_HEADER sTexHeader; FILL_ZERO(&sTexHeader, sizeof(sTexHeader)); // Blank for texture's header. izanagi::tool::CIoStreamSeekHelper cSeekHelper(&m_Out); VRETURN(_BeginExportChunk(sTexHeader, cSeekHelper)); m_TexList.clear(); CGparameter param = ::cgGetFirstEffectParameter(m_pCgEffect); while (param != NULL) { if (CParamUtil::IsTexture(param)) { izanagi::shader::S_SHD_TEXTURE sTex; { FILL_ZERO(&sTex, sizeof(sTex)); CParamUtil::SetNameAndSemantic(sTex, param); #if 0 sTex.type = _GetTexTypeFromSemantic(param); sTex.ann.isRenderTarget = IZ_TRUE; sTex.ann.isDynamic = IZ_FALSE; sTex.ann.typeRsc = izanagi::graph::E_GRAPH_RSC_USAGE_STATIC; VRETURN( CTextureUtil::SetAnnValue( sTex.ann, param)); #endif } m_TexList.push_back(param); // 出力 VRETURN(ExportData(sTex)); sTexHeader.numTexture++; } param = ::cgGetNextParameter(param); } VRETURN(_EndExportChunk(sTexHeader, cSeekHelper)); m_ShdHeader.numTexture = sTexHeader.numTexture; return TRUE; }
BOOL CPostEffectConverter::ExportTexture() { m_TexList.clear(); CGparameter param = ::cgGetFirstEffectParameter(m_pCgEffect); while (param != NULL) { if (CParamUtil::IsTexture(param)) { izanagi::S_PES_TEXTURE sTex; { FILL_ZERO(&sTex, sizeof(sTex)); CParamUtil::SetNameAndSemantic(sTex, param); sTex.type = _GetTexTypeFromSemantic(param); sTex.ann.isRenderTarget = IZ_TRUE; sTex.ann.isDynamic = IZ_FALSE; sTex.ann.typeRsc = izanagi::graph::E_GRAPH_RSC_USAGE_STATIC; VRETURN( CTextureUtil::SetAnnValue( sTex.ann, param)); } m_TexList.push_back(param); // 出力 VRETURN(ExportData(sTex)); m_PesHeader.numTex++; } param = ::cgGetNextParameter(param); } return TRUE; }