本文整理汇总了C++中Part::addScale方法的典型用法代码示例。如果您正苦于以下问题:C++ Part::addScale方法的具体用法?C++ Part::addScale怎么用?C++ Part::addScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part::addScale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTrees
void addTrees() {
for(int i = 0; i < 150; i++) {
Part * trunk = new Part(ID_TREE_BARK, textureMapCylinder, cylMesh, -1);
Part * top = new Part(treeTopMesh, -1);
parts.push_back(trunk);
trunk->addChild(top);
int area = WORLD_SZ;
int xLoc = (rand() % area*2) - area;
int zLoc = (rand() % area * 0.2) - area;
int yLoc = -10;
float scaleRand = getRandFloat01() - 0.3;
float scale1 = 1.75f + scaleRand;
float scale2 = scale1*3;
trunk->addScale(scale1/4.0, scale1*3, scale1/4.0);
trunk->addTranslation(xLoc, yLoc, zLoc);
float trunkG = 0.05;
float trunkR = 0.1;
trunk->setMaterialAmbient(trunkR, trunkG, 0.0, 1.0);
trunk->setMaterialDiffuse(trunkR, trunkG, 0.0, 1.0);
trunk->setMaterialSpecular(0, 0, 0, 1.0);
trunk->setMaterialShininess(0);
float topR = 0.05;
float topG = 0.2;
float topB = 0.05;
top->addScale(scale2, scale2/4, scale2);
top->addTranslation(0, 150, 0);
top->setMaterialAmbient(topR, topG, topB, 1.0);
top->setMaterialDiffuse(topR, topG, topB, 1.0);
top->setMaterialSpecular(0, 0, 0, 1.0);
top->setMaterialShininess(0);
}
}
示例2: addDeathStar
void addDeathStar() {
Part * deathStar = new Part(ID_METAL, textureMapSphere1, sphereMesh, -1);
int dsScale = 15;
float amb = 1.0;
float diff = 1.0;
float spec = 1.0;
deathStar->addScale(dsScale, dsScale, dsScale);
deathStar->addTranslation(-7000, 4000, -19250);
deathStar->setMaterialAmbient(amb, amb, amb, 1.0);
deathStar->setMaterialDiffuse(diff, diff, diff, 1.0);
deathStar->setMaterialSpecular(spec, spec, spec, 1.0);
deathStar->setMaterialShininess(1.0);
parts.push_back(deathStar);
}
示例3: addMoon
void addMoon() {
Part * moon = new Part(sphereMesh, -1);
int scale = 4;
float amb = 1.0;
float diff = 0.9;
float spec = 1.0;
moon->addScale(0.75 * scale, scale, scale);
moon->addTranslation(7000, 5000, -18000);
moon->setMaterialAmbient(amb, amb, amb*0.3, 1.0);
moon->setMaterialDiffuse(diff, diff, diff, 1.0);
moon->setMaterialSpecular(spec, spec, spec, 1.0);
moon->setMaterialShininess(1.0);
parts.push_back(moon);
}
示例4: addNightStars
void addNightStars() {
for(int i = 0; i < 150; i++) {
Part * star = new Part(starMesh, -1);
int area = WORLD_SZ * 0.5;
int xLoc = (rand() % area) - area/2;
int zLoc = (rand() % area) - area;
int yLoc = (rand() % 5000) + 1000;
float starScale = 0.25*getRandFloat01();
star->addScale(starScale, starScale, starScale);
star->addTranslation(xLoc, yLoc, zLoc);
star->setMaterialAmbient(getRandFloat01(), getRandFloat01(), getRandFloat01(), 1.0);
star->setMaterialDiffuse(getRandFloat01(), getRandFloat01(), getRandFloat01(), 1.0);
star->setMaterialSpecular(1.0, 1.0, 1.0, 1.0);
star->setMaterialShininess(1.0);
parts.push_back(star);
}
}