本文整理汇总了C++中IVideoDriver::draw3DLine方法的典型用法代码示例。如果您正苦于以下问题:C++ IVideoDriver::draw3DLine方法的具体用法?C++ IVideoDriver::draw3DLine怎么用?C++ IVideoDriver::draw3DLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVideoDriver
的用法示例。
在下文中一共展示了IVideoDriver::draw3DLine方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: draw
// ----------------------------------------------------------------------------
void CheckLineHandler::draw()
{
IVideoDriver* vd = Editor::getEditor()->getVideoDriver();
std::list<CheckLine>::iterator it = m_check_lines.begin();
while (it != m_check_lines.end() && it->active)
{
vd->draw3DLine(it->n1->getPosition(), it->n2->getPosition(), SColor(255, 255, 0, 0));
it++;
}
} // draw
示例3: 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) );
}
}
示例4: 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) );
}
}
示例5: runTestWithDriver
//! Tests projection matrices
static bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
if (!device)
return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
IVideoDriver* driver = device->getVideoDriver();
stabilizeScreenBackground(driver);
logTestString("Testing driver %ls\n", driver->getName());
bool result = true;
driver->beginScene(true, false, SColor(255,0,0,0));
SMaterial mat;
mat.MaterialType = EMT_SOLID;
mat.Lighting = false;
mat.ZBuffer = false;
mat.ZWriteEnable = false;
mat.Thickness = 1;
driver->setMaterial(mat);
core::dimension2d<f32> dims(driver->getCurrentRenderTargetSize());
//apply custom projection, no offset
core::matrix4 pmtx = matrix4().buildProjectionMatrixOrthoLH(dims.Width, dims.Height, 0, 100);
driver->setTransform(ETS_PROJECTION, pmtx);
driver->setTransform(ETS_VIEW, matrix4());
driver->setTransform(ETS_WORLD, matrix4());
//the red cross appears at center
for (u32 i=0; i<10; ++i)
{
driver->draw3DLine(vector3df(0.f+i,-50.f,1.f), vector3df(0.f+i,50.f,1.f), SColor(255,255,0,0));
driver->draw3DLine(vector3df(-50.f,0.f+i,1.f), vector3df(50.f,0.f+i,1.f), SColor(255,255,0,0));
}
//apply custom projection, offset to right-top
pmtx.setTranslation(vector3df(0.7f, 0.7f, 0.f));
driver->setTransform(ETS_PROJECTION, pmtx);
driver->setTransform(ETS_VIEW, matrix4());
driver->setTransform(ETS_WORLD, matrix4());
//The green cross must be in right-top corner. But for OpenGL driver it is in left-top corner
for (u32 i=0; i<10; ++i)
{
driver->draw3DLine(vector3df(0.f+i,-50,1), vector3df(0.f+i,50,1), SColor(255,0,255,0));
driver->draw3DLine(vector3df(-50,0.f+i,1), vector3df(50,0.f+i,1), SColor(255,0,255,0));
}
driver->endScene();
result = takeScreenshotAndCompareAgainstReference(driver, "-projMat.png", 98.71f);
device->closeDevice();
device->run();
device->drop();
return result;
}