本文整理匯總了C++中Billboard::SetSize方法的典型用法代碼示例。如果您正苦於以下問題:C++ Billboard::SetSize方法的具體用法?C++ Billboard::SetSize怎麽用?C++ Billboard::SetSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Billboard
的用法示例。
在下文中一共展示了Billboard::SetSize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: Init
void Billboard_Test::Init(Scene * scene)
{
BillboardPtr ptr = scene->AddBillboard();
Billboard * b = ptr.Get();
b->SetSize(20.0f, 20.0f);
b->UseDiffuseTexture(true);
b->SetDiffuseTexture("assets/fire.png");
StaticVert verts[4];
verts[0].pos = Vector3(-1.0f, -1.0f, 0.0f);
verts[1].pos = Vector3(-1.0f, 1.0f, 0.0f);
verts[2].pos = Vector3(1.0f, 1.0f, 0.0f);
verts[3].pos = Vector3(1.0f, -1.0f, 0.0f);
verts[0].u = 0.0f;
verts[0].v = 1.0f;
verts[1].u = 0.0f;
verts[1].v = 0.0f;
verts[2].u = 1.0f;
verts[2].v = 0.0f;
verts[3].u = 1.0f;
verts[3].v = 1.0f;
unsigned int ind[] = { 0, 1, 3, 1, 3, 2 };
ModelCreator<StaticVert> creator;
creator.StartMesh();
creator.SetTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
creator.SetDrawMethod(DM_DRAW_INDEXED);
creator.SetVertexBuffer(verts, sizeof(verts), sizeof(StaticVert));
creator.SetIndexBuffer(ind, 6);
creator.EndMesh();
StaticEntityPtr triPtr = scene->AddStaticEntity(creator, "tri");
StaticEntity * tri = triPtr.Get();
tri->Illuminate(false);
tri->SetPosition(50.0f, 0.0f, 0.0f);
tri->SetScale(20.0f, 20.0f, 2.0f);
Material * mat = tri->GetMaterial(0);
mat->UseDiffuseMap(true);
mat->SetDiffuseMap("assets/fire.png");
mat->SetEmmisivePower(1);
}
示例2: Load
bool FuelCell::Load(File*)
{
Vec3f p = GetPos();
float s = 5.0f; // TODO CONFIG
m_aabb.Set(p.x - s, p.x + s, p.y - s, p.y + s, p.z - s, p.z + s);
FuelNode* sm = new FuelNode;
sm->SetAABB(m_aabb);
SetSceneNode(sm);
Billboard* bb = new Billboard;
Texture* tex = (Texture*)TheResourceManager::Instance()->GetRes("flare.png");
bb->SetTexture(tex);
bb->SetSize(30.0f); // TODO CONFIG
bb->SetAABB(m_aabb);
sm->AddChild(bb);
return true;
}
示例3: init
void init()
{
glClearColor(0.5, 0.5, 1.0, 1);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// Note that the light is defined in the eye or camera frame.
GLfloat light_position[] = {0.0, 0.0, 0.0, 1.0};
GLfloat ambient[] = {0.3, 0.3, 0.3, 1};
GLfloat diffuse[] = {1.0, 1.0, 1.0, 1};
GLfloat specular[] = {1.0, 1.0, 1.0, 1};
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
// Generate display list for the surveillance camera.
surveillanceCameraID = glGenLists(1);
glNewList(surveillanceCameraID, GL_COMPILE);
surveillanceCamera.Draw();
glEndList();
// Generate display list for the car.
carID = glGenLists(1);
glNewList(carID, GL_COMPILE);
car.Draw();
glEndList();
board.SetLocation(boardPos);
board.SetOrientation(boarddirection);
board.SetSize(3, 2.5);
board.ReadFile("Square.ppm");
board2.SetLocation(boardPos2);
board2.SetOrientation(boarddirection2);
board2.SetSize(5, 3.5);
board2.ReadFile("wendys.ppm");
// Generate the display list for terrain, including road and grass.
terrainID = glGenLists(1);
glNewList(terrainID, GL_COMPILE);
glDisable(GL_LIGHTING);
// Grass
glColor3f(0, 0.7, 0);
glBegin(GL_QUADS);
glVertex3f(-1000, 0, 1000);
glVertex3f(-10, 0, 1000);
glVertex3f(-10, 0, 10);
glVertex3f(-1000, 0, 10);
glVertex3f(10, 0, 1000);
glVertex3f(1000, 0, 1000);
glVertex3f(1000, 0, 10);
glVertex3f(10, 0, 10);
glVertex3f(10, 0, -10);
glVertex3f(1000, 0, -10);
glVertex3f(1000, 0, -1000);
glVertex3f(10, 0, -1000);
glVertex3f(-1000, 0, -10);
glVertex3f(-10, 0, -10);
glVertex3f(-10, 0, -1000);
glVertex3f(-1000, 0, -1000);
glEnd();
// Roads
glBegin(GL_QUADS);
glColor3f(0.2, 0.2, 0.2);
glVertex3f(-10, 0, 1000);
glVertex3f(10, 0, 1000);
glVertex3f(10, 0, -1000);
glVertex3f(-10, 0, -1000);
glVertex3f(-1000, 0, 10);
glVertex3f(1000, 0, 10);
glVertex3f(1000, 0, -10);
glVertex3f(-1000, 0, -10);
glEnd();
// Yellow line South
glBegin(GL_POLYGON);
glColor3f(1, 1, 0);
//.........這裏部分代碼省略.........