?? creategfxobjects.cc
字號:
#include "monitorframe.hh"#define X .525731112119133606 #define Z .850650808352039932using namespace bats;void MonitorFrame::createGFXObjects(){ std::cerr << "Copy! -2" << std::endl; /* The Field */ GFXObject *gfxField = new GFXObject; // Get the faces. // std::vector<Face> &faces = gfxField->getFaces(); std::cerr << "Copy! -1" << std::endl; Face face; std::cerr << "Copy! 0" << std::endl; // Two green triangles: face.begin(GL_TRIANGLES); face.color(0.0,0.6,0.0); face.vertex(Vector3D( -1.0, 1.0, 0.0), Vector3D(0.0, 0.0, 1.0)); face.vertex(Vector3D( 1.0, 1.0, 0.0), Vector3D(0.0, 0.0, 1.0)); face.vertex(Vector3D( 1.0,-1.0, 0.0), Vector3D(0.0, 0.0, 1.0)); face.end(); std::cerr << "Copy! 1" << std::endl; gfxField->addFace(face); std::cerr << "Copy! 2" << std::endl; face.begin(GL_TRIANGLES); face.color(0.0,0.6,0.0); face.vertex(Vector3D( -1.0, 1.0, 0.0), Vector3D(0.0, 0.0, 1.0)); face.vertex(Vector3D( 1.0,-1.0, 0.0), Vector3D(0.0, 0.0, 1.0)); face.vertex(Vector3D( -1.0,-1.0, 0.0), Vector3D(0.0, 0.0, 1.0)); face.end(); gfxField->addFace(face); /* The Player A */ d_gfxPlayerA = new GFXObject; // Get the faces. // faces = d_gfxPlayerA->getFaces(); static Vector3D vdata[12] = { Vector3D(-X, 0.0, Z), Vector3D(X, 0.0, Z), Vector3D(-X, 0.0, -Z), Vector3D(X, 0.0, -Z), Vector3D(0.0, Z, X), Vector3D(0.0, Z, -X), Vector3D(0.0, -Z, X), Vector3D(0.0, -Z, -X), Vector3D(Z, X, 0.0), Vector3D(-Z, X, 0.0), Vector3D(Z, -X, 0.0), Vector3D(-Z, -X, 0.0) }; static GLint tindices[20][3] = { {0,4,1}, {0,9,4}, {9,5,4}, {4,5,8}, {4,8,1}, {8,10,1}, {8,3,10}, {5,3,8}, {5,2,3}, {2,7,3}, {7,10,3}, {7,6,10}, {7,11,6}, {11,0,6}, {0,1,6}, {6,1,10}, {9,0,11}, {9,11,2}, {9,2,5}, {7,2,11} }; for (unsigned i = 0; i < 20; ++i) { /* color information here */ face.begin(GL_TRIANGLES); face.color(0.0, 0.0, 0.6); face.vertex(vdata[tindices[i][0]], vdata[tindices[i][0]]); face.vertex(vdata[tindices[i][1]], vdata[tindices[i][1]]); face.vertex(vdata[tindices[i][2]], vdata[tindices[i][2]]); face.end(); d_gfxPlayerA->addFace(face); } /* The Player B */ d_gfxPlayerB = new GFXObject; *d_gfxPlayerB = *d_gfxPlayerA; d_gfxPlayerB->setColors(0.6,0.0,0.0); /* The Ball */ d_gfxBall = new GFXObject; *d_gfxBall = *d_gfxPlayerA; d_gfxBall->setColors(1.0,1.0,0.5); /* The Goal */ d_gfxGoal = new GFXObject; *d_gfxGoal = *gfxField; d_gfxGoal->setColors(1.0,1.0,1.0); /* The flag */ d_gfxFlag = new GFXObject; *d_gfxFlag = *gfxField; d_gfxFlag->setColors(1.0, 0.0, 0.0); delete gfxField;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -