Exemplo n.º 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;
    }
Exemplo n.º 2
0
    DiMaterialPtr DiMaterial::QuickCreate(const DiString& name, const DiString& vs, const DiString& ps, uint64 flag )
    {
        DiMaterialPtr mat = DiAssetManager::GetInstance().CreateOrReplaceAsset<DiMaterial>(name);

        mat->SetShaderFlag(flag);
        mat->LoadShader(vs,ps);

        return mat;
    }
Exemplo n.º 3
0
    DiMaterialPtr DiMaterial::QuickCreate( const DiString& vs, const DiString& ps , uint64 flag)
    {
        static int quickcreateID = 0;
        DiString name;
        name.Format("quick_%d", quickcreateID++);
        DiMaterialPtr mat = DiAssetManager::GetInstance().CreateOrReplaceAsset<DiMaterial>(name);

        mat->SetShaderFlag(flag);
        mat->LoadShader(vs,ps);

        return mat;
    }