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

C++ VertexFormat类代码示例

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

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



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

示例1: Node

//----------------------------------------------------------------------------
void RenderToTexture::CreateScene ()
{
	// Create the root of the scene.
	mScene = new0 Node();
	mTrnNode = new0 Node();
	mScene->AttachChild(mTrnNode);
	mWireState = new0 WireState();
	mRenderer->SetOverrideWireState(mWireState);

	// Create a screen-space camera to use with the render target.
	mScreenCamera = ScreenTarget::CreateCamera();

	// Create a screen polygon to use with the render target.
	VertexFormat* vformat = VertexFormat::Create(2,
	                        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
	                        VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 0);

	const int rtWidth = 256, rtHeight = 256;
	mScreenPolygon = ScreenTarget::CreateRectangle(vformat, rtWidth, rtHeight,
	                 0.0f, 0.2f, 0.0f, 0.2f, 0.0f);

	// Create the render target.
	//Texture::Format tformat = Texture::TF_A8B8G8R8;  // DX9 fails
	Texture::Format tformat = Texture::TF_A8R8G8B8;
	//Texture::Format tformat = Texture::TF_A16B16G16R16;
	//Texture::Format tformat = Texture::TF_A16B16G16R16F;
	//Texture::Format tformat = Texture::TF_A32B32G32R32F;
	mRenderTarget = new0 RenderTarget(1, tformat, rtWidth, rtHeight, false,
	                                  false);

	// Attach the render target texture to the screen polygon mesh.
	mScreenPolygon->SetEffectInstance(Texture2DEffect::CreateUniqueInstance(
	                                      mRenderTarget->GetColorTexture(0), Shader::SF_LINEAR,
	                                      Shader::SC_CLAMP_EDGE, Shader::SC_CLAMP_EDGE));

	// Load the face model and use multitexturing.
#ifdef WM5_LITTLE_ENDIAN
	std::string path = Environment::GetPathR("FacePN.wmof");
#else
	std::string path = Environment::GetPathR("FacePN.be.wmof");
#endif
	InStream inStream;
	inStream.Load(path);
	TriMeshPtr mesh = DynamicCast<TriMesh>(inStream.GetObjectAt(0));

	// Create texture coordinates for the face.  Based on knowledge of the
	// mesh, the (x,z) values of the model-space vertices may be mapped to
	// (s,t) in [0,1]^2.
	VertexBufferAccessor vba0(mesh);
	const int numVertices = vba0.GetNumVertices();
	float xmin = Mathf::MAX_REAL, xmax = -Mathf::MAX_REAL;
	float zmin = Mathf::MAX_REAL, zmax = -Mathf::MAX_REAL;
	int i;
	for (i = 1; i < numVertices; ++i)
	{
		Float3 position = vba0.Position<Float3>(i);
		float x = position[0];
		if (x < xmin)
		{
			xmin = x;
		}
		if (x > xmax)
		{
			xmax = x;
		}

		float z = position[2];
		if (z < zmin)
		{
			zmin = z;
		}
		if (z > zmax)
		{
			zmax = z;
		}
	}
	float invXRange = 1.0f/(xmax - xmin);
	float invZRange = 1.0f/(zmax - zmin);

	// Strip out the normal vectors, because there is no lighting in this
	// sample.  Add in two texture coordinate channels for a multiplicative
	// texture effect.
	vformat = VertexFormat::Create(3,
	                               VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
	                               VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 0,
	                               VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 1);
	int vstride = vformat->GetStride();

	VertexBuffer* vbuffer = new0 VertexBuffer(numVertices, vstride);
	VertexBufferAccessor vba1(vformat, vbuffer);
	for (i = 0; i < numVertices; ++i)
	{
		Float3 position = vba0.Position<Float3>(i);
		Float2 tcoord(
		    (position[0] - xmin)*invXRange,
		    (position[2] - zmin)*invZRange);

		vba1.Position<Float3>(i) = position;
		vba1.TCoord<Float2>(0, i) = tcoord;
//.........这里部分代码省略.........
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:101,代码来源:RenderToTexture.cpp


示例2: Node

//----------------------------------------------------------------------------
void VolumeTextures::CreateScene ()
{
    mScene = new0 Node();
    mAlphaState = new0 AlphaState();
    mAlphaState->BlendEnabled = true;
    mRenderer->SetOverrideAlphaState(mAlphaState);
    mCullState = new0 CullState();
    mCullState->Enabled = false;
    mRenderer->SetOverrideCullState(mCullState);

    // Create the grid of square meshes.
    const int numSlices = 64;
    const int numSamples = 32;

    // The vertex format that is shared by all square meshes.
    VertexFormat* vformat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT3, 0);
    int vstride = vformat->GetStride();

    // The index buffer that is shared by all square meshes.
    int numIndices = 6*(numSamples-1)*(numSamples-1);
    IndexBuffer* ibuffer = new0 IndexBuffer(numIndices, sizeof(int));
    int* indices = (int*)ibuffer->GetData();
    for (int i1 = 0; i1 < numSamples - 1; ++i1)
    {
        for (int i0 = 0; i0 < numSamples - 1; ++i0)
        {
            int v0 = i0 + numSamples * i1;
            int v1 = v0 + 1;
            int v2 = v1 + numSamples;
            int v3 = v0 + numSamples;
            *indices++ = v0;
            *indices++ = v1;
            *indices++ = v2;
            *indices++ = v0;
            *indices++ = v2;
            *indices++ = v3;
        }
    }

    // Create the volume texture.  Three Gaussian distributions are used for
    // the RGB color channels.  The alpha channel is constant.
    const int bound = 64;
    Texture3D* texture = new0 Texture3D(Texture::TF_A8R8G8B8, bound, bound,
        bound, 1);
    unsigned char* data = (unsigned char*)texture->GetData(0);
    const float mult = 1.0f/(bound - 1.0f);
    const float rParam = 0.01f;
    const float gParam = 0.01f;
    const float bParam = 0.01f;
    const float extreme = 8.0f;
    APoint rCenter( 0.5f*extreme,  0.0f,         0.0f);
    APoint gCenter(-0.5f*extreme, -0.5f*extreme, 0.0f);
    APoint bCenter(-0.5f*extreme, +0.5f*extreme, 0.0f);
    unsigned char commonAlpha = 12;
    APoint point;
    for (int z = 0; z < bound; ++z)
    {
        point[2] = -extreme + 2.0f*extreme*mult*z;
        for (int y = 0; y < bound; ++y)
        {
            point[1] = -extreme + 2.0f*extreme*mult*y;
            for (int x = 0; x < bound; ++x)
            {
                point[0] = -extreme + 2.0f*extreme*mult*x;

                AVector diff = point - rCenter;
                float sqrLength = diff.SquaredLength();
                float rGauss = 1.0f - rParam*sqrLength;
                if (rGauss < 0.0f)
                {
                    rGauss = 0.0f;
                }

                diff = point - gCenter;
                sqrLength = diff.SquaredLength();
                float gGauss = 1.0f - gParam*sqrLength;
                if (gGauss < 0.0f)
                {
                    gGauss = 0.0f;
                }

                diff = point - bCenter;
                sqrLength = diff.SquaredLength();
                float bGauss = 1.0f - bParam*sqrLength;
                if (bGauss < 0.0f)
                {
                    bGauss = 0.0f;
                }

                *data++ = (unsigned char)(255.0f*bGauss);
                *data++ = (unsigned char)(255.0f*gGauss);
                *data++ = (unsigned char)(255.0f*rGauss);
                *data++ = commonAlpha;
            }
        }
    }

//.........这里部分代码省略.........
开发者ID:rasslingcats,项目名称:calico,代码行数:101,代码来源:VolumeTextures.cpp


示例3: vshader

//----------------------------------------------------------------------------
bool StructuredBuffersWindow::CreateScene()
{
    // Create the shaders and associated resources
    HLSLDefiner definer;
    definer.SetInt("WINDOW_WIDTH", mXSize);
    std::shared_ptr<VertexShader> vshader(ShaderFactory::CreateVertex(
        mEnvironment.GetPath("StructuredBuffers.hlsl"), definer));
    if (!vshader)
    {
        return false;
    }

    std::shared_ptr<PixelShader> pshader(ShaderFactory::CreatePixel(
        mEnvironment.GetPath("StructuredBuffers.hlsl"), definer));
    if (!pshader)
    {
        return false;
    }

    std::shared_ptr<ConstantBuffer> cbuffer(new ConstantBuffer(
        sizeof(Matrix4x4<float>), true));
    vshader->Set("PVWMatrix", cbuffer);

    // Create the pixel shader and associated resources.
    std::string path = mEnvironment.GetPath("StoneWall.png");
    std::shared_ptr<Texture2> baseTexture(WICFileIO::Load(path, false));
    pshader->Set("baseTexture", baseTexture);

    std::shared_ptr<SamplerState> baseSampler(new SamplerState());
    baseSampler->filter = SamplerState::MIN_L_MAG_L_MIP_P;
    baseSampler->mode[0] = SamplerState::CLAMP;
    baseSampler->mode[1] = SamplerState::CLAMP;
    pshader->Set("baseSampler", baseSampler);

    mDrawnPixels.reset(new StructuredBuffer(mXSize*mYSize,
        sizeof(Vector4<float>)));
    mDrawnPixels->SetUsage(Resource::SHADER_OUTPUT);
    mDrawnPixels->SetCopyType(Resource::COPY_BIDIRECTIONAL);
    memset(mDrawnPixels->GetData(), 0, mDrawnPixels->GetNumBytes());
    pshader->Set("drawnPixels", mDrawnPixels);

    // Create the visual effect for the square.
    std::shared_ptr<VisualEffect> effect(new VisualEffect(vshader, pshader));

    // Create a vertex buffer for a single triangle.  The PNG is stored in
    // left-handed coordinates.  The texture coordinates are chosen to reflect
    // the texture in the y-direction.
    struct Vertex
    {
        Vector3<float> position;
        Vector2<float> tcoord;
    };
    VertexFormat vformat;
    vformat.Bind(VA_POSITION, DF_R32G32B32_FLOAT, 0);
    vformat.Bind(VA_TEXCOORD, DF_R32G32_FLOAT, 0);
    std::shared_ptr<VertexBuffer> vbuffer(new VertexBuffer(vformat, 4));
    Vertex* vertex = vbuffer->Get<Vertex>();
    vertex[0].position = Vector3<float>(0.0f, 0.0f, 0.0f);
    vertex[0].tcoord = Vector2<float>(0.0f, 1.0f);
    vertex[1].position = Vector3<float>(1.0f, 0.0f, 0.0f);
    vertex[1].tcoord = Vector2<float>(1.0f, 1.0f);
    vertex[2].position = Vector3<float>(0.0f, 1.0f, 0.0f);
    vertex[2].tcoord = Vector2<float>(0.0f, 0.0f);
    vertex[3].position = Vector3<float>(1.0f, 1.0f, 0.0f);
    vertex[3].tcoord = Vector2<float>(1.0f, 0.0f);

    // Create an indexless buffer for a triangle mesh with two triangles.
    std::shared_ptr<IndexBuffer> ibuffer(new IndexBuffer(IP_TRISTRIP, 2));

    // Create the geometric object for drawing.  Translate it so that its
    // center of mass is at the origin.  This supports virtual trackball
    // motion about the object "center".
    mSquare.reset(new Visual(vbuffer, ibuffer, effect));
    mSquare->localTransform.SetTranslation(-0.5f, -0.5f, 0.0f);
    mSquare->Update();

    // Enable automatic updates of pvw-matrices and w-matrices.
    SubscribeCW(mSquare, cbuffer);

    // The structured buffer is written in the pixel shader.  This texture
    // will receive a copy of it so that we can write the results to disk
    // as a PNG file.
    mDrawnPixelsTexture = new Texture2(DF_R8G8B8A8_UNORM, mXSize, mYSize);
    return true;
}
开发者ID:rin-23,项目名称:OculusProjects,代码行数:86,代码来源:StructuredBuffersWindow.cpp


示例4: while


//.........这里部分代码省略.........
                        // Unsupported Version.
                        deserializer.Seek(header.sizeInBytes);
                    }

                    break;
                }

            case Serialization::ChunkID_Model_Meshes:
                {
                    deserializer.Seek(sizeof(header));

                    if (header.version == 1)
                    {
                        uint32_t meshCount;
                        deserializer.Read(meshCount);

                        for (uint32_t iMesh = 0; iMesh < meshCount; ++iMesh)
                        {
                            ModelDefinition::Mesh newMesh(m_context);

                            // Name.
                            deserializer.ReadString(newMesh.name);


                            // Material
                            String materialName;
                            deserializer.ReadString(materialName);

                            newMesh.material = m_context.GetMaterialLibrary().Create(materialName.c_str());



                            // Geometry
                            VertexFormat vertexFormat;
                            vertexFormat.Deserialize(deserializer);
                            newMesh.geometry = Renderer::CreateVertexArray(VertexArrayUsage_Static, vertexFormat);
                            
                            // Vertices.
                            uint32_t vertexCount;
                            deserializer.Read(vertexCount);

                            if (vertexCount > 0)
                            {
                                newMesh.geometry->SetVertexData(nullptr, static_cast<size_t>(vertexCount));
                                auto vertexData = newMesh.geometry->MapVertexData();
                                {
                                    deserializer.Read(vertexData, vertexCount * vertexFormat.GetSizeInBytes());
                                }
                                newMesh.geometry->UnmapVertexData();
                            }

                            // Indices.
                            uint32_t indexCount;
                            deserializer.Read(indexCount);

                            if (indexCount > 0)
                            {
                                newMesh.geometry->SetIndexData(nullptr, static_cast<size_t>(indexCount));
                                auto indexData = newMesh.geometry->MapIndexData();
                                {
                                    deserializer.Read(indexData, indexCount * sizeof(uint32_t));
                                }
                                newMesh.geometry->UnmapIndexData();
                            }

开发者ID:mackron,项目名称:GTGameEngine,代码行数:65,代码来源:ModelDefinition.cpp


示例5: WinMain

int WINAPI WinMain( HINSTANCE inst, HINSTANCE, LPSTR cmdLine, int cmdShow )
{
	Window wnd;

	P(Context)				context		= 0;
	int						sw			= 640;
	int						sh			= 480;
	int						sbpp		= 0;
	bool					fullscreen	= (0 != sbpp);
	P(Scene)				root		= 0;

	try
	{
		// args
		String fxname = cmdLine;
		if ( fxname == "" )
			fxname = "bump.fx";

		// init window
		DWORD style = WS_VISIBLE;
		DWORD styleEx = 0;
		if ( fullscreen )
		{
			style |= WS_POPUP;
			styleEx |= WS_EX_TOPMOST;
		}
		else
		{
			style |= WS_OVERLAPPEDWINDOW;
		}
		wnd.create( "sgtestclass", "sg test", style, styleEx, 0, 0, sw, sh, inst, 0 );

		// init context
		context = new Context( "gd_dx8" );
		context->open( sw, sh, sbpp, 75,
			Context::SURFACE_TARGET + 
			Context::SURFACE_DEPTH + 
			Context::SURFACE_STENCIL,
			Context::RASTERIZER_HW, 
			Context::VERTEXP_HW,
			Context::TC_DISABLED );

		// scene
		root = new Scene;
		root->setName( "root" );

		// camera
		P(Camera) cam = new Camera;
		cam->setName( "cam" );
		cam->setPosition( Vector3(0,1.5f,-3) );
		Matrix3x3 rot = Matrix3x3( Vector3(1,0,0), Math::toRadians(30.f) );
		cam->setRotation( rot );
		cam->setHorizontalFov( Math::toRadians(100.f) );
		cam->setFront( 0.2f );
		cam->setBack( 100.f );
		cam->linkTo( root );

		// light
		P(DirectLight) lt = new DirectLight;
		lt->setName( "keylight" );
		lt->setIntensity( 0.5f );
		lt->linkTo( root );
		lt->lookAt( Vector3(-0.5f,-1,0) );

		// resources
		P(Texture) difmap = loadTex( "diffuse_map.tga" );
		P(Texture) normmap = loadTex( "normal_map.tga" );
		P(CubeTexture) envmap = loadCubeTex( "TestCubeTexture1.dds" );

		// read vb and ib data
		FileInputStream vbin( "vb.dat" );
		Array<uint8_t> vbbytes( vbin.available() );
		vbin.read( vbbytes.begin(), vbbytes.size() );
		int vertexSize = 4*3*4;
		int vertices = vbbytes.size() / vertexSize;
		FileInputStream ibin( "ib.dat" );
		Array<uint8_t> ibbytes( ibin.available() );
		ibin.read( ibbytes.begin(), ibbytes.size() );
		int indexSize = 2;
		int indices = ibbytes.size() / indexSize;

		// geometry (indirectly from vb and ib dat)
		VertexFormat vf; 
		vf.addNormal().addTextureCoordinate(3);
		P(Model) model = new Model( vertices, indices, vf );
		{
			VertexAndIndexLock<Model> lk( model, Model::LOCK_READWRITE );

			for ( int i = 0 ; i < vertices ; ++i )
			{
				model->setVertexPositions( i, (Vector3*)(vbbytes.begin()+i*vertexSize) );
				model->setVertexNormals( i, (Vector3*)(vbbytes.begin()+12+i*vertexSize) );
				model->setVertexTextureCoordinates( i, 0, 3, (float*)(vbbytes.begin()+24+i*vertexSize) );
			}

			void* idata;
			int istride;
			model->getIndexData( &idata, &istride );
			memcpy( idata, ibbytes.begin(), ibbytes.size() );
		}
//.........这里部分代码省略.........
开发者ID:TheRyaz,项目名称:c_reading,代码行数:101,代码来源:WinMain.cpp


示例6: Node

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

    // All triangle meshes have this common vertex format.  Use StandardMesh
    // to create these meshes.
    VertexFormat* vformat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 0);

    StandardMesh stdMesh(vformat);

    // Create the ground.  It covers a square with vertices (1,1,0), (1,-1,0),
    // (-1,1,0), and (-1,-1,0).  Multiply the texture coordinates by a factor
    // to enhance the wrap-around.
    mGround = stdMesh.Rectangle(2, 2, 16.0f, 16.0f);
    VertexBufferAccessor vba(mGround);
    int i;
    for (i = 0; i < vba.GetNumVertices(); ++i)
    {
        Float2& tcoord = vba.TCoord<Float2>(0, i);
        tcoord[0] *= 128.0f;
        tcoord[1] *= 128.0f;
    }

    // Create a texture effect for the ground.
    std::string path = Environment::GetPathR("Horizontal.wmtf");
    Texture2D* texture = Texture2D::LoadWMTF(path);
    VisualEffectInstance* instance = Texture2DEffect::CreateUniqueInstance(
        texture, Shader::SF_LINEAR_LINEAR, Shader::SC_REPEAT,
        Shader::SC_REPEAT);
    mGround->SetEffectInstance(instance);
    mScene->AttachChild(mGround);

    // Create a rectangle mesh.  The mesh is in the xy-plane.  Do not apply
    // local transformations to the mesh.  Use the billboard node transforms
    // to control the mesh location and orientation.
    mRectangle = stdMesh.Rectangle(2, 2, 0.125f, 0.25f);

    // Create a texture effect for the rectangle and for the torus.
    Texture2DEffect* geomEffect = new0 Texture2DEffect(Shader::SF_LINEAR);
    path = Environment::GetPathR("RedSky.wmtf");
    texture = Texture2D::LoadWMTF(path);
    mRectangle->SetEffectInstance(geomEffect->CreateInstance(texture));

    // Create a billboard node that causes a rectangle to always be facing
    // the camera.  This is the type of billboard for an avatar.
    mBillboard0 = new0 BillboardNode(mCamera);
    mBillboard0->AttachChild(mRectangle);
    mScene->AttachChild(mBillboard0);

    // The billboard rotation is about its model-space up-vector (0,1,0).  In
    // this application, world-space up is (0,0,1).  Locally rotate the
    // billboard so it's up-vector matches the world's.
    mBillboard0->LocalTransform.SetTranslate(APoint(-0.25f, 0.0f, 0.25f));
    mBillboard0->LocalTransform.SetRotate(HMatrix(AVector::UNIT_X,
        Mathf::HALF_PI));

    // Create a torus mesh.  Do not apply local transformations to the mesh.
    // Use the billboard node transforms to control the mesh location and
    // orientation.
    mTorus = StandardMesh(vformat, false).Torus(16, 16, 1.0f, 0.25f);
    mTorus->LocalTransform.SetUniformScale(0.1f);

    // Create a texture effect for the torus.  It uses the RedSky image that
    // the rectangle uses.
    mTorus->SetEffectInstance(geomEffect->CreateInstance(texture));

    // Create a billboard node that causes an object to always be oriented
    // the same way relative to the camera.
    mBillboard1 = new0 BillboardNode(mCamera);
    mBillboard1->AttachChild(mTorus);
    mScene->AttachChild(mBillboard1);

    // The billboard rotation is about its model-space up-vector (0,1,0).  In
    // this application, world-space up is (0,0,1).  Locally rotate the
    // billboard so it's up-vector matches the world's.
    mBillboard1->LocalTransform.SetTranslate(APoint(0.25f, 0.0f, 0.25f));
    mBillboard1->LocalTransform.SetRotate(HMatrix(AVector::UNIT_X,
        Mathf::HALF_PI));

#ifdef DEMONSTRATE_VIEWPORT_BOUNDING_RECTANGLE
    // The screen camera is designed to map (x,y,z) in [0,1]^3 to (x',y,'z')
    // in [-1,1]^2 x [0,1].
    mSSCamera = new0 Camera(false);
    mSSCamera->SetFrustum(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f);
    mSSCamera->SetFrame(APoint::ORIGIN, AVector::UNIT_Z, AVector::UNIT_Y,
        AVector::UNIT_X);

    // Create a semitransparent screen rectangle.
    VertexFormat* ssVFormat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_COLOR, VertexFormat::AT_FLOAT4, 0);
    int ssVStride = ssVFormat->GetStride();

//.........这里部分代码省略.........
开发者ID:rasslingcats,项目名称:calico,代码行数:101,代码来源:BillboardNodes.cpp


示例7: input

bool ConvexHull3DWindow::LoadData()
{
    std::string filename = "data";
    if (mCurrentFile < 10)
    {
        filename += "0";
    }
    filename += std::to_string(mCurrentFile) + ".txt";
    std::string path = mEnvironment.GetPath(filename);
    if (path == "")
    {
        return false;
    }

    std::ifstream input(path);
    if (!input)
    {
        return false;
    }

    Vector3<float> center{ 0.0f, 0.0f, 0.0f };
    unsigned int numVertices;
    input >> numVertices;
    std::vector<Vector3<float>> vertices(numVertices);
    for (auto& v : vertices)
    {
        for (int j = 0; j < 3; ++j)
        {
            input >> v[j];
        }
        center += v;
    }
    input.close();
    center /= static_cast<float>(numVertices);

    float radius = 0.0f;
    for (auto const& v : vertices)
    {
        Vector3<float> diff = v - center;
        float length = Length(diff);
        if (length > radius)
        {
            radius = length;
        }
    }

    // The worst-case number of words for UIntegerFP32<N> for 'float' input
    // to ConvexHull3 is N = 27.  For 'double', it is 'N = 197'.
    ConvexHull3<float, BSNumber<UIntegerFP32<27>>> ch;
    if (numVertices < 4 || !ch(numVertices, &vertices[0], 0.0f))
    {
        if (mMesh)
        {
            mTrackball.Detach(mMesh);
            mTrackball.Update();
            mCameraRig.Unsubscribe(mMesh->worldTransform);
            mMesh = nullptr;
        }

        mMessage = "File = " + std::to_string(mCurrentFile) +
            " has intrinsic dimension " + std::to_string(ch.GetDimension());
        return false;
    }
#if defined(GTE_COLLECT_BSNUMBER_STATISTICS)
    std::cout << "max size = " << gte::gBSNumberMaxSize << std::endl;
#endif

    std::vector<TriangleKey<true>> const& triangles = ch.GetHullUnordered();

    std::mt19937 mte;
    std::uniform_real_distribution<float> rnd(0.0f, 1.0f);

    struct Vertex
    {
        Vector3<float> position;
        Vector4<float> color;
    };
    VertexFormat vformat;
    vformat.Bind(VA_POSITION, DF_R32G32B32_FLOAT, 0);
    vformat.Bind(VA_COLOR, DF_R32G32B32A32_FLOAT, 0);
    std::shared_ptr<VertexBuffer> vbuffer(new VertexBuffer(vformat,
        numVertices));
    Vertex* vertex = vbuffer->Get<Vertex>();
    for (unsigned int i = 0; i < numVertices; ++i)
    {
        vertex[i].position = vertices[i];
        vertex[i].color[0] = rnd(mte);
        vertex[i].color[1] = rnd(mte);
        vertex[i].color[2] = rnd(mte);
        vertex[i].color[3] = 1.0f;
    }

    unsigned int numPrimitives = static_cast<unsigned int>(triangles.size());
    std::shared_ptr<IndexBuffer> ibuffer(new IndexBuffer(IP_TRIMESH,
        numPrimitives, sizeof(unsigned int)));
    Memcpy(ibuffer->GetData(), &triangles[0], ibuffer->GetNumBytes());

    // Update all information associated with the mesh transforms.
    if (mMesh)
    {
//.........这里部分代码省略.........
开发者ID:c0g,项目名称:FaceWarpApp,代码行数:101,代码来源:ConvexHull3DWindow.cpp


示例8: Init

void Vertex::Init(const VertexFormat &vf)
{
    int totalVertexSize = vf.GetStride();
    if(totalVertexSize > 0) data = malloc(totalVertexSize);
    else data = nullptr;
}
开发者ID:sephirot47,项目名称:Cheezy,代码行数:6,代码来源:Vertex.cpp


示例9: HasAttribute

bool Vertex::HasAttribute(string name, const VertexFormat &vf) const
{
    int offset = vf.GetOffsetOf(name);
    return (offset != -1);
}
开发者ID:sephirot47,项目名称:Cheezy,代码行数:5,代码来源:Vertex.cpp


示例10: defined

bool GeometryShadersWindow::CreateScene()
{
    std::string filename;
#if defined(USE_DRAW_DIRECT)
    filename = mEnvironment.GetPath("RandomSquares.hlsl");
#else
    filename = mEnvironment.GetPath("RandomSquaresIndirect.hlsl");
#endif
    std::shared_ptr<VisualProgram> program =
        mProgramFactory.CreateFromFiles(filename, filename, filename);
    if (!program)
    {
        return false;
    }

    // Create particles used by direct and indirect drawing.
    struct Vertex
    {
        Vector3<float> position;
        Vector3<float> color;
        float size;
    };

    // Use a Mersenne twister engine for random numbers.
    std::mt19937 mte;
    std::uniform_real_distribution<float> symr(-1.0f, 1.0f);
    std::uniform_real_distribution<float> unir(0.0f, 1.0f);
    std::uniform_real_distribution<float> posr(0.01f, 0.1f);

    int const numParticles = 128;
    std::vector<Vertex> particles(numParticles);
    for (auto& particle : particles)
    {
        particle.position = { symr(mte), symr(mte), symr(mte) };
        particle.color = { unir(mte), unir(mte), unir(mte) };
        particle.size = posr(mte);
    }

    // Create the constant buffer used by direct and indirect drawing.
    mMatrices = std::make_shared<ConstantBuffer>(
        2 * sizeof(Matrix4x4<float>), true);
    program->GetGShader()->Set("Matrices", mMatrices);

#if defined(USE_DRAW_DIRECT)
    // Create a mesh for direct drawing.
    VertexFormat vformat;
    vformat.Bind(VA_POSITION, DF_R32G32B32_FLOAT, 0);
    vformat.Bind(VA_COLOR, DF_R32G32B32_FLOAT, 0);
    vformat.Bind(VA_TEXCOORD, DF_R32_FLOAT, 0);
    std::shared_ptr<VertexBuffer> vbuffer(new VertexBuffer(vformat,
        numParticles));
    Memcpy(vbuffer->GetData(), &particles[0], numParticles*sizeof(Vertex));
#else
    // Create a mesh for indirect drawing.
    std::shared_ptr<VertexBuffer> vbuffer(new VertexBuffer(numParticles));
    mParticles = std::make_shared<StructuredBuffer>(numParticles,
        sizeof(Vertex));
    Memcpy(mParticles->GetData(), &particles[0], numParticles*sizeof(Vertex));
    gshader->Set("particles", mParticles);
#endif

    std::shared_ptr<IndexBuffer> ibuffer(new IndexBuffer(IP_POLYPOINT,
        numParticles));

    std::shared_ptr<VisualEffect> effect =
        std::make_shared<VisualEffect>(program);

    mMesh = std::make_shared<Visual>(vbuffer, ibuffer, effect);
    return true;
}
开发者ID:yimogod,项目名称:gt_learn,代码行数:70,代码来源:GeometryShadersWindow.cpp


示例11: inFile

//----------------------------------------------------------------------------
TriMesh* Castle::LoadMeshPNT2 (const std::string& name)
{
    // Get the vertex format.
    VertexFormat* vformat = VertexFormat::Create(4,
                            VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
                            VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT3, 2,  // normals
                            VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 0,
                            VertexFormat::AU_TEXCOORD, VertexFormat::AT_FLOAT2, 1);
    int vstride = vformat->GetStride();

    // Get the positions.
    std::string filename = Environment::GetPathR(name);
    std::ifstream inFile(filename.c_str());
    int numPositions;
    Float3* positions;
    GetFloat3(inFile, numPositions, positions);

    // Get the normals.
    int numNormals;
    Float3* normals;
    GetFloat3(inFile, numNormals, normals);

    // Get the texture coordinates for unit 0.
    int numTCoords0;
    Float2* tcoords0;
    GetFloat2(inFile, numTCoords0, tcoords0);

    // Get the texture coordinates for unit 1.
    int numTCoords1;
    Float2* tcoords1;
    GetFloat2(inFile, numTCoords1, tcoords1);

    // Get the vertices and indices.
    int numTriangles;
    inFile >> numTriangles;
    VertexPNT2* vertices = new1<VertexPNT2>(3*numTriangles);
    std::vector<VertexPNT2> PNT2Array;
    std::map<VertexPNT2,int> PNT2Map;
    std::vector<int> indices;
    for (int t = 0; t < numTriangles; ++t)
    {
        for (int j = 0, k = 3*t; j < 3; ++j, ++k)
        {
            VertexPNT2& vertex = vertices[k];
            inFile >> vertex.PIndex;
            inFile >> vertex.NIndex;
            inFile >> vertex.T0Index;
            inFile >> vertex.T1Index;

            std::map<VertexPNT2,int>::iterator miter = PNT2Map.find(vertex);
            int index;
            if (miter != PNT2Map.end())
            {
                // Second or later time the vertex is encountered.
                index = miter->second;
            }
            else
            {
                // First time the vertex is encountered.
                index = (int)PNT2Array.size();
                PNT2Map.insert(std::make_pair(vertex, index));
                PNT2Array.push_back(vertex);
            }
            indices.push_back(index);
        }
    }
    inFile.close();

    // Build the mesh.
    int numVertices = (int)PNT2Array.size();
    VertexBuffer* vbuffer = new0 VertexBuffer(numVertices, vstride);
    VertexBufferAccessor vba(vformat, vbuffer);
    for (int i = 0; i < numVertices; ++i)
    {
        VertexPNT2& vertex = PNT2Array[i];
        vba.Position<Float3>(i) = positions[vertex.PIndex];
        vba.TCoord<Float3>(2, i) = normals[vertex.NIndex];
        vba.TCoord<Float2>(0, i) = tcoords0[vertex.T0Index];
        vba.TCoord<Float2>(1, i) = tcoords1[vertex.T1Index];
    }

    int numIndices = (int)indices.size();
    IndexBuffer* ibuffer = new0 IndexBuffer(numIndices, sizeof(int));
    memcpy(ibuffer->GetData(), &indices[0], numIndices*sizeof(int));

    delete1(vertices);
    delete1(tcoords1);
    delete1(tcoords0);
    delete1(normals);
    delete1(positions);

    return new0 TriMesh(vformat, vbuffer, ibuffer);
}
开发者ID:galek,项目名称:GeometricTools,代码行数:94,代码来源:LoadData.cpp


示例12: generateShaders

void ShaderGenerator::generateShaders(Material& mat, const RenderState& rs, const VertexFormat& vf, const FogParameters fogParams) {

	bool hasNormalMap = false;
	bool hasParallaxMap = false;

	ctemplate::TemplateDictionary vertexShaderDict("vertexShader");
	ctemplate::TemplateDictionary fragmentShaderDict("fragmentShader");

	ctemplate::TemplateDictionary* vertexIoDict = vertexShaderDict.AddIncludeDictionary("VERTEX_INPUTS");
	vertexIoDict->SetFilename("shader_templates/ft_vertex_inout.tpl");

	ctemplate::TemplateDictionary* fragmentOutDict = vertexShaderDict.AddIncludeDictionary("FRAGMENT_INPUTS");
	fragmentOutDict->SetFilename("shader_templates/ft_fragment_inout.tpl");
	fragmentOutDict->ShowSection("OUT_DIRECTION");

	ctemplate::TemplateDictionary* uniformsDict = vertexShaderDict.AddIncludeDictionary("UNIFORMS");
	uniformsDict->SetFilename("shader_templates/uniforms.tpl");

	// emit the fog uniforms if necessary
	if (fogParams.m_fogMode != FOG_NONE) {
		uniformsDict->ShowSection("FOG");
	}

	// use lighting when material uses shading and we have normals
	bool useLighting = !mat.m_shadeless && vf.getAttributeBySemantic(Vertex_Normal);
	if (useLighting) {
		uniformsDict->ShowSection("USE_LIGHTING");
	}

	if (vf.getAttributeBySemantic(Vertex_Normal)) {
		vertexShaderDict.ShowSection("HAS_NORMALS");
		vertexShaderDict.ShowSection("NORMALIZE_NORMALS");

		vertexIoDict->ShowSection("HAS_NORMALS");
		vertexIoDict->ShowSection("NORMALIZE_NORMALS");

		fragmentOutDict->ShowSection("HAS_NORMALS");

		uniformsDict->ShowSection("HAS_NORMALS");
	}

	if (vf.getAttributeBySemantic(Vertex_Tangent)) {
		fragmentOutDict->ShowSection("HAS_TANGENTS");
		vertexIoDict->ShowSection("HAS_TANGENTS");
	}

	if (vf.getAttributeBySemantic(Vertex_BiNormal)) {
		fragmentOutDict->ShowSection("HAS_BINORMALS");
		vertexIoDict->ShowSection("HAS_BINORMALS");
	}

	if (vf.getAttributeBySemantic(Vertex_Color)) {
		vertexShaderDict.ShowSection("HAS_COLORS");
		vertexIoDict->ShowSection("HAS_COLORS");
		fragmentOutDict->ShowSection("HAS_COLORS");
	}

	// indicates if the tex coords generation functions declarations template has already been
	// included in the vertex shader template
	bool texGenDeclIncluded = false;

	// number of active texture units
	uint activeTextures = 0;

	ctemplate::TemplateDictionary* texGenDict = vertexShaderDict.AddIncludeDictionary("TEX_COORDS_GEN");
	texGenDict->SetFilename("shader_templates/ft_tex_coords_gen.tpl");

	// Loops over all material textures and performs the following:
	//	1. Declares a respective uniform sampler object which will be named as u_sampler#,
	//     where # is the active texture index.
	//  2. Emits code for any texture coordinates generation scheme, if not simple UV.

	ctemplate::TemplateDictionary* parallaxMapDict = 0;

	for (int i = 0; i < MAX_TEXTURES_STACK; i++) {
		TexturePtr tex = mat.m_texStack->textures[i];
		if (tex) {
			// for the fragment shader, here we can fill in the dictionary for the texture application section
			// that takes into account the texture's mapTo, environment color, uvset, etc.
			ctemplate::TemplateDictionary* texUnitDict = fragmentShaderDict.AddIncludeDictionary(
					"SINGLE_TEXTURE_STACK_ENTRY");
			texUnitDict->SetFilename("shader_templates/ft_tex_stack_application.tpl");

			ctemplate::TemplateDictionary* alphaMapDict = 0;
			ctemplate::TemplateDictionary* tangentNormalMapDict = 0;
			ctemplate::TemplateDictionary* offsetMappingDict = 0;

			// depending on the texture's mapTo, we will emit different sections in the template
			ctemplate::TemplateDictionary* texMapToDict = 0;
			switch (mat.m_texStack->texOutputs[i].mapTo) {
			case TexMapTo_Diffuse:
				texMapToDict = texUnitDict->AddSectionDictionary("TEX_MAP_TO_DIFFUSE");
				break;
			case TexMapTo_CSpecular:
				texMapToDict = texUnitDict->AddSectionDictionary("TEX_MAP_TO_SPECULAR");
				break;
			case TexMapTo_Shininess:
				texMapToDict = texUnitDict->AddSectionDictionary("TEX_MAP_TO_SHININESS");
				break;
			case TexMapTo_Alpha:
//.........这里部分代码省略.........
开发者ID:vardis,项目名称:glraster,代码行数:101,代码来源:ShaderGenerator.cpp


示例13: defined

void MassSprings3DWindow::CreateBoxFaces()
{
    // The vertex buffer will use the mass-spring position array for its
    // CPU data.
    int const numVertices = mDimension[0] * mDimension[1] * mDimension[2];

#if defined(DO_CPU_MASS_SPRING)
    VertexFormat vformat;
    vformat.Bind(VA_POSITION, DF_R32G32B32_FLOAT, 0);
    mVBuffer = std::make_shared<VertexBuffer>(vformat, numVertices, false);
    mVBuffer->SetUsage(Resource::DYNAMIC_UPDATE);
#else
    mVBuffer = std::make_shared<VertexBuffer>(numVertices);
#endif
    
    size_t const idxsize = sizeof(unsigned int);
    std::shared_ptr<IndexBuffer> ibuffer;
    int numTriangles, t, x, y, z, v0, v1, v2, v3;

    // box face z = 1
    numTriangles = 2 * (mDimension[0] - 1) * (mDimension[1] - 1);
    ibuffer = std::make_shared<IndexBuffer>(IP_TRIMESH, numTriangles,
        idxsize);
    for (y = 1, t = 0; y < mDimension[1] - 2; ++y)
    {
        for (x = 1; x < mDimension[0] - 2; ++x)
        {
            v0 = GetIndex(x, y, 1);
            v1 = GetIndex(x + 1, y, 1);
            v2 = GetIndex(x, y + 1, 1);
            v3 = GetIndex(x + 1, y + 1, 1);
            ibuffer->SetTriangle(t++, v0, v2, v3);
            ibuffer->SetTriangle(t++, v0, v3, v1);
        }
    }
    mBoxFace[0] = std::make_shared<Visual>(mVBuffer, ibuffer);

    // box face z = dim2 - 2
    numTriangles = 2 * (mDimension[0] - 1) * (mDimension[1] - 1);
    ibuffer = std::make_shared<IndexBuffer>(IP_TRIMESH, numTriangles,
        idxsize);
    for (y = 1, t = 0; y < mDimension[1] - 2; ++y)
    {
        for (x = 1; x < mDimension[0] - 2; ++x)
        {
            v0 = GetIndex(x, y, mDimension[2] - 2);
            v1 = GetIndex(x + 1, y, mDimension[2] - 2);
            v2 = GetIndex(x, y + 1, mDimension[2] - 2);
            v3 = GetIndex(x + 1, y + 1, mDimension[2] - 2);
            ibuffer->SetTriangle(t++, v0, v3, v2);
            ibuffer->SetTriangle(t++, v0, v1, v3);
        }
    }
    mBoxFace[1] = std::make_shared<Visual>(mVBuffer, ibuffer);

    // box face y = 1
    numTriangles = 2 * (mDimension[0] - 1) * (mDimension[2] - 1);
    ibuffer = std::make_shared<IndexBuffer>(IP_TRIMESH, numTriangles,
        idxsize);
    for (z = 1, t = 0; z < mDimension[2] - 2; ++z)
    {
        for (x = 1; x < mDimension[0] - 2; ++x)
        {
            v0 = GetIndex(x, 1, z);
            v1 = GetIndex(x + 1, 1, z);
            v2 = GetIndex(x, 1, z + 1);
            v3 = GetIndex(x + 1, 1, z + 1);
            ibuffer->SetTriangle(t++, v0, v3, v2);
            ibuffer->SetTriangle(t++, v0, v1, v3);
        }
    }
    mBoxFace[2] = std::make_shared<Visual>(mVBuffer, ibuffer);

    // box face y = dim1 - 2
    numTriangles = 2 * (mDimension[0] - 1) * (mDimension[2] - 1);
    ibuffer = std::make_shared<IndexBuffer>(IP_TRIMESH, numTriangles,
        idxsize);
    for (z = 1, t = 0; z < mDimension[2] - 2; ++z)
    {
        for (x = 1; x < mDimension[0] - 2; ++x)
        {
            v0 = GetIndex(x, mDimension[1] - 2, z);
            v1 = GetIndex(x + 1, mDimension[1] - 2, z);
            v2 = GetIndex(x, mDimension[1] - 2, z + 1);
            v3 = GetIndex(x + 1, mDimension[1] - 2, z + 1);
            ibuffer->SetTriangle(t++, v0, v2, v3);
            ibuffer->SetTriangle(t++, v0, v3, v1);
        }
    }
    mBoxFace[3] = std::make_shared<Visual>(mVBuffer, ibuffer);

    // box face x = 1
    numTriangles = 2 * (mDimension[1] - 1) * (mDimension[2] - 1);
    ibuffer = std::make_shared<IndexBuffer>(IP_TRIMESH, numTriangles,
        idxsize);
    for (z = 1, t = 0; z < mDimension[2] - 2; ++z)
    {
        for (y = 1; y < mDimension[1] - 2; ++y)
        {
            v0 = GetIndex(1, y, z);
//.........这里部分代码省略.........
开发者ID:yimogod,项目名称:gt_learn,代码行数:101,代码来源:MassSprings3DWindow.cpp


示例14: SetVertexFormat

//----------------------------------------------------------------------------
void FramesMesh::_Cal(const std::string &texPackFilename)
{
	const TexPack &texPack = PX2_RM.GetTexPack(texPackFilename);
	if (!texPack.IsValid()) return;

	std::string outPath;
	std::string outBaseFilename;
	StringHelp::SplitFilename(texPackFilename, outPath, outBaseFilename);

	std::string outBaseName;
	std::string outExt;
	StringHelp::SplitBaseFilename(outBaseFilename, outBaseName, outExt);

	VertexFormat *vf = PX2_GR.GetVertexFormat(GraphicsRoot::VFT_PCT1);
	SetVertexFormat(vf);

	mNumAllFrames = (int)texPack.Elements.size();
	mNumFramesPerDir = mNumAllFrames / mNumDir;
	if (0 == mNumFramesPerDir)
	{
		//assertion(false, "no frames");
		//return;
	}

	VBIBObj &obj = VBIBManager::GetSingleton().GetVBID(texPackFilename);
	if (obj.IsValued)
	{
		SetVertexBuffer(obj.mVB);
		SetIndexBuffer(obj.mIB);
	}
	else
	{
		int numVertex = mNumAllFrames * 4;
		int numIndex = mNumAllFrames * 6;

		int frameIndex = 0;
		VertexBuffer *vb = new0 VertexBuffer(numVertex, vf->GetStride());
		VertexBufferAccessor vba(vf, vb);
		for (int i = 0; i < mNumDir; i++)
		{
			for (int j = 0; j < mNumFramesPerDir; j++)
			{
				std::string eleName = outBaseName + "_" + StringHelp::IntToString(i * 45) + "_" + StringHelp::IntToString(j + 1);

				const TexPackElement &ele = PX2_RM.GetTexPackElement(texPackFilename, eleName);

				float xPlusPer = 0.0f;
				float widthPer = 0.0f;
				float zPlusPer = 0.0f;
				float heightPer = 0.0f;
				if (0 != ele.OW)
				{
					xPlusPer = (float)ele.OX / (float)ele.OW;
					widthPer = (float)ele.W / (float)ele.OW;
				}
				if (0 != ele.OH)
				{
					zPlusPer = 1.0f - (float)(ele.OY + ele.H) / (float)ele.OH;
					heightPer = (float)ele.H / (float)ele.OH;
				}

				float width = mSize;
				float height = mSize;

				float xPos = 0.0f - width * 0.5f;
				float zPos = 0.0f - height * 0.5f;
				xPos += xPlusPer * width;
				zPos += zPlusPer * height;

				width *= widthPer;
				height *= heightPer;

				Float3 p0 = Float3(xPos, zPos, 0.0f);
				Float3 p1 = Float3(xPos + width, zPos, 0.0f);
				Float3 p2 = Float3(xPos, zPos + height, 0.0f);
				Float3 p3 = Float3(xPos + width, zPos + height, 0.0f);

				float uBegin = (float)ele.X / (float)ele.TexWidth;
				float uEnd = (float)(ele.X + ele.W) / (float)ele.TexWidth;
				float vBegin = (float)(ele.TexHeight - ele.Y - ele.H) / (float)ele.TexHeight;
				float vEnd = (float)(ele.TexHeight - ele.Y) / (float)ele.TexHeight;

				vba.Position<Float3>(frameIndex * 4 + 0) = p0;
				vba.Position<Float3>(frameIndex * 4 + 1) = p1;
				vba.Position<Float3>(frameIndex * 4 + 2) = p2;
				vba.Position<Float3>(frameIndex * 4 + 3) = p3;

				vba.TCoord<Float2>(0, frameIndex * 4 + 0) = Float2(uBegin, vBegin);
				vba.TCoord<Float2>(0, frameIndex * 4 + 1) = Float2(uEnd, vBegin);
				vba.TCoord<Float2>(0, frameIndex * 4 + 2) = Float2(uBegin, vEnd);
				vba.TCoord<Float2>(0, frameIndex * 4 + 3) = Float2(uEnd, vEnd);

				frameIndex++;
			}
		}

		IndexBuffer *ib = new0 IndexBuffer(numIndex, 2);
		for (int i = 0; i < mNumAllFrames; i++)
		{
//.........这里部分代码省略.........
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:101,代码来源:PX2FramesMesh.cpp


示例15: mIndex

//----------------------------------------------------------------------------
CurveCtrl::CurveCtrl (Curve *curve, CurveCtrlType type, int index)
    :
    mIndex(index),
    mSelected(false),
    mCurve(curve),
    mCtrlType(type),
    mXScale(1.0f),
    mZScale(1.0f),
    mDragLength(1.0f),
    mInVal(-1.0f),
    mSelectMode(SM_MAX_MODE)
{
    mCtrlNode = new0 Node();

    float dragSize = 0.1f;

    VertexFormat *vFormat = PX2_GR.GetVertexFormat(GraphicsRoot::VFT_PC);
    StandardMesh sm(vFormat);

    Float3 curveColor = mCurve->GetCurveColor();

    VertexColor4MaterialPtr mtl = new0 VertexColor4Material();
    MaterialInstancePtr mtlInst = mtl->CreateInstance();

    sm.SetVertexColor(Float4(curveColor[0], curveColor[1], curveColor[2], 1.0f));
    mDragBox = sm.Box(dragSize, dragSize, dragSize);
    mDragBox->SetMaterialInstance(mtlInst);

    sm.SetVertexColor(Float4::WHITE);

    mDragBoxArrive = sm.Box(dragSize, dragSize, dragSize);
    mDragBoxArrive->SetMaterialInstance(mtlInst);

    mDragBoxLeave = sm.Box(dragSize, dragSize, dragSize);
    mDragBoxLeave->SetMaterialInstance(mtlInst);

    Vertex 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ VertexLayout类代码示例发布时间:2022-05-31
下一篇:
C++ VertexElement类代码示例发布时间: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