Merged from branch 1.4 revisions 1290:1305.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1306 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2008-03-30 23:19:12 +00:00
parent bffa0b1905
commit 897a3fa6a6
10 changed files with 98 additions and 12 deletions

View File

@ -49,6 +49,8 @@ Changes in version 1.5 (... 2008)
-------------------------------------------
Changes in version 1.4.1 (??? 2008)
- Fixed bug in CBillboardSceneNode::setColor, reported by rogerborg
- Fixed clipping of menu, toolbar and combo box GUI elements, reported by greenya
- setNotClipped now applies all the way up to the root of the GUI environment, rather than just to the next parent

View File

@ -290,6 +290,17 @@ namespace scene
**/
virtual IAnimatedMesh* getMesh(const c8* filename) = 0;
//! Returns pointer to an animateable mesh. Loads the file if not loaded already.
/**
* Works just as getMesh(const char* filename)
* If you want to remove a loaded mesh from the cache again, use removeMesh().
* \param file: File handle of the mesh to load.
* \return Returns NULL if failed and the pointer to the mesh if
* successful.
* This pointer should not be dropped. See IReferenceCounted::drop() for more information.
**/
virtual IAnimatedMesh* getMesh(io::IReadFile* file) = 0;
//! Returns an interface to the mesh cache which is shared beween all existing scene managers.
/** With this interface, it is possible to manually add new loaded
meshes (if ISceneManager::getMesh() is not sufficient), to remove them and to iterate
@ -891,9 +902,9 @@ namespace scene
ISceneNode::OnRegisterSceneNode() call.
\param node: Node to register for drawing. Usually scene nodes would set 'this'
as parameter here because they want to be drawn.
\param pass: Specifies when the mode wants to be drawn in relation to the other nodes.
\param pass: Specifies when the node wants to be drawn in relation to the other nodes.
For example, if the node is a shadow, it usually wants to be drawn after all other nodes
and will use ESNRP_SHADOW for this. See E_SCENE_NODE_RENDER_PASS for details.
and will use ESNRP_SHADOW for this. See scene::E_SCENE_NODE_RENDER_PASS for details.
\return scene will be rendered ( passed culling ) */
virtual u32 registerNodeForRendering(ISceneNode* node,
E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
@ -973,7 +984,7 @@ namespace scene
how big the radius should be, you could use the following code to determine
it:
\code
const core::aabbox<f32>& box = yourSceneNode->getBoundingBox();
const core::aabbox3d<f32>& box = yourSceneNode->getBoundingBox();
core::vector3df radius = box.MaxEdge - box.getCenter();
\endcode
\param gravityPerSecond: Sets the gravity of the environment. A good example value would be

View File

@ -12,11 +12,19 @@ namespace irr
//! 8 bit unsigned variable.
/** This is a typedef for unsigned char, it ensures portability of the engine. */
#ifdef _MSC_VER
typedef unsigned __int8 u8;
#else
typedef unsigned char u8;
#endif
//! 8 bit signed variable.
/** This is a typedef for signed char, it ensures portability of the engine. */
#ifdef _MSC_VER
typedef __int8 s8;
#else
typedef signed char s8;
#endif
//! 8 bit character variable.
/** This is a typedef for char, it ensures portability of the engine. */
@ -26,21 +34,37 @@ typedef char c8;
//! 16 bit unsigned variable.
/** This is a typedef for unsigned short, it ensures portability of the engine. */
#ifdef _MSC_VER
typedef unsigned __int16 u16;
#else
typedef unsigned short u16;
#endif
//! 16 bit signed variable.
/** This is a typedef for signed short, it ensures portability of the engine. */
#ifdef _MSC_VER
typedef __int16 s16;
#else
typedef signed short s16;
#endif
//! 32 bit unsigned variable.
/** This is a typedef for unsigned int, it ensures portability of the engine. */
#ifdef _MSC_VER
typedef unsigned __int32 u32;
#else
typedef unsigned int u32;
#endif
//! 32 bit signed variable.
/** This is a typedef for signed int, it ensures portability of the engine. */
#ifdef _MSC_VER
typedef __int32 s32;
#else
typedef signed int s32;
#endif
@ -98,7 +122,12 @@ typedef unsigned short wchar_t;
//! define a break macro for debugging.
#if defined(_DEBUG)
#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
#if defined(_WIN64) // using portable common solution for x64 configuration
#include <crtdbg.h>
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}
#else
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
#endif
#else
#include "assert.h"
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) assert( !(_CONDITION_) );
@ -108,7 +137,7 @@ typedef unsigned short wchar_t;
#endif
//! Defines a small statement to work around a microsoft compiler bug.
/** The microsft compiler 7.0 - 7.1 has a bug:
/** The microsoft compiler 7.0 - 7.1 has a bug:
When you call unmanaged code that returns a bool type value of false from managed code,
the return value may appear as true. See
http://support.microsoft.com/default.aspx?kbid=823071 for details.

View File

@ -191,7 +191,7 @@ void CBillboardSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttrib
void CBillboardSceneNode::setColor(const video::SColor & overallColor)
{
for(u32 vertex = 0; vertex < 4; ++vertex)
vertices[0].Color = overallColor;
vertices[vertex].Color = overallColor;
}

View File

@ -43,7 +43,7 @@ namespace video
virtual bool beginScene(bool backBuffer, bool zBuffer, SColor color);
//! applications must call this method after performing any rendering. returns false if failed.
virtual bool endScene( s32 windowId, core::rect<s32>* sourceRect=0 );
virtual bool endScene(s32 windowId=0, core::rect<s32>* sourceRect=0);
//! queries the features of the driver, returns true if feature is available
virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const;

View File

@ -237,7 +237,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
WORD KeyAsc=0;
GetKeyboardState(allKeys);
ToAscii(wParam,lParam,allKeys,&KeyAsc,0);
ToAscii((UINT)wParam,(UINT)lParam,allKeys,&KeyAsc,0);
event.KeyInput.Shift = ((allKeys[VK_SHIFT] & 0x80)!=0);
event.KeyInput.Control = ((allKeys[VK_CONTROL] & 0x80)!=0);
@ -610,7 +610,7 @@ void CIrrDeviceWin32::present(video::IImage* image, s32 windowId, core::rect<s32
{
HWND hwnd = HWnd;
if ( windowId )
hwnd = (HWND)windowId;
hwnd = reinterpret_cast<HWND>(windowId);
HDC dc = GetDC(hwnd);
@ -779,10 +779,13 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
case VER_PLATFORM_WIN32_NT:
if (osvi.dwMajorVersion <= 4)
out.append("Microsoft Windows NT ");
else
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
out.append("Microsoft Windows 2000 ");
else
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
out.append("Microsoft Windows XP ");
else
if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 )
out.append("Microsoft Windows Vista ");

View File

@ -396,7 +396,7 @@ void COpenGLDriver::createMaterialRenderers()
//! presents the rendered scene on the screen, returns false if failed
bool COpenGLDriver::endScene( s32 windowId, core::rect<s32>* sourceRect )
{
CNullDriver::endScene( windowId );
CNullDriver::endScene();
glFlush();
@ -2257,7 +2257,7 @@ void COpenGLDriver::setFog(SColor c, bool linearFog, f32 start,
{
CNullDriver::setFog(c, linearFog, start, end, density, pixelFog, rangeFog);
glFogi(GL_FOG_MODE, linearFog ? GL_LINEAR : GL_EXP);
glFogf(GL_FOG_MODE, linearFog ? GL_LINEAR : GL_EXP);
#ifdef GL_EXT_fog_coord
if (FeatureAvailable[IRR_EXT_fog_coord])
glFogi(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH);

View File

@ -37,7 +37,7 @@ s32 CReadFile::read(void* buffer, u32 sizeToRead)
if (!isOpen())
return 0;
return fread(buffer, 1, sizeToRead, File);
return (s32)fread(buffer, 1, sizeToRead, File);
}

View File

@ -345,6 +345,44 @@ IAnimatedMesh* CSceneManager::getMesh(const c8* filename)
}
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
IAnimatedMesh* CSceneManager::getMesh(io::IReadFile* file)
{
if (!file)
return 0;
core::stringc name = file->getFileName();
IAnimatedMesh* msh = MeshCache->getMeshByFilename(file->getFileName());
if (msh)
return msh;
name.make_lower();
s32 count = MeshLoaderList.size();
for (s32 i=count-1; i>=0; --i)
{
if (MeshLoaderList[i]->isALoadableFileExtension(name.c_str()))
{
// reset file to avoid side effects of previous calls to createMesh
file->seek(0);
msh = MeshLoaderList[i]->createMesh(file);
if (msh)
{
MeshCache->addMesh(file->getFileName(), msh);
msh->drop();
break;
}
}
}
if (!msh)
os::Printer::log("Could not load mesh, file format seems to be unsupported", file->getFileName(), ELL_ERROR);
else
os::Printer::log("Loaded mesh", file->getFileName(), ELL_INFORMATION);
return msh;
}
//! returns the video driver
video::IVideoDriver* CSceneManager::getVideoDriver()
{

View File

@ -42,6 +42,9 @@ namespace scene
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
virtual IAnimatedMesh* getMesh(const c8* filename);
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
virtual IAnimatedMesh* getMesh(io::IReadFile* file);
//! Returns an interface to the mesh cache which is shared beween all existing scene managers.
virtual IMeshCache* getMeshCache();