当前位置: 首页>>代码示例>>C++>>正文


C++ Part::addScale方法代码示例

本文整理汇总了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);
    }
}
开发者ID:jeffwmair,项目名称:rebel_defence,代码行数:36,代码来源:main.cpp

示例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);
}
开发者ID:jeffwmair,项目名称:rebel_defence,代码行数:15,代码来源:main.cpp

示例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);
    
}
开发者ID:jeffwmair,项目名称:rebel_defence,代码行数:16,代码来源:main.cpp

示例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);
    }
}
开发者ID:jeffwmair,项目名称:rebel_defence,代码行数:17,代码来源:main.cpp


注:本文中的Part::addScale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。