Commit 0b034027 authored by hybrid's avatar hybrid

Merged from 1.5 branch to trunk, all changes from 1821 to 1835. Mostly warning...

Merged from 1.5 branch to trunk, all changes from 1821 to 1835. Mostly warning fixes, GL ASM shaders repaired, d3d9 RTTs less memory consuming, skinned mesh bboxes updating.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1837 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f778a1eb
......@@ -20,7 +20,9 @@ tutorial, we use a lot stuff from the gui namespace.
using namespace irr;
using namespace gui;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
/*
......@@ -38,15 +40,15 @@ scene::ICameraSceneNode* Camera[2] = { 0, 0};
/*
Toggle between various cameras
*/
void setActiveCamera ( scene::ICameraSceneNode* newActive )
void setActiveCamera(scene::ICameraSceneNode* newActive)
{
if ( 0 == Device )
if (0 == Device)
return;
scene::ICameraSceneNode* active = Device->getSceneManager()->getActiveCamera ();
Device->getSceneManager()->getActiveCamera();
newActive->setInputReceiverEnabled ( true );
Device->getSceneManager()->setActiveCamera ( newActive );
newActive->setInputReceiverEnabled(true);
Device->getSceneManager()->setActiveCamera(newActive);
}
/*
......@@ -73,43 +75,41 @@ void loadModel(const c8* fn)
{
// modify the name if it a .pk3 file
core::stringc filename ( fn );
core::stringc filename(fn);
core::stringc extension;
core::getFileNameExtension ( extension, filename );
core::getFileNameExtension(extension, filename);
extension.make_lower();
// if a texture is loaded apply it to the current model..
if ( extension == ".jpg" ||
extension == ".pcx" ||
extension == ".png" ||
extension == ".ppm" ||
extension == ".pgm" ||
extension == ".pbm" ||
extension == ".psd" ||
extension == ".tga" ||
extension == ".bmp"
)
if (extension == ".jpg" ||
extension == ".pcx" ||
extension == ".png" ||
extension == ".ppm" ||
extension == ".pgm" ||
extension == ".pbm" ||
extension == ".psd" ||
extension == ".tga" ||
extension == ".bmp")
{
video::ITexture * texture =
Device->getVideoDriver()->getTexture( filename.c_str() );
if ( texture && Model )
{
// always reload texture
Device->getVideoDriver()->removeTexture ( texture );
Device->getVideoDriver()->removeTexture(texture);
texture = Device->getVideoDriver()->getTexture( filename.c_str() );
Model->setMaterialTexture ( 0, texture );
Model->setMaterialTexture(0, texture);
}
return;
}
// if a archive is loaded add it to the FileSystems..
if ( extension == ".pk3" ||
extension == ".zip"
)
if (extension == ".pk3" ||
extension == ".zip")
{
Device->getFileSystem()->addZipFileArchive( filename.c_str () );
Device->getFileSystem()->addZipFileArchive( filename.c_str() );
return;
}
......@@ -154,7 +154,8 @@ void createToolBox()
IGUIEnvironment* env = Device->getGUIEnvironment();
IGUIElement* root = env->getRootGUIElement();
IGUIElement* e = root->getElementFromId(5000, true);
if (e) e->remove();
if (e)
e->remove();
// create the toolbox window
IGUIWindow* wnd = env->addWindow(core::rect<s32>(600,25,800,480),
......@@ -207,13 +208,13 @@ public:
event.KeyInput.Key == irr::KEY_ESCAPE &&
event.KeyInput.PressedDown == false)
{
if ( Device )
if (Device)
{
scene::ICameraSceneNode * camera =
Device->getSceneManager()->getActiveCamera();
if ( camera )
if (camera)
{
camera->setInputReceiverEnabled ( !camera->isInputReceiverEnabled() );
camera->setInputReceiverEnabled( !camera->isInputReceiverEnabled() );
}
return true;
}
......@@ -296,10 +297,10 @@ public:
break;
case 1000:
setActiveCamera ( Camera[0] );
setActiveCamera(Camera[0]);
break;
case 1100:
setActiveCamera ( Camera[1] );
setActiveCamera(Camera[1]);
break;
}
......@@ -412,6 +413,8 @@ public:
break;
}
break;
default:
break;
}
}
......@@ -480,7 +483,7 @@ int main(int argc, char* argv[])
smgr->addLightSceneNode(0, core::vector3df(50,-50,100),
video::SColorf(1.0f,1.0f,1.0f),20000);
// add our media directory as "search path"
Device->getFileSystem()->addFolderFileArchive ( "../../media/" );
Device->getFileSystem()->addFolderFileArchive("../../media/");
/*
The next step is to read the configuration file. It is stored in the xml
......@@ -523,6 +526,8 @@ int main(int argc, char* argv[])
Caption = xml->getAttributeValue(L"caption");
}
break;
default:
break;
}
}
......@@ -682,7 +687,7 @@ int main(int argc, char* argv[])
Camera[1] = smgr->addCameraSceneNodeFPS();
Camera[1]->setFarValue(20000.f);
setActiveCamera ( Camera[0] );
setActiveCamera(Camera[0]);
// load the irrlicht engine logo
IGUIImage *img =
......
......@@ -171,8 +171,8 @@ int main()
addShaderMaterial() instead of addShaderMaterialFromFiles().
*/
c8* vsFileName = 0; // filename for the vertex shader
c8* psFileName = 0; // filename for the pixel shader
const c8* vsFileName = 0; // filename for the vertex shader
const c8* psFileName = 0; // filename for the pixel shader
switch(driverType)
{
......
......@@ -13,7 +13,9 @@ nearly all other tutorials.
using namespace irr;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
/*
For this example, we need an event receiver, to make it possible for the user
......
......@@ -19,7 +19,9 @@ toggles between solid and detail mapped material.
using namespace irr;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
class MyEventReceiver : public IEventReceiver
......@@ -54,6 +56,8 @@ public:
Terrain->getMaterial(0).MaterialType == video::EMT_SOLID ?
video::EMT_DETAIL_MAP : video::EMT_SOLID);
return true;
default:
break;
}
}
......@@ -123,7 +127,7 @@ int main()
env->getSkin()->setFont(env->getFont("../../media/fontlucida.png"));
// add some help text
gui::IGUIStaticText* text = env->addStaticText(
env->addStaticText(
L"Press 'W' to change wireframe mode\nPress 'D' to toggle detail map",
core::rect<s32>(10,440,250,475), true, true, 0, -1, true);
......@@ -131,7 +135,7 @@ int main()
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS(0,100.0f,1200.f);
camera->setPosition(core::vector3df(1900*2,255*2,3700*2));
camera->setPosition(core::vector3df(2700*2,255*2,2600*2));
camera->setTarget(core::vector3df(2397*2,343*2,2700*2));
camera->setFarValue(12000.0f);
......
......@@ -13,7 +13,9 @@ for the rendering driver, create the Irrlicht Device:
using namespace irr;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
int main()
{
......@@ -84,8 +86,8 @@ int main()
*/
// add white light
scene::ILightSceneNode* light = smgr->addLightSceneNode(0,
core::vector3df(-15,5,-105), video::SColorf(1.0f, 1.0f, 1.0f));
smgr->addLightSceneNode(0, core::vector3df(-15,5,-105),
video::SColorf(1.0f, 1.0f, 1.0f));
// set ambient light
smgr->setAmbientLight(video::SColor(0,60,60,60));
......
......@@ -58,7 +58,9 @@ Again, to be able to use the Irrlicht.DLL file, we need to link with the
Irrlicht.lib. We could set this option in the project settings, but
to make it easy, we use a pragma comment lib:
*/
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
//! produces a serie of screenshots
......@@ -235,9 +237,11 @@ int IRRCALLCONV main(int argc, char* argv[])
// the additional mesh can be quite huge and is unoptimized
scene::IMesh * additional_mesh = mesh->getMesh ( quake3::E_Q3_MESH_ITEMS );
#ifdef SHOW_SHADER_NAME
gui::IGUIFont *font = device->getGUIEnvironment()->getFont("../../media/fontlucida.png");
u32 count = 0;
#endif
for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount (); ++i )
{
IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i );
......
......@@ -11,7 +11,7 @@ nothing to say about it)
*/
#include <irrlicht.h>
#include <stdio.h>
#include <iostream>
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
......@@ -19,11 +19,9 @@ nothing to say about it)
//Namespaces for the engine
using namespace irr;
using namespace video;
using namespace core;
using namespace video;
using namespace scene;
using namespace io;
using namespace gui;
/*
Now we'll define the resolution in a constant for use in
......@@ -76,13 +74,36 @@ Just take care of the maps position.
*/
int main()
{
video::E_DRIVER_TYPE driverType;
printf("Please select the driver you want for this example:\n"\
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
" (f) NullDevice\n (otherKey) exit\n\n");
char i;
std::cin >> i;
switch(i)
{
case 'a': driverType = video::EDT_DIRECT3D9;break;
case 'b': driverType = video::EDT_DIRECT3D8;break;
case 'c': driverType = video::EDT_OPENGL; break;
case 'd': driverType = video::EDT_SOFTWARE; break;
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break;
default: return 1;
}
//Instance of the EventReceiver
MyEventReceiver receiver;
//Initialise the engine
IrrlichtDevice *device = createDevice(EDT_OPENGL,
IrrlichtDevice *device = createDevice(driverType,
dimension2d<s32>(ResX,ResY), 32, fullScreen,
false, false, &receiver);
if (!device)
return 1;
ISceneManager *smgr = device->getSceneManager();
IVideoDriver *driver = device->getVideoDriver();
......@@ -93,10 +114,14 @@ int main()
return 1;
IAnimatedMeshSceneNode *model_node = smgr->addAnimatedMeshSceneNode(model);
//Load texture
ITexture *texture = driver->getTexture("../../media/sydney.bmp");
model_node->setMaterialTexture(0,texture);
//Disable lighting (we've got no light)
model_node->setMaterialFlag(EMF_LIGHTING,false);
if (model_node)
{
ITexture *texture = driver->getTexture("../../media/sydney.bmp");
model_node->setMaterialTexture(0,texture);
model_node->setMD2Animation(scene::EMAT_RUN);
//Disable lighting (we've got no light)
model_node->setMaterialFlag(EMF_LIGHTING,false);
}
//Load map
device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");
......
......@@ -171,6 +171,10 @@ int main()
std::cout << "Joystick support is not enabled." << std::endl;
}
wchar_t tmp[1024];
swprintf(tmp, 1024, L"Irrlicht Joystick Example (%u joysticks)", joystickInfo.size());
device->setWindowCaption(tmp);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
......
......@@ -740,7 +740,7 @@ void CDemo::createParticleImpacts()
#ifdef USE_IRRKLANG
if (irrKlang)
{
audio::ISound* sound =
irrklang::ISound* sound =
irrKlang->play3D(impactSound, Impacts[i].pos, false, false, true);
if (sound)
......@@ -768,14 +768,14 @@ void CDemo::createParticleImpacts()
#ifdef USE_IRRKLANG
void CDemo::startIrrKlang()
{
irrKlang = audio::createIrrKlangDevice();
irrKlang = irrklang::createIrrKlangDevice();
if (!irrKlang)
return;
// play music
audio::ISound* snd = irrKlang->play2D("../../media/IrrlichtTheme.ogg", true, false, true);
irrklang::ISound* snd = irrKlang->play2D("../../media/IrrlichtTheme.ogg", true, false, true);
if ( !snd )
snd = irrKlang->play2D("IrrlichtTheme.ogg", true, false, true);
......
......@@ -63,9 +63,9 @@ private:
#ifdef USE_IRRKLANG
void startIrrKlang();
audio::ISoundEngine* irrKlang;
audio::ISoundSource* ballSound;
audio::ISoundSource* impactSound;
irrklang::ISoundEngine* irrKlang;
irrklang::ISoundSource* ballSound;
irrklang::ISoundSource* impactSound;
#endif
#ifdef USE_SDL_MIXER
......
......@@ -81,7 +81,8 @@ namespace scene
{
if (sizeof(T)==sizeof(u16))
return video::EIT_16BIT;
return video::EIT_32BIT;
else
return video::EIT_32BIT;
}
};
......
......@@ -76,8 +76,7 @@ namespace gui
EGTDF_ROWS = 1,
EGTDF_COLUMNS = 2,
EGTDF_ACTIVE_ROW = 4,
EGTDF_COUNT,
EGTDF_COUNT
};
class IGUIFont;
......
......@@ -25,9 +25,6 @@ class IMaterialRenderer : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~IMaterialRenderer() {}
//! Called by the IVideoDriver implementation the let the renderer set its needed render states.
/** This is called during the IVideoDriver::setMaterial() call.
When overriding this, you can set some renderstates or for example a
......
......@@ -21,10 +21,6 @@ class IShaderConstantSetCallBack : public virtual IReferenceCounted
{
public:
//! Destructor.
virtual ~IShaderConstantSetCallBack() {}
//! Called to let the callBack know the used material (optional method)
/**
\code
......
......@@ -86,7 +86,7 @@ class quaternion
void getMatrix( matrix4 &dest ) const;
//! Creates a matrix from this quaternion
void getMatrix_transposed( matrix4 &dest ) const;
inline void getMatrix_transposed( matrix4 &dest ) const;
//! Inverts this quaternion
quaternion& makeInverse();
......
......@@ -201,24 +201,31 @@ void CAnimatedMeshSceneNode::OnRegisterSceneNode()
}
}
IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(void)
IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControlJoints)
{
if(MeshForCurrentFrame && core::equals(CurrentFrameNr, FrameWhenCurrentMeshWasGenerated))
return MeshForCurrentFrame;
if(Mesh->getMeshType() != EAMT_SKINNED)
{
MeshForCurrentFrame = Mesh->getMesh((s32)getFrameNr(), 255, StartFrame, EndFrame);
if(!MeshForCurrentFrame || core::equals(CurrentFrameNr, FrameWhenCurrentMeshWasGenerated))
MeshForCurrentFrame = Mesh->getMesh((s32)getFrameNr(), 255, StartFrame, EndFrame);
}
else
{
CSkinnedMesh* skinnedMesh = reinterpret_cast<CSkinnedMesh*>(Mesh);
if (JointMode == EJUOR_CONTROL)//write to mesh
if (JointMode == EJUOR_CONTROL && forceRecalcOfControlJoints)//write to mesh
{
skinnedMesh->transferJointsToMesh(JointChildSceneNodes);
else
skinnedMesh->animateMesh(getFrameNr(), 1.0f);
}
else
{
// Return the mesh for the current frame if it hasn't changed, otherwise update it.
if(MeshForCurrentFrame && core::equals(CurrentFrameNr, FrameWhenCurrentMeshWasGenerated))
return MeshForCurrentFrame;
else
skinnedMesh->animateMesh(getFrameNr(), 1.0f);
}
// Update the skinned mesh for the current joint transforms.
skinnedMesh->skinMesh();
if (JointMode == EJUOR_READ)//read from mesh
......@@ -231,7 +238,11 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(void)
{
JointChildSceneNodes[n]->updateAbsolutePositionOfAllChildren(); //temp, should be an option
}
}
else
{
// For EJUOR_READ meshes, this is done by calling animateMesh()
skinnedMesh->updateBoundingBox();
}
MeshForCurrentFrame = skinnedMesh;
......@@ -249,7 +260,7 @@ void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
if ( Mesh )
{
scene::IMesh * mesh = getMeshForCurrentFrame();
scene::IMesh * mesh = getMeshForCurrentFrame(true);
if ( mesh )
Box = mesh->getBoundingBox();
......@@ -273,7 +284,7 @@ void CAnimatedMeshSceneNode::render()
++PassCount;
scene::IMesh* m = getMeshForCurrentFrame();
scene::IMesh* m = getMeshForCurrentFrame(false);
if ( 0 == m )
{
......
......@@ -162,7 +162,10 @@ namespace scene
private:
//! Get a static mesh for the current frame of this animated mesh
IMesh* getMeshForCurrentFrame(void);
/** \param forceRecalcOfControlJoints If the mesh is a skinned mesh with controlled joints, force
a recalculation even if the frame number hasn't changed. Otherwise return the cached mesh for the
current frame if it exists. */
IMesh* getMeshForCurrentFrame(bool forceRecalcOfControlJoints);
f32 buildFrameNr( u32 timeMs);
void checkJoints();
......
......@@ -418,7 +418,7 @@ namespace video
{
BD3DZB_FALSE = 0, // Disable depth buffering
BD3DZB_TRUE = 1, // Enable z-buffering
BD3DZB_USEW = 2, //Enable w-buffering.
BD3DZB_USEW = 2 //Enable w-buffering.
};
//! Defines the supported compare functions.
......@@ -438,7 +438,7 @@ namespace video
{
BD3DMCS_MATERIAL = 0, // Use the color from the current material.
BD3DMCS_COLOR1 = 1, // Use the diffuse vertex color.
BD3DMCS_COLOR2 = 2, // Use the specular vertex color.
BD3DMCS_COLOR2 = 2 // Use the specular vertex color.
};
......@@ -462,7 +462,7 @@ namespace video
/*! BD3DSHADE_PHONG
Not supported.
*/
BD3DSHADE_PHONG = 3,
BD3DSHADE_PHONG = 3
};
/*! Defines constants describing the fill mode
......@@ -472,7 +472,7 @@ namespace video
{
BD3DFILL_POINT = 1, // Fill points.
BD3DFILL_WIREFRAME = 2, // Fill wireframes.
BD3DFILL_SOLID = 3, // Fill solids.
BD3DFILL_SOLID = 3 // Fill solids.
};
......@@ -485,7 +485,7 @@ namespace video
{
BD3DCULL_NONE = 1, // Do not cull back faces.
BD3DCULL_CW = 2, // Cull back faces with clockwise vertices.
BD3DCULL_CCW = 3, // Cull back faces with counterclockwise vertices.
BD3DCULL_CCW = 3 // Cull back faces with counterclockwise vertices.
};
struct SShaderParam
......
......@@ -2118,39 +2118,39 @@ void CColladaFileLoader::readPolygonSection(io::IXMLReaderUTF8* reader,
// as full tesselation is problematic
if (FlipAxis)
{
for (u32 i = indices.size()-3; i>0 ; --i)
for (u32 ind = indices.size()-3; ind>0 ; --ind)
{
mbuffer->Indices.push_back(indices[0]);
mbuffer->Indices.push_back(indices[i+2]);
mbuffer->Indices.push_back(indices[i+1]);
mbuffer->Indices.push_back(indices[ind+2]);
mbuffer->Indices.push_back(indices[ind+1]);
}
}
else
{
for (u32 i = 0; i+2 < indices.size(); ++i)
for (u32 ind = 0; i+2 < indices.size(); ++ind)
{
mbuffer->Indices.push_back(indices[0]);
mbuffer->Indices.push_back(indices[i+1]);
mbuffer->Indices.push_back(indices[i+2]);
mbuffer->Indices.push_back(indices[ind+1]);
mbuffer->Indices.push_back(indices[ind+2]);
}
}
}
else
{
// it's just triangles
for (u32 i = 0; i < indices.size(); i+=3)
for (u32 ind = 0; ind < indices.size(); ind+=3)
{
if (FlipAxis)
{
mbuffer->Indices.push_back(indices[i+2]);
mbuffer->Indices.push_back(indices[i+1]);
mbuffer->Indices.push_back(indices[i+0]);
mbuffer->Indices.push_back(indices[ind+2]);
mbuffer->Indices.push_back(indices[ind+1]);
mbuffer->Indices.push_back(indices[ind+0]);
}
else
{
mbuffer->Indices.push_back(indices[i+0]);
mbuffer->Indices.push_back(indices[i+1]);
mbuffer->Indices.push_back(indices[i+2]);
mbuffer->Indices.push_back(indices[ind+0]);
mbuffer->Indices.push_back(indices[ind+1]);
mbuffer->Indices.push_back(indices[ind+2]);
}
}
}
......
......@@ -2750,7 +2750,7 @@ void CD3D9Driver::checkDepthBuffer(ITexture* tex)
!queryFeature(EVDF_TEXTURE_NPOT),
!queryFeature(EVDF_TEXTURE_NSQUARE), true);
SDepthSurface* depth=0;
core::dimension2di destSize=(0x7fffffff, 0x7fffffff);
core::dimension2di destSize(0x7fffffff, 0x7fffffff);
for (u32 i=0; i<DepthBuffers.size(); ++i)
{
if ((DepthBuffers[i]->Size.Width>=optSize.Width) &&
......
......@@ -279,14 +279,14 @@ void CGUIColorSelectDialog::buildColorRing( const core::dimension2d<s32> & dim,
if ( rTest >= 0.5f && rTest <= 0.55f )
{
u32 alpha = (s32) ( (rTest - 0.5f ) * ( 255.f / 0.05f ) );
*dst = *dst & 0x00ffffff | (alpha << 24);
*dst = (*dst & 0x00ffffff) | (alpha << 24);
}
if ( rTest >= 0.95f )
{
u32 alpha = (s32) ( (rTest - 0.95f ) * ( 255.f / 0.05f ) );
alpha = 255 - alpha;
*dst = *dst & 0x00ffffff | (alpha << 24);
*dst = (*dst & 0x00ffffff) | (alpha << 24);
}
}
}
......
......@@ -1401,16 +1401,16 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
for(joystick = 0; joystick < joystickInfo.size(); ++joystick)
{
char logString[256];
(void)sprintf(logString, "Found joystick %d, %d axes, %d buttons '%s'",
(void)sprintf(logString, "Found joystick %u, %u axes, %u buttons '%s'",
joystick, joystickInfo[joystick].Axes,
joystickInfo[joystick].Buttons, joystickInfo[joystick].Name.c_str());
os::Printer::log(logString, ELL_INFORMATION);
}
return true;
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
#else
return false;
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
}
......
......@@ -1202,9 +1202,9 @@ void CLWOMeshFileLoader::readMat(u32 size)
size -= readVX(mat->Envelope[21]);
File->read(&tmp32, 4); // skip type
size -= 4;
core::stringc name;
size -= readString(name, size);
// mat->VertexColor = getColorVMAP(name);
core::stringc tmpname;
size -= readString(tmpname, size);
// mat->VertexColor = getColorVMAP(tmpname);
}
break;
case charsToUIntD('F','L','A','G'):
......@@ -1511,10 +1511,10 @@ void CLWOMeshFileLoader::readMat(u32 size)
os::Printer::log("LWO loader: loading material vmap binding.");
#endif
{
core::stringc name;
size -= readString(name);
if (VMap.find(name) != 0)
mat->Texture[currTexture].TCoords = &TCoords[VMap.find(name)->getValue()];
core::stringc tmpname;
size -= readString(tmpname);
if (VMap.find(tmpname) != 0)
mat->Texture[currTexture].TCoords = &TCoords[VMap.find(tmpname)->getValue()];
}
break;
case charsToUIntD('B','L','O','K'):
......
......@@ -11,7 +11,7 @@
#include <string.h>
#include <unistd.h>
#ifdef _IRR_USE_OSX_DEVICE_
#include "OSXClipboard.h"
#include "MacOSX/OSXClipboard.h"
#endif
#ifdef _IRR_OSX_PLATFORM_
#include <sys/types.h>
......
......@@ -1040,7 +1040,6 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun
const void* indexList, u32 primitiveCount,
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType)
{
if (!primitiveCount || !vertexCount)
return;
......
......@@ -41,7 +41,6 @@ COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(video::COpenGLDriver* drive
: Driver(driver), CallBack(callback), BaseMaterial(baseMaterial),
Program(0), UserData(userData)
{
#ifdef _DEBUG
setDebugName("COpenGLSLMaterialRenderer");
#endif
......@@ -124,6 +123,7 @@ void COpenGLSLMaterialRenderer::init(s32& outMaterialTypeNr,
outMaterialTypeNr = Driver->addMaterialRenderer(this);
}
bool COpenGLSLMaterialRenderer::OnRender(IMaterialRendererServices* service,
E_VERTEX_TYPE vtxtype)
{
......@@ -142,7 +142,7 @@ void COpenGLSLMaterialRenderer::OnSetMaterial(const video::SMaterial& material,
{
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{
if(Program)
if (Program)
Driver->extGlUseProgramObject(Program);
if (BaseMaterial)
......@@ -215,6 +215,7 @@ bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shad
return true;
}
bool COpenGLSLMaterialRenderer::linkProgram()
{
Driver->extGlLinkProgram(Program);
......@@ -290,7 +291,6 @@ bool COpenGLSLMaterialRenderer::linkProgram()
}
void COpenGLSLMaterialRenderer::setBasicRenderStates(const SMaterial& material,
const SMaterial& lastMaterial,
bool resetAllRenderstates)
......
......@@ -78,13 +78,13 @@ void COpenGLShaderMaterialRenderer::init(s32& outMaterialTypeNr, const c8* verte
{
outMaterialTypeNr = -1;
bool failure;
bool success;
// create vertex shader
failure=createVertexShader(vertexShaderProgram);
success=createVertexShader(vertexShaderProgram);
// create pixel shader
if (!createPixelShader(pixelShaderProgram) || failure)
if (!createPixelShader(pixelShaderProgram) || !success)
return;
// register as a new material
......@@ -208,7 +208,7 @@ bool COpenGLShaderMaterialRenderer::createPixelShader(const c8* pxsh)
}
bool COpenGLShaderMaterialRenderer::createVertexShader(const char* vtxsh)
bool COpenGLShaderMaterialRenderer::createVertexShader(const c8* vtxsh)
{
if (!vtxsh)
return true;
......
......@@ -72,7 +72,7 @@ protected:
const c8* pixelShaderProgram, E_VERTEX_TYPE type);
bool createPixelShader(const c8* pxsh);
bool createVertexShader(const char* vtxsh);
bool createVertexShader(const c8* vtxsh);
COpenGLDriver* Driver;
IShaderConstantSetCallBack* CallBack;
......
......@@ -186,9 +186,9 @@ void CSceneNodeAnimatorCollisionResponse::animateNode(ISceneNode* node, u32 time
// move camera target
if (AnimateCameraTarget && IsCamera)
{
const core::vector3df diff = Object->getPosition() - LastPosition - vel;
const core::vector3df pdiff = Object->getPosition() - LastPosition - vel;
ICameraSceneNode* cam = (ICameraSceneNode*)Object;
cam->setTarget(cam->getTarget() + diff);
cam->setTarget(cam->getTarget() + pdiff);
}
LastPosition = Object->getPosition();
......
......@@ -174,19 +174,19 @@ void CSkinnedMesh::buildAll_LocalAnimatedMatrices()
*/
// -------- joint->LocalAnimatedMatrix *= scaleMatrix -----------------
f32 *m1 = joint->LocalAnimatedMatrix.pointer();
m1[0] *= joint->Animatedscale.X;
m1[1] *= joint->Animatedscale.X;
m1[2] *= joint->Animatedscale.X;
m1[3] *= joint->Animatedscale.X;
m1[4] *= joint->Animatedscale.Y;
m1[5] *= joint->Animatedscale.Y;
m1[6] *= joint->Animatedscale.Y;
m1[7] *= joint->Animatedscale.Y;
m1[8] *= joint->Animatedscale.Z;
m1[9] *= joint->Animatedscale.Z;
m1[10] *= joint->Animatedscale.Z;
m1[11] *= joint->Animatedscale.Z;
core::matrix4& mat = joint->LocalAnimatedMatrix;
mat[0] *= joint->Animatedscale.X;
mat[1] *= joint->Animatedscale.X;
mat[2] *= joint->Animatedscale.X;
mat[3] *= joint->Animatedscale.X;
mat[4] *= joint->Animatedscale.Y;
mat[5] *= joint->Animatedscale.Y;
mat[6] *= joint->Animatedscale.Y;
mat[7] *= joint->Animatedscale.Y;
mat[8] *= joint->Animatedscale.Z;
mat[9] *= joint->Animatedscale.Z;
mat[10] *= joint->Animatedscale.Z;
mat[11] *= joint->Animatedscale.Z;
// -----------------------------------
}
......
......@@ -144,6 +144,8 @@ namespace scene
virtual SWeight *createWeight(SJoint *joint);
virtual void updateBoundingBox(void);
private:
void checkForAnimation();
......@@ -168,8 +170,6 @@ private:
core::vector3df& vt1, core::vector3df& vt2, core::vector3df& vt3,
core::vector2df& tc1, core::vector2df& tc2, core::vector2df& tc3);
void updateBoundingBox(void);
core::array<SSkinMeshBuffer*> *SkinningBuffers; //Meshbuffer to skin, default is to skin localBuffers
core::array<SSkinMeshBuffer*> LocalBuffers;
......
......@@ -41,7 +41,7 @@ JPEGLIBOBJ = jpeglib/jcapimin.o jpeglib/jcapistd.o jpeglib/jccoefct.o jpeglib/jc
LIBPNGOBJ = libpng/png.o libpng/pngerror.o libpng/pngget.o libpng/pngmem.o libpng/pngpread.o libpng/pngread.o libpng/pngrio.o libpng/pngrtran.o libpng/pngrutil.o libpng/pngset.o libpng/pngtrans.o libpng/pngwio.o libpng/pngwrite.o libpng/pngwtran.o libpng/pngwutil.o
# Next variable is for additional scene nodes etc. of customized Irrlicht versions
EXTRAOBJ =
LINKOBJ := $(IRRMESHOBJ) $(IRROBJ) $(IRRPARTICLEOBJ) $(IRRANIMOBJ) \
LINKOBJ = $(IRRMESHOBJ) $(IRROBJ) $(IRRPARTICLEOBJ) $(IRRANIMOBJ) \
$(IRRVIDEOOBJ) $(IRRSWRENDEROBJ) $(IRRIOOBJ) $(IRROTHEROBJ) \
$(IRRGUIOBJ) $(ZLIBOBJ) $(JPEGLIBOBJ) $(LIBPNGOBJ) $(EXTRAOBJ)
......@@ -69,17 +69,23 @@ LIBSELECT=64
endif
#Linux specific options
staticlib sharedlib install: SYSTEM = Linux
STATIC_LIB = libIrrlicht.a
IRRLICHT_DLL := ../../bin/Win32-gcc/Irrlicht.dll
LIB_PATH = ../../lib/$(SYSTEM)
INSTALL_DIR = /usr/local/lib
staticlib sharedlib install: SYSTEM = Linux
staticlib_osx sharedlib_osx install_osx: SYSTEM = MacOSX
sharedlib: SHARED_LIB = libIrrlicht.so
staticlib sharedlib: LDFLAGS = --no-export-all-symbols --add-stdcall-alias
sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm
staticlib sharedlib: CXXINCS += -I/usr/X11R6/include
#OSX specific options
staticlib_osx sharedlib_osx install_osx: SYSTEM = MacOSX
staticlib_osx sharedlib_osx: IRROTHEROBJ += MacOSX/CIrrDeviceMacOSX.o MacOSX/OSXClipboard.o MacOSX/AppDelegate.o
staticlib_osx sharedlib_osx: CXXINCS += -IMacOSX -I/usr/X11R6/include
sharedlib_osx: SHARED_LIB = libIrrlicht.dylib
staticlib sharedlib staticlib_osx sharedlib_osx: LDFLAGS = --no-export-all-symbols --add-stdcall-alias
sharedlib sharedlib_osx: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm
staticlib sharedlib staticlib_osx sharedlib_osx: CXXINCS += -I/usr/X11R6/include
staticlib_osx sharedlib_osx: LDFLAGS = --no-export-all-symbols --add-stdcall-alias
sharedlib_osx: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm
#Windows specific options
sharedlib_win32 staticlib_win32: SYSTEM = Win32-gcc
......@@ -136,6 +142,10 @@ TAGS:
%.d:%.cpp
$(CXX) $(CPPFLAGS) -MM -MF $@ $<
# Create object files from objective-c code
%.o:%.mm
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $@ $<
ifneq ($(MAKECMDGOALS),clean)
-include $(LINKOBJ:.o=.d)
endif
......
......@@ -273,7 +273,7 @@ enum e4DVertexFlag
VERTEX4D_FORMAT_MASK_COLOR = 0x00F00000,
VERTEX4D_FORMAT_COLOR_1 = 0x00100000,
VERTEX4D_FORMAT_COLOR_2 = 0x00200000,
VERTEX4D_FORMAT_COLOR_2 = 0x00200000
};
......
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