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


C++ IVideoDriver::setMaterial方法代码示例

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


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

示例1: render

// ----------------------------------------------------------------------------
void Terrain::render()
{
    if (!m_visible) return;

    IVideoDriver* driver = SceneManager->getVideoDriver();

    driver->setMaterial(m_material);
    driver->setTransform(video::ETS_WORLD, IdentityMatrix);

    driver->drawVertexPrimitiveList(&m_mesh.vertices[0], m_mesh.vertex_count,
                                    &m_mesh.indices[0], m_mesh.quad_count * 2,
                                    video::EVT_2TCOORDS, EPT_TRIANGLES,
                                    video::EIT_16BIT);

    if (m_highlight_mesh.vertices && m_highlight_visible)
    {
        driver->setMaterial(m_highlight_material);
        driver->drawVertexPrimitiveList(&m_highlight_mesh.vertices[0],
                                         m_highlight_mesh.vertex_count,
                                         &m_highlight_mesh.indices[0],
                                         m_highlight_mesh.quad_count * 2,
                                         video::EVT_2TCOORDS, EPT_TRIANGLES,
                                         video::EIT_16BIT);
    }

} // render
开发者ID:Boyquotes,项目名称:stk-editor,代码行数:27,代码来源:terrain.cpp

示例2: render

void Sprite::render()
{
    IVideoDriver* driver = SceneManager->getVideoDriver();
    driver->setMaterial(Material);
    driver->setTransform(ETS_WORLD, AbsoluteTransformation);
    driver->drawIndexedTriangleList(&Vertices[0], 4, &Indices[0], 4);
}
开发者ID:blaketrahan,项目名称:coquelicot,代码行数:7,代码来源:sprite.cpp

示例3: render

	//! render
	void CLightSceneNode::render()
	{
		IVideoDriver* driver = SceneManager->getVideoDriver();
		if (!driver)
			return;

		if (DebugDataVisible & EDS_BBOX)
		{
			driver->setTransform(ETS_WORLD, AbsoluteTransformation);
			SMaterial m;
			m.Lighting = false;
			driver->setMaterial(m);

			switch (LightData.Type)
			{
			case ELT_POINT:
			case ELT_SPOT:
				driver->draw3DBox(BBox, LightData.DiffuseColor);
				break;

			case ELT_DIRECTIONAL:
				driver->draw3DLine(Vector3(0.f, 0.f, 0.f),
					LightData.Direction * LightData.Radius,
					LightData.DiffuseColor);
				break;
			default:
				break;
			}
		}

		DriverLightIndex = driver->addDynamicLight(LightData);
		setVisible(LightIsOn);
	}
开发者ID:zxycode007,项目名称:Sapphire,代码行数:34,代码来源:SapphireCLightSceneNode.cpp

示例4: render

	virtual void render()
	{
		IVideoDriver* driver = SceneManager->getVideoDriver();

		driver->setMaterial(Material);
		driver->setTransform(ETS_WORLD, AbsoluteTransformation);
		driver->drawIndexedTriangleList(VertexBuffer, IndexBuffer, Descriptor, 4);
	}
开发者ID:fdejaeger,项目名称:Irrlicht,代码行数:8,代码来源:main.cpp

示例5: render

void DecalSceneNode::render()
{
u16 indices[] = { 0,1,2, 0,2,3};
IVideoDriver* driver = SceneManager->getVideoDriver();
driver->setMaterial(Material);
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 2);
}
开发者ID:tecan,项目名称:IrrlichtDemos,代码行数:8,代码来源:decalscenenode.cpp

示例6: render

 virtual void render()
  { 
      u16 indices[] = { 0,1,3, 3,1,2, 1,0,2, 2,0,3 };
      IVideoDriver* driver = SceneManager->getVideoDriver();
      driver->setMaterial(Material);
      driver->setTransform(ETS_WORLD, AbsoluteTransformation);
      driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 4);
  }
开发者ID:tecan,项目名称:IrrlichtDemos,代码行数:8,代码来源:hybridVideoTexture.cpp

示例7: render

	void CSampleSceneNode::render()
	{
		u16 indices[] = { 0,2,3, 2,1,3, 1,0,3, 2,0,1 };
		IVideoDriver* driver = SceneManager->getVideoDriver();

		driver->setMaterial(Material);
		driver->setTransform(ETS_WORLD, AbsoluteTransformation);
		driver->drawVertexPrimitiveList(&Vertices[0], 4, &indices[0], 4, EVT_STANDARD, EPT_TRIANGLES, EIT_16BIT);
	}
开发者ID:leonmiura,项目名称:refactirr,代码行数:9,代码来源:CSampleSceneNode.cpp

示例8: sq_dorender

 void sq_dorender() const
 {
     vd->setMaterial(mat);
     vd->setTransform(ETS_WORLD, core::IdentityMatrix);
     vd->setTransform(ETS_VIEW, core::IdentityMatrix);
     vd->setTransform(ETS_PROJECTION, core::IdentityMatrix);
     vd->drawVertexPrimitiveList(vertices, 4, indices, 2, EVT_STANDARD,
                     scene::EPT_TRIANGLE_STRIP);
 }
开发者ID:Berulacks,项目名称:stk-code,代码行数:9,代码来源:screenquad.hpp

示例9: render

//! does nothing.
void CGameParticleContainerSceneNode::render()
{
	IVideoDriver *driver = getIView()->getDriver();

	#ifdef GSEDITOR
	CGameObject::EObjectState state = m_owner->getObjectState();
	
	// draw bbox on select
	if (
			state == CGameObject::Move ||
			state == CGameObject::Review		
		)
		setDebugDataVisible( EDS_BBOX );
	else
		setDebugDataVisible( 0 );

	// call object draw
	m_owner->drawObject();

#endif
	
	if ( DebugDataVisible & scene::EDS_BBOX )
	{		
		driver->setTransform(video::ETS_WORLD, getAbsoluteTransformation() );
		video::SMaterial deb_m;
		deb_m.Lighting = false;
		driver->setMaterial(deb_m);
		
		driver->draw3DBox( Box, video::SColor(255,255,255,255));
	}

#ifdef GSEDITOR	
	// draw move
	if ( 
			state == CGameObject::Move || 
			state == CGameObject::Rotation ||
			state == CGameObject::Scale
		)
		m_owner->drawFrontUpLeftVector();	
	
	if ( state == CGameObject::Rotation )
		m_owner->drawCircleAroundObject();	
#endif

}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:46,代码来源:CGameParticleContainerSceneNode.cpp

示例10: render

//! does nothing.
void CGameContainerSceneNode::render()
{
	if ( m_owner == NULL )
		return;

	IVideoDriver *driver = getIView()->getDriver();

	if ( DebugDataVisible & scene::EDS_BBOX )
	{
		driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
		video::SMaterial deb_m;
		deb_m.Lighting = false;
		driver->setMaterial(deb_m);

		core::aabbox3d<f32> tbox = Box;
		getAbsoluteTransformation().transformBoxEx(tbox);

		driver->draw3DBox( tbox, video::SColor(255,255,0,255));
	}
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:21,代码来源:CGameContainerSceneNode.cpp

示例11: drawObject

// drawObject	
void CWayPoint::drawObject()
{
	if ( m_visible && m_next )
	{
		IVideoDriver *driver = getIView()->getDriver();

		// set material
		SMaterial debug_mat;	
		debug_mat.Lighting = false;
		debug_mat.AntiAliasing=0;
		driver->setMaterial(debug_mat);

		// reset transform
		core::matrix4 mat;
		mat.makeIdentity();
		driver->setTransform(video::ETS_WORLD, mat);

		// draw up
		driver->draw3DLine( m_position, m_next->getPosition(), SColor(255, 0, 255, 0) );
	}
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:22,代码来源:CWayPoint.cpp

示例12: render

void GrassNode::render()
{
    IVideoDriver* driver = SceneManager->getVideoDriver();
    driver->setMaterial(Material);
    driver->setTransform(ETS_WORLD, AbsoluteTransformation);
    float Z = -5;
    for (int i = 0; i < particle.size(); i++)
    {

        Vertices[0].Pos = vector3df(particle[i]->pos.X + -fx, particle[i]->pos.Y + -fy,Z);//, 0,0,0,SColor(255,255,255,255),0,1);
        Vertices[1].Pos = vector3df(particle[i]->pos.X +  fx, particle[i]->pos.Y + -fy,Z);//, 0,0,0,SColor(255,255,255,255),1,1);
        Vertices[2].Pos = vector3df(particle[i]->pos.X +  fx, particle[i]->pos.Y +  fy,Z);//, 0,0,0,SColor(255,255,255,255),1,0);
        Vertices[3].Pos = vector3df(particle[i]->pos.X + -fx, particle[i]->pos.Y +  fy,Z);//, 0,0,0,SColor(255,255,255,255),0,0);
        if (particle[i]->dir <= 0) {
            float x = (particle[i]->crntFrm % stepww)*fWidth;
            float y = (particle[i]->crntFrm / stepww)*fHeight;
            Vertices[0].TCoords.X = x;
            Vertices[0].TCoords.Y = y+fHeight;
            Vertices[1].TCoords.X = x+fWidth;
            Vertices[1].TCoords.Y = y+fHeight;
            Vertices[2].TCoords.X = x+fWidth;
            Vertices[2].TCoords.Y = y;
            Vertices[3].TCoords.X = x;
            Vertices[3].TCoords.Y = y;
        } else if (particle[i]->dir > 0)
        {
            float x = (particle[i]->crntFrm % stepww)*fWidth;
            float y = (particle[i]->crntFrm / stepww)*fHeight;
            Vertices[1].TCoords.X = x;
            Vertices[1].TCoords.Y = y+fHeight;
            Vertices[0].TCoords.X = x+fWidth;
            Vertices[0].TCoords.Y = y+fHeight;
            Vertices[3].TCoords.X = x+fWidth;
            Vertices[3].TCoords.Y = y;
            Vertices[2].TCoords.X = x;
            Vertices[2].TCoords.Y = y;
        }
        driver->drawIndexedTriangleList(&Vertices[0], 4, &Indices[0], 4);
    }
}
开发者ID:blaketrahan,项目名称:King,代码行数:40,代码来源:grass.cpp

示例13: drawObject

// drawObject
void CGameCamera::drawObject()
{
	if ( m_visible && m_objectID != -1  && getIView()->getActiveCamera() != this )
	{
		IVideoDriver *driver = getIView()->getDriver();

		// set material
		SMaterial debug_mat;	
		debug_mat.Lighting = false;
		debug_mat.AntiAliasing=0;
		driver->setMaterial(debug_mat);

		// reset transform
		core::matrix4 mat;
		mat.makeIdentity();
		driver->setTransform(video::ETS_WORLD, mat);

		// draw up
		core::vector3df ray = (m_targetPos - m_position).normalize();

		driver->draw3DLine( m_position, m_position + ray*100, SColor(255, 255, 255, 0) );
	}
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:24,代码来源:CGameCamera.cpp

示例14: render

// render
// override render state
void CGameAnimatedMeshSceneNode::render()
{
#ifdef GSEDITOR
	CGameObject::EObjectState state = m_owner->getObjectState();
	
	// draw bbox on select
	if ( 
			state == CGameObject::Move ||
			state == CGameObject::Review		
		)
		setDebugDataVisible( EDS_BBOX );
	else
		setDebugDataVisible( 0 );

	// call object draw
	m_owner->drawObject();	
#endif

	// draw animesh
	CAnimatedMeshSceneNode::render();

#ifdef GSANIMATION		
	// get driver
	IVideoDriver* driver = getSceneManager()->getVideoDriver();

	ISkinnedMesh *mesh = (ISkinnedMesh*)getMesh();
	IView *pView = getIView();

	irr::gui::IGUIFont* font = getSceneManager()->getGUIEnvironment()->getBuiltInFont();

	video::SMaterial debug_mat;
	debug_mat.Lighting = false;
	debug_mat.AntiAliasing = 0;
	debug_mat.ZBuffer = video::ECFN_NEVER;
		
	for (u32 g=0; g < mesh->getAllJoints().size(); ++g)
	{
		ISkinnedMesh::SJoint *joint = mesh->getAllJoints()[g];
		core::vector3df v;
		
		//basic bone
		//core::matrix4 mat1 = joint->GlobalInversedMatrix;
		//mat1.makeInverse();

		//anim bone
		core::matrix4 mat1 = joint->GlobalAnimatedMatrix;

		// get position
		mat1.transformVect( v );
		
		// scale with character
		v *= m_owner->getScale();

		// draw name bone on screen
		int x, y;
		pView->getScreenCoordinatesFrom3DPosition( v, &x, &y );
		wchar_t text[1024];
		uiString::copy<wchar_t, const c8>( text, joint->Name.c_str() );		
		
		// draw bone position
		SColor c = SColor(255,0,0,255);	
		driver->setMaterial(debug_mat);
		driver->draw2DRectangle( c, core::rect<s32>( x - 2, y - 2, x + 2, y + 2 ) ); 

		// draw text
		font->draw( text, core::rect<s32>( x + 10, y, x + 100, y + 50), SColor(255, 255,255,0) );
	}
#endif

#ifdef GSEDITOR	
	// draw move
	if ( 
			state == CGameObject::Move || 
			state == CGameObject::Rotation ||
			state == CGameObject::Scale
		)
		m_owner->drawFrontUpLeftVector();	
	
	if ( state == CGameObject::Rotation )
		m_owner->drawCircleAroundObject();	
#endif

}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:85,代码来源:CGameAnimatedMeshSceneNode.cpp

示例15: render

// render
// irr scenenode impl
void CGameGrassSceneNode::render()
{
	ISceneManager	*smgr = getSceneManager();
	IVideoDriver	*driver = smgr->getVideoDriver();
	

#ifdef GSEDITOR
	CGameObject::EObjectState state = m_owner->getObjectState();
	
	// draw bbox on select
	if ( 
			state == CGameObject::Move ||
			state == CGameObject::Review		
		)
		setDebugDataVisible( EDS_BBOX );
	else
		setDebugDataVisible( 0 );

	// call object draw
	m_owner->drawObject();
#endif

	// set world transform
	driver->setTransform( video::ETS_WORLD, getAbsoluteTransformation());

	// set current material with config shader
    driver->setMaterial( m_Material);

	// draw mesh with grass shader
	int meshCount = m_mesh->getMeshBufferCount();
	for ( int i = 0; i < meshCount; i++ )
		driver->drawMeshBuffer(m_mesh->getMeshBuffer(i));

	// draw bouding box
	if ( DebugDataVisible & scene::EDS_BBOX )
	{
		driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
		video::SMaterial deb_m;
		deb_m.Lighting = false;
		driver->setMaterial(deb_m);

		core::aabbox3d<f32> tbox = m_mesh->getBoundingBox();
		getAbsoluteTransformation().transformBoxEx(tbox);

		driver->draw3DBox( tbox, video::SColor(255,255,255,255));
	}

#ifdef GSEDITOR	
	// draw move
	if ( 
			state == CGameObject::Move || 
			state == CGameObject::Rotation ||
			state == CGameObject::Scale
		)
		m_owner->drawFrontUpLeftVector();	
	
	if ( state == CGameObject::Rotation )
		m_owner->drawCircleAroundObject();	
#endif

}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:63,代码来源:CGameGrassSceneNode.cpp


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