本文整理汇总了C++中ogre::ColourValue类的典型用法代码示例。如果您正苦于以下问题:C++ ColourValue类的具体用法?C++ ColourValue怎么用?C++ ColourValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ColourValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configureFog
void RenderingManager::configureFog(const MWWorld::CellStore &mCell)
{
Ogre::ColourValue color;
color.setAsABGR (mCell.getCell()->mAmbi.mFog);
configureFog (mCell.getCell()->mAmbi.mFogDensity, color);
}
示例2: configureFog
void RenderingManager::configureFog(ESMS::CellStore<MWWorld::RefData> &mCell)
{
Ogre::ColourValue color;
color.setAsABGR (mCell.cell->ambi.fog);
configureFog(mCell.cell->ambi.fogDensity, color);
}
示例3: setBackgroundColor
void OgreWidget::setBackgroundColor(QColor c)
{
if (m_viewport)
{
Ogre::ColourValue ogreColour;
ogreColour.setAsARGB(c.rgba());
m_viewport->setBackgroundColour(ogreColour);
}
}
示例4: 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);
}
}
示例5: setAmbient
void CSVRender::UnpagedWorldspaceWidget::update()
{
const CSMWorld::Record<CSMWorld::Cell>& record =
dynamic_cast<const CSMWorld::Record<CSMWorld::Cell>&> (mCellsModel->getRecord (mCellId));
Ogre::ColourValue colour;
colour.setAsABGR (record.get().mAmbi.mAmbient);
setAmbient (colour);
/// \todo deal with mSunlight and mFog/mForDensity
}
示例6: configureFog
// configure fog according to cell
void InteriorCellRender::configureFog()
{
Ogre::ColourValue color;
color.setAsABGR (cell.cell->ambi.fog);
float high = 4500 + 9000 * (1-cell.cell->ambi.fogDensity);
float low = 200;
scene.getMgr()->setFog (FOG_LINEAR, color, 0, low, high);
scene.getCamera()->setFarClipDistance (high + 10);
scene.getViewport()->setBackgroundColour (color);
}
示例7: configureAmbient
void InteriorCellRender::configureAmbient()
{
ambientColor.setAsABGR (cell.cell->ambi.ambient);
setAmbientMode();
// Create a "sun" that shines light downwards. It doesn't look
// completely right, but leave it for now.
Ogre::Light *light = scene.getMgr()->createLight();
Ogre::ColourValue colour;
colour.setAsABGR (cell.cell->ambi.sunlight);
light->setDiffuseColour (colour);
light->setType(Ogre::Light::LT_DIRECTIONAL);
light->setDirection(0,-1,0);
}
示例8: configureAmbient
void RenderingManager::configureAmbient(MWWorld::Ptr::CellStore &mCell)
{
mAmbientColor.setAsABGR (mCell.mCell->mAmbi.mAmbient);
setAmbientMode();
// Create a "sun" that shines light downwards. It doesn't look
// completely right, but leave it for now.
if(!mSun)
{
mSun = mRendering.getScene()->createLight();
}
Ogre::ColourValue colour;
colour.setAsABGR (mCell.mCell->mAmbi.mSunlight);
mSun->setDiffuseColour (colour);
mSun->setType(Ogre::Light::LT_DIRECTIONAL);
mSun->setDirection(0,-1,0);
}
示例9: configureAmbient
void RenderingManager::configureAmbient(MWWorld::CellStore &mCell)
{
if (mCell.getCell()->mData.mFlags & ESM::Cell::Interior)
mAmbientColor.setAsABGR (mCell.getCell()->mAmbi.mAmbient);
setAmbientMode();
// Create a "sun" that shines light downwards. It doesn't look
// completely right, but leave it for now.
if(!mSun)
{
mSun = mRendering.getScene()->createLight();
mSun->setType(Ogre::Light::LT_DIRECTIONAL);
}
if (mCell.getCell()->mData.mFlags & ESM::Cell::Interior)
{
Ogre::ColourValue colour;
colour.setAsABGR (mCell.getCell()->mAmbi.mSunlight);
mSun->setDiffuseColour (colour);
mSun->setDirection(1,-1,-1);
sunEnable(false);
}
}
示例10: BuildUIForObject
void CReflectiveUI::BuildUIForObject(CMFCPropertyGridProperty* root, RTTIObject* pObject, const char* szName )
{
CMFCPropertyGridProperty* pRoot = new CMFCPropertyGridProperty(szName);
if (root)
{
root->AddSubItem( pRoot );
}
else
{
m_pGrid->AddProperty(pRoot);
}
std::vector<BaseProperty*> Properties;
pObject->GetRTTI()->EnumProperties( Properties );
for ( size_t i = 0; i < Properties.size(); i++ )
{
switch ( Properties[i]->GetTypeID() )
{
case eptBool:
{
AddPropertyToGrid<bool>(pRoot, pObject, Properties[i]);
break;
}
case eptByte:
{
AddPropertyToGrid<char>(pRoot, pObject, Properties[i]);
break;
}
case eptInt:
{
AddPropertyToGrid<int>(pRoot, pObject, Properties[i]);
break;
}
case eptShort:
{
AddPropertyToGrid<short>(pRoot, pObject, Properties[i]);
break;
}
case eptLong :
{
AddPropertyToGrid<long>(pRoot, pObject, Properties[i]);
break;
}
case eptPtr:
{
TypedProperty<RTTIObject*>* pTypedProperty = (TypedProperty<RTTIObject*>*)Properties[i];
BuildUIForObject(pRoot
, pTypedProperty->GetValue( pObject )
, pTypedProperty->GetName().c_str()
);
break;
}
case eptOgreReal:
{
AddPropertyToGrid<Ogre::Real>(pRoot, pObject, Properties[i]);
break;
}
case eptOgreString:
{
AddPropertyToGrid_AsString<Ogre::String>(pRoot, pObject, Properties[i]);
break;
}
case eptOgreVector2:
{
AddPropertyToGrid_AsString<Ogre::Vector2>(pRoot, pObject, Properties[i]);
}
break;
case eptOgreVector3:
{
AddPropertyToGrid_AsString<Ogre::Vector3>(pRoot, pObject, Properties[i]);
}
break;
case eptOgreVector4:
{
AddPropertyToGrid_AsString<Ogre::Vector4>(pRoot, pObject, Properties[i]);
}
break;
case eptOgreColorValue:
{
TypedProperty<Ogre::ColourValue>* pTypedProperty = (TypedProperty<Ogre::ColourValue>*)Properties[i];
Ogre::ColourValue val = pTypedProperty->GetValue(pObject);
CMFCPropertyGridProperty* pGrid = new CMFCPropertyGridColorProperty(
pTypedProperty->GetName().c_str()
, val.getAsRGBA()
, 0
, pTypedProperty->GetDescription().c_str()
);
pRoot->AddSubItem( pGrid );
CReflectiveUI::SPropertyObject PO(Properties[i], pObject);
_GridPropertyMap[pGrid] = PO;
}
break;
case eptOgreQuaternion:
{
AddPropertyToGrid_AsString<Ogre::Quaternion>(pRoot, pObject, Properties[i]);
}
//.........这里部分代码省略.........
示例11: operator
bool operator()(const Ogre::ColourValue &a, const Ogre::ColourValue &b) const
{
return a.getAsBGRA() < b.getAsBGRA();
}
示例12: createChunk
void CubeWorld::createChunk (Ogre::ManualObject* MeshChunk, const int StartX, const int StartY, const int StartZ)
{
block_t LastBlock = 0;
//Ogre::ManualObject* MeshChunk = new Ogre::ManualObject("MeshMatChunk" + Ogre::StringConverter::toString(m_ChunkID));
//MeshChunk->begin("TerrainImage");
int iVertex = 0;
block_t Block;
block_t Block1;
/* Only create visible faces of each chunk */
block_t DefaultBlock = 1;
int SX = 0;
int SY = 0;
int SZ = 0;
int MaxSize = WORLD_SIZE;
float V1, V2;
float BlockLight;
Ogre::ColourValue BlockColory1; //Top face
Ogre::ColourValue BlockColory2; //Bottom face
Ogre::ColourValue BlockColorx1; //Sunset face
Ogre::ColourValue BlockColorx2; //Sunrise face
Ogre::ColourValue BlockColorz; //Front/back faces
for (int z = StartZ; z < CHUNK_SIZE + StartZ; ++z)
{
for (int y = StartY; y < CHUNK_SIZE + StartY; ++y)
{
for (int x = StartX; x < CHUNK_SIZE + StartX; ++x)
{
Block = GetBlock(x,y,z);
if (Block == 0) continue; // Ignore air blocks
if (Block == 5) continue; // Ignore water blocks
//Compute the block's texture coordinates
V1 = 0.25f * (float)(Block - 1);
V2 = V1 + 0.25f;
BlockLight = GetBlockLight(x, y, z) / 255.0f; //For the two x faces
float BlockLight1 = BlockLight * 0.9f; //For the two z faces
float BlockLight2 = BlockLight * 0.8f; //For the two y faces
// std::cerr << "*** BlockLight: " << BlockLight << std::endl;
// std::cerr << "*** BlockLight1: " << BlockLight1 << std::endl;
// std::cerr << "*** BlockLight2: " << BlockLight2 << std::endl;
float BaseLight = GetBlockLight(x, y, z) / 255.0f;
float Factor;
if (m_LightAngle >= 0 && m_LightAngle <= 180)
Factor = sin(m_LightAngle * 3.1415926f / 180.0f);
else
Factor = 0;
if (Factor < 0.1f)
Factor = 0.1f;
BlockColory1 = m_LightColor * (Factor * BaseLight) + m_AmbientColor;
BlockColory1.saturate();
BlockColory2 = m_LightColor * (Factor / 2.0f * BaseLight) + m_AmbientColor;
BlockColory2.saturate();
BlockColorz = m_LightColor * (Factor * 0.70f * BaseLight) + m_AmbientColor;
BlockColorz.saturate();
BlockColorz *= 0.80f;
if (m_LightAngle >= 315 || m_LightAngle <= 45)
Factor = fabs(cos(m_LightAngle * 3.1415926f / 180.0f));
else
Factor = fabs(sin(m_LightAngle * 3.1415926f / 180.0f));
if (Factor < 0.1f)
Factor = 0.1f;
BlockColorx1 = m_LightColor * (Factor * 0.80f * BaseLight) + m_AmbientColor;
BlockColorx1.saturate();
BlockColorx1 *= 0.95f;
if (m_LightAngle >= 135 && m_LightAngle <= 225)
Factor = fabs(cos(m_LightAngle * 3.1415926f / 180.0f));
else
Factor = fabs(sin(m_LightAngle * 3.1415926f / 180.0f));
if (Factor < 0.1f)
Factor = 0.1f;
BlockColorx2 = m_LightColor * (Factor * 0.80f * BaseLight) + m_AmbientColor;
BlockColorx2.saturate();
BlockColorx2 *= 0.95f;
Block1 = DefaultBlock;
if (x > SX)
Block1 = GetBlock(x-1,y,z);
//x-1
if (g_BlockInfo[Block1].Transparent)
{
MeshChunk->position(x, y, z+1); MeshChunk->normal(-1,0,0); MeshChunk->textureCoord(0, V2); MeshChunk->colour(BlockColorx1);
MeshChunk->position(x, y+1, z+1); MeshChunk->normal(-1,0,0); MeshChunk->textureCoord(1, V2); MeshChunk->colour(BlockColorx1);
MeshChunk->position(x, y+1, z); MeshChunk->normal(-1,0,0); MeshChunk->textureCoord(1, V1); MeshChunk->colour(BlockColorx1);
MeshChunk->position(x, y, z); MeshChunk->normal(-1,0,0); MeshChunk->textureCoord(0, V1); MeshChunk->colour(BlockColorx1);
MeshChunk->triangle(iVertex, iVertex+1, iVertex+2);
MeshChunk->triangle(iVertex+2, iVertex+3, iVertex);
//.........这里部分代码省略.........
示例13: setSubMeshColors
bool MaterialVertexBuffer::setSubMeshColors(
EntityMaterial* entity,
unsigned short mesh_index,
size_t ui32VertexColorCount,
const float* pVertexColorArray) const
{
if(entity->getOgreEntity() == NULL)
{
m_rKernelContext.getLogManager() << LogLevel_Error << "Can't set colors : no Entity found!\n";
return false;
}
Ogre::Mesh* mesh = entity->getOgreEntity()->getMesh().get();
if(mesh == NULL || mesh_index >= mesh->getNumSubMeshes())
{
m_rKernelContext.getLogManager() << LogLevel_Error << "Can't set colors : no Mesh found!\n";
return false;
}
Ogre::SubMesh* submesh = mesh->getSubMesh( mesh_index );
if(submesh->useSharedVertices)
{
m_rKernelContext.getLogManager() << LogLevel_Error << "Can't set colors : vertices are shared and thus not accessible from SubMesh!\n";
return false;
}
else
{
if(ui32VertexColorCount != submesh->vertexData->vertexCount)
{
m_rKernelContext.getLogManager() << LogLevel_Error << "Can't set colors : vertex count mismatch!\n";
return false;
}
//get pointer to submesh vertex data
Ogre::VertexData* vertex_data = submesh->vertexData;
//get pointer to DIFFUSE element
const Ogre::VertexElement* difElem = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_DIFFUSE);
if(difElem == NULL)
{
m_rKernelContext.getLogManager() << LogLevel_Error << "Can't set colors : no colours_diffuse element found in vertex buffer!\n";
return false;
}
//convert color to current RenderSystem's format
Ogre::VertexElementType type = difElem->getType();
//retrieve VB for DIFFUSE element
Ogre::HardwareVertexBufferSharedPtr vbuf = vertex_data->vertexBufferBinding->getBuffer(difElem->getSource());
//lock VB for reading
unsigned char* color = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_NORMAL));
// There is _no_ baseVertexPointerToElement() which takes an Ogre::Real or a double
// as second argument. So make it float, to avoid trouble when Ogre::Real will
// be comiled/typedefed as double:
// Ogre::Real* pReal;
Ogre::RGBA* pRGBA;
Ogre::ColourValue colour;
for( size_t j = 0; j < vertex_data->vertexCount; ++j, color += vbuf->getVertexSize())
{
//get pointer to RGBA DIFFUSE data
difElem->baseVertexPointerToElement(color, &pRGBA);
colour.r = pVertexColorArray[4*j];
colour.g = pVertexColorArray[4*j+1];
colour.b = pVertexColorArray[4*j+2];
colour.a = pVertexColorArray[4*j+3];
//convert color from RGBA floats to a single ARGB uint32
if(type == Ogre::VET_COLOUR_ARGB) //D3D format
{
*pRGBA = colour.getAsARGB();
}
else /*if type == OGRE::VET_COLOUR_ABGR)*/ //GL format
{
*pRGBA = colour.getAsABGR();
}
}
//unlock VB
vbuf->unlock();
}
return true;
}
示例14: setDefaultShadowColour
void PlantAreaQueryResult::setDefaultShadowColour(const Ogre::ColourValue& colour)
{
//Make sure to saturate so the values are clamped to [0..1]
mDefaultShadowColourValue = colour.saturateCopy();
mDefaultShadowColourLong = mDefaultShadowColourValue.getAsARGB();
}
示例15: importFont
// ----------------------------------------------------------------------
void FontSerializer::importFont(Ogre::DataStreamPtr &stream, Font *pDest)
{
uint32 fccomp;
stream->read(&fccomp, sizeof(uint32));
if(fccomp != Font::mFourCC)
SONETTO_THROW("Invalid Font File");
stream->read(&pDest->mVersion, sizeof(uint32));
stream->read(&pDest->mEncode, sizeof(uint32));
stream->read(&pDest->mVerticalOffsetTop, sizeof(float));
stream->read(&pDest->mVerticalOffsetBottom, sizeof(float));
stream->read(&pDest->mHorizontalScale, sizeof(float));
pDest->mIName = loadString(stream);
// setup material
pDest->mMaterial = Ogre::MaterialManager::getSingleton().create(pDest->mIName+"_mat",pDest->getGroup());
if(pDest->mMaterial.isNull())
SONETTO_THROW("Unable to create material for font.");
Ogre::Pass * pass = pDest->mMaterial->getTechnique(0)->getPass(0);
bool has_separate_blend;
uint32 mat_scene_blend_source;
uint32 mat_scene_blend_dest;
uint32 mat_scene_blend_source_a;
uint32 mat_scene_blend_dest_a;
stream->read(&has_separate_blend, sizeof(bool));
stream->read(&mat_scene_blend_source, sizeof(uint32));
stream->read(&mat_scene_blend_dest, sizeof(uint32));
stream->read(&mat_scene_blend_source_a, sizeof(uint32));
stream->read(&mat_scene_blend_dest_a, sizeof(uint32));
if(has_separate_blend)
{
pass->setSeparateSceneBlending( (Ogre::SceneBlendFactor)mat_scene_blend_source,
(Ogre::SceneBlendFactor)mat_scene_blend_dest,
(Ogre::SceneBlendFactor)mat_scene_blend_source_a,
(Ogre::SceneBlendFactor)mat_scene_blend_dest_a);
} else {
pass->setSceneBlending((Ogre::SceneBlendFactor)mat_scene_blend_source,(Ogre::SceneBlendFactor)mat_scene_blend_dest);
}
uint32 mat_alpha_reject_func;
uint8 mat_alpha_reject_val;
bool map_alpha_reject_atc;
stream->read(&mat_alpha_reject_func, sizeof(uint32));
stream->read(&mat_alpha_reject_val, sizeof(uint8));
stream->read(&map_alpha_reject_atc, sizeof(bool));
pass->setAlphaRejectSettings((Ogre::CompareFunction) mat_alpha_reject_func, mat_alpha_reject_val, map_alpha_reject_atc);
pass->setDepthCheckEnabled(false);
pass->setDepthWriteEnabled(false);
pass->setLightingEnabled(false);
Ogre::TextureUnitState * tex_unit = pass->createTextureUnitState();
uint32 tex_address_mode_u;
uint32 tex_address_mode_v;
uint32 tex_address_mode_w;
uint32 tex_filtering_min;
uint32 tex_filtering_mag;
Ogre::ColourValue tex_border_color;
stream->read(&tex_address_mode_u, sizeof(uint32));
stream->read(&tex_address_mode_v, sizeof(uint32));
stream->read(&tex_address_mode_w, sizeof(uint32));
stream->read(&tex_filtering_min, sizeof(uint32));
stream->read(&tex_filtering_mag, sizeof(uint32));
stream->read(tex_border_color.ptr(), sizeof(float) * 4);
tex_unit->setTextureAddressingMode( (Ogre::TextureUnitState::TextureAddressingMode) tex_address_mode_u,
(Ogre::TextureUnitState::TextureAddressingMode) tex_address_mode_v,
(Ogre::TextureUnitState::TextureAddressingMode) tex_address_mode_w);
tex_unit->setTextureFiltering((Ogre::FilterOptions)tex_filtering_min, (Ogre::FilterOptions)tex_filtering_mag, Ogre::FO_NONE);
tex_unit->setTextureBorderColour(tex_border_color);
uint32 numcol = 0;
stream->read(&numcol, sizeof(uint32));
for(uint32 l = 0; l != numcol; ++l)
{
std::cout << "reading color #"<<l<<"...\n";
Ogre::ColourValue color;
stream->read(color.ptr(), sizeof(float) * 4);
pDest->mColorList.push_back(color);
std::cout << "color #"<<l<<" read complete...\n";
}
std::cout << "all color values have been read correctly...\n";
std::cout << "reading font glyph list...\n";
for(uint16 i = 0; i != 256; ++i)
{
std::cout << "reading glyph #"<<(int)i<<"...\n";
FontGlyph glyph;
stream->read(&glyph, sizeof(FontGlyph));
pDest->mGlyph.push_back(glyph);
std::cout << "glyph #"<<(int)i<<" read complete...\n";
}
std::cout << "all font glyph have been read correctly...\n";
// size_t width, size_t height, size_t depth, size_t pixel format
size_t txt_width, txt_height, txt_depth, txt_pixelformat, txt_faces, txt_mipmaps = 0;
//.........这里部分代码省略.........