• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ogre::ColourValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了ColourValue类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:as641219987,项目名称:openmw,代码行数:7,代码来源:renderingmanager.cpp


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


示例3: setBackgroundColor

void  OgreWidget::setBackgroundColor(QColor c)
{
  if (m_viewport)
    {
      Ogre::ColourValue ogreColour;
      ogreColour.setAsARGB(c.rgba());
      m_viewport->setBackgroundColour(ogreColour);
    }
}
开发者ID:ShrademnThill,项目名称:ogre-construction-set,代码行数:9,代码来源:OgreWidget.cpp


示例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);
	}
}
开发者ID:juanjmostazo,项目名称:once-upon-a-night,代码行数:11,代码来源:GameObjectFlashLight.cpp


示例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
}
开发者ID:Chiur,项目名称:openmw,代码行数:11,代码来源:unpagedworldspacewidget.cpp


示例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);
}
开发者ID:Senney,项目名称:openmw,代码行数:13,代码来源:interior.cpp


示例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);
}
开发者ID:Senney,项目名称:openmw,代码行数:14,代码来源:interior.cpp


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


示例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);
    }
}
开发者ID:as641219987,项目名称:openmw,代码行数:22,代码来源:renderingmanager.cpp


示例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]);
			}
//.........这里部分代码省略.........
开发者ID:windrobin,项目名称:ogremeshviewer,代码行数:101,代码来源:ReflectiveUI.cpp


示例11: operator

 bool operator()(const Ogre::ColourValue &a, const Ogre::ColourValue &b) const
 {
     return a.getAsBGRA() < b.getAsBGRA();
 }
开发者ID:jhooks1,项目名称:openmw,代码行数:4,代码来源:selectionbuffer.hpp


示例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);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


示例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;
}
开发者ID:Akanoa,项目名称:PRI,代码行数:90,代码来源:ovkMaterialAction.cpp


示例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();
}
开发者ID:Arsakes,项目名称:ember,代码行数:6,代码来源:PlantAreaQueryResult.cpp


示例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;
//.........这里部分代码省略.........
开发者ID:gmasucci,项目名称:sonetto,代码行数:101,代码来源:SonettoFontSerializer.cpp


示例16: 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


示例17: OnPropertyChanged

void CReflectiveUI::OnPropertyChanged(CMFCPropertyGridProperty* pProp)
{
	//if (!ValidateItemData(pProp))
	//{
	//	return;
	//}

	CMFCPropertyGridProperty* pItem = pProp;

	const COleVariant variant = pItem->GetValue();

	assert( _GridPropertyMap.find(pItem) != _GridPropertyMap.end() );
	SPropertyObject PO = _GridPropertyMap[pItem];

	switch ( PO._pProperty->GetTypeID() )
	{
	case eptBool:
		{
			TypedProperty<bool>* pTypedProperty = (TypedProperty<bool>*)PO._pProperty;
			pTypedProperty->SetValue( PO._pObject, pItem->GetValue().boolVal != 0);
			break;
		}
	case eptByte:
		{
			TypedProperty<char>* pTypedProperty = (TypedProperty<char>*)PO._pProperty;
			pTypedProperty->SetValue( PO._pObject, pItem->GetValue().bVal );
			break;
		}
	case eptShort:
		{
			TypedProperty<short>* pTypedProperty = (TypedProperty<short>*)PO._pProperty;
			pTypedProperty->SetValue( PO._pObject, pItem->GetValue().iVal );
			break;
		}
	case eptInt:
		{
			TypedProperty<int>* pTypedProperty = (TypedProperty<int>*)PO._pProperty;
			pTypedProperty->SetValue( PO._pObject, pItem->GetValue().intVal );
			break;
		}
	case eptLong:
		{
			TypedProperty<long>* pTypedProperty = (TypedProperty<long>*)PO._pProperty;
			pTypedProperty->SetValue( PO._pObject, pItem->GetValue().lVal );
			break;
		}
	case eptPtr:
		{
			break;
		}
	case eptOgreReal:
		{
			TypedProperty<Ogre::Real>* pTypedProperty = (TypedProperty<Ogre::Real>*)PO._pProperty;
			pTypedProperty->SetValue( PO._pObject, pItem->GetValue().fltVal );
			break;
		}
	case eptOgreString:
		{
			TypedProperty<Ogre::String>* pTypedProperty = (TypedProperty<Ogre::String>*)PO._pProperty;
			GString gStr(pItem->GetValue().bstrVal);
			pTypedProperty->SetValueFromString( PO._pObject, gStr.ToMbcs() );
			break;
		}
	case eptOgreVector2:
		{
			TypedProperty<Ogre::Vector2>* pTypedProperty = (TypedProperty<Ogre::Vector2>*)PO._pProperty;
			GString gStr(pItem->GetValue().bstrVal);
			pTypedProperty->SetValueFromString( PO._pObject, gStr.ToMbcs() );
		}
		break;
	case eptOgreVector3:
		{
			TypedProperty<Ogre::Vector3>* pTypedProperty = (TypedProperty<Ogre::Vector3>*)PO._pProperty;
			GString gStr(pItem->GetValue().bstrVal);
			pTypedProperty->SetValueFromString( PO._pObject, gStr.ToMbcs() );
		}
		break;
	case eptOgreVector4:
		{
			TypedProperty<Ogre::Vector4>* pTypedProperty = (TypedProperty<Ogre::Vector4>*)PO._pProperty;
			GString gStr(pItem->GetValue().bstrVal);
			pTypedProperty->SetValueFromString( PO._pObject, gStr.ToMbcs() );
		}
		break;
	case eptOgreColorValue:
		{
			TypedProperty<Ogre::ColourValue>* pTypedProperty = (TypedProperty<Ogre::ColourValue>*)PO._pProperty;
			Ogre::ColourValue val;
			val.setAsABGR(pItem->GetValue().intVal);
			pTypedProperty->SetValue( PO._pObject, val);
		}
		break;
	case eptOgreQuaternion:
		{
			TypedProperty<Ogre::Quaternion>* pTypedProperty = (TypedProperty<Ogre::Quaternion>*)PO._pProperty;
			GString gStr(pItem->GetValue().bstrVal);
			pTypedProperty->SetValueFromString( PO._pObject, gStr.ToMbcs() );
		}
		break;
	case eptOgreMatrix3:
//.........这里部分代码省略.........
开发者ID:windrobin,项目名称:ogremeshviewer,代码行数:101,代码来源:ReflectiveUI.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ogre::ConfigFile类代码示例发布时间:2022-05-31
下一篇:
C++ ogre::Camera类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap