本文整理汇总了C++中Maze::cellToPx方法的典型用法代码示例。如果您正苦于以下问题:C++ Maze::cellToPx方法的具体用法?C++ Maze::cellToPx怎么用?C++ Maze::cellToPx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maze
的用法示例。
在下文中一共展示了Maze::cellToPx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reloadLevel
void ColoredCubeApp::reloadLevel()
{
currentKeys = 0;
flashLightObject.getBattery();
//add in the maze reset function
Dimension d;
d.x=20;
d.z = 20;
maze.init(d,mfxWVPVar,mfxWorldVar,md3dDevice);
maze.build();
/*maze.setTex(mfxDiffuseMapVar,mfxSpecMapVar,L"brickwork-texture.jpg",L"brickwork-bump-map.jpg");
maze.setCeilTex(mfxDiffuseMapVar,mfxSpecMapVar,L"13.free-brick-textures.jpg",L"brickwork-bump-map.jpg");
maze.setFloorTex(mfxDiffuseMapVar,mfxSpecMapVar,L"carpet_diffuse.jpg",L"brickwork-bump-map.jpg");*/
for(int i = 0; i < numLightObjects; i++)
{
Location l;
l.x = rand()%mazeX;
l.z = rand()%mazeZ;
auto spot = maze.cellToPx(l);
lamps[i].setPosition(Vector3(spot.x,5,spot.z));
}
for(int i = 0; i < totalKeys; i++)
{
Location l;
l.x = rand()%mazeX;
l.z = rand()%mazeZ;
auto spot = maze.cellToPx(l);
keyObject[i].setPosition(Vector3(spot.x,-1,spot.z));
keyObject[i].setActive();
}
for(int i = 0; i < numBatteries; i++)
{
Location l;
l.x = rand()%mazeX;
l.z = rand()%mazeZ;
auto spot = maze.cellToPx(l);
batteries[i].setPosition(Vector3(spot.x,-1,spot.z));
batteries[i].setActive();
}
}
示例2: initApp
void ColoredCubeApp::initApp()
{
D3DApp::initApp();
//0: Parallel
//1: Point
//2: Spot
hurtLight = D3DXCOLOR(1,0,0,1);
ambientLight = D3DXCOLOR(0.3f, 0.03f, 0.2f, 1.0f);
//ambientLight = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
lights[1].ambient = ambientLight;
lights[1].diffuse = D3DXCOLOR(0.0f, 0.02f, 0.02f, 1.0f);
lights[1].specular = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);
lights[1].att.x = 1.0f;
lights[1].att.y = 0.0f;
lights[1].att.z = 0.0f;
lights[1].spotPow = 20;
lights[1].range = 100;
lights[1].pos = D3DXVECTOR3(-10,20,-10);
lights[1].dir = D3DXVECTOR3(0, -1, 0);
lights[1].lightType.x = 0;
buildFX();
buildVertexLayouts();
Dimension d;
d.x = 10;
d.z = 10;
mazeX = d.x;
mazeZ = d.z;
maze.init(d,mfxWVPVar,mfxWorldVar,md3dDevice);
maze.build();
maze.setTex(mfxDiffuseMapVar,mfxSpecMapVar,L"brickwork-texture.jpg",L"brickwork-bump-map.jpg");
maze.setCeilTex(mfxDiffuseMapVar,mfxSpecMapVar,L"13.free-brick-textures.jpg",L"brickwork-bump-map.jpg");
maze.setFloorTex(mfxDiffuseMapVar,mfxSpecMapVar,L"carpet_diffuse.jpg",L"brickwork-bump-map.jpg");
camera.init(&maze);
mBox.init(md3dDevice, 1.0f);
//testMesh.init(md3dDevice,1.0f,"surfrev2.dat");
line.init(md3dDevice, 1.0f, DARKBROWN);
line2.init(md3dDevice, 1.0f, RED);
line3.init(md3dDevice, 1.0f, GREEN);
origin.init(&line,&line2,&line3,mfxWVPVar,10);
quad1.init(md3dDevice,1,D3DXCOLOR(0.5,0.25,0.1,1.0));
//make the texture init in another function so it is not an issue switching between shaders
/*floor.init(&mBox,mfxWVPVar,mfxWorldVar,2,Vector3(0,-3,0),Vector3(0,0,0),0,Vector3(20,0.1,20));
floor.setTex(mfxDiffuseMapVar,mfxSpecMapVar,L"WoodCrate01.dds",L"defaultspec.dds");
wall1.init(&mBox,mfxWVPVar,mfxWorldVar,2,Vector3(-20,-3+20,0),Vector3(0,0,0),0,Vector3(0.1,20,20));
wall2.init(&mBox,mfxWVPVar,mfxWorldVar,2,Vector3(20,-3+20,0),Vector3(0,0,0),0,Vector3(0.1,20,20));
wall3.init(&mBox,mfxWVPVar,mfxWorldVar,2,Vector3(0,-3+20,20),Vector3(0,0,0),0,Vector3(20,20,0.1));
wall4.init(&mBox,mfxWVPVar,mfxWorldVar,2,Vector3(0,-3+20,-20),Vector3(0,0,0),0,Vector3(20,20,0.1));*/
player.init(&mBox,mfxWVPVar,mfxWorldVar,sqrt(2.0f),Vector3(10,0,10),Vector3(0,0,0),0,Vector3(1,1,1));
player.setTex(mfxDiffuseMapVar,mfxSpecMapVar,L"brickwork-texture.jpg",L"brickwork-bump-map.jpg");
Location start = maze.getStartPosition();
start = maze.cellToPx(start);
player.setPosition(Vector3(start.x+10,0,start.z+10));
flashLightObject.init(md3dDevice,mfxWVPVar,mfxWorldVar,2,Vector3(0,0,0),Vector3(0,0,0),0,Vector3(0.25,0.25,0.25));
flashLightObject.setRotation(Vector3(ToRadian(90),0,0));
//lightObject1.init(md3dDevice,mfxWVPVar,mfxWorldVar,2,Vector3(10,3,0),Vector3(0,0,0),0,Vector3(0.25,0.25,0.25));
//lightObject1.setTex(mfxDiffuseMapVar,mfxSpecMapVar,L"WoodCrate01.dds",L"ice.dds");
for(int i = 0; i < numLightObjects; i++)
{
lamps[i].init(md3dDevice,mfxWVPVar,mfxWorldVar,2,Vector3(10,3,0),Vector3(0,0,0),0,Vector3(0.75,0.75,0.75));
lamps[i].setTex(mfxDiffuseMapVar,mfxSpecMapVar,L"WoodCrate01.dds",L"ice.dds");
Location l;
l.x = rand()%mazeX;
l.z = rand()%mazeZ;
auto spot = maze.cellToPx(l);
lamps[i].setPosition(Vector3(spot.x,5,spot.z));
lamps[i].setColor(D3DXCOLOR(0.2f, 0.5f, 0.3f, 1.0f));
}
key.init(md3dDevice,1,"item1.txt");
for(int i = 0; i < totalKeys; i++)
{
keyObject[i].init(&key,mfxWVPVar,mfxWorldVar,sqrt(2.0f),Vector3(0,0,0),Vector3(0,0,0),0,Vector3(0.25,0.25,0.25));
Location l;
l.x = rand()%mazeX;
l.z = rand()%mazeZ;
auto spot = maze.cellToPx(l);
keyObject[i].setPosition(Vector3(spot.x,-1,spot.z));
}
endCube.init(&mBox,mfxWVPVar,mfxWorldVar,sqrt(3.0f),Vector3(0,0,0),Vector3(0,0,0),0,Vector3(2,2,2));
endCube.setTex(mfxDiffuseMapVar,mfxSpecMapVar,L"WoodCrate01.dds",L"ice.dds");
Location end = maze.getEndPosition();
end = maze.cellToPx(end);
endCube.setPosition(Vector3(end.x,0,end.z));
//.........这里部分代码省略.........