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


C++ ColourValue::setAsRGBA方法代码示例

本文整理汇总了C++中ogre::ColourValue::setAsRGBA方法的典型用法代码示例。如果您正苦于以下问题:C++ ColourValue::setAsRGBA方法的具体用法?C++ ColourValue::setAsRGBA怎么用?C++ ColourValue::setAsRGBA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::ColourValue的用法示例。


在下文中一共展示了ColourValue::setAsRGBA方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: applyTintColour

void GameObjectFlashLight::applyTintColour(int colour)
{
	Ogre::ColourValue tint;
	tint.setAsRGBA(colour);
	Ogre::MaterialPtr mat=Ogre::MaterialManager::getSingleton().getByName(CONE_MATERIAL_NAME);
	Ogre::TextureUnitState* tex= mat->getTechnique(0)->getPass(0)->getTextureUnitState(0);
	if (tex)
	{
		tex->setColourOperationEx(Ogre::LBX_MODULATE,Ogre::LBS_MANUAL,Ogre::LBS_CURRENT,tint);
	}
}
开发者ID:juanjmostazo,项目名称:once-upon-a-night,代码行数:11,代码来源:GameObjectFlashLight.cpp

示例2: generateSideMesh


//.........这里部分代码省略.........
            case Item::NormalLeavesTexture:
                texture_name = "LeavesRegular";
                break;
            case Item::RedwoodLeavesTexture:
                texture_name = "RedwoodLeaves";
                break;
            case Item::BirchLeavesTexture:
                texture_name = "BirchLeaves";
                break;
            }
        }
        break;
        case Item::Farmland:
        if (side_index == PositiveZ)
            texture_name = block.farmlandMetadata() == 0 ? "FarmlandDry" : "FarmlandWet";
        break;
        case Item::Crops:
        texture_name = QString("Crops") + QString::number(block.cropsMetadata());
        break;
        case Item::Wool:
        texture_name = c_wool_texture_names[block.woolMetadata()];
        break;
        case Item::Furnace:
        case Item::BurningFurnace:
        case Item::Dispenser:
        {
            if (side_index != NegativeZ && side_index != PositiveZ) {
                if ((block.furnaceMetadata() == Item::EastFacingFurnace && side_index == PositiveX) ||
                    (block.furnaceMetadata() == Item::WestFacingFurnace && side_index == NegativeX) ||
                    (block.furnaceMetadata() == Item::NorthFacingFurnace && side_index == PositiveY) ||
                    (block.furnaceMetadata() == Item::SouthFacingFurnace && side_index == NegativeY))
                {
                    texture_name = block_data.side_textures.value(NegativeY);
                } else {
                    texture_name = "FurnaceBack";
                }
            }
        }
        break;
        case Item::Pumpkin:
        case Item::JackOLantern:
        {
            if (side_index != NegativeZ && side_index != PositiveZ) {
                if ((block.pumpkinMetadata() == Item::EastFacingPumpkin && side_index == PositiveX) ||
                    (block.pumpkinMetadata() == Item::WestFacingPumpkin && side_index == NegativeX) ||
                    (block.pumpkinMetadata() == Item::NorthFacingPumpkin && side_index == PositiveY) ||
                    (block.pumpkinMetadata() == Item::SouthFacingPumpkin && side_index == NegativeY))
                {
                    texture_name = block_data.side_textures.value(NegativeY);
                } else {
                    texture_name = "PumpkinBack";
                }
            }
        }
        break;
        case Item::RedstoneWire_placed:
        {
            if (block.redstoneMetadata() == 0) {
                texture_name = "RedWire4wayOff";
            } else {
                texture_name = "RedWire4wayOn";
            }
        }
        break;
        default:;
    }
    MainWindow::BlockTextureCoord btc = m_owner->texCoords(texture_name);

    Ogre::Vector3 squish = block_data.squish_amount.at(side_index);

    float brightness;
    int night_darkness = 0;
    brightness = c_light_brightness[qMax(neighbor_block.skyLight() - night_darkness, neighbor_block.light())];

    Ogre::ColourValue color = Ogre::ColourValue::White;
    if (block.type() == Item::Grass && side_index == PositiveZ)
        color.setAsRGBA(0x8DD55EFF);
    else if (block.type() == Item::Leaves)
        color.setAsRGBA(0x8DD55EFF);

    color *= brightness;
    color *= c_brightness_bias[side_index];

    for (int triangle_index = 0; triangle_index < 2; triangle_index++) {
        for (int point_index = 0; point_index < 3; point_index++) {
            Ogre::Vector3 pos = c_side_coord[side_index][triangle_index][point_index] - squish;
            if (block_data.rotate) {
                pos -= 0.5f;
                pos = Ogre::Quaternion(Ogre::Degree(45), Ogre::Vector3::UNIT_Z) * pos;
                pos += 0.5f;
            }
            obj->position(pos + abs_block_loc);

            Ogre::Vector2 tex_coord = c_tex_coord[triangle_index][point_index];
            obj->textureCoord((btc.x+tex_coord.x*btc.w) / c_terrain_png_width, (btc.y+tex_coord.y*btc.h) / c_terrain_png_height);

            obj->colour(color);
        }
    }
}
开发者ID:Innefektiv,项目名称:mineflayer,代码行数:101,代码来源:SubChunkMeshGenerator.cpp


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