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


C++ Renderable::setColour方法代码示例

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


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

示例1: setupBounds

void setupBounds()
{
    Vec3f topLeftFront = Vec3f(-WIDTH/2., HEIGHT/2.,DEPTH/2.);
    Vec3f topLeftBack = Vec3f(-WIDTH/2., HEIGHT/2.,-DEPTH/2.);
    Vec3f topRightFront = Vec3f(WIDTH/2., HEIGHT/2.,DEPTH/2.);
    Vec3f topRightBack = Vec3f(WIDTH/2., HEIGHT/2.,-DEPTH/2.);
    Vec3f botLeftFront = Vec3f(-WIDTH/2., -HEIGHT/2.,DEPTH/2.);
    Vec3f botLeftBack = Vec3f(-WIDTH/2., -HEIGHT/2.,-DEPTH/2.);
    Vec3f botRightFront = Vec3f(WIDTH/2., -HEIGHT/2.,DEPTH/2.);
    Vec3f botRightBack = Vec3f(WIDTH/2., -HEIGHT/2.,-DEPTH/2.);


    bounds.setColour(Vec3f(0,0,1));
    bounds.setFragmentShaderPath("Shaders/basic_fs.glsl");
    bounds.setVertexShaderPath("Shaders/basic_vs.glsl");
    bounds.setRenderMode(GL_LINES);
    std::vector<Vec3f> points;

    points.push_back(topLeftFront);
    points.push_back(topLeftBack);

    points.push_back(topLeftBack);
    points.push_back(topRightBack);

    points.push_back(topRightBack);
    points.push_back(topRightFront);

    points.push_back(topRightFront);
    points.push_back(topLeftFront);

    points.push_back(botLeftFront);
    points.push_back(botLeftBack);

    points.push_back(botLeftBack);
    points.push_back(botRightBack);

    points.push_back(botRightBack);
    points.push_back(botRightFront);

    points.push_back(botRightFront);
    points.push_back(botLeftFront);

    points.push_back(topLeftFront);
    points.push_back(botLeftFront);

    points.push_back(topRightFront);
    points.push_back(botRightFront);

    points.push_back(topLeftBack);
    points.push_back(botLeftBack);

    points.push_back(topRightBack);
    points.push_back(botRightBack);



    bounds.setVerts(points);
}
开发者ID:Scraniel,项目名称:ParticleSimulator,代码行数:58,代码来源:main.cpp

示例2: loadCurveFromFile

/* Loads a curve from a ".vert" file, which is constructed as such:
 * 2				//First line is the number of vec3f's to read (call this 'n')
 * 1.0 1.0 1.0		// Second line is always the colour to render the curve
 * -1.0 1.0 0.0		// The remaining n -1 lines are the vertices of the curve
 */
void FileHelper::loadCurveFromFile(const char* file, Renderable & curve){

	char buffer[50];
	FILE* fp;
	int numPoints;

	fp = fopen(file, "r");

	fgets(buffer, 50, fp);
	numPoints = atoi(buffer);

	std::vector<Vec3f> verts;
	for(int i = 0; i < numPoints; i++){
		float temp1, temp2, temp3;
		fgets(buffer, 50, fp);
		sscanf(buffer, "%f %f %f\n", &temp1, &temp2, &temp3);
		Vec3f vert(temp1, temp2, temp3);

		// First point is the colour
		if(i == 0)
		{
			curve.setColour(vert);
		}

		// Remaining points are the vertices
		else
		{
			verts.push_back(vert);
		}

	}

	curve.setVerts(verts);

	fclose(fp);
	printf("Loaded %s!\n", file);
}
开发者ID:Scraniel,项目名称:MassSpringSystem,代码行数:42,代码来源:FileHelper.cpp


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