Update speed of draw3DBox (OpenGL). Thanks @zerochen for patch (https://sourceforge.net/p/irrlicht/patches/256)
(DirectX part still open, will apply that another day). git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5389 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
49cc0f54ad
commit
f28e0ba53c
|
@ -1,6 +1,7 @@
|
|||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
|
||||
- Update speed of draw3DBox (OpenGL). Thanks @zerochen for patch (https://sourceforge.net/p/irrlicht/patches/256)
|
||||
- Support more keys on OSX "[]\". Thanks @neoascetic for patch (#313).
|
||||
- Fix IBillboardTextSceneNode::setTextColor which did nothing in the past. It now maps to setColor instead.
|
||||
- Add access functions to IBillboardTextSceneNode (getText, getFont).
|
||||
|
|
|
@ -3524,6 +3524,67 @@ void COpenGLDriver::setFog(SColor c, E_FOG_TYPE fogType, f32 start,
|
|||
glFogfv(GL_FOG_COLOR, data);
|
||||
}
|
||||
|
||||
//! Draws a 3d box.
|
||||
void COpenGLDriver::draw3DBox( const core::aabbox3d<f32>& box, SColor color )
|
||||
{
|
||||
core::vector3df edges[8];
|
||||
box.getEdges(edges);
|
||||
|
||||
setRenderStates3DMode();
|
||||
|
||||
video::S3DVertex v[24];
|
||||
|
||||
for(u32 i = 0; i < 24; i++)
|
||||
v[i].Color = color;
|
||||
|
||||
v[0].Pos = edges[5];
|
||||
v[1].Pos = edges[1];
|
||||
v[2].Pos = edges[1];
|
||||
v[3].Pos = edges[3];
|
||||
v[4].Pos = edges[3];
|
||||
v[5].Pos = edges[7];
|
||||
v[6].Pos = edges[7];
|
||||
v[7].Pos = edges[5];
|
||||
v[8].Pos = edges[0];
|
||||
v[9].Pos = edges[2];
|
||||
v[10].Pos = edges[2];
|
||||
v[11].Pos = edges[6];
|
||||
v[12].Pos = edges[6];
|
||||
v[13].Pos = edges[4];
|
||||
v[14].Pos = edges[4];
|
||||
v[15].Pos = edges[0];
|
||||
v[16].Pos = edges[1];
|
||||
v[17].Pos = edges[0];
|
||||
v[18].Pos = edges[3];
|
||||
v[19].Pos = edges[2];
|
||||
v[20].Pos = edges[7];
|
||||
v[21].Pos = edges[6];
|
||||
v[22].Pos = edges[5];
|
||||
v[23].Pos = edges[4];
|
||||
|
||||
if (!FeatureAvailable[IRR_ARB_vertex_array_bgra] && !FeatureAvailable[IRR_EXT_vertex_array_bgra])
|
||||
getColorBuffer(v, 24, EVT_STANDARD);
|
||||
|
||||
CacheHandler->setClientState(true, false, true, false);
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(v))[0].Pos);
|
||||
|
||||
#ifdef GL_BGRA
|
||||
const GLint colorSize=(FeatureAvailable[IRR_ARB_vertex_array_bgra] || FeatureAvailable[IRR_EXT_vertex_array_bgra])?GL_BGRA:4;
|
||||
#else
|
||||
const GLint colorSize=4;
|
||||
#endif
|
||||
if (FeatureAvailable[IRR_ARB_vertex_array_bgra] || FeatureAvailable[IRR_EXT_vertex_array_bgra])
|
||||
glColorPointer(colorSize, GL_UNSIGNED_BYTE, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(v))[0].Color);
|
||||
else
|
||||
{
|
||||
_IRR_DEBUG_BREAK_IF(ColorBuffer.size()==0);
|
||||
glColorPointer(colorSize, GL_UNSIGNED_BYTE, 0, &ColorBuffer[0]);
|
||||
}
|
||||
|
||||
glDrawArrays(GL_LINES, 0, 24);
|
||||
}
|
||||
|
||||
|
||||
//! Draws a 3d line.
|
||||
void COpenGLDriver::draw3DLine(const core::vector3df& start,
|
||||
|
@ -4275,7 +4336,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_G32R32F:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_rg))
|
||||
{
|
||||
internalFormat = GL_RG32F;
|
||||
internalFormat = GL_RG32F;
|
||||
pixelFormat = GL_RG;
|
||||
pixelType = GL_FLOAT;
|
||||
}
|
||||
|
@ -4285,7 +4346,7 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
case ECF_A32B32G32R32F:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_ARB_texture_float))
|
||||
{
|
||||
internalFormat = GL_RGBA32F_ARB;
|
||||
internalFormat = GL_RGBA32F_ARB;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_FLOAT;
|
||||
}
|
||||
|
|
|
@ -197,6 +197,9 @@ namespace video
|
|||
//! Draws a single pixel
|
||||
virtual void drawPixel(u32 x, u32 y, const SColor & color) _IRR_OVERRIDE_;
|
||||
|
||||
//! Draws a 3d box
|
||||
virtual void draw3DBox( const core::aabbox3d<f32>& box, SColor color = SColor(255,255,255,255 ) ) _IRR_OVERRIDE_;
|
||||
|
||||
//! Draws a 3d line.
|
||||
virtual void draw3DLine(const core::vector3df& start,
|
||||
const core::vector3df& end,
|
||||
|
|
Loading…
Reference in New Issue