Commit a23436f9 authored by hybrid's avatar hybrid

Merged revisions 3199-3217 from 1.7 branch. Fix collision problem in aabbox3d...

Merged revisions 3199-3217 from 1.7 branch. Fix collision problem in aabbox3d and some compile problems due to API changes. Fixed some minor mem leaks.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3218 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 360cd6d1
......@@ -75,12 +75,12 @@ public:
error log and can be catched with a custom event receiver. */
virtual s32 addHighLevelShaderMaterial(
const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const c8* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
const c8* geometryShaderProgram = 0,
const c8* vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget,
const c8* pixelShaderProgram,
const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget,
const c8* geometryShaderProgram,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
......@@ -155,12 +155,12 @@ public:
error log and can be catched with a custom event receiver. */
virtual s32 addHighLevelShaderMaterialFromFiles(
const io::path& vertexShaderProgramFileName,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const io::path& pixelShaderProgramFileName = "",
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
const io::path& geometryShaderProgramFileName="",
const c8* vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget,
const io::path& pixelShaderProgramFileName,
const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget,
const io::path& geometryShaderProgramFileName,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
......@@ -233,12 +233,12 @@ public:
the error log and can be catched with a custom event receiver. */
virtual s32 addHighLevelShaderMaterialFromFiles(
io::IReadFile* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
io::IReadFile* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
io::IReadFile* geometryShaderProgram = 0,
const c8* vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget,
io::IReadFile* pixelShaderProgram,
const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget,
io::IReadFile* geometryShaderProgram,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
......
......@@ -222,16 +222,18 @@ class aabbox3d
otherwise false. */
bool isFullInside(const aabbox3d<T>& other) const
{
return MinEdge >= other.MinEdge && MaxEdge <= other.MaxEdge;
return (MinEdge.X >= other.MinEdge.X && MinEdge.Y >= other.MinEdge.Y && MinEdge.Z >= other.MinEdge.Z &&
MaxEdge.X <= other.MaxEdge.X && MaxEdge.Y <= other.MaxEdge.Y && MaxEdge.Z <= other.MaxEdge.Z);
}
//! Determines if the box intersects with another box.
//! Determines if the axis-aligned box intersects with another axis-aligned box.
/** \param other: Other box to check a intersection with.
\return True if there is an intersection with the other box,
otherwise false. */
bool intersectsWithBox(const aabbox3d<T>& other) const
{
return (MinEdge <= other.MaxEdge && MaxEdge >= other.MinEdge);
return (MinEdge.X <= other.MaxEdge.X && MinEdge.Y <= other.MaxEdge.Y && MinEdge.Z <= other.MaxEdge.Z &&
MaxEdge.X >= other.MinEdge.X && MaxEdge.Y >= other.MinEdge.Y && MaxEdge.Z >= other.MinEdge.Z);
}
//! Tests if the box intersects with a line
......
......@@ -344,12 +344,12 @@ namespace video
//! language.
virtual s32 addHighLevelShaderMaterial(
const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const c8* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
const c8* geometryShaderProgram = 0,
const c8* vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget,
const c8* pixelShaderProgram,
const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget,
const c8* geometryShaderProgram,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
......
......@@ -1125,10 +1125,13 @@ void CIrrDeviceLinux::setWindowCaption(const wchar_t* text)
return;
XTextProperty txt;
XwcTextListToTextProperty(display, const_cast<wchar_t**>(&text), 1, XStdICCTextStyle, &txt);
XSetWMName(display, window, &txt);
XSetWMIconName(display, window, &txt);
XFree(txt.value);
if (Success==XwcTextListToTextProperty(display, const_cast<wchar_t**>(&text),
1, XStdICCTextStyle, &txt))
{
XSetWMName(display, window, &txt);
XSetWMIconName(display, window, &txt);
XFree(txt.value);
}
#endif
}
......
......@@ -486,17 +486,11 @@ void COBJMeshFileLoader::readMTL(const c8* fileName, const io::path& relPath)
if (FileSystem->existFile(realFile))
mtlReader = FileSystem->createAndOpenFile(realFile);
else if (FileSystem->existFile(relPath + realFile))
{
mtlReader = FileSystem->createAndOpenFile(relPath + realFile);
}
else if (FileSystem->existFile(FileSystem->getFileBasename(realFile)))
{
mtlReader = FileSystem->createAndOpenFile(FileSystem->getFileBasename(realFile));
}
else
{
mtlReader = FileSystem->createAndOpenFile(relPath + FileSystem->getFileBasename(realFile));
}
if (!mtlReader) // fail to open and read file
{
os::Printer::log("Could not open material file", realFile, ELL_WARNING);
......@@ -507,6 +501,7 @@ void COBJMeshFileLoader::readMTL(const c8* fileName, const io::path& relPath)
if (!filesize)
{
os::Printer::log("Skipping empty material file", realFile, ELL_WARNING);
mtlReader->drop();
return;
}
......
......@@ -277,12 +277,12 @@ namespace video
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
virtual s32 addHighLevelShaderMaterial(
const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const c8* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
const c8* geometryShaderProgram = 0,
const c8* vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget,
const c8* pixelShaderProgram,
const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget,
const c8* geometryShaderProgram,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
......
......@@ -933,7 +933,7 @@ class COpenGLExtensionHandler
void extGlEnableIndexed(GLenum target, GLuint index);
void extGlDisableIndexed(GLenum target, GLuint index);
void extGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst);
void extGlProgramParameteri(GLhandleARB program, GLenum pname, GLint value);
void extGlProgramParameteri(GLuint program, GLenum pname, GLint value);
protected:
......
......@@ -303,7 +303,7 @@ static bool checkBBoxIntersection(IrrlichtDevice * device,
video::IVideoDriver* driver = device->getVideoDriver();
// add camera
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
scene::ICameraSceneNode* camera = smgr->addCameraSceneNode();
camera->setPosition(core::vector3df(30, 30, 30));
camera->setTarget(core::vector3df(8.f, 8.f, 8.f));
camera->setID(0);
......@@ -369,9 +369,32 @@ static bool checkBBoxIntersection(IrrlichtDevice * device,
camera->setTarget(core::vector3df(80.f, 80.f, 80.f));
}
ISceneNode* node = smgr->addSphereSceneNode(5.f, 16, 0, -1, core::vector3df(0, 0, 1), core::vector3df(), core::vector3df(0.3f, 0.3f, 0.3f));
cube->remove();
cube = smgr->addCubeSceneNode(10.f, 0, -1, core::vector3df(0, 6.5f, 1), core::vector3df(), core::vector3df(10, 0.1f, 1.f));
camera->setPosition(core::vector3df(0, 0, 10));
camera->setTarget(core::vector3df());
u32 count=0;
for (u32 i=0; i<30; ++i)
{
driver->beginScene(true, true, video::SColor(100, 50, 50, 100));
smgr->drawAll();
driver->endScene();
count += node->getTransformedBoundingBox().intersectsWithBox(cube->getTransformedBoundingBox())?1:0;
node->setPosition(node->getPosition()+core::vector3df(.5f,.5f,0));
if (i==8 && count != 0)
result=false;
if (i==17 && count != 9)
result=false;
}
if (count != 9)
result=false;
smgr->clear();
return (result);
return result;
}
......@@ -433,7 +456,7 @@ static bool compareGetSceneNodeFromRayBBWithBBIntersectsWithLine(IrrlichtDevice
/** Test functionality of the sceneCollisionManager */
bool sceneCollisionManager(void)
{
IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(160, 120));
IrrlichtDevice * device = irr::createDevice(video::EDT_OPENGL, dimension2d<u32>(160, 120));
assert(device);
if(!device)
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment