当前位置: 首页>>代码示例>>C++>>正文


C++ VisualEffectInstance类代码示例

本文整理汇总了C++中VisualEffectInstance的典型用法代码示例。如果您正苦于以下问题:C++ VisualEffectInstance类的具体用法?C++ VisualEffectInstance怎么用?C++ VisualEffectInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了VisualEffectInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* VolumeFogEffect::CreateInstance (Texture2D* baseTexture)
{
	VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
	instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
	instance->SetPixelTexture(0, 0, baseTexture);
	return instance;
}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:8,代码来源:VolumeFogEffect.cpp

示例2: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* Texture2ColorBlendEffect::CreateInstance (
    Texture2D* texture0, Texture2D* texture1) const
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
    instance->SetPixelTexture(0, 0, texture0);
    instance->SetPixelTexture(0, 1, texture1);

    PixelShader* pshader = GetPixelShader();

    Shader::SamplerFilter filter0 = pshader->GetFilter(0);
    if (filter0 != Shader::SF_NEAREST && filter0 != Shader::SF_LINEAR
    &&  !texture0->HasMipmaps())
    {
        texture0->GenerateMipmaps();
    }

    Shader::SamplerFilter filter1 = pshader->GetFilter(1);
    if (filter1 != Shader::SF_NEAREST && filter1 != Shader::SF_LINEAR
    &&  !texture1->HasMipmaps())
    {
        texture1->GenerateMipmaps();
    }

    return instance;
}
开发者ID:fishxz,项目名称:omni-bot,代码行数:27,代码来源:Wm5Texture2ColorBlendEffect.cpp

示例3: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* MaterialEffect::CreateInstance (Material* material)
    const
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, "PVWMatrix", new0 PVWMatrixConstant());
    instance->SetVertexConstant(0, "MaterialDiffuse",
        new0 MaterialDiffuseConstant(material));
    return instance;
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:10,代码来源:Wm5MaterialEffect.cpp

示例4: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* SimpleBumpMapEffect::CreateInstance (
    Texture2D* baseTexture, Texture2D* normalTexture)
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
    instance->SetPixelTexture(0, 0, baseTexture);
    instance->SetPixelTexture(0, 1, normalTexture);
    return instance;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:10,代码来源:SimpleBumpMapEffect.cpp

示例5: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* SphereMapEffect::CreateInstance (
    Texture2D* environmentTexture)
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
    instance->SetVertexConstant(0, 1, new0 VWMatrixConstant());
    instance->SetPixelTexture(0, 0, environmentTexture);
    return instance;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:10,代码来源:SphereMapEffect.cpp

示例6: Node

//----------------------------------------------------------------------------
void PointInPolyhedron::CreateScene ()
{
    mScene = new0 Node();
    mWireState = new0 WireState();
    mRenderer->SetOverrideWireState(mWireState);

    // Create a semitransparent sphere mesh.
    VertexFormat* vformatMesh = VertexFormat::Create(1,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0);
    TriMesh* mesh = StandardMesh(vformatMesh).Sphere(16, 16, 1.0f);
    Material* material = new0 Material();
    material->Diffuse = Float4(1.0f, 0.0f, 0.0f, 0.25f);
    VisualEffectInstance* instance = MaterialEffect::CreateUniqueInstance(
        material);
    instance->GetEffect()->GetAlphaState(0, 0)->BlendEnabled = true;
    mesh->SetEffectInstance(instance);

    // Create the data structures for the polyhedron that represents the
    // sphere mesh.
    CreateQuery(mesh);

    // Create a set of random points.  Points inside the polyhedron are
    // colored white.  Points outside the polyhedron are colored blue.
    VertexFormat* vformat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_COLOR, VertexFormat::AT_FLOAT3, 0);
    int vstride = vformat->GetStride();

    VertexBuffer* vbuffer = new0 VertexBuffer(1024, vstride);
    VertexBufferAccessor vba(vformat, vbuffer);
    Float3 white(1.0f, 1.0f, 1.0f);
    Float3 blue(0.0f, 0.0f, 1.0f);
    for (int i = 0; i < vba.GetNumVertices(); ++i)
    {
        Vector3f random(Mathf::SymmetricRandom(),
            Mathf::SymmetricRandom(), Mathf::SymmetricRandom());

        vba.Position<Vector3f>(i) = random;

        if (mQuery->Contains(random))
        {
            vba.Color<Float3>(0, i) = white;
        }
        else
        {
            vba.Color<Float3>(0, i) = blue;
        }
    }

    DeleteQuery();

    mPoints = new0 Polypoint(vformat, vbuffer);
    mPoints->SetEffectInstance(VertexColor3Effect::CreateUniqueInstance());

    mScene->AttachChild(mPoints);
    mScene->AttachChild(mesh);
}
开发者ID:rasslingcats,项目名称:calico,代码行数:58,代码来源:PointInPolyhedron.cpp

