Commit f29995de authored by hybrid's avatar hybrid

Merged revisions 2848:2891 from 1.6 branch. DMF loader fixes, Win32 shift key...

Merged revisions 2848:2891 from 1.6 branch. DMF loader fixes, Win32 shift key fixes, version number update.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2892 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 23ffd04c
......@@ -176,7 +176,6 @@ namespace scene
//! flags the meshbuffer as changed, reloads hardware buffers
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0;
//to be spit into vertex and index buffers:
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
virtual u32 getChangedID_Vertex() const = 0;
......
......@@ -7,12 +7,12 @@
//! Irrlicht SDK Version
#define IRRLICHT_VERSION_MAJOR 1
#define IRRLICHT_VERSION_MINOR 6
#define IRRLICHT_VERSION_REVISION 0
#define IRRLICHT_VERSION_MINOR 7
#define IRRLICHT_VERSION_REVISION 0-alpha
// This flag will be defined only in SVN, the official release code will have
// it undefined
//#define IRRLICHT_VERSION_SVN
#define IRRLICHT_SDK_VERSION "1.6"
#define IRRLICHT_VERSION_SVN
#define IRRLICHT_SDK_VERSION "1.7.0-alpha"
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
......
......@@ -46,6 +46,32 @@ CDMFLoader::CDMFLoader(ISceneManager* smgr, io::IFileSystem* filesys)
}
void CDMFLoader::findFile(bool use_mat_dirs, const core::stringc& path, const core::stringc& matPath, core::stringc& filename)
{
// path + texpath + full name
if (use_mat_dirs && FileSystem->existFile(path+matPath+filename))
filename = path+matPath+filename;
// path + full name
else if (FileSystem->existFile(path+filename))
filename = path+filename;
// path + texpath + base name
else if (use_mat_dirs && FileSystem->existFile(path+matPath+FileSystem->getFileBasename(filename)))
filename = path+matPath+FileSystem->getFileBasename(filename);
// path + base name
else if (FileSystem->existFile(path+FileSystem->getFileBasename(filename)))
filename = path+FileSystem->getFileBasename(filename);
// texpath + full name
else if (use_mat_dirs && FileSystem->existFile(matPath+filename))
filename = matPath+filename;
// texpath + base name
else if (use_mat_dirs && FileSystem->existFile(matPath+FileSystem->getFileBasename(filename)))
filename = matPath+FileSystem->getFileBasename(filename);
// base name
else if (FileSystem->existFile(FileSystem->getFileBasename(filename)))
filename = FileSystem->getFileBasename(filename);
}
/**Creates/loads an animated mesh from the file.
\return Pointer to the created mesh. Returns 0 if loading failed.
If you no longer need the mesh, you should call IAnimatedMesh::drop().
......@@ -136,6 +162,8 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
// Add this face's verts
if (use2TCoords)
{
// make sure we have the proper type set
meshBuffer->VertexType=video::EVT_2TCOORDS;
for (u32 v = 0; v < faces[i].numVerts; v++)
{
const dmfVert& vv = verts[faces[i].firstVert + v];
......@@ -244,34 +272,8 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
{
if (materiali[i].textureBlend==4)
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT,true);
// path + texpath + full name
if (use_mat_dirs && FileSystem->existFile(path+materiali[i].pathName+materiali[i].textureName))
tex = driver->getTexture((path+materiali[i].pathName+materiali[i].textureName));
// path + full name
else if (FileSystem->existFile(path+materiali[i].textureName))
tex = driver->getTexture((path+materiali[i].textureName));
// path + texpath + base name
else if (use_mat_dirs && FileSystem->existFile(path+materiali[i].pathName+FileSystem->getFileBasename(materiali[i].textureName)))
tex = driver->getTexture((path+materiali[i].pathName+FileSystem->getFileBasename(materiali[i].textureName)));
// path + base name
else if (FileSystem->existFile(path+FileSystem->getFileBasename(materiali[i].textureName)))
tex = driver->getTexture((path+FileSystem->getFileBasename(materiali[i].textureName)));
// texpath + full name
else if (use_mat_dirs && FileSystem->existFile(materiali[i].pathName+materiali[i].textureName))
tex = driver->getTexture(materiali[i].pathName+materiali[i].textureName.c_str());
// full name
else if (FileSystem->existFile(materiali[i].textureName))
tex = driver->getTexture(materiali[i].textureName.c_str());
// texpath + base name
else if (use_mat_dirs && FileSystem->existFile(materiali[i].pathName+FileSystem->getFileBasename(materiali[i].textureName)))
tex = driver->getTexture(materiali[i].pathName+FileSystem->getFileBasename(materiali[i].textureName));
// base name
else if (FileSystem->existFile(FileSystem->getFileBasename(materiali[i].textureName)))
tex = driver->getTexture(FileSystem->getFileBasename(materiali[i].textureName));
#ifdef _IRR_DMF_DEBUG_
else
os::Printer::log("Could not load texture", materiali[i].textureName);
#endif // _IRR_DMF_DEBUG_
findFile(use_mat_dirs, path, materiali[i].pathName, materiali[i].textureName);
tex = driver->getTexture(materiali[i].textureName);
}
//Primary texture is just a colour
else if(materiali[i].textureFlag==1)
......@@ -299,7 +301,10 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
//Lightmap is present
if (materiali[i].lightmapFlag == 0)
lig = driver->getTexture((path+materiali[i].lightmapName));
{
findFile(use_mat_dirs, path, materiali[i].pathName, materiali[i].lightmapName);
lig = driver->getTexture(materiali[i].lightmapName);
}
else //no lightmap
{
mat.MaterialType = video::EMT_SOLID;
......
......@@ -78,6 +78,8 @@ namespace scene
bool mode = true);
private:
void findFile(bool use_mat_dirs, const core::stringc& path, const core::stringc& matPath, core::stringc& filename);
ISceneManager* SceneMgr;
io::IFileSystem* FileSystem;
};
......
......@@ -208,17 +208,30 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
event.KeyInput.Key = (irr::EKEY_CODE)wParam;
event.KeyInput.PressedDown = (message==WM_KEYDOWN || message == WM_SYSKEYDOWN);
const UINT MY_MAPVK_VSC_TO_VK_EX = 3; // MAPVK_VSC_TO_VK_EX should be in SDK according to MSDN, but isn't in mine.
if ( event.KeyInput.Key == irr::KEY_SHIFT )
{
// this will fail on systems before windows NT/2000/XP, not sure _what_ will return there instead.
event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MY_MAPVK_VSC_TO_VK_EX );
}
if ( event.KeyInput.Key == irr::KEY_CONTROL )
{
event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MY_MAPVK_VSC_TO_VK_EX );
// some keyboards will just return LEFT for both - left and right keys. So also check extend bit.
if (lParam & 0x1000000)
event.KeyInput.Key = irr::KEY_RCONTROL;
}
if ( event.KeyInput.Key == irr::KEY_MENU )
{
event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MY_MAPVK_VSC_TO_VK_EX );
if (lParam & 0x1000000)
event.KeyInput.Key = irr::KEY_RMENU;
}
WORD KeyAsc=0;
GetKeyboardState(allKeys);
ToAscii((UINT)wParam,(UINT)lParam,allKeys,&KeyAsc,0);
if (event.KeyInput.Key==irr::KEY_SHIFT)
{
if ((allKeys[VK_LSHIFT] & 0x80)!=0)
event.KeyInput.Key=irr::KEY_LSHIFT;
else if ((allKeys[VK_RSHIFT] & 0x80)!=0)
event.KeyInput.Key=irr::KEY_RSHIFT;
}
event.KeyInput.Shift = ((allKeys[VK_SHIFT] & 0x80)!=0);
event.KeyInput.Control = ((allKeys[VK_CONTROL] & 0x80)!=0);
event.KeyInput.Char = (KeyAsc & 0x00ff); //KeyAsc >= 0 ? KeyAsc : 0;
......
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