本文整理汇总了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);
}
示例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);
}