示例7: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* MRTEffect::CreateInstance (Texture2D* texture0,
    Texture2D* texture1)
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
    instance->SetPixelTexture(0, 0, texture0);
    instance->SetPixelTexture(0, 1, texture1);
    return instance;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:10,代码来源:MRTEffect.cpp

示例8: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* SMBlurEffect::CreateInstance (ShaderFloat* weights,
    ShaderFloat* offsets, Texture2D* baseTexture) const
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
    instance->SetPixelConstant(0, 0, weights);
    instance->SetPixelConstant(0, 1, offsets);
    instance->SetPixelTexture(0, 0, baseTexture);
    return instance;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例9: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* SkinningEffect::CreateInstance (
    ShaderFloat* skinningMatrix[4])
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
    for (int i = 0; i < 4; ++i)
    {
        instance->SetVertexConstant(0, i + 1, skinningMatrix[i]);
    }
    return instance;
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:12,代码来源:SkinningEffect.cpp

示例10: Node

//----------------------------------------------------------------------------
void ClipMesh::CreateScene ()
{
    mScene = new0 Node();

    VertexFormat* vformat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_COLOR, VertexFormat::AT_FLOAT3, 0);

    // The plane is fixed at z = 0.
    mPlane.SetNormal(AVector::UNIT_Z);
    mPlane.SetConstant(0.0f);
    mMeshPlane = StandardMesh(vformat).Rectangle(32, 32, 16.0f, 16.0f);
    VisualEffectInstance* instance =
        VertexColor3Effect::CreateUniqueInstance();
    instance->GetEffect()->GetWireState(0,0)->Enabled = true;
    mMeshPlane->SetEffectInstance(instance);
    mScene->AttachChild(mMeshPlane);

    VertexBufferAccessor vba(mMeshPlane);
    Float3 green(0.0f, 1.0f, 0.0f);
    int i;
    for (i = 0; i < vba.GetNumVertices(); ++i)
    {
        vba.Color<Float3>(0, i) = green;
    }

    // Get the positions and indices for a torus.
    mTorus = StandardMesh(vformat).Torus(64, 64, 4.0f, 1.0f);
    instance = VertexColor3Effect::CreateUniqueInstance();
    mTorusWireState = instance->GetEffect()->GetWireState(0, 0);
    mTorus->SetEffectInstance(instance);
    mScene->AttachChild(mTorus);

    vba.ApplyTo(mTorus);
    mTorusVerticesMS.resize(vba.GetNumVertices());
    mTorusVerticesWS.resize(vba.GetNumVertices());
    Float3 black(0.0f, 0.0f, 0.0f);
    for (i = 0; i < vba.GetNumVertices(); ++i)
    {
        mTorusVerticesMS[i] = vba.Position<Float3>(i);
        mTorusVerticesWS[i] = mTorusVerticesMS[i];
        vba.Color<Float3>(0, i) = black;
    }

    IndexBuffer* ibuffer = mTorus->GetIndexBuffer();
    int numIndices = ibuffer->GetNumElements();
    int* indices = (int*)ibuffer->GetData();
    mTorusIndices.resize(numIndices);
    memcpy(&mTorusIndices[0], indices, numIndices*sizeof(int));

    Update();
}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:53,代码来源:ClipMesh.cpp

示例11: assertion

//----------------------------------------------------------------------------
void Delaunay3D::ChangeTetraStatus (int index, const Float4& color,
    bool enableWire)
{
    Visual* tetra = DynamicCast<Visual>(mScene->GetChild(1 + index));
    assertion(tetra != 0, "Expecting a Visual object.\n");
    VertexBufferAccessor vba(tetra);
    for (int i = 0; i < 4; ++i)
    {
        vba.Color<Float4>(0, i) = color;
    }
    mRenderer->Update(tetra->GetVertexBuffer());

    VisualEffectInstance* instance = tetra->GetEffectInstance();
    instance->GetEffect()->GetWireState(0, 0)->Enabled = enableWire;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:16,代码来源:Delaunay3D.cpp

示例12: BSplineVolumef

//----------------------------------------------------------------------------
void GelatinCube::CreateBox ()
{
    // Create a quadratic spline using the interior particles as control
    // points.
    int numSlices = mModule->GetNumSlices() - 2;
    int numRows = mModule->GetNumRows() - 2;
    int numCols = mModule->GetNumCols() - 2;
    mSpline = new0 BSplineVolumef(numCols, numRows, numSlices, 2, 2, 2);

    for (int s = 0; s < numSlices; ++s)
    {
        for (int r = 0; r < numRows; ++r)
        {
            for (int c = 0; c < numCols; ++c)
            {
                mSpline->SetControlPoint(c, r, s,
                    mModule->Position(s + 1, r + 1, c + 1));
            }
        }
    }

    // Generate the box.
    VertexFormat* vformat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 0);

    VertexFormat* vformats[6] =
        { vformat, vformat, vformat, vformat, vformat, vformat };

    mBox = new0 BoxSurface(mSpline, 8, 8, 8, vformats);

    // The texture effect for the box faces.
    std::string path = Environment::GetPathR("WaterWithAlpha.wmtf");
    Texture2D* texture = Texture2D::LoadWMTF(path);
    VisualEffectInstance* instance = Texture2DEffect::CreateUniqueInstance(
        texture, Shader::SF_LINEAR, Shader::SC_REPEAT, Shader::SC_REPEAT);
    for (int i = 0; i < 6; ++i)
    {
        TriMesh* mesh = StaticCast<TriMesh>(mBox->GetChild(i));
        mesh->SetEffectInstance(instance);
    }

    // The texture has an alpha channel of 1/2 for all texels.
    instance->GetEffect()->GetAlphaState(0, 0)->BlendEnabled = true;

    mBox->EnableSorting();
    mTrnNode->AttachChild(mBox);
}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:49,代码来源:GelatinCube.cpp

示例13: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* Texture3DEffect::CreateInstance (Texture3D* texture)
const
{
	VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
	instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
	instance->SetPixelTexture(0, 0, texture);

	Shader::SamplerFilter filter = GetPixelShader()->GetFilter(0);
	if (filter != Shader::SF_NEAREST && filter != Shader::SF_LINEAR
	        &&  !texture->HasMipmaps())
	{
		texture->GenerateMipmaps();
	}

	return instance;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:17,代码来源:Wm5Texture3DEffect.cpp

示例14: ShaderFloat

//----------------------------------------------------------------------------
void GpuGaussianBlur2::SetBlurInput ()
{
    VisualEffectInstance* instance = mIP->GetMainEffectInstance();
    float dCol = mIP->GetColSpacing();
    float dRow = mIP->GetRowSpacing();

    ShaderFloat* deltaConstant = new0 ShaderFloat(1);
    float* delta = deltaConstant->GetData();
    delta[0] = dCol;
    delta[1] = dRow;
    instance->SetPixelConstant(0, "Delta", deltaConstant);

    ShaderFloat* weightConstant = new0 ShaderFloat(1);
    float* weight = weightConstant->GetData();
    weight[0] = 0.01f;  // = kappa*DeltaT/DeltaX^2
    weight[1] = 0.01f;  // = kappa*DeltaT/DeltaY^2
    weight[2] = 1.0f - 2.0f*weight[0] - 2.0f*weight[1];  // must be positive
    instance->SetPixelConstant(0, "Weight", weightConstant);
}
开发者ID:rasslingcats,项目名称:calico,代码行数:20,代码来源:GpuGaussianBlur2.cpp

示例15: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* SMSceneEffect::CreateInstance (
    ProjectorWorldPositionConstant* lightWorldPosition,
    ProjectorMatrixConstant* lightPVMatrix, ShaderFloat* lightBSMatrix,
    ShaderFloat* screenBSMatrix, ShaderFloat* lightColor,
    Texture2D* baseTexture, Texture2D* blurTexture,
    Texture2D* projectedTexture) const
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
    instance->SetVertexConstant(0, 1, new0 WMatrixConstant());
    instance->SetVertexConstant(0, 2, lightPVMatrix);
    instance->SetVertexConstant(0, 3, lightBSMatrix);
    instance->SetVertexConstant(0, 4, screenBSMatrix);
    instance->SetVertexConstant(0, 5, lightWorldPosition);
    instance->SetVertexConstant(0, 6, new0 CameraWorldPositionConstant());
    instance->SetPixelConstant(0, 0, lightColor);
    instance->SetPixelTexture(0, 0, baseTexture);
    instance->SetPixelTexture(0, 1, blurTexture);
    instance->SetPixelTexture(0, 2, projectedTexture);
    return instance;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:22,代码来源:SMSceneEffect.cpp


注:本文中的VisualEffectInstance类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。