• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VisualEffectInstance类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: VertexBuffer

//----------------------------------------------------------------------------
TriMesh* Delaunay3D::CreateTetra (int index) const
{
    const Vector3f* dvertices = mDelaunay->GetVertices();
    const int* dindices = mDelaunay->GetIndices();

    VertexFormat* vformat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_COLOR, VertexFormat::AT_FLOAT4, 0);
    int vstride = vformat->GetStride();

    VertexBuffer* vbuffer = new0 VertexBuffer(4, vstride);
    VertexBufferAccessor vba(vformat, vbuffer);
    vba.Position<Vector3f>(0) = dvertices[dindices[4*index    ]];
    vba.Position<Vector3f>(1) = dvertices[dindices[4*index + 1]];
    vba.Position<Vector3f>(2) = dvertices[dindices[4*index + 2]];
    vba.Position<Vector3f>(3) = dvertices[dindices[4*index + 3]];
    Float4 lightGray(0.75f, 0.75f, 0.75f, 1.0f);
    vba.Color<Float4>(0, 0) = lightGray;
    vba.Color<Float4>(0, 1) = lightGray;
    vba.Color<Float4>(0, 2) = lightGray;
    vba.Color<Float4>(0, 3) = lightGray;

    IndexBuffer* ibuffer = new0 IndexBuffer(12, sizeof(int));
    int* indices = (int*)ibuffer->GetData();
    indices[ 0] = 0;  indices[ 1] = 1;  indices[ 2] = 2;
    indices[ 3] = 0;  indices[ 4] = 3;  indices[ 5] = 1;
    indices[ 6] = 0;  indices[ 7] = 2;  indices[ 8] = 3;
    indices[ 9] = 3;  indices[10] = 2;  indices[11] = 1;

    TriMesh* tetra = new0 TriMesh(vformat, vbuffer, ibuffer);
    VisualEffectInstance* instance =
        VertexColor4Effect::CreateUniqueInstance();
    instance->GetEffect()->GetAlphaState(0, 0)->BlendEnabled = true;
    instance->GetEffect()->GetWireState(0, 0)->Enabled = true;
    tetra->SetEffectInstance(instance);

    return tetra;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:39,代码来源:Delaunay3D.cpp


示例17: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* BlendedTerrainEffect::CreateInstance (
    ShaderFloat* flowDirection, ShaderFloat* powerFactor,
    Texture2D* grassTexture, Texture2D* stoneTexture, Texture2D* cloudTexture)
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
    instance->SetVertexConstant(0, 1, flowDirection);
    instance->SetPixelConstant(0, 0, powerFactor);
    instance->SetPixelTexture(0, 0, grassTexture);
    instance->SetPixelTexture(0, 1, stoneTexture);
    instance->SetPixelTexture(0, 2, mBlendTexture);
    instance->SetPixelTexture(0, 3, cloudTexture);
    return instance;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:15,代码来源:BlendedTerrainEffect.cpp


示例18: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* DLitMatTexEffect::CreateInstance (
    Light* directionalLight, Material* material, Texture2D* diffuseTexture)
{
    VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
    instance->SetVertexConstant(0, 0,
        new0 PVWMatrixConstant());
    instance->SetPixelConstant(0, 0,
        new0 CameraModelPositionConstant());
    instance->SetPixelConstant(0, 1,
        new0 MaterialAmbientConstant(material));
    instance->SetPixelConstant(0, 2,
        new0 MaterialSpecularConstant(material));
    instance->SetPixelConstant(0, 3,
        new0 LightModelDVectorConstant(directionalLight));
    instance->SetPixelConstant(0, 4,
        new0 LightAmbientConstant(directionalLight));
    instance->SetPixelTexture(0, 0, diffuseTexture);
    return instance;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:20,代码来源:DLitMatTexEffect.cpp


示例19: VisualEffectInstance

//----------------------------------------------------------------------------
VisualEffectInstance* LightAmbEffect::CreateInstance (Light* light,
        Material* material) const
{
	VisualEffectInstance* instance = new0 VisualEffectInstance(this, 0);
	instance->SetVertexConstant(0, 0, new0 PVWMatrixConstant());
	instance->SetVertexConstant(0, 1,
	                            new0 MaterialEmissiveConstant(material));
	instance->SetVertexConstant(0, 2,
	                            new0 MaterialAmbientConstant(material));
	instance->SetVertexConstant(0, 3,
	                            new0 LightAmbientConstant(light));
	instance->SetVertexConstant(0, 4,
	                            new0 LightAttenuationConstant(light));
	return instance;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:16,代码来源:Wm5LightAmbEffect.cpp


示例20: Node

//----------------------------------------------------------------------------
void BSplineSurfaceFitter::CreateScene ()
{
	mScene = new0 Node();
	mWireState = new0 WireState();
	mRenderer->SetOverrideWireState(mWireState);
	mCullState = new0 CullState();
	mCullState->Enabled = false;
	mRenderer->SetOverrideCullState(mCullState);

	// Begin with a flat 64x64 height field.
	const int numSamples = 64;
	const float extent = 8.0f;
	VertexFormat* vformat = VertexFormat::Create(2,
	                        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
	                        VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 0);
	mHeightField = StandardMesh(vformat).Rectangle(numSamples, numSamples,
	               extent, extent);
	mScene->AttachChild(mHeightField);

	// Set the heights based on a precomputed height field.  Also create a
	// texture image to go with the height field.
	std::string path = Environment::GetPathR("HeightField.wmtf");
	Texture2D* texture = Texture2D::LoadWMTF(path);
	VisualEffectInstance* instance = Texture2DEffect::CreateUniqueInstance(
	                                     texture, Shader::SF_LINEAR, Shader::SC_CLAMP_EDGE,
	                                     Shader::SC_CLAMP_EDGE);
	mHeightField->SetEffectInstance(instance);
	unsigned char* data = (unsigned char*)texture->GetData(0);

	VertexBufferAccessor vba(mHeightField);
	Vector3f** samplePoints = new2<Vector3f>(numSamples, numSamples);
	int i;
	for (i = 0; i < vba.GetNumVertices(); ++i)
	{
		unsigned char value = *data;
		float height = 3.0f*((float)value)/255.0f +
		               0.05f*Mathf::SymmetricRandom();

		*data++ = (unsigned char)Mathf::IntervalRandom(32.0f, 64.0f);
		*data++ = 3*(128 - value/2)/4;
		*data++ = 0;
		data++;

		vba.Position<Vector3f>(i).Z() = height;
		samplePoints[i % numSamples][i / numSamples] =
		    vba.Position<Vector3f>(i);
	}

	// Compute a B-Spline surface with NxN control points, where N < 64.
	// This surface will be sampled to 64x64 and displayed together with the
	// original height field for comparison.
	const int numCtrlPoints = 32;
	const int degree = 3;
	BSplineSurfaceFitf fitter(degree, numCtrlPoints, numSamples, degree,
	                          numCtrlPoints, numSamples, samplePoints);
	delete2(samplePoints);

	vformat = VertexFormat::Create(2,
	                               VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
	                               VertexFormat::AU_COLOR, VertexFormat::AT_FLOAT4, 0);
	mFittedField = StandardMesh(vformat).Rectangle(numSamples, numSamples,
	               extent, extent);
	mScene->AttachChild(mFittedField);

	vba.ApplyTo(mFittedField);
	Float4 translucent(1.0f, 1.0f, 1.0f, 0.5f);
	for (i = 0; i < vba.GetNumVertices(); ++i)
	{
		float u = 0.5f*(vba.Position<Vector3f>(i).X()/extent + 1.0f);
		float v = 0.5f*(vba.Position<Vector3f>(i).Y()/extent + 1.0f);
		vba.Position<Vector3f>(i) = fitter.GetPosition(u, v);
		vba.Color<Float4>(0,i) = translucent;
	}

	instance = VertexColor4Effect::CreateUniqueInstance();
	mFittedField->SetEffectInstance(instance);
	instance->GetEffect()->GetAlphaState(0, 0)->BlendEnabled = true;
}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:79,代码来源:BSplineSurfaceFitter.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VisualGraphics类代码示例发布时间:2022-05-31
下一篇:
C++ Visual类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap