Merge revisions r5476 through r5483 from trunk to ogl-es-

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5484 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2017-06-11 18:34:38 +00:00
parent e316100012
commit ff7a1c154f
8 changed files with 33 additions and 12 deletions

View File

@ -10,6 +10,7 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
--------------------------
Changes in 1.9 (not yet released)
- ISceneManager::getMesh can now creates meshes with alternative cache-names.
- Lets the BSP loader find textures inserted with relative paths. Thx@ curaga for patch
- Slightly simplified ALLOC_STRATEGY_DOUBLE in arrays
- Add alternavive BoundingBox calculation for BillboardSceneNode which can take in a camera node. Thx @Seven and @JacKDuRdEn for bugreports.

View File

@ -379,10 +379,11 @@ namespace scene
* If you would like to implement and add your own file format loader to Irrlicht,
* see addExternalMeshLoader().
* \param filename: Filename of the mesh to load.
* \param alternativeCacheName: In case you want to have the mesh under another name in the cache (to create real copies)
* \return Null if failed, otherwise pointer to the mesh.
* This pointer should not be dropped. See IReferenceCounted::drop() for more information.
**/
virtual IAnimatedMesh* getMesh(const io::path& filename) = 0;
virtual IAnimatedMesh* getMesh(const io::path& filename, const io::path& alternativeCacheName=io::path("")) = 0;
//! Get pointer to an animateable mesh. Loads the file if not loaded already.
/** Works just as getMesh(const char* filename). If you want to

View File

@ -966,8 +966,11 @@ namespace video
virtual void draw2DRectangleOutline(const core::recti& pos,
SColor color=SColor(255,255,255,255)) =0;
//! Draws a 2d line. Both start and end will be included in coloring.
/** \param start Screen coordinates of the start of the line
//! Draws a 2d line.
/** In theory both start and end will be included in coloring.
BUG: Currently hardware drivers (d3d/opengl) ignore the last pixel
(they use the so called "diamond exit rule" for drawing lines).
\param start Screen coordinates of the start of the line
in pixels.
\param end Screen coordinates of the start of the line in
pixels.

View File

@ -7,6 +7,10 @@
#include "IrrCompileConfig.h"
#if __GNUC__ && __STDC_VERSION__ >= 199901L // Should at least be available since C99
#include <stdint.h> // needed by __WORDSIZE below
#endif
namespace irr
{

View File

@ -23,8 +23,8 @@ class COpenGLCoreCacheHandler
class STextureCache
{
public:
STextureCache(COpenGLCoreCacheHandler* cacheHandler, u32 textureCount) :
CacheHandler(cacheHandler), DriverType(cacheHandler->getDriverType()), TextureCount(textureCount)
STextureCache(COpenGLCoreCacheHandler& cacheHandler, E_DRIVER_TYPE driverType, u32 textureCount) :
CacheHandler(cacheHandler), DriverType(driverType), TextureCount(textureCount)
{
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)
{
@ -61,7 +61,7 @@ class COpenGLCoreCacheHandler
if (index < MATERIAL_MAX_TEXTURES && index < TextureCount)
{
CacheHandler->setActiveTexture(GL_TEXTURE0 + index);
CacheHandler.setActiveTexture(GL_TEXTURE0 + index);
const TOpenGLTexture* prevTexture = Texture[index];
@ -160,7 +160,7 @@ class COpenGLCoreCacheHandler
}
private:
COpenGLCoreCacheHandler* CacheHandler;
COpenGLCoreCacheHandler& CacheHandler;
E_DRIVER_TYPE DriverType;
@ -170,7 +170,16 @@ class COpenGLCoreCacheHandler
public:
COpenGLCoreCacheHandler(TOpenGLDriver* driver) :
Driver(driver), TextureCache(STextureCache(this, Driver->getFeature().TextureUnit)), FrameBufferCount(0), BlendEquation(0), BlendSourceRGB(0),
Driver(driver),
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable: 4355) // Warning: "'this' : used in base member initializer list. ". It's OK, we don't use the reference in STextureCache constructor.
#endif
TextureCache(STextureCache(*this, driver->getDriverType(), driver->getFeature().TextureUnit)),
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
FrameBufferCount(0), BlendEquation(0), BlendSourceRGB(0),
BlendDestinationRGB(0), BlendSourceAlpha(0), BlendDestinationAlpha(0), Blend(0), BlendEquationInvalid(false), BlendFuncInvalid(false), BlendInvalid(false),
ColorMask(0), ColorMaskInvalid(false), CullFaceMode(GL_BACK), CullFace(false), DepthFunc(GL_LESS), DepthMask(true), DepthTest(false), FrameBufferID(0),
ProgramID(0), ActiveTexture(GL_TEXTURE0), ViewportX(0), ViewportY(0)

View File

@ -1887,6 +1887,8 @@ void COpenGLDriver::draw2DRectangle(const core::rect<s32>& position,
void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
const core::position2d<s32>& end, SColor color)
{
// TODO: It's not pixel-exact. Reason is the way OpenGL handles line-drawing (search the web for "diamond exit rule").
if (start==end)
drawPixel(start.X, start.Y, color);
else

View File

@ -401,9 +401,10 @@ CSceneManager::~CSceneManager()
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
IAnimatedMesh* CSceneManager::getMesh(const io::path& filename)
IAnimatedMesh* CSceneManager::getMesh(const io::path& filename, const io::path& alternativeCacheName)
{
IAnimatedMesh* msh = MeshCache->getMeshByName(filename);
io::path cacheName = alternativeCacheName.empty() ? filename : alternativeCacheName;
IAnimatedMesh* msh = MeshCache->getMeshByName(cacheName);
if (msh)
return msh;
@ -425,7 +426,7 @@ IAnimatedMesh* CSceneManager::getMesh(const io::path& filename)
msh = MeshLoaderList[i]->createMesh(file);
if (msh)
{
MeshCache->addMesh(filename, msh);
MeshCache->addMesh(cacheName, msh);
msh->drop();
break;
}

View File

@ -42,7 +42,7 @@ namespace scene
virtual ~CSceneManager();
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
virtual IAnimatedMesh* getMesh(const io::path& filename) _IRR_OVERRIDE_;
virtual IAnimatedMesh* getMesh(const io::path& filename, const io::path& alternativeCacheName) _IRR_OVERRIDE_;
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
virtual IAnimatedMesh* getMesh(io::IReadFile* file) _IRR_OVERRIDE_;