Merge revision 4668-4710 from branch to ogl-es:
- Add ITexture::getSource which can be used to check where the last IVideoDriver::getTexture call found the texture. - Add IMeshTextureLoader interface and replace texture-loading algorithms in most meshloaders. - Prevent some precision troubles on some compilers when working with vector3d<s32>. - CGUICheckBox no longer gives up focus on EMIE_LMOUSE_LEFT_UP (thx @Demre for reporting) - Bugfix: IGUIElement::addChild now prevents setting an element as it's own child. - GUI editor improvements (prevent crash, improve UI) - Add IrrlichtDevice::setWindowSize. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4711 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
9f8e6c0e9d
commit
5ec052ff0f
|
@ -6,6 +6,12 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
|
|||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
|
||||
- Add ITexture::getSource which can be used to check where the last IVideoDriver::getTexture call found the texture.
|
||||
- Add IMeshTextureLoader interface and replace texture-loading algorithms in most meshloaders.
|
||||
- CGUICheckBox no longer gives up focus on EMIE_LMOUSE_LEFT_UP (thx @Demre for reporting)
|
||||
- Bugfix: IGUIElement::addChild now prevents setting an element as it's own child.
|
||||
- GUI editor improvements (prevent crash, improve UI)
|
||||
- Add IrrlichtDevice::setWindowSize.
|
||||
- Bugfix: getFont for xml-fonts now also works for fonts inside archives (thx @Neirdan for bugreport)
|
||||
- Added function irr::core::mergeFilename
|
||||
- Add ISceneNodeAnimator::setStartTime/getStartTime to allow resetting movement animators.
|
||||
|
|
|
@ -278,9 +278,9 @@ public:
|
|||
//! Adds a GUI element as new child of this element.
|
||||
virtual void addChild(IGUIElement* child)
|
||||
{
|
||||
addChildToEnd(child);
|
||||
if (child)
|
||||
if ( child && child != this )
|
||||
{
|
||||
addChildToEnd(child);
|
||||
child->updateAbsolutePosition();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "IReferenceCounted.h"
|
||||
#include "path.h"
|
||||
#include "IMeshTextureLoader.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -27,8 +28,15 @@ class IMeshLoader : public virtual IReferenceCounted
|
|||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
IMeshLoader() : TextureLoader(0) {}
|
||||
|
||||
//! Destructor
|
||||
virtual ~IMeshLoader() {}
|
||||
virtual ~IMeshLoader()
|
||||
{
|
||||
if ( TextureLoader )
|
||||
TextureLoader->drop();
|
||||
}
|
||||
|
||||
//! Returns true if the file might be loaded by this class.
|
||||
/** This decision should be based on the file extension (e.g. ".cob")
|
||||
|
@ -43,6 +51,35 @@ public:
|
|||
If you no longer need the mesh, you should call IAnimatedMesh::drop().
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IAnimatedMesh* createMesh(io::IReadFile* file) = 0;
|
||||
|
||||
//! Set a new texture loader which this meshloader can use when searching for textures.
|
||||
/** NOTE: Not all meshloaders do support this interface. Meshloaders which
|
||||
support it will return a non-null value in getMeshTextureLoader from the start. Setting a
|
||||
texture-loader to a meshloader which doesn't support it won't help.
|
||||
\param textureLoader The textureloader to use. When set to NULL the mesh will not load any textures.
|
||||
*/
|
||||
virtual void setMeshTextureLoader(IMeshTextureLoader* textureLoader)
|
||||
{
|
||||
if ( textureLoader != TextureLoader )
|
||||
{
|
||||
if ( textureLoader )
|
||||
textureLoader->grab();
|
||||
if ( TextureLoader )
|
||||
TextureLoader->drop();
|
||||
TextureLoader = textureLoader;
|
||||
}
|
||||
}
|
||||
|
||||
//! Get the texture loader used when this meshloder searches for textures.
|
||||
/** NOTE: not all meshloaders support this interface so this can return NULL.
|
||||
*/
|
||||
virtual IMeshTextureLoader* getMeshTextureLoader() const
|
||||
{
|
||||
return TextureLoader;
|
||||
}
|
||||
|
||||
protected:
|
||||
IMeshTextureLoader* TextureLoader;
|
||||
};
|
||||
|
||||
|
||||
|
@ -50,4 +87,3 @@ public:
|
|||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef IRR_I_MESH_TEXTURE_LOADER_H_INCLUDED__
|
||||
#define IRR_I_MESH_TEXTURE_LOADER_H_INCLUDED__
|
||||
|
||||
#include "path.h"
|
||||
#include "IReferenceCounted.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
||||
namespace video
|
||||
{
|
||||
class ITexture;
|
||||
}
|
||||
namespace io
|
||||
{
|
||||
class IReadFile;
|
||||
}
|
||||
|
||||
namespace scene
|
||||
{
|
||||
|
||||
//! Finding and loading textures inside meshloaders.
|
||||
/** A texture loader can search for a texture in several paths.
|
||||
For example relative to a given texture-path, relative to the current
|
||||
working directory or relative to a mesh- and/or material-file.
|
||||
*/
|
||||
class IMeshTextureLoader : public virtual IReferenceCounted
|
||||
{
|
||||
public:
|
||||
|
||||
//! Destructor
|
||||
virtual ~IMeshTextureLoader() {}
|
||||
|
||||
//! Set a custom texture path.
|
||||
/** This is the first path the texture-loader should search. */
|
||||
virtual void setTexturePath(const irr::io::path& path) = 0;
|
||||
|
||||
//! Get the current custom texture path.
|
||||
virtual const irr::io::path& getTexturePath() const = 0;
|
||||
|
||||
//! Get the texture by searching for it in all paths that makes sense for the given textureName.
|
||||
/** Usually you do not have to use this method, it is used internally by IMeshLoader's.
|
||||
\param textureName Texturename as used in the mesh-format
|
||||
\return Pointer to the texture. Returns 0 if loading failed.*/
|
||||
virtual irr::video::ITexture* getTexture(const irr::io::path& textureName) = 0;
|
||||
|
||||
//! Meshloaders will search paths relative to the meshFile.
|
||||
/** Usually you do not have to use this method, it is used internally by IMeshLoader's.
|
||||
Any values you set here will likely be overwritten internally. */
|
||||
virtual void setMeshFile(const irr::io::IReadFile* meshFile) = 0;
|
||||
|
||||
//! Meshloaders will try to look relative to the path of the materialFile
|
||||
/** Usually you do not have to use this method, it is used internally by IMeshLoader's.
|
||||
Any values you set here will likely be overwritten internally. */
|
||||
virtual void setMaterialFile(const irr::io::IReadFile* materialFile) = 0;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
|
@ -187,12 +187,7 @@ namespace scene
|
|||
* architecture and calculating lighting. Irrlicht can
|
||||
* directly import .csm files thanks to the IrrCSM library
|
||||
* created by Saurav Mohapatra which is now integrated
|
||||
* directly in Irrlicht. If you are using this loader,
|
||||
* please note that you'll have to set the path of the
|
||||
* textures before loading .csm files. You can do this
|
||||
* using
|
||||
* SceneManager->getParameters()->setAttribute(scene::CSM_TEXTURE_PATH,
|
||||
* "path/to/your/textures");</TD>
|
||||
* directly in Irrlicht.
|
||||
* </TR>
|
||||
* <TR>
|
||||
* <TD>COLLADA (.dae, .xml)</TD>
|
||||
|
@ -232,9 +227,8 @@ namespace scene
|
|||
* game-development. With this loader, it is possible to
|
||||
* directly load all geometry is as well as textures and
|
||||
* lightmaps from .dmf files. To set texture and
|
||||
* material paths, see scene::DMF_USE_MATERIALS_DIRS and
|
||||
* scene::DMF_TEXTURE_PATH. It is also possible to flip
|
||||
* the alpha texture by setting
|
||||
* material paths, see scene::DMF_USE_MATERIALS_DIRS.
|
||||
* It is also possible to flip the alpha texture by setting
|
||||
* scene::DMF_FLIP_ALPHA_TEXTURES to true and to set the
|
||||
* material transparent reference value by setting
|
||||
* scene::DMF_ALPHA_CHANNEL_REF to a float between 0 and
|
||||
|
@ -297,12 +291,7 @@ namespace scene
|
|||
* 3D packages. With this built-in importer, Irrlicht
|
||||
* can read and display those files directly. This
|
||||
* loader was written by Zhuck Dimitry who also created
|
||||
* the whole My3DTools package. If you are using this
|
||||
* loader, please note that you can set the path of the
|
||||
* textures before loading .my3d files. You can do this
|
||||
* using
|
||||
* SceneManager->getParameters()->setAttribute(scene::MY3D_TEXTURE_PATH,
|
||||
* "path/to/your/textures");
|
||||
* the whole My3DTools package.
|
||||
* </TD>
|
||||
* </TR>
|
||||
* <TR>
|
||||
|
@ -331,11 +320,7 @@ namespace scene
|
|||
* <TD>LMTools is a set of tools (Windows & Linux) for
|
||||
* creating lightmaps. Irrlicht can directly read .lmts
|
||||
* files thanks to<br> the importer created by Jonas
|
||||
* Petersen. If you are using this loader, please note
|
||||
* that you can set the path of the textures before
|
||||
* loading .lmts files. You can do this using
|
||||
* SceneManager->getParameters()->setAttribute(scene::LMTS_TEXTURE_PATH,
|
||||
* "path/to/your/textures");
|
||||
* Petersen.
|
||||
* Notes for<br> this version of the loader:<br>
|
||||
* - It does not recognise/support user data in the
|
||||
* *.lmts files.<br>
|
||||
|
@ -1433,10 +1418,7 @@ namespace scene
|
|||
|
||||
//! Get interface to the parameters set in this scene.
|
||||
/** String parameters can be used by plugins and mesh loaders.
|
||||
For example the CMS and LMTS loader want a parameter named 'CSM_TexturePath'
|
||||
and 'LMTS_TexturePath' set to the path were attached textures can be found. See
|
||||
CSM_TEXTURE_PATH, LMTS_TEXTURE_PATH, MY3D_TEXTURE_PATH,
|
||||
COLLADA_CREATE_SCENE_INSTANCES, DMF_TEXTURE_PATH and DMF_USE_MATERIALS_DIRS*/
|
||||
See COLLADA_CREATE_SCENE_INSTANCES and DMF_USE_MATERIALS_DIRS */
|
||||
virtual io::IAttributes* getParameters() = 0;
|
||||
|
||||
//! Get current render pass.
|
||||
|
|
|
@ -539,12 +539,12 @@ namespace scene
|
|||
}
|
||||
|
||||
|
||||
//! Enables or disables automatic culling based on the bounding box.
|
||||
/** Automatic culling is enabled by default. Note that not
|
||||
//! Set a culling style or disable culling completely.
|
||||
/** Box cullling (EAC_BOX) is set by default. Note that not
|
||||
all SceneNodes support culling and that some nodes always cull
|
||||
their geometry because it is their only reason for existence,
|
||||
for example the OctreeSceneNode.
|
||||
\param state The culling state to be used. */
|
||||
\param state The culling state to be used. Check E_CULLING_TYPE for possible values.*/
|
||||
void setAutomaticCulling( u32 state)
|
||||
{
|
||||
AutomaticCullingState = state;
|
||||
|
|
|
@ -118,6 +118,19 @@ enum E_TEXTURE_CUBE_SURFACE
|
|||
ETCS_NEGZ = 5
|
||||
};
|
||||
|
||||
//! Where did the last IVideoDriver::getTexture call find this texture
|
||||
enum E_TEXTURE_SOURCE
|
||||
{
|
||||
//! IVideoDriver::getTexture was never called (texture created otherwise)
|
||||
ETS_UNKNOWN,
|
||||
|
||||
//! Texture has been found in cache
|
||||
ETS_FROM_CACHE,
|
||||
|
||||
//! Texture had to be loaded
|
||||
ETS_FROM_FILE
|
||||
};
|
||||
|
||||
//! Interface of a Video Driver dependent Texture.
|
||||
/** An ITexture is created by an IVideoDriver by using IVideoDriver::addTexture
|
||||
or IVideoDriver::getTexture. After that, the texture may only be used by this
|
||||
|
@ -132,7 +145,7 @@ class ITexture : public virtual IReferenceCounted
|
|||
public:
|
||||
|
||||
//! constructor
|
||||
ITexture(const io::path& name, E_TEXTURE_TYPE type = ETT_2D) : NamedPath(name), Type(type)
|
||||
ITexture(const io::path& name, E_TEXTURE_TYPE type = ETT_2D) : NamedPath(name), Source(ETS_UNKNOWN), Type(type)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -225,6 +238,12 @@ public:
|
|||
//! Returns the type of texture
|
||||
E_TEXTURE_TYPE getType() const { return Type; }
|
||||
|
||||
//! Check where the last IVideoDriver::getTexture found this texture
|
||||
E_TEXTURE_SOURCE getSource() const { return Source; }
|
||||
|
||||
//! Used internally by the engine to update Source status on IVideoDriver::getTexture calls.
|
||||
void updateSource(E_TEXTURE_SOURCE source) { Source = source; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Helper function, helps to get the desired texture creation format from the flags.
|
||||
|
@ -244,7 +263,7 @@ protected:
|
|||
}
|
||||
|
||||
io::SNamedPath NamedPath;
|
||||
|
||||
E_TEXTURE_SOURCE Source;
|
||||
E_TEXTURE_TYPE Type;
|
||||
};
|
||||
|
||||
|
|
|
@ -231,6 +231,13 @@ namespace irr
|
|||
\param resize Flag whether the window should be resizable. */
|
||||
virtual void setResizable(bool resize=false) = 0;
|
||||
|
||||
//! Resize the render window.
|
||||
/** This will only work in windowed mode and is not yet supported on all systems.
|
||||
It does set the drawing/clientDC size of the window, the window decorations are added to that.
|
||||
You get the current window size with IVideoDriver::getScreenSize() (might be unified in future)
|
||||
*/
|
||||
virtual void setWindowSize(const irr::core::dimension2d<u32>& size) = 0;
|
||||
|
||||
//! Minimizes the window if possible.
|
||||
virtual void minimizeWindow() =0;
|
||||
|
||||
|
|
|
@ -29,24 +29,24 @@ namespace scene
|
|||
**/
|
||||
const c8* const ALLOW_ZWRITE_ON_TRANSPARENT = "Allow_ZWrite_On_Transparent";
|
||||
|
||||
//! Name of the parameter for changing the texture path of the built-in csm loader.
|
||||
/** Use it like this:
|
||||
//! Deprecated, use IMeshLoader::getMeshTextureLoader()->setTexturePath instead.
|
||||
/** Was used for changing the texture path of the built-in csm loader like this:
|
||||
\code
|
||||
SceneManager->getParameters()->setAttribute(scene::CSM_TEXTURE_PATH, "path/to/your/textures");
|
||||
\endcode
|
||||
**/
|
||||
const c8* const CSM_TEXTURE_PATH = "CSM_TexturePath";
|
||||
|
||||
//! Name of the parameter for changing the texture path of the built-in lmts loader.
|
||||
/** Use it like this:
|
||||
//! Deprecated, use IMeshLoader::getMeshTextureLoader()->setTexturePath instead.
|
||||
/** Was used for changing the texture path of the built-in lmts loader like this:
|
||||
\code
|
||||
SceneManager->getParameters()->setAttribute(scene::LMTS_TEXTURE_PATH, "path/to/your/textures");
|
||||
\endcode
|
||||
**/
|
||||
const c8* const LMTS_TEXTURE_PATH = "LMTS_TexturePath";
|
||||
|
||||
//! Name of the parameter for changing the texture path of the built-in my3d loader.
|
||||
/** Use it like this:
|
||||
//! Deprecated, use IMeshLoader::getMeshTextureLoader()->setTexturePath instead.
|
||||
/** Was used for changing the texture path of the built-in MY3D loader like this:
|
||||
\code
|
||||
SceneManager->getParameters()->setAttribute(scene::MY3D_TEXTURE_PATH, "path/to/your/textures");
|
||||
\endcode
|
||||
|
@ -66,7 +66,7 @@ namespace scene
|
|||
*/
|
||||
const c8* const COLLADA_CREATE_SCENE_INSTANCES = "COLLADA_CreateSceneInstances";
|
||||
|
||||
//! Name of the parameter for changing the texture path of the built-in DMF loader.
|
||||
//! Deprecated, use IMeshLoader::getMeshTextureLoader()->setTexturePath instead.
|
||||
/** This path is prefixed to the file names defined in the Deled file when loading
|
||||
textures. This allows to alter the paths for a specific project setting.
|
||||
Use it like this:
|
||||
|
@ -111,8 +111,8 @@ namespace scene
|
|||
const c8* const DMF_FLIP_ALPHA_TEXTURES = "DMF_FlipAlpha";
|
||||
|
||||
|
||||
//! Name of the parameter for changing the texture path of the built-in obj loader.
|
||||
/** Use it like this:
|
||||
//! Deprecated, use IMeshLoader::getMeshTextureLoader()->setTexturePath instead.
|
||||
/** Was used for changing the texture path of the built-in obj loader like this:
|
||||
\code
|
||||
SceneManager->getParameters()->setAttribute(scene::OBJ_TEXTURE_PATH, "path/to/your/textures");
|
||||
\endcode
|
||||
|
@ -145,8 +145,8 @@ namespace scene
|
|||
**/
|
||||
const c8* const B3D_LOADER_IGNORE_MIPMAP_FLAG = "B3D_IgnoreMipmapFlag";
|
||||
|
||||
//! Name of the parameter for changing the texture path of the built-in b3d loader.
|
||||
/** Use it like this:
|
||||
//! Deprecated, use IMeshLoader::getMeshTextureLoader()->setTexturePath instead.
|
||||
/** Was used for changing the texture path of the built-in b3d loader like this:
|
||||
\code
|
||||
SceneManager->getParameters()->setAttribute(scene::B3D_TEXTURE_PATH, "path/to/your/textures");
|
||||
\endcode
|
||||
|
|
|
@ -302,7 +302,8 @@ namespace core
|
|||
{
|
||||
vector3d<T> angle;
|
||||
|
||||
const f64 tmp = (atan2((f64)X, (f64)Z) * RADTODEG64);
|
||||
// tmp avoids some precision troubles on some compilers when working with T=s32
|
||||
f64 tmp = (atan2((f64)X, (f64)Z) * RADTODEG64);
|
||||
angle.Y = (T)tmp;
|
||||
|
||||
if (angle.Y < 0)
|
||||
|
@ -312,7 +313,8 @@ namespace core
|
|||
|
||||
const f64 z1 = core::squareroot(X*X + Z*Z);
|
||||
|
||||
angle.X = (T)(atan2((f64)z1, (f64)Y) * RADTODEG64 - 90.0);
|
||||
tmp = (atan2((f64)z1, (f64)Y) * RADTODEG64 - 90.0);
|
||||
angle.X = (T)tmp;
|
||||
|
||||
if (angle.X < 0)
|
||||
angle.X += 360;
|
||||
|
|
|
@ -135,6 +135,7 @@ LOCAL_SRC_FILES := \
|
|||
CMeshCache.cpp \
|
||||
CMeshManipulator.cpp \
|
||||
CMeshSceneNode.cpp \
|
||||
CMeshTextureLoader.cpp \
|
||||
CMetaTriangleSelector.cpp \
|
||||
CMountPointReader.cpp \
|
||||
CMS3DMeshFileLoader.cpp \
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_3DS_LOADER_
|
||||
|
||||
#include "C3DSMeshFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "os.h"
|
||||
#include "SMeshBuffer.h"
|
||||
#include "SAnimatedMesh.h"
|
||||
|
@ -136,6 +137,8 @@ C3DSMeshFileLoader::C3DSMeshFileLoader(ISceneManager* smgr, io::IFileSystem* fs)
|
|||
|
||||
if (FileSystem)
|
||||
FileSystem->grab();
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, SceneManager->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,6 +169,9 @@ bool C3DSMeshFileLoader::isALoadableFileExtension(const io::path& filename) cons
|
|||
//! See IReferenceCounted::drop() for more information.
|
||||
IAnimatedMesh* C3DSMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
ChunkData data;
|
||||
|
||||
readChunkData(file, data);
|
||||
|
@ -1127,12 +1133,10 @@ void C3DSMeshFileLoader::composeObject(io::IReadFile* file, const core::stringc&
|
|||
|
||||
void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
||||
{
|
||||
// create a mesh buffer for every material
|
||||
core::stringc modelFilename = file->getFileName();
|
||||
|
||||
if (Materials.empty())
|
||||
os::Printer::log("No materials found in 3ds file.", ELL_INFORMATION);
|
||||
|
||||
// create a mesh buffer for every material
|
||||
MeshBufferNames.reallocate(Materials.size());
|
||||
for (u32 i=0; i<Materials.size(); ++i)
|
||||
{
|
||||
|
@ -1143,33 +1147,19 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
m->getMaterial() = Materials[i].Material;
|
||||
if (Materials[i].Filename[0].size())
|
||||
{
|
||||
video::ITexture* texture = 0;
|
||||
if (FileSystem->existFile(Materials[i].Filename[0]))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[0]);
|
||||
video::ITexture* texture = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(Materials[i].Filename[0]) : NULL;
|
||||
if (!texture)
|
||||
{
|
||||
const core::stringc fname = FileSystem->getFileDir(modelFilename) + "/" + FileSystem->getFileBasename(Materials[i].Filename[0]);
|
||||
if (FileSystem->existFile(fname))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname);
|
||||
}
|
||||
if (!texture)
|
||||
os::Printer::log("Could not load a texture for entry in 3ds file",
|
||||
Materials[i].Filename[0].c_str(), ELL_WARNING);
|
||||
}
|
||||
else
|
||||
m->getMaterial().setTexture(0, texture);
|
||||
}
|
||||
|
||||
if (Materials[i].Filename[2].size())
|
||||
{
|
||||
video::ITexture* texture = 0;
|
||||
if (FileSystem->existFile(Materials[i].Filename[2]))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[2]);
|
||||
if (!texture)
|
||||
{
|
||||
const core::stringc fname = FileSystem->getFileDir(modelFilename) + "/" + FileSystem->getFileBasename(Materials[i].Filename[2]);
|
||||
if (FileSystem->existFile(fname))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname);
|
||||
}
|
||||
video::ITexture* texture = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(Materials[i].Filename[2]) : NULL;
|
||||
if (!texture)
|
||||
{
|
||||
os::Printer::log("Could not load a texture for entry in 3ds file",
|
||||
|
@ -1184,16 +1174,7 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
|
||||
if (Materials[i].Filename[3].size())
|
||||
{
|
||||
video::ITexture* texture = 0;
|
||||
if (FileSystem->existFile(Materials[i].Filename[3]))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[3]);
|
||||
if (!texture)
|
||||
{
|
||||
const core::stringc fname = FileSystem->getFileDir(modelFilename) + "/" + FileSystem->getFileBasename(Materials[i].Filename[3]);
|
||||
if (FileSystem->existFile(fname))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname);
|
||||
}
|
||||
|
||||
video::ITexture* texture = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(Materials[i].Filename[3]) : NULL;
|
||||
if (!texture)
|
||||
{
|
||||
os::Printer::log("Could not load a texture for entry in 3ds file",
|
||||
|
@ -1209,18 +1190,12 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
|
||||
if (Materials[i].Filename[4].size())
|
||||
{
|
||||
video::ITexture* texture = 0;
|
||||
if (FileSystem->existFile(Materials[i].Filename[4]))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[4]);
|
||||
video::ITexture* texture = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(Materials[i].Filename[4]) : NULL;
|
||||
if (!texture)
|
||||
{
|
||||
const core::stringc fname = FileSystem->getFileDir(modelFilename) + "/" + FileSystem->getFileBasename(Materials[i].Filename[4]);
|
||||
if (FileSystem->existFile(fname))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname);
|
||||
}
|
||||
if (!texture)
|
||||
os::Printer::log("Could not load a texture for entry in 3ds file",
|
||||
Materials[i].Filename[4].c_str(), ELL_WARNING);
|
||||
}
|
||||
else
|
||||
{
|
||||
m->getMaterial().setTexture(1, texture);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_B3D_LOADER_
|
||||
|
||||
#include "CB3DMeshFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
|
||||
#include "IVideoDriver.h"
|
||||
#include "IFileSystem.h"
|
||||
|
@ -32,6 +33,8 @@ CB3DMeshFileLoader::CB3DMeshFileLoader(scene::ISceneManager* smgr)
|
|||
#ifdef _DEBUG
|
||||
setDebugName("CB3DMeshFileLoader");
|
||||
#endif
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( SceneManager->getFileSystem(), SceneManager->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,12 +50,15 @@ bool CB3DMeshFileLoader::isALoadableFileExtension(const io::path& filename) cons
|
|||
//! \return Pointer to the created mesh. Returns 0 if loading failed.
|
||||
//! If you no longer need the mesh, you should call IAnimatedMesh::drop().
|
||||
//! See IReferenceCounted::drop() for more information.
|
||||
IAnimatedMesh* CB3DMeshFileLoader::createMesh(io::IReadFile* f)
|
||||
IAnimatedMesh* CB3DMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if (!f)
|
||||
if (!file)
|
||||
return 0;
|
||||
|
||||
B3DFile = f;
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
B3DFile = file;
|
||||
AnimatedMesh = new scene::CSkinnedMesh();
|
||||
ShowWarning = true; // If true a warning is issued if too many textures are used
|
||||
VerticesStart=0;
|
||||
|
@ -1028,6 +1034,12 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||
|
||||
void CB3DMeshFileLoader::loadTextures(SB3dMaterial& material) const
|
||||
{
|
||||
if ( getMeshTextureLoader() )
|
||||
{
|
||||
if ( SceneManager->getParameters()->existsAttribute(B3D_TEXTURE_PATH) )
|
||||
getMeshTextureLoader()->setTexturePath( SceneManager->getParameters()->getAttributeAsString(B3D_TEXTURE_PATH) );
|
||||
}
|
||||
|
||||
const bool previous32BitTextureFlag = SceneManager->getVideoDriver()->getTextureCreationFlag(video::ETCF_ALWAYS_32_BIT);
|
||||
SceneManager->getVideoDriver()->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
|
||||
|
||||
|
@ -1043,23 +1055,7 @@ void CB3DMeshFileLoader::loadTextures(SB3dMaterial& material) const
|
|||
if (!SceneManager->getParameters()->getAttributeAsBool(B3D_LOADER_IGNORE_MIPMAP_FLAG))
|
||||
SceneManager->getVideoDriver()->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, (B3dTexture->Flags & 0x8) ? true:false);
|
||||
{
|
||||
video::ITexture* tex = 0;
|
||||
io::IFileSystem* fs = SceneManager->getFileSystem();
|
||||
io::path texnameWithUserPath( SceneManager->getParameters()->getAttributeAsString(B3D_TEXTURE_PATH) );
|
||||
if ( texnameWithUserPath.size() )
|
||||
{
|
||||
texnameWithUserPath += '/';
|
||||
texnameWithUserPath += B3dTexture->TextureName;
|
||||
}
|
||||
if (fs->existFile(texnameWithUserPath))
|
||||
tex = SceneManager->getVideoDriver()->getTexture(texnameWithUserPath);
|
||||
else if (fs->existFile(B3dTexture->TextureName))
|
||||
tex = SceneManager->getVideoDriver()->getTexture(B3dTexture->TextureName);
|
||||
else if (fs->existFile(fs->getFileDir(B3DFile->getFileName()) +"/"+ fs->getFileBasename(B3dTexture->TextureName)))
|
||||
tex = SceneManager->getVideoDriver()->getTexture(fs->getFileDir(B3DFile->getFileName()) +"/"+ fs->getFileBasename(B3dTexture->TextureName));
|
||||
else
|
||||
tex = SceneManager->getVideoDriver()->getTexture(fs->getFileBasename(B3dTexture->TextureName));
|
||||
|
||||
video::ITexture* tex = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(B3dTexture->TextureName) : NULL;
|
||||
material.Material.setTexture(i, tex);
|
||||
}
|
||||
if (material.Textures[i]->Flags & 0x10) // Clamp U
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_CSM_LOADER_
|
||||
|
||||
#include "CCSMLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "os.h"
|
||||
#include "IFileSystem.h"
|
||||
#include "IReadFile.h"
|
||||
|
@ -359,10 +360,11 @@ namespace scene
|
|||
CCSMLoader::CCSMLoader(scene::ISceneManager* manager, io::IFileSystem* fs)
|
||||
: FileSystem(fs), SceneManager(manager)
|
||||
{
|
||||
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CCSMLoader");
|
||||
#endif
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, SceneManager->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -377,6 +379,9 @@ namespace scene
|
|||
//! creates/loads an animated mesh from the file.
|
||||
IAnimatedMesh* CCSMLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
scene::IMesh* m = createCSMMesh(file);
|
||||
|
||||
if (!m)
|
||||
|
@ -400,15 +405,18 @@ namespace scene
|
|||
CSMFile csmFile;
|
||||
csmFile.load(&reader);
|
||||
|
||||
return createIrrlichtMesh(&csmFile,
|
||||
SceneManager->getParameters()->getAttributeAsString(CSM_TEXTURE_PATH),
|
||||
file->getFileName());
|
||||
return createIrrlichtMesh(&csmFile, file->getFileName());
|
||||
}
|
||||
|
||||
|
||||
scene::IMesh* CCSMLoader::createIrrlichtMesh(const CSMFile* csmFile,
|
||||
const core::stringc& textureRoot, const io::path& lmprefix)
|
||||
scene::IMesh* CCSMLoader::createIrrlichtMesh(const CSMFile* csmFile, const io::path& lmprefix)
|
||||
{
|
||||
if ( getMeshTextureLoader() )
|
||||
{
|
||||
if ( SceneManager->getParameters()->existsAttribute(CSM_TEXTURE_PATH) )
|
||||
getMeshTextureLoader()->setTexturePath( SceneManager->getParameters()->getAttributeAsString(CSM_TEXTURE_PATH) );
|
||||
}
|
||||
|
||||
scene::SMesh *pMesh = new scene::SMesh();
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
|
||||
|
@ -438,30 +446,9 @@ namespace scene
|
|||
{
|
||||
const Surface* surface = mshPtr->getSurfaceAt(s);
|
||||
|
||||
core::stringc texName;
|
||||
if (textureRoot.size())
|
||||
{
|
||||
texName += textureRoot;
|
||||
texName += "/";
|
||||
}
|
||||
texName+= surface->getTextureName();
|
||||
video::ITexture* texture = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(surface->getTextureName()) : NULL;
|
||||
|
||||
video::ITexture* texture = 0;
|
||||
if (texName.size())
|
||||
{
|
||||
if (FileSystem->existFile(texName))
|
||||
texture = driver->getTexture(texName);
|
||||
else if (FileSystem->existFile(surface->getTextureName()))
|
||||
texture = driver->getTexture(surface->getTextureName());
|
||||
else if (FileSystem->existFile(FileSystem->getFileBasename(surface->getTextureName())))
|
||||
texture = driver->getTexture(FileSystem->getFileBasename(surface->getTextureName()));
|
||||
else if (FileSystem->existFile(FileSystem->getFileDir(lmprefix)+"/"+surface->getTextureName()))
|
||||
texture = driver->getTexture(FileSystem->getFileDir(lmprefix)+"/"+surface->getTextureName());
|
||||
else
|
||||
texture = driver->getTexture(FileSystem->getFileDir(lmprefix)+"/"+FileSystem->getFileBasename(surface->getTextureName()));
|
||||
}
|
||||
|
||||
//material
|
||||
// same lightmap name as above where they are created
|
||||
io::path lmapName = lmprefix;
|
||||
lmapName += "LMAP_";
|
||||
lmapName += io::path(surface->getLightMapId());
|
||||
|
|
|
@ -68,8 +68,7 @@ namespace scene
|
|||
|
||||
scene::IMesh* createCSMMesh(io::IReadFile* file);
|
||||
|
||||
scene::IMesh* createIrrlichtMesh(const CSMFile* csmFile,
|
||||
const core::stringc& textureRoot, const io::path& lmprefix);
|
||||
scene::IMesh* createIrrlichtMesh(const CSMFile* csmFile, const io::path& lmprefix);
|
||||
|
||||
io::IFileSystem* FileSystem;
|
||||
scene::ISceneManager* SceneManager;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_COLLADA_LOADER_
|
||||
|
||||
#include "CColladaFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "os.h"
|
||||
#include "IXMLReader.h"
|
||||
#include "IDummyTransformationSceneNode.h"
|
||||
|
@ -329,6 +330,8 @@ CColladaFileLoader::CColladaFileLoader(scene::ISceneManager* smgr,
|
|||
#ifdef _DEBUG
|
||||
setDebugName("CColladaFileLoader");
|
||||
#endif
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, SceneManager->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -361,6 +364,9 @@ IAnimatedMesh* CColladaFileLoader::createMesh(io::IReadFile* file)
|
|||
if (!reader)
|
||||
return 0;
|
||||
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
CurrentlyLoadingMesh = file->getFileName();
|
||||
CreateInstances = SceneManager->getParameters()->getAttributeAsBool(
|
||||
scene::COLLADA_CREATE_SCENE_INSTANCES);
|
||||
|
@ -2799,9 +2805,7 @@ video::ITexture* CColladaFileLoader::getTextureFromImage(core::stringc uri, SCol
|
|||
{
|
||||
if (Images[i].Source.size() && Images[i].SourceIsFilename)
|
||||
{
|
||||
if (FileSystem->existFile(Images[i].Source))
|
||||
return driver->getTexture(Images[i].Source);
|
||||
return driver->getTexture((FileSystem->getFileDir(CurrentlyLoadingMesh)+"/"+Images[i].Source));
|
||||
return getMeshTextureLoader() ? getMeshTextureLoader()->getTexture( Images[i].Source ) : NULL;
|
||||
}
|
||||
else
|
||||
if (Images[i].Source.size())
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#endif
|
||||
|
||||
#include "CDMFLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "ISceneManager.h"
|
||||
#include "IAttributes.h"
|
||||
#include "SAnimatedMesh.h"
|
||||
|
@ -42,32 +43,21 @@ CDMFLoader::CDMFLoader(ISceneManager* smgr, io::IFileSystem* filesys)
|
|||
#ifdef _DEBUG
|
||||
IReferenceCounted::setDebugName("CDMFLoader");
|
||||
#endif
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, SceneMgr->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
void CDMFLoader::findFile(bool use_mat_dirs, const core::stringc& path, const core::stringc& matPath, core::stringc& filename)
|
||||
void CDMFLoader::addMaterialPath(core::stringc& filename, const core::stringc& matPath)
|
||||
{
|
||||
// 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))
|
||||
c8 last = matPath.lastChar();
|
||||
if ( last == '/' || last == '\\' )
|
||||
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);
|
||||
else
|
||||
{
|
||||
core::stringc matPathSlash(matPath);
|
||||
matPathSlash.append('/');
|
||||
filename = matPathSlash+filename;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,6 +69,15 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
|
|||
{
|
||||
if (!file)
|
||||
return 0;
|
||||
|
||||
if ( getMeshTextureLoader() )
|
||||
{
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
if ( SceneMgr->getParameters()->existsAttribute(DMF_TEXTURE_PATH) )
|
||||
getMeshTextureLoader()->setTexturePath( SceneMgr->getParameters()->getAttributeAsString(DMF_TEXTURE_PATH) );
|
||||
}
|
||||
|
||||
video::IVideoDriver* driver = SceneMgr->getVideoDriver();
|
||||
|
||||
//Load stringlist
|
||||
|
@ -250,13 +249,6 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
|
|||
#endif
|
||||
const bool use_mat_dirs=!SceneMgr->getParameters()->getAttributeAsBool(DMF_IGNORE_MATERIALS_DIRS);
|
||||
|
||||
core::stringc path;
|
||||
if ( SceneMgr->getParameters()->existsAttribute(DMF_TEXTURE_PATH) )
|
||||
path = SceneMgr->getParameters()->getAttributeAsString(DMF_TEXTURE_PATH);
|
||||
else
|
||||
path = FileSystem->getFileDir(file->getFileName());
|
||||
path += ('/');
|
||||
|
||||
for (i=0; i<mesh->getMeshBufferCount(); i++)
|
||||
{
|
||||
//texture and lightmap
|
||||
|
@ -271,8 +263,10 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
|
|||
{
|
||||
if (materiali[i].textureBlend==4)
|
||||
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT,true);
|
||||
findFile(use_mat_dirs, path, materiali[i].pathName, materiali[i].textureName);
|
||||
tex = driver->getTexture(materiali[i].textureName);
|
||||
|
||||
if ( use_mat_dirs )
|
||||
addMaterialPath(materiali[i].textureName, materiali[i].pathName);
|
||||
tex = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture( materiali[i].textureName ) : NULL;
|
||||
}
|
||||
//Primary texture is just a color
|
||||
else if(materiali[i].textureFlag==1)
|
||||
|
@ -301,8 +295,9 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
|
|||
//Lightmap is present
|
||||
if (materiali[i].lightmapFlag == 0)
|
||||
{
|
||||
findFile(use_mat_dirs, path, materiali[i].pathName, materiali[i].lightmapName);
|
||||
lig = driver->getTexture(materiali[i].lightmapName);
|
||||
if ( use_mat_dirs )
|
||||
addMaterialPath(materiali[i].lightmapName, materiali[i].pathName);
|
||||
lig = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(materiali[i].lightmapName) : NULL;
|
||||
}
|
||||
else //no lightmap
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace scene
|
|||
bool mode = true);
|
||||
|
||||
private:
|
||||
void findFile(bool use_mat_dirs, const core::stringc& path, const core::stringc& matPath, core::stringc& filename);
|
||||
void addMaterialPath(core::stringc& filename, const core::stringc& matPath);
|
||||
|
||||
ISceneManager* SceneMgr;
|
||||
io::IFileSystem* FileSystem;
|
||||
|
|
|
@ -89,7 +89,6 @@ bool CGUICheckBox::OnEvent(const SEvent& event)
|
|||
if (event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP)
|
||||
{
|
||||
bool wasPressed = Pressed;
|
||||
Environment->removeFocus(this);
|
||||
Pressed = false;
|
||||
|
||||
if (wasPressed && Parent)
|
||||
|
|
|
@ -1116,6 +1116,20 @@ void CIrrDeviceLinux::setResizable(bool resize)
|
|||
#endif // #ifdef _IRR_COMPILE_WITH_X11_
|
||||
}
|
||||
|
||||
//! Resize the render window.
|
||||
void CIrrDeviceLinux::setWindowSize(const irr::core::dimension2d<u32>& size)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
if (CreationParams.DriverType == video::EDT_NULL || CreationParams.Fullscreen )
|
||||
return;
|
||||
|
||||
XWindowChanges values;
|
||||
values.width = size.Width;
|
||||
values.height = size.Height;
|
||||
XConfigureWindow(display, window, CWWidth | CWHeight, &values);
|
||||
XFlush(display);
|
||||
#endif // #ifdef _IRR_COMPILE_WITH_X11_
|
||||
}
|
||||
|
||||
//! Return pointer to a list with all video modes supported by the gfx adapter.
|
||||
video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
|
||||
|
|
|
@ -83,6 +83,9 @@ namespace irr
|
|||
//! Sets if the window should be resizable in windowed mode.
|
||||
virtual void setResizable(bool resize=false) _IRR_OVERRIDE_;
|
||||
|
||||
//! Resize the render window.
|
||||
virtual void setWindowSize(const irr::core::dimension2d<u32>& size) _IRR_OVERRIDE_;
|
||||
|
||||
//! Minimizes the window.
|
||||
virtual void minimizeWindow() _IRR_OVERRIDE_;
|
||||
|
||||
|
|
|
@ -175,6 +175,8 @@ namespace irr
|
|||
//! Remove all messages pending in the system message loop
|
||||
virtual void clearSystemMessages() _IRR_OVERRIDE_;
|
||||
|
||||
//! Resize the render window.
|
||||
virtual void setWindowSize(const irr::core::dimension2d<u32>& size) _IRR_OVERRIDE_ {}
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -1740,6 +1740,28 @@ void CIrrDeviceWin32::OnResized()
|
|||
Resized = true;
|
||||
}
|
||||
|
||||
//! Resize the render window.
|
||||
void CIrrDeviceWin32::setWindowSize(const irr::core::dimension2d<u32>& size)
|
||||
{
|
||||
if (ExternalWindow || !getVideoDriver() || CreationParams.Fullscreen)
|
||||
return;
|
||||
|
||||
// get size of the window for the give size of the client area
|
||||
LONG_PTR style = GetWindowLongPtr(HWnd, GWL_STYLE);
|
||||
LONG_PTR exStyle = GetWindowLongPtr(HWnd, GWL_EXSTYLE);
|
||||
RECT clientSize;
|
||||
clientSize.top = 0;
|
||||
clientSize.left = 0;
|
||||
clientSize.right = size.Width;
|
||||
clientSize.bottom = size.Height;
|
||||
AdjustWindowRectEx(&clientSize, style, false, exStyle);
|
||||
const s32 realWidth = clientSize.right - clientSize.left;
|
||||
const s32 realHeight = clientSize.bottom - clientSize.top;
|
||||
|
||||
UINT flags = SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER;
|
||||
SetWindowPos(HWnd, HWND_TOP, 0, 0, realWidth, realHeight, flags);
|
||||
}
|
||||
|
||||
//! Sets if the window should be resizable in windowed mode.
|
||||
void CIrrDeviceWin32::setResizable(bool resize)
|
||||
{
|
||||
|
|
|
@ -77,6 +77,9 @@ namespace irr
|
|||
//! Sets if the window should be resizable in windowed mode.
|
||||
virtual void setResizable(bool resize=false) _IRR_OVERRIDE_;
|
||||
|
||||
//! Resize the render window.
|
||||
virtual void setWindowSize(const irr::core::dimension2d<u32>& size) _IRR_OVERRIDE_;
|
||||
|
||||
//! Minimizes the window.
|
||||
virtual void minimizeWindow() _IRR_OVERRIDE_;
|
||||
|
||||
|
|
|
@ -68,6 +68,8 @@ Version 1.0 - 29 July 2004
|
|||
#include "IrrCompileConfig.h"
|
||||
#ifdef _IRR_COMPILE_WITH_LMTS_LOADER_
|
||||
|
||||
#include "CLMTSMeshFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "SMeshBufferLightMap.h"
|
||||
#include "SAnimatedMesh.h"
|
||||
#include "SMeshBuffer.h"
|
||||
|
@ -75,7 +77,6 @@ Version 1.0 - 29 July 2004
|
|||
#include "IReadFile.h"
|
||||
#include "IAttributes.h"
|
||||
#include "ISceneManager.h"
|
||||
#include "CLMTSMeshFileLoader.h"
|
||||
#include "os.h"
|
||||
|
||||
namespace irr
|
||||
|
@ -97,6 +98,8 @@ CLMTSMeshFileLoader::CLMTSMeshFileLoader(io::IFileSystem* fs,
|
|||
|
||||
if (FileSystem)
|
||||
FileSystem->grab();
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, Driver );
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,6 +134,9 @@ bool CLMTSMeshFileLoader::isALoadableFileExtension(const io::path& filename) con
|
|||
|
||||
IAnimatedMesh* CLMTSMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
u32 i;
|
||||
u32 id;
|
||||
|
||||
|
@ -326,19 +332,20 @@ void CLMTSMeshFileLoader::loadTextures(SMesh* mesh)
|
|||
core::array<u32> id2id;
|
||||
id2id.reallocate(Header.TextureCount);
|
||||
|
||||
const core::stringc Path = Parameters->getAttributeAsString(LMTS_TEXTURE_PATH);
|
||||
if ( getMeshTextureLoader() )
|
||||
{
|
||||
if ( Parameters->existsAttribute(LMTS_TEXTURE_PATH) )
|
||||
getMeshTextureLoader()->setTexturePath(Parameters->getAttributeAsString(LMTS_TEXTURE_PATH));
|
||||
}
|
||||
|
||||
core::stringc s;
|
||||
for (u32 t=0; t<Header.TextureCount; ++t)
|
||||
{
|
||||
video::ITexture* tmptex = 0;
|
||||
s = Path;
|
||||
s.append(Textures[t].Filename);
|
||||
|
||||
if (FileSystem->existFile(s))
|
||||
tmptex = Driver->getTexture(s);
|
||||
else
|
||||
video::ITexture* tmptex = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(Textures[t].Filename) : NULL;
|
||||
if ( !tmptex )
|
||||
{
|
||||
os::Printer::log("LMTS WARNING: Texture does not exist", s.c_str(), ELL_WARNING);
|
||||
}
|
||||
|
||||
if (Textures[t].Flags & 0x01)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#include "CLWOMeshFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "os.h"
|
||||
#include "SAnimatedMesh.h"
|
||||
#include "SMesh.h"
|
||||
|
@ -123,6 +124,8 @@ CLWOMeshFileLoader::CLWOMeshFileLoader(scene::ISceneManager* smgr,
|
|||
#ifdef _DEBUG
|
||||
setDebugName("CLWOMeshFileLoader");
|
||||
#endif
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, SceneManager->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,6 +148,9 @@ bool CLWOMeshFileLoader::isALoadableFileExtension(const io::path& filename) cons
|
|||
//! creates/loads an animated mesh from the file.
|
||||
IAnimatedMesh* CLWOMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
File = file;
|
||||
|
||||
if (Mesh)
|
||||
|
@ -2090,22 +2096,14 @@ bool CLWOMeshFileLoader::readFileHeader()
|
|||
|
||||
video::ITexture* CLWOMeshFileLoader::loadTexture(const core::stringc& file)
|
||||
{
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
video::ITexture* texture = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(file) : NULL;
|
||||
|
||||
if (FileSystem->existFile(file))
|
||||
return driver->getTexture(file);
|
||||
if (!texture)
|
||||
{
|
||||
os::Printer::log("Could not load texture", file.c_str(), ELL_WARNING);
|
||||
}
|
||||
|
||||
core::stringc strippedName=FileSystem->getFileBasename(file);
|
||||
if (FileSystem->existFile(strippedName))
|
||||
return driver->getTexture(strippedName);
|
||||
core::stringc newpath = FileSystem->getFileDir(File->getFileName());
|
||||
newpath.append("/");
|
||||
newpath.append(strippedName);
|
||||
if (FileSystem->existFile(newpath))
|
||||
return driver->getTexture(newpath);
|
||||
os::Printer::log("Could not load texture", file.c_str(), ELL_WARNING);
|
||||
|
||||
return 0;
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_MY3D_LOADER_
|
||||
|
||||
#include "CMY3DMeshFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
|
||||
#include "SAnimatedMesh.h"
|
||||
#include "SMeshBuffer.h"
|
||||
|
@ -60,6 +61,8 @@ CMY3DMeshFileLoader::CMY3DMeshFileLoader(ISceneManager* scmgr, io::IFileSystem*
|
|||
|
||||
if (FileSystem)
|
||||
FileSystem->grab();
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, SceneManager->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,17 +81,17 @@ bool CMY3DMeshFileLoader::isALoadableFileExtension(const io::path& filename) con
|
|||
|
||||
IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if ( getMeshTextureLoader() )
|
||||
{
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
if ( SceneManager->getParameters()->existsAttribute(MY3D_TEXTURE_PATH) )
|
||||
getMeshTextureLoader()->setTexturePath(SceneManager->getParameters()->getAttributeAsString(MY3D_TEXTURE_PATH));
|
||||
}
|
||||
|
||||
MaterialEntry.clear();
|
||||
MeshBufferEntry.clear();
|
||||
ChildNodes.clear();
|
||||
|
||||
// working directory (from which we load the scene)
|
||||
core::stringc filepath = FileSystem->getFileDir(file->getFileName());
|
||||
if (filepath==".")
|
||||
filepath="";
|
||||
else
|
||||
filepath.append("/");
|
||||
|
||||
// read file into memory
|
||||
SMyFileHeader fileHeader;
|
||||
file->read(&fileHeader, sizeof(SMyFileHeader));
|
||||
|
@ -134,9 +137,6 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
core::stringc texturePath =
|
||||
SceneManager->getParameters()->getAttributeAsString(MY3D_TEXTURE_PATH);
|
||||
|
||||
file->read(&id, sizeof(id));
|
||||
#ifdef __BIG_ENDIAN__
|
||||
id = os::Byteswap::byteswap(id);
|
||||
|
@ -188,12 +188,9 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
const bool oldMipMapState = SceneManager->getVideoDriver()->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
|
||||
SceneManager->getVideoDriver()->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
|
||||
|
||||
me.Texture2FileName = texturePath.size() ? texturePath : filepath;
|
||||
me.Texture2FileName.append("Lightmaps/");
|
||||
me.Texture2FileName = "Lightmaps/";
|
||||
me.Texture2FileName.append(name);
|
||||
|
||||
if (name.size())
|
||||
me.Texture2 = SceneManager->getVideoDriver()->getTexture(me.Texture2FileName);
|
||||
me.Texture2 = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(me.Texture2FileName) : NULL;
|
||||
|
||||
me.MaterialType = video::EMT_LIGHTMAP_M2;
|
||||
gotLightMap = true;
|
||||
|
@ -203,21 +200,28 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
else
|
||||
if (!gotLightMap && gotMainMap)
|
||||
{
|
||||
me.Texture2FileName = texturePath.size() ? texturePath : filepath;
|
||||
me.Texture2FileName.append(name);
|
||||
|
||||
if (name.size())
|
||||
me.Texture2 = SceneManager->getVideoDriver()->getTexture(me.Texture2FileName);
|
||||
if ( getMeshTextureLoader() )
|
||||
{
|
||||
me.Texture2 = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(name) : NULL;
|
||||
if ( me.Texture2 )
|
||||
me.Texture2FileName = me.Texture2->getName();
|
||||
}
|
||||
else
|
||||
me.Texture2FileName = name;
|
||||
|
||||
me.MaterialType = video::EMT_REFLECTION_2_LAYER;
|
||||
}
|
||||
else
|
||||
if (!gotMainMap && !gotLightMap)
|
||||
{
|
||||
me.Texture1FileName = filepath;
|
||||
me.Texture1FileName.append(name);
|
||||
if (name.size())
|
||||
me.Texture1 = SceneManager->getVideoDriver()->getTexture(me.Texture1FileName);
|
||||
if ( getMeshTextureLoader() )
|
||||
{
|
||||
me.Texture1 = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(name) : NULL;
|
||||
if ( me.Texture1 )
|
||||
me.Texture1FileName = me.Texture1->getName();
|
||||
}
|
||||
else
|
||||
me.Texture1FileName = name;
|
||||
|
||||
gotMainMap = true;
|
||||
me.MaterialType = video::EMT_SOLID;
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
#include "CMeshTextureLoader.h"
|
||||
#include "IFileSystem.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "os.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
{
|
||||
|
||||
CMeshTextureLoader::CMeshTextureLoader(irr::io::IFileSystem* fs, irr::video::IVideoDriver* driver)
|
||||
: FileSystem(fs)
|
||||
, VideoDriver(driver)
|
||||
, MeshFile(0)
|
||||
, MaterialFile(0)
|
||||
{
|
||||
}
|
||||
|
||||
//! Set a custom texture path.
|
||||
void CMeshTextureLoader::setTexturePath(const irr::io::path& path)
|
||||
{
|
||||
TexturePath = path;
|
||||
preparePath(TexturePath);
|
||||
}
|
||||
|
||||
//! Get the current custom texture path.
|
||||
const irr::io::path& CMeshTextureLoader::getTexturePath() const
|
||||
{
|
||||
return TexturePath;
|
||||
}
|
||||
|
||||
bool CMeshTextureLoader::checkTextureName( const irr::io::path& filename)
|
||||
{
|
||||
os::Printer::log("CheckTextureName:", core::stringc(filename).c_str(), ELL_DEBUG);
|
||||
if (FileSystem->existFile(filename))
|
||||
{
|
||||
os::Printer::log("file exists", ELL_DEBUG);
|
||||
TextureName = filename;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Get the texture by searching for it in all paths that makes sense for the given textureName.
|
||||
irr::video::ITexture* CMeshTextureLoader::getTexture(const irr::io::path& textureName)
|
||||
{
|
||||
if ( textureName.empty() || !FileSystem || !VideoDriver)
|
||||
return NULL;
|
||||
|
||||
// Pre-process texture filename.
|
||||
irr::io::path simplifiedTexName(textureName);
|
||||
simplifiedTexName.replace(_IRR_TEXT('\\'),_IRR_TEXT('/'));
|
||||
|
||||
// user defined texture path
|
||||
if ( !TexturePath.empty() )
|
||||
{
|
||||
if ( checkTextureName(TexturePath + simplifiedTexName) )
|
||||
return VideoDriver->getTexture(TextureName);
|
||||
|
||||
if ( checkTextureName(TexturePath + FileSystem->getFileBasename(simplifiedTexName)) )
|
||||
return VideoDriver->getTexture(TextureName);
|
||||
}
|
||||
|
||||
// just the name itself
|
||||
if ( checkTextureName(simplifiedTexName) )
|
||||
return VideoDriver->getTexture(TextureName);
|
||||
|
||||
// look in files relative to the folder of the meshfile
|
||||
if ( MeshFile )
|
||||
{
|
||||
if ( MeshPath.empty() )
|
||||
{
|
||||
MeshPath = FileSystem->getFileDir(MeshFile->getFileName());
|
||||
preparePath(MeshPath);
|
||||
}
|
||||
if ( !MeshPath.empty() )
|
||||
{
|
||||
if ( checkTextureName(MeshPath + simplifiedTexName) )
|
||||
return VideoDriver->getTexture(TextureName);
|
||||
|
||||
if ( checkTextureName(MeshPath + FileSystem->getFileBasename(simplifiedTexName)) )
|
||||
return VideoDriver->getTexture(TextureName);
|
||||
}
|
||||
}
|
||||
|
||||
// look in files relative to the folder of the materialfile
|
||||
if ( MaterialFile )
|
||||
{
|
||||
if ( MaterialPath.empty() )
|
||||
{
|
||||
MaterialPath = FileSystem->getFileDir(MaterialFile->getFileName());
|
||||
preparePath(MaterialPath);
|
||||
}
|
||||
if ( !MaterialPath.empty() )
|
||||
{
|
||||
if ( checkTextureName(MaterialPath + simplifiedTexName) )
|
||||
return VideoDriver->getTexture(TextureName);
|
||||
|
||||
if ( checkTextureName(MaterialPath + FileSystem->getFileBasename(simplifiedTexName)) )
|
||||
return VideoDriver->getTexture(TextureName);
|
||||
}
|
||||
}
|
||||
|
||||
// check current working directory
|
||||
if ( checkTextureName(FileSystem->getFileBasename(simplifiedTexName)) )
|
||||
return VideoDriver->getTexture(TextureName);
|
||||
|
||||
TextureName = _IRR_TEXT("");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//! Meshloaders will search paths relative to the meshFile.
|
||||
void CMeshTextureLoader::setMeshFile(const irr::io::IReadFile* meshFile)
|
||||
{
|
||||
// no grab (would need a weak_ptr)
|
||||
MeshFile = meshFile;
|
||||
MeshPath = _IRR_TEXT(""); // do a lazy evaluation later
|
||||
}
|
||||
|
||||
//! Meshloaders will try to look relative to the path of the materialFile
|
||||
void CMeshTextureLoader::setMaterialFile(const irr::io::IReadFile* materialFile)
|
||||
{
|
||||
// no grab (would need a weak_ptr)
|
||||
MaterialFile = materialFile;
|
||||
MaterialPath = _IRR_TEXT(""); // do a lazy evaluation later
|
||||
}
|
||||
|
||||
} // end namespace scnene
|
||||
} // end namespace irr
|
|
@ -0,0 +1,81 @@
|
|||
#ifndef IRR_C_MESH_TEXTURE_LOADER_H_INCLUDED
|
||||
#define IRR_C_MESH_TEXTURE_LOADER_H_INCLUDED
|
||||
|
||||
#include "IMeshTextureLoader.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
class IFileSystem;
|
||||
} // end namespace io
|
||||
namespace video
|
||||
{
|
||||
class IVideoDriver;
|
||||
}
|
||||
|
||||
namespace scene
|
||||
{
|
||||
|
||||
class CMeshTextureLoader : public IMeshTextureLoader
|
||||
{
|
||||
public:
|
||||
CMeshTextureLoader(irr::io::IFileSystem* fs, irr::video::IVideoDriver* driver);
|
||||
|
||||
//! Set a custom texture path.
|
||||
/** This is the first path the texture-loader should search. */
|
||||
virtual void setTexturePath(const irr::io::path& path) _IRR_OVERRIDE_;
|
||||
|
||||
//! Get the current custom texture path.
|
||||
virtual const irr::io::path& getTexturePath() const _IRR_OVERRIDE_;
|
||||
|
||||
//! Get the texture by searching for it in all paths that makes sense for the given textureName.
|
||||
/** Usually you do not have to use this method, it is used internally by IMeshLoader's.
|
||||
\param textureName Texturename as used in the mesh-format
|
||||
\return Pointer to the texture. Returns 0 if loading failed.*/
|
||||
virtual irr::video::ITexture* getTexture(const irr::io::path& textureName) _IRR_OVERRIDE_;
|
||||
|
||||
//! Meshloaders will search paths relative to the meshFile.
|
||||
/** Usually you do not have to use this method, it is used internally by IMeshLoader's.
|
||||
Any values you set here will likely be overwritten internally. */
|
||||
virtual void setMeshFile(const irr::io::IReadFile* meshFile) _IRR_OVERRIDE_;
|
||||
|
||||
//! Meshloaders will try to look relative to the path of the materialFile
|
||||
/** Usually you do not have to use this method, it is used internally by IMeshLoader's.
|
||||
Any values you set here will likely be overwritten internally. */
|
||||
virtual void setMaterialFile(const irr::io::IReadFile* materialFile) _IRR_OVERRIDE_;
|
||||
|
||||
protected:
|
||||
// make certain path's have a certain internal format
|
||||
void preparePath(irr::io::path& directory)
|
||||
{
|
||||
if (!directory.empty())
|
||||
{
|
||||
if (directory == _IRR_TEXT("."))
|
||||
directory = _IRR_TEXT("");
|
||||
|
||||
directory.replace(_IRR_TEXT('\\'),_IRR_TEXT('/'));
|
||||
if (directory.lastChar() != _IRR_TEXT('/'))
|
||||
directory.append(_IRR_TEXT('/'));
|
||||
}
|
||||
}
|
||||
|
||||
// Save the texturename when it's a an existing file
|
||||
bool checkTextureName( const irr::io::path& filename);
|
||||
|
||||
private:
|
||||
irr::io::IFileSystem * FileSystem;
|
||||
irr::video::IVideoDriver* VideoDriver;
|
||||
irr::io::path TexturePath;
|
||||
const irr::io::IReadFile* MeshFile;
|
||||
irr::io::path MeshPath;
|
||||
const irr::io::IReadFile* MaterialFile;
|
||||
irr::io::path MaterialPath;
|
||||
irr::io::path TextureName;
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
|
|
@ -431,12 +431,18 @@ ITexture* CNullDriver::getTexture(const io::path& filename)
|
|||
|
||||
ITexture* texture = findTexture(absolutePath);
|
||||
if (texture)
|
||||
{
|
||||
texture->updateSource(ETS_FROM_CACHE);
|
||||
return texture;
|
||||
}
|
||||
|
||||
// Then try the raw filename, which might be in an Archive
|
||||
texture = findTexture(filename);
|
||||
if (texture)
|
||||
{
|
||||
texture->updateSource(ETS_FROM_CACHE);
|
||||
return texture;
|
||||
}
|
||||
|
||||
// Now try to open the file using the complete path.
|
||||
io::IReadFile* file = FileSystem->createAndOpenFile(absolutePath);
|
||||
|
@ -453,6 +459,7 @@ ITexture* CNullDriver::getTexture(const io::path& filename)
|
|||
texture = findTexture(file->getFileName());
|
||||
if (texture)
|
||||
{
|
||||
texture->updateSource(ETS_FROM_CACHE);
|
||||
file->drop();
|
||||
return texture;
|
||||
}
|
||||
|
@ -462,6 +469,7 @@ ITexture* CNullDriver::getTexture(const io::path& filename)
|
|||
|
||||
if (texture)
|
||||
{
|
||||
texture->updateSource(ETS_FROM_FILE);
|
||||
addTexture(texture);
|
||||
texture->drop(); // drop it because we created it, one grab too much
|
||||
}
|
||||
|
@ -487,12 +495,16 @@ ITexture* CNullDriver::getTexture(io::IReadFile* file)
|
|||
texture = findTexture(file->getFileName());
|
||||
|
||||
if (texture)
|
||||
{
|
||||
texture->updateSource(ETS_FROM_CACHE);
|
||||
return texture;
|
||||
}
|
||||
|
||||
texture = loadTextureFromFile(file);
|
||||
|
||||
if (texture)
|
||||
{
|
||||
texture->updateSource(ETS_FROM_FILE);
|
||||
addTexture(texture);
|
||||
texture->drop(); // drop it because we created it, one grab too much
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_OBJ_LOADER_
|
||||
|
||||
#include "COBJMeshFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "IMeshManipulator.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "SMesh.h"
|
||||
|
@ -38,6 +39,8 @@ COBJMeshFileLoader::COBJMeshFileLoader(scene::ISceneManager* smgr, io::IFileSyst
|
|||
|
||||
if (FileSystem)
|
||||
FileSystem->grab();
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, SceneManager->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,6 +66,12 @@ bool COBJMeshFileLoader::isALoadableFileExtension(const io::path& filename) cons
|
|||
//! See IReferenceCounted::drop() for more information.
|
||||
IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if (!file)
|
||||
return 0;
|
||||
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
const long filesize = file->getSize();
|
||||
if (!filesize)
|
||||
return 0;
|
||||
|
@ -420,59 +429,37 @@ const c8* COBJMeshFileLoader::readTextures(const c8* bufPtr, const c8* const buf
|
|||
currMaterial->Meshbuffer->Material.setFlag(video::EMF_TEXTURE_WRAP, video::ETC_CLAMP);
|
||||
|
||||
io::path texname(textureNameBuf);
|
||||
texname.replace('\\', '/');
|
||||
|
||||
video::ITexture * texture = 0;
|
||||
bool newTexture=false;
|
||||
if (texname.size())
|
||||
if (texname.size() && getMeshTextureLoader())
|
||||
{
|
||||
io::path texnameWithUserPath( SceneManager->getParameters()->getAttributeAsString(OBJ_TEXTURE_PATH) );
|
||||
if ( texnameWithUserPath.size() )
|
||||
{
|
||||
texnameWithUserPath += '/';
|
||||
texnameWithUserPath += texname;
|
||||
}
|
||||
if (FileSystem->existFile(texnameWithUserPath))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(texnameWithUserPath);
|
||||
else if (FileSystem->existFile(texname))
|
||||
video::ITexture * texture = getMeshTextureLoader()->getTexture(texname);
|
||||
if ( texture )
|
||||
{
|
||||
newTexture = SceneManager->getVideoDriver()->findTexture(texname) == 0;
|
||||
texture = SceneManager->getVideoDriver()->getTexture(texname);
|
||||
if (type==0)
|
||||
currMaterial->Meshbuffer->Material.setTexture(0, texture);
|
||||
else if (type==1)
|
||||
{
|
||||
if ( texture->getSource() == video::ETS_FROM_FILE)
|
||||
SceneManager->getVideoDriver()->makeNormalMapTexture(texture, bumpiness);
|
||||
currMaterial->Meshbuffer->Material.setTexture(1, texture);
|
||||
currMaterial->Meshbuffer->Material.MaterialType=video::EMT_PARALLAX_MAP_SOLID;
|
||||
currMaterial->Meshbuffer->Material.MaterialTypeParam=0.035f;
|
||||
}
|
||||
else if (type==2)
|
||||
{
|
||||
currMaterial->Meshbuffer->Material.setTexture(0, texture);
|
||||
currMaterial->Meshbuffer->Material.MaterialType=video::EMT_TRANSPARENT_ADD_COLOR;
|
||||
}
|
||||
else if (type==3)
|
||||
{
|
||||
// currMaterial->Meshbuffer->Material.Textures[1] = texture;
|
||||
// currMaterial->Meshbuffer->Material.MaterialType=video::EMT_REFLECTION_2_LAYER;
|
||||
}
|
||||
// Set diffuse material color to white so as not to affect texture color
|
||||
// Because Maya set diffuse color Kd to black when you use a diffuse color map
|
||||
// But is this the right thing to do?
|
||||
currMaterial->Meshbuffer->Material.DiffuseColor.set(
|
||||
currMaterial->Meshbuffer->Material.DiffuseColor.getAlpha(), 255, 255, 255 );
|
||||
}
|
||||
else
|
||||
{
|
||||
newTexture = SceneManager->getVideoDriver()->findTexture(relPath + texname) == 0;
|
||||
// try to read in the relative path, the .obj is loaded from
|
||||
texture = SceneManager->getVideoDriver()->getTexture( relPath + texname );
|
||||
}
|
||||
}
|
||||
if ( texture )
|
||||
{
|
||||
if (type==0)
|
||||
currMaterial->Meshbuffer->Material.setTexture(0, texture);
|
||||
else if (type==1)
|
||||
{
|
||||
if (newTexture)
|
||||
SceneManager->getVideoDriver()->makeNormalMapTexture(texture, bumpiness);
|
||||
currMaterial->Meshbuffer->Material.setTexture(1, texture);
|
||||
currMaterial->Meshbuffer->Material.MaterialType=video::EMT_PARALLAX_MAP_SOLID;
|
||||
currMaterial->Meshbuffer->Material.MaterialTypeParam=0.035f;
|
||||
}
|
||||
else if (type==2)
|
||||
{
|
||||
currMaterial->Meshbuffer->Material.setTexture(0, texture);
|
||||
currMaterial->Meshbuffer->Material.MaterialType=video::EMT_TRANSPARENT_ADD_COLOR;
|
||||
}
|
||||
else if (type==3)
|
||||
{
|
||||
// currMaterial->Meshbuffer->Material.Textures[1] = texture;
|
||||
// currMaterial->Meshbuffer->Material.MaterialType=video::EMT_REFLECTION_2_LAYER;
|
||||
}
|
||||
// Set diffuse material color to white so as not to affect texture color
|
||||
// Because Maya set diffuse color Kd to black when you use a diffuse color map
|
||||
// But is this the right thing to do?
|
||||
currMaterial->Meshbuffer->Material.DiffuseColor.set(
|
||||
currMaterial->Meshbuffer->Material.DiffuseColor.getAlpha(), 255, 255, 255 );
|
||||
}
|
||||
return bufPtr;
|
||||
}
|
||||
|
@ -497,6 +484,13 @@ void COBJMeshFileLoader::readMTL(const c8* fileName, const io::path& relPath)
|
|||
return;
|
||||
}
|
||||
|
||||
if ( getMeshTextureLoader() )
|
||||
{
|
||||
getMeshTextureLoader()->setMaterialFile(mtlReader);
|
||||
if ( SceneManager->getParameters()->existsAttribute(OBJ_TEXTURE_PATH) )
|
||||
getMeshTextureLoader()->setTexturePath(SceneManager->getParameters()->getAttributeAsString(OBJ_TEXTURE_PATH));
|
||||
}
|
||||
|
||||
const long filesize = mtlReader->getSize();
|
||||
if (!filesize)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_OCT_LOADER_
|
||||
|
||||
#include "COCTLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "IFileSystem.h"
|
||||
#include "os.h"
|
||||
|
@ -35,6 +36,8 @@ COCTLoader::COCTLoader(ISceneManager* smgr, io::IFileSystem* fs)
|
|||
#endif
|
||||
if (FileSystem)
|
||||
FileSystem->grab();
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, SceneManager->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,6 +88,9 @@ IAnimatedMesh* COCTLoader::createMesh(io::IReadFile* file)
|
|||
if (!file)
|
||||
return 0;
|
||||
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
octHeader header;
|
||||
file->read(&header, sizeof(octHeader));
|
||||
|
||||
|
@ -199,16 +205,9 @@ IAnimatedMesh* COCTLoader::createMesh(io::IReadFile* file)
|
|||
tex.reallocate(header.numTextures + 1);
|
||||
tex.push_back(0);
|
||||
|
||||
const core::stringc relpath = FileSystem->getFileDir(file->getFileName())+"/";
|
||||
for (i = 1; i < (header.numTextures + 1); i++)
|
||||
{
|
||||
core::stringc path(textures[i-1].fileName);
|
||||
path.replace('\\','/');
|
||||
if (FileSystem->existFile(path))
|
||||
tex.push_back(SceneManager->getVideoDriver()->getTexture(path));
|
||||
else
|
||||
// try to read in the relative path of the OCT file
|
||||
tex.push_back(SceneManager->getVideoDriver()->getTexture( (relpath + path) ));
|
||||
tex.push_back( getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(textures[i-1].fileName) : NULL );
|
||||
}
|
||||
|
||||
// prepare lightmaps
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_OGRE_LOADER_
|
||||
|
||||
#include "COgreMeshFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "os.h"
|
||||
#include "SMeshBuffer.h"
|
||||
#include "SAnimatedMesh.h"
|
||||
|
@ -76,6 +77,8 @@ COgreMeshFileLoader::COgreMeshFileLoader(io::IFileSystem* fs, video::IVideoDrive
|
|||
|
||||
if (Driver)
|
||||
Driver->grab();
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, Driver );
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,6 +112,12 @@ bool COgreMeshFileLoader::isALoadableFileExtension(const io::path& filename) con
|
|||
//! See IReferenceCounted::drop() for more information.
|
||||
IAnimatedMesh* COgreMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if ( !file )
|
||||
return 0;
|
||||
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
s16 id;
|
||||
|
||||
file->read(&id, 2);
|
||||
|
@ -469,10 +478,13 @@ void COgreMeshFileLoader::composeMeshBufferMaterial(scene::IMeshBuffer* mb, cons
|
|||
material=Materials[k].Techniques[0].Passes[0].Material;
|
||||
for (u32 i=0; i<Materials[k].Techniques[0].Passes[0].Texture.Filename.size(); ++i)
|
||||
{
|
||||
if (FileSystem->existFile(Materials[k].Techniques[0].Passes[0].Texture.Filename[i]))
|
||||
material.setTexture(i, Driver->getTexture(Materials[k].Techniques[0].Passes[0].Texture.Filename[i]));
|
||||
else
|
||||
material.setTexture(i, Driver->getTexture((CurrentlyLoadingFromPath+"/"+FileSystem->getFileBasename(Materials[k].Techniques[0].Passes[0].Texture.Filename[i]))));
|
||||
video::ITexture * texture = NULL;
|
||||
if ( getMeshTextureLoader() )
|
||||
{
|
||||
texture = getMeshTextureLoader()->getTexture(Materials[k].Techniques[0].Passes[0].Texture.Filename[i]);
|
||||
if ( texture )
|
||||
material.setTexture(i, texture);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_SMF_LOADER_
|
||||
|
||||
#include "CSMFMeshFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "SAnimatedMesh.h"
|
||||
#include "SMeshBuffer.h"
|
||||
#include "IReadFile.h"
|
||||
|
@ -19,9 +20,10 @@ namespace irr
|
|||
namespace scene
|
||||
{
|
||||
|
||||
CSMFMeshFileLoader::CSMFMeshFileLoader(video::IVideoDriver* driver)
|
||||
CSMFMeshFileLoader::CSMFMeshFileLoader(irr::io::IFileSystem* fs, video::IVideoDriver* driver)
|
||||
: Driver(driver)
|
||||
{
|
||||
TextureLoader = new CMeshTextureLoader( fs, driver );
|
||||
}
|
||||
|
||||
//! Returns true if the file might be loaded by this class.
|
||||
|
@ -33,6 +35,12 @@ bool CSMFMeshFileLoader::isALoadableFileExtension(const io::path& filename) cons
|
|||
//! Creates/loads an animated mesh from the file.
|
||||
IAnimatedMesh* CSMFMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if ( !file )
|
||||
return 0;
|
||||
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
// create empty mesh
|
||||
SMesh *mesh = new SMesh();
|
||||
|
||||
|
@ -93,9 +101,12 @@ void CSMFMeshFileLoader::loadLimb(io::IReadFile* file, SMesh* mesh, const core::
|
|||
|
||||
for (const c8 **ext = extensions; !texture && *ext; ++ext)
|
||||
{
|
||||
texture = Driver->getTexture(textureName + *ext);
|
||||
texture = getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(textureName + *ext) : NULL;
|
||||
if (texture)
|
||||
{
|
||||
textureName = textureName + *ext;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// find the correct mesh buffer
|
||||
u32 i;
|
||||
|
|
|
@ -1,67 +1,71 @@
|
|||
// Copyright (C) 2010-2012 Gaz Davidson
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef __C_SMF_MESH_LOADER_H_INCLUDED__
|
||||
#define __C_SMF_MESH_LOADER_H_INCLUDED__
|
||||
|
||||
#include "IMeshLoader.h"
|
||||
#include "SMesh.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
||||
namespace video
|
||||
{
|
||||
class IVideoDriver;
|
||||
}
|
||||
|
||||
namespace scene
|
||||
{
|
||||
|
||||
//! Class which can load
|
||||
class CSMFMeshFileLoader : public virtual IMeshLoader
|
||||
{
|
||||
public:
|
||||
|
||||
CSMFMeshFileLoader(video::IVideoDriver* driver);
|
||||
|
||||
//! Returns true if the file might be loaded by this class.
|
||||
virtual bool isALoadableFileExtension(const io::path& filename) const _IRR_OVERRIDE_;
|
||||
|
||||
//! Creates/loads an animated mesh from the file.
|
||||
virtual IAnimatedMesh* createMesh(io::IReadFile* file) _IRR_OVERRIDE_;
|
||||
private:
|
||||
|
||||
void loadLimb(io::IReadFile* file, scene::SMesh* mesh, const core::matrix4 &parentTransformation);
|
||||
|
||||
video::IVideoDriver* Driver;
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
|
||||
namespace io
|
||||
{
|
||||
class BinaryFile
|
||||
{
|
||||
public:
|
||||
//! reads most types from the given file, moving the file pointer along
|
||||
template <class T>
|
||||
static void read(io::IReadFile* file, T &out, bool bigEndian=false);
|
||||
|
||||
//! reads a 3d vector from the file, moving the file pointer along
|
||||
static void read(io::IReadFile* file, core::vector3df &outVector2d, bool bigEndian=false);
|
||||
|
||||
//! reads a 2d vector from the file, moving the file pointer along
|
||||
static void read(io::IReadFile* file, core::vector2df &outVector2d, bool bigEndian=false);
|
||||
|
||||
//! reads a null terminated string from the file, moving the file pointer along
|
||||
static void read(io::IReadFile* file, core::stringc &outString, bool bigEndian=false);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
} // end namespace irr
|
||||
|
||||
#endif // __C_SMF_MESH_LOADER_H_INCLUDED__
|
||||
|
||||
// Copyright (C) 2010-2012 Gaz Davidson
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef __C_SMF_MESH_LOADER_H_INCLUDED__
|
||||
#define __C_SMF_MESH_LOADER_H_INCLUDED__
|
||||
|
||||
#include "IMeshLoader.h"
|
||||
#include "SMesh.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
||||
namespace video
|
||||
{
|
||||
class IVideoDriver;
|
||||
}
|
||||
namespace io
|
||||
{
|
||||
class IFileSystem;
|
||||
}
|
||||
|
||||
namespace scene
|
||||
{
|
||||
|
||||
//! Class which can load
|
||||
class CSMFMeshFileLoader : public virtual IMeshLoader
|
||||
{
|
||||
public:
|
||||
|
||||
CSMFMeshFileLoader(irr::io::IFileSystem* fs, video::IVideoDriver* driver);
|
||||
|
||||
//! Returns true if the file might be loaded by this class.
|
||||
virtual bool isALoadableFileExtension(const io::path& filename) const _IRR_OVERRIDE_;
|
||||
|
||||
//! Creates/loads an animated mesh from the file.
|
||||
virtual IAnimatedMesh* createMesh(io::IReadFile* file) _IRR_OVERRIDE_;
|
||||
private:
|
||||
|
||||
void loadLimb(io::IReadFile* file, scene::SMesh* mesh, const core::matrix4 &parentTransformation);
|
||||
|
||||
video::IVideoDriver* Driver;
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
|
||||
namespace io
|
||||
{
|
||||
class BinaryFile
|
||||
{
|
||||
public:
|
||||
//! reads most types from the given file, moving the file pointer along
|
||||
template <class T>
|
||||
static void read(io::IReadFile* file, T &out, bool bigEndian=false);
|
||||
|
||||
//! reads a 3d vector from the file, moving the file pointer along
|
||||
static void read(io::IReadFile* file, core::vector3df &outVector2d, bool bigEndian=false);
|
||||
|
||||
//! reads a 2d vector from the file, moving the file pointer along
|
||||
static void read(io::IReadFile* file, core::vector2df &outVector2d, bool bigEndian=false);
|
||||
|
||||
//! reads a null terminated string from the file, moving the file pointer along
|
||||
static void read(io::IReadFile* file, core::stringc &outString, bool bigEndian=false);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
} // end namespace irr
|
||||
|
||||
#endif // __C_SMF_MESH_LOADER_H_INCLUDED__
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
|
|||
MeshLoaderList.push_back(new CPLYMeshFileLoader(this));
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_SMF_LOADER_
|
||||
MeshLoaderList.push_back(new CSMFMeshFileLoader(Driver));
|
||||
MeshLoaderList.push_back(new CSMFMeshFileLoader(FileSystem, Driver));
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_OCT_LOADER_
|
||||
MeshLoaderList.push_back(new COCTLoader(this, FileSystem));
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifdef _IRR_COMPILE_WITH_X_LOADER_
|
||||
|
||||
#include "CXMeshFileLoader.h"
|
||||
#include "CMeshTextureLoader.h"
|
||||
#include "os.h"
|
||||
|
||||
#include "fast_atof.h"
|
||||
|
@ -35,6 +36,8 @@ CXMeshFileLoader::CXMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem*
|
|||
#ifdef _DEBUG
|
||||
setDebugName("CXMeshFileLoader");
|
||||
#endif
|
||||
|
||||
TextureLoader = new CMeshTextureLoader( FileSystem, SceneManager->getVideoDriver() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,18 +53,21 @@ bool CXMeshFileLoader::isALoadableFileExtension(const io::path& filename) const
|
|||
//! \return Pointer to the created mesh. Returns 0 if loading failed.
|
||||
//! If you no longer need the mesh, you should call IAnimatedMesh::drop().
|
||||
//! See IReferenceCounted::drop() for more information.
|
||||
IAnimatedMesh* CXMeshFileLoader::createMesh(io::IReadFile* f)
|
||||
IAnimatedMesh* CXMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if (!f)
|
||||
if (!file)
|
||||
return 0;
|
||||
|
||||
if ( getMeshTextureLoader() )
|
||||
getMeshTextureLoader()->setMeshFile(file);
|
||||
|
||||
#ifdef _XREADER_DEBUG
|
||||
u32 time = os::Timer::getRealTime();
|
||||
#endif
|
||||
|
||||
AnimatedMesh = new CSkinnedMesh();
|
||||
|
||||
if (load(f))
|
||||
if (load(file))
|
||||
{
|
||||
AnimatedMesh->finalize();
|
||||
}
|
||||
|
@ -458,7 +464,6 @@ bool CXMeshFileLoader::readFileIntoMemory(io::IReadFile* file)
|
|||
P = &Buffer[16];
|
||||
|
||||
readUntilEndOfLine();
|
||||
FilePath = FileSystem->getFileDir(file->getFileName()) + "/";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1524,19 +1529,8 @@ bool CXMeshFileLoader::parseDataObjectMaterial(video::SMaterial& material)
|
|||
if (!parseDataObjectTextureFilename(TextureFileName))
|
||||
return false;
|
||||
|
||||
// original name
|
||||
if (FileSystem->existFile(TextureFileName))
|
||||
material.setTexture(textureLayer, SceneManager->getVideoDriver()->getTexture(TextureFileName));
|
||||
// mesh path
|
||||
else
|
||||
{
|
||||
TextureFileName=FilePath + FileSystem->getFileBasename(TextureFileName);
|
||||
if (FileSystem->existFile(TextureFileName))
|
||||
material.setTexture(textureLayer, SceneManager->getVideoDriver()->getTexture(TextureFileName));
|
||||
// working directory
|
||||
else
|
||||
material.setTexture(textureLayer, SceneManager->getVideoDriver()->getTexture(FileSystem->getFileBasename(TextureFileName)));
|
||||
}
|
||||
material.setTexture( textureLayer, getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(TextureFileName) : NULL );
|
||||
|
||||
++textureLayer;
|
||||
if (textureLayer==2)
|
||||
material.MaterialType=video::EMT_LIGHTMAP;
|
||||
|
@ -1549,19 +1543,8 @@ bool CXMeshFileLoader::parseDataObjectMaterial(video::SMaterial& material)
|
|||
if (!parseDataObjectTextureFilename(TextureFileName))
|
||||
return false;
|
||||
|
||||
// original name
|
||||
if (FileSystem->existFile(TextureFileName))
|
||||
material.setTexture(1, SceneManager->getVideoDriver()->getTexture(TextureFileName));
|
||||
// mesh path
|
||||
else
|
||||
{
|
||||
TextureFileName=FilePath + FileSystem->getFileBasename(TextureFileName);
|
||||
if (FileSystem->existFile(TextureFileName))
|
||||
material.setTexture(1, SceneManager->getVideoDriver()->getTexture(TextureFileName));
|
||||
// working directory
|
||||
else
|
||||
material.setTexture(1, SceneManager->getVideoDriver()->getTexture(FileSystem->getFileBasename(TextureFileName)));
|
||||
}
|
||||
material.setTexture( 1, getMeshTextureLoader() ? getMeshTextureLoader()->getTexture(TextureFileName) : NULL );
|
||||
|
||||
if (textureLayer==1)
|
||||
++textureLayer;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -922,6 +922,7 @@
|
|||
<ClInclude Include="..\..\include\IMeshLoader.h" />
|
||||
<ClInclude Include="..\..\include\IMeshManipulator.h" />
|
||||
<ClInclude Include="..\..\include\IMeshSceneNode.h" />
|
||||
<ClInclude Include="..\..\include\IMeshTextureLoader.h" />
|
||||
<ClInclude Include="..\..\include\IMeshWriter.h" />
|
||||
<ClInclude Include="..\..\include\IMetaTriangleSelector.h" />
|
||||
<ClInclude Include="..\..\include\IParticleAffector.h" />
|
||||
|
@ -1031,6 +1032,7 @@
|
|||
<ClInclude Include="CLWOMeshFileLoader.h" />
|
||||
<ClInclude Include="CMD2MeshFileLoader.h" />
|
||||
<ClInclude Include="CMD3MeshFileLoader.h" />
|
||||
<ClInclude Include="CMeshTextureLoader.h" />
|
||||
<ClInclude Include="CMS3DMeshFileLoader.h" />
|
||||
<ClInclude Include="CMY3DHelper.h" />
|
||||
<ClInclude Include="CMY3DMeshFileLoader.h" />
|
||||
|
@ -1293,6 +1295,7 @@
|
|||
<ClCompile Include="CLWOMeshFileLoader.cpp" />
|
||||
<ClCompile Include="CMD2MeshFileLoader.cpp" />
|
||||
<ClCompile Include="CMD3MeshFileLoader.cpp" />
|
||||
<ClCompile Include="CMeshTextureLoader.cpp" />
|
||||
<ClCompile Include="CMS3DMeshFileLoader.cpp" />
|
||||
<ClCompile Include="CMY3DMeshFileLoader.cpp" />
|
||||
<ClCompile Include="COBJMeshFileLoader.cpp" />
|
||||
|
|
|
@ -359,6 +359,9 @@
|
|||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\IMeshSceneNode.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\IMeshTextureLoader.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\IMeshWriter.h">
|
||||
<Filter>include\scene</Filter>
|
||||
|
@ -629,6 +632,9 @@
|
|||
</ClInclude>
|
||||
<ClInclude Include="CMD3MeshFileLoader.h">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CMeshTextureLoader.h">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CMS3DMeshFileLoader.h">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
|
@ -1432,6 +1438,9 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="CMD3MeshFileLoader.cpp">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CMeshTextureLoader.cpp">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CMS3DMeshFileLoader.cpp">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
|
|
|
@ -926,6 +926,7 @@
|
|||
<ClInclude Include="..\..\include\IMeshLoader.h" />
|
||||
<ClInclude Include="..\..\include\IMeshManipulator.h" />
|
||||
<ClInclude Include="..\..\include\IMeshSceneNode.h" />
|
||||
<ClInclude Include="..\..\include\IMeshTextureLoader.h" />
|
||||
<ClInclude Include="..\..\include\IMeshWriter.h" />
|
||||
<ClInclude Include="..\..\include\IMetaTriangleSelector.h" />
|
||||
<ClInclude Include="..\..\include\IParticleAffector.h" />
|
||||
|
@ -1036,6 +1037,7 @@
|
|||
<ClInclude Include="CLWOMeshFileLoader.h" />
|
||||
<ClInclude Include="CMD2MeshFileLoader.h" />
|
||||
<ClInclude Include="CMD3MeshFileLoader.h" />
|
||||
<ClInclude Include="CMeshTextureLoader.h" />
|
||||
<ClInclude Include="CMS3DMeshFileLoader.h" />
|
||||
<ClInclude Include="CMY3DHelper.h" />
|
||||
<ClInclude Include="CMY3DMeshFileLoader.h" />
|
||||
|
@ -1298,6 +1300,7 @@
|
|||
<ClCompile Include="CLWOMeshFileLoader.cpp" />
|
||||
<ClCompile Include="CMD2MeshFileLoader.cpp" />
|
||||
<ClCompile Include="CMD3MeshFileLoader.cpp" />
|
||||
<ClCompile Include="CMeshTextureLoader.cpp" />
|
||||
<ClCompile Include="CMS3DMeshFileLoader.cpp" />
|
||||
<ClCompile Include="CMY3DMeshFileLoader.cpp" />
|
||||
<ClCompile Include="COBJMeshFileLoader.cpp" />
|
||||
|
|
|
@ -362,6 +362,9 @@
|
|||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\IMeshSceneNode.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\IMeshTextureLoader.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\IMeshWriter.h">
|
||||
<Filter>include\scene</Filter>
|
||||
|
@ -632,6 +635,9 @@
|
|||
</ClInclude>
|
||||
<ClInclude Include="CMD3MeshFileLoader.h">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CMeshTextureLoader.h">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CMS3DMeshFileLoader.h">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
|
@ -1425,6 +1431,9 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="CMD3MeshFileLoader.cpp">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CMeshTextureLoader.cpp">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CMS3DMeshFileLoader.cpp">
|
||||
<Filter>Irrlicht\scene\loaders</Filter>
|
||||
|
|
|
@ -925,6 +925,10 @@
|
|||
RelativePath=".\..\..\include\IMeshSceneNode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\..\include\IMeshTextureLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\IMeshWriter.h"
|
||||
>
|
||||
|
@ -2440,6 +2444,14 @@
|
|||
RelativePath=".\CMeshSceneNode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CMeshTextureLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CMeshTextureLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\COctreeSceneNode.cpp"
|
||||
>
|
||||
|
|
|
@ -1044,6 +1044,10 @@
|
|||
RelativePath="..\..\include\IMeshSceneNode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\IMeshTextureLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\IMeshWriter.h"
|
||||
>
|
||||
|
@ -1695,6 +1699,14 @@
|
|||
RelativePath="CMeshSceneNode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CMeshTextureLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CMeshTextureLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="COctreeSceneNode.cpp"
|
||||
>
|
||||
|
|
|
@ -644,6 +644,10 @@
|
|||
RelativePath="..\..\include\IMeshSceneNode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\IMeshTextureLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\IMeshWriter.h"
|
||||
>
|
||||
|
@ -2013,6 +2017,14 @@
|
|||
RelativePath="CMeshSceneNode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CMeshTextureLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CMeshTextureLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="COctreeSceneNode.cpp"
|
||||
>
|
||||
|
|
|
@ -444,6 +444,9 @@
|
|||
<File
|
||||
RelativePath="..\..\include\IMeshSceneNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\IMeshTextureLoader.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\IMeshWriter.h">
|
||||
</File>
|
||||
|
@ -1062,6 +1065,12 @@
|
|||
<File
|
||||
RelativePath=".\CMeshSceneNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CMeshTextureLoader.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CMeshTextureLoader.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CMetaTriangleSelector.cpp">
|
||||
</File>
|
||||
|
|
|
@ -29,7 +29,7 @@ VERSION_RELEASE = 0
|
|||
#
|
||||
|
||||
#List of object files, separated based on engine architecture
|
||||
IRRMESHLOADER = CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMY3DMeshFileLoader.o COCTLoader.o CXMeshFileLoader.o CIrrMeshFileLoader.o CSTLMeshFileLoader.o CLWOMeshFileLoader.o CPLYMeshFileLoader.o CSMFMeshFileLoader.o
|
||||
IRRMESHLOADER = CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMY3DMeshFileLoader.o COCTLoader.o CXMeshFileLoader.o CIrrMeshFileLoader.o CSTLMeshFileLoader.o CLWOMeshFileLoader.o CPLYMeshFileLoader.o CSMFMeshFileLoader.o CMeshTextureLoader.o
|
||||
IRRMESHWRITER = CColladaMeshWriter.o CIrrMeshWriter.o CSTLMeshWriter.o COBJMeshWriter.o CPLYMeshWriter.o
|
||||
IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \
|
||||
CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
<Unit filename="burningsVideo.cpp" />
|
||||
<Unit filename="collisionResponseAnimator.cpp" />
|
||||
<Unit filename="color.cpp" />
|
||||
<Unit filename="coreutil.cpp" />
|
||||
<Unit filename="createImage.cpp" />
|
||||
<Unit filename="cursorSetVisible.cpp" />
|
||||
<Unit filename="disambiguateTextures.cpp" />
|
||||
|
|
|
@ -153,6 +153,7 @@
|
|||
<ClCompile Include="burningsVideo.cpp" />
|
||||
<ClCompile Include="collisionResponseAnimator.cpp" />
|
||||
<ClCompile Include="color.cpp" />
|
||||
<ClCompile Include="coreutil.cpp" />
|
||||
<ClCompile Include="createImage.cpp" />
|
||||
<ClCompile Include="cursorSetVisible.cpp" />
|
||||
<ClCompile Include="disambiguateTextures.cpp" />
|
||||
|
|
|
@ -157,6 +157,7 @@
|
|||
<ClCompile Include="burningsVideo.cpp" />
|
||||
<ClCompile Include="collisionResponseAnimator.cpp" />
|
||||
<ClCompile Include="color.cpp" />
|
||||
<ClCompile Include="coreutil.cpp" />
|
||||
<ClCompile Include="createImage.cpp" />
|
||||
<ClCompile Include="cursorSetVisible.cpp" />
|
||||
<ClCompile Include="disambiguateTextures.cpp" />
|
||||
|
|
|
@ -204,6 +204,10 @@
|
|||
RelativePath=".\color.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\coreutil.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\createImage.cpp"
|
||||
>
|
||||
|
|
|
@ -203,6 +203,10 @@
|
|||
RelativePath=".\color.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\coreutil.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\createImage.cpp"
|
||||
>
|
||||
|
|
|
@ -37,16 +37,16 @@ CGUIEditWindow::CGUIEditWindow(IGUIEnvironment* environment, core::rect<s32> rec
|
|||
if (!skin)
|
||||
return;
|
||||
|
||||
s32 th = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
|
||||
|
||||
setRelativePosition(core::rect<s32>(50,50,250,500));
|
||||
core::rect<s32> dlgRect(50,50,250,500);
|
||||
setRelativePosition(dlgRect);
|
||||
setMinSize(core::dimension2du(200,200));
|
||||
|
||||
IGUITabControl *TabControl = environment->addTabControl(core::rect<s32>(1,th+5,199,449), this, false, true);
|
||||
s32 th = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
|
||||
IGUITabControl *TabControl = environment->addTabControl(core::rect<s32>(1,th+5,dlgRect.getWidth()-1,dlgRect.getHeight()-1), this, false, true);
|
||||
TabControl->setSubElement(true);
|
||||
TabControl->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
|
||||
|
||||
TabControl->addTab(L"Tools");
|
||||
//TabControl->addTab(L"Tools");
|
||||
//L"Texture Cache Browser"
|
||||
//L"Font Browser"
|
||||
//L"Font Generator"
|
||||
|
@ -83,7 +83,8 @@ CGUIEditWindow::CGUIEditWindow(IGUIEnvironment* environment, core::rect<s32> rec
|
|||
TreeView->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
|
||||
IGUITreeViewNode* treenode = TreeView->getRoot();
|
||||
//treenode->addChildFront(L"Elements");
|
||||
ResizeButton = environment->addButton(core::rect<s32>(199-th,449-th,199,449), this);
|
||||
|
||||
ResizeButton = environment->addButton(core::rect<s32>(dlgRect.getWidth()-(th+1),dlgRect.getHeight()-(th+1),dlgRect.getWidth()-1,dlgRect.getHeight()-1), this);
|
||||
ResizeButton->setDrawBorder(false);
|
||||
ResizeButton->setEnabled(false);
|
||||
ResizeButton->setSpriteBank(skin->getSpriteBank());
|
||||
|
@ -92,6 +93,7 @@ CGUIEditWindow::CGUIEditWindow(IGUIEnvironment* environment, core::rect<s32> rec
|
|||
ResizeButton->grab();
|
||||
ResizeButton->setSubElement(true);
|
||||
ResizeButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);
|
||||
|
||||
updateTree();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<Build>
|
||||
<Target title="Windows">
|
||||
<Option platforms="Windows;" />
|
||||
<Option output="..\..\bin\win32-gcc\GUIEditor.exe" prefix_auto="0" extension_auto="0" />
|
||||
<Option output="../../bin/win32-gcc/GUIEditor.exe" prefix_auto="0" extension_auto="0" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Option projectResourceIncludeDirsRelation="1" />
|
||||
|
@ -16,12 +16,12 @@
|
|||
<Add option="-g" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add directory="..\..\lib\Win32-gcc" />
|
||||
<Add directory="../../lib/Win32-gcc" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="Linux">
|
||||
<Option platforms="Unix;" />
|
||||
<Option output="..\..\bin\Linux\GUIEditor" prefix_auto="0" extension_auto="0" />
|
||||
<Option output="../../bin/Linux/GUIEditor" prefix_auto="0" extension_auto="0" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Option projectResourceIncludeDirsRelation="1" />
|
||||
|
@ -33,7 +33,8 @@
|
|||
<Add library="Irrlicht" />
|
||||
<Add library="Xxf86vm" />
|
||||
<Add library="GL" />
|
||||
<Add directory="..\..\lib\Linux" />
|
||||
<Add library="X11" />
|
||||
<Add directory="../../lib/Linux" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
|
@ -41,7 +42,7 @@
|
|||
<Add alias="All" targets="Windows;Linux;" />
|
||||
</VirtualTargets>
|
||||
<Compiler>
|
||||
<Add directory="..\..\include" />
|
||||
<Add directory="../../include" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="Irrlicht" />
|
||||
|
|
|
@ -14,7 +14,7 @@ using namespace gui;
|
|||
int main()
|
||||
{
|
||||
// ask user for driver
|
||||
video::E_DRIVER_TYPE driverType=driverChoiceConsole();
|
||||
video::E_DRIVER_TYPE driverType=driverChoiceConsole(false);
|
||||
if (driverType==video::EDT_COUNT)
|
||||
return 1;
|
||||
|
||||
|
@ -56,21 +56,29 @@ int main()
|
|||
*/
|
||||
|
||||
env->addGUIElement("GUIEditor");
|
||||
|
||||
while(device->run())
|
||||
{
|
||||
device->sleep(10);
|
||||
|
||||
if (device->isWindowActive())
|
||||
while(device->run())
|
||||
{
|
||||
if (!device->isWindowMinimized())
|
||||
{
|
||||
const core::dimension2d<u32>& screenSize = driver->getScreenSize();
|
||||
wchar_t caption[512];
|
||||
swprintf(caption, 512, L"screen (%4u/%4u)", screenSize.Width, screenSize.Height);
|
||||
device->setWindowCaption(caption);
|
||||
driver->beginScene(true, true, video::SColor(0,200,200,200));
|
||||
smgr->drawAll();
|
||||
env->drawAll();
|
||||
driver->endScene();
|
||||
}
|
||||
|
||||
// be nice to CPU
|
||||
device->sleep(10);
|
||||
if (!device->isWindowActive())
|
||||
device->sleep(90);
|
||||
}
|
||||
|
||||
device->closeDevice();
|
||||
device->drop();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue