Beispiel #1
0
    DiMaterialPtr DiMaterial::Clone( const DiString& newname )
    {
        DiMaterialPtr mat = DiAssetManager::GetInstance().CreateManualAsset<DiMaterial>(newname);

        mat->SetShaderFlag(mat->mShaderFlag);
        mat->LoadShader(mVertexShader->GetName().ExtractBaseName(),
            mPixelShader->GetName().ExtractBaseName());

        mat->mCullMode        = mCullMode;
        mat->mDepthWrite      = mDepthWrite;
        mat->mDepthCheck      = mDepthCheck;
        mat->mWireframe       = mWireframe;
        mat->mForceWireframe  = mForceWireframe;
        mat->mBlendMode       = mBlendMode;
        mat->mInstanceState   = mInstanceState;
        mat->mOpacity         = mOpacity;
        mat->mShininess       = mShininess;
        mat->mAmbient         = mAmbient;
        mat->mDiffuse         = mDiffuse;
        mat->mSpecular        = mSpecular;

        mShaderParameter->CloneVarsTo(mat->GetShaderParameter());
        
        return mat;
    }
Beispiel #2
0
void ModelConverter::WriteSimpleMaterial( int boneWeightsNum, const DiString& filename )
{
	DiMaterialPtr mat = Demi::DiAssetManager::GetInstancePtr(
		)->CreateOrReplaceAsset<DiMaterial>("_tempSimple");

	if (boneWeightsNum == 0)
	{
		mat->LoadVertexShader(DiMaterialDefine::STATIC_MESH_SHADER_NAME);
	}
	else if (boneWeightsNum == 1)
	{
        mat->LoadVertexShader(DiMaterialDefine::SKINING_1_WEIGHT_SHADER);
	}
	else if (boneWeightsNum == 2)
	{
        mat->LoadVertexShader(DiMaterialDefine::SKINING_2_WEIGHTS_SHADER);
	}
	else
	{
        mat->LoadVertexShader(DiMaterialDefine::SKINING_4_WEIGHTS_SHADER);
	}

    mat->LoadPixelShader(DiMaterialDefine::DIFFUSE_PIXEL_SHADER);

	Demi::DiShaderParameter* materialIns = mat->GetShaderParameter();
	materialIns->WriteTexture2D("diffuseTexture","_default.dds");

	DiMaterialSerializer mas;
	mas.SaveMaterial(filename,mat.get());
}
Beispiel #3
0
    Demi::DiMaterialPtr DiMaterial::Clone()
    {
        DiMaterialPtr mat = QuickCreate(mVertexShader->GetName().ExtractBaseName(),
            mPixelShader->GetName().ExtractBaseName(), mShaderFlag);

        mat->mCullMode        = mCullMode;
        mat->mDepthWrite      = mDepthWrite;
        mat->mDepthCheck      = mDepthCheck;
        mat->mWireframe       = mWireframe;
        mat->mForceWireframe  = mForceWireframe;
        mat->mBlendMode       = mBlendMode;
        mat->mInstanceState   = mInstanceState;
        mat->mOpacity         = mOpacity;
        mat->mShininess       = mShininess;
        mat->mAmbient         = mAmbient;
        mat->mDiffuse         = mDiffuse;
        mat->mSpecular        = mSpecular;

        mShaderParameter->CloneVarsTo(mat->GetShaderParameter());

        return mat;
    }