Commit 2abda10e authored by hybrid's avatar hybrid

Put the dmf stuff into irr namespace as suggested by Piraaate.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2455 dfc29bdd-3216-0410-991c-e03cc46cb475
parent af6ec8b2
...@@ -184,8 +184,8 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file) ...@@ -184,8 +184,8 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
path += ('/'); path += ('/');
//texture and lightmap //texture and lightmap
ITexture *tex = 0; video::ITexture *tex = 0;
ITexture *lig = 0; video::ITexture *lig = 0;
//current buffer to apply material //current buffer to apply material
SMeshBufferLightMap* buffer = (SMeshBufferLightMap*)mesh->getMeshBuffer(i); SMeshBufferLightMap* buffer = (SMeshBufferLightMap*)mesh->getMeshBuffer(i);
...@@ -194,7 +194,7 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file) ...@@ -194,7 +194,7 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
if (materiali[i].textureFlag==0) if (materiali[i].textureFlag==0)
{ {
if (materiali[i].textureBlend==4) if (materiali[i].textureBlend==4)
driver->setTextureCreationFlag(ETCF_ALWAYS_32_BIT,true); driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT,true);
if (FileSystem->existFile(path+materiali[i].textureName)) if (FileSystem->existFile(path+materiali[i].textureName))
tex = driver->getTexture((path+materiali[i].textureName)); tex = driver->getTexture((path+materiali[i].textureName));
else if (FileSystem->existFile(path+FileSystem->getFileBasename(materiali[i].textureName))) else if (FileSystem->existFile(path+FileSystem->getFileBasename(materiali[i].textureName)))
...@@ -211,14 +211,14 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file) ...@@ -211,14 +211,14 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
//Primary texture is just a colour //Primary texture is just a colour
else if(materiali[i].textureFlag==1) else if(materiali[i].textureFlag==1)
{ {
SColor color(axtoi(materiali[i].textureName.c_str())); video::SColor color(axtoi(materiali[i].textureName.c_str()));
//just for compatibility with older Irrlicht versions //just for compatibility with older Irrlicht versions
//to support transparent materials //to support transparent materials
if (color.getAlpha()!=255 && materiali[i].textureBlend==4) if (color.getAlpha()!=255 && materiali[i].textureBlend==4)
driver->setTextureCreationFlag(ETCF_ALWAYS_32_BIT,true); driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT,true);
CImage *immagine= new CImage(ECF_A8R8G8B8, video::CImage *immagine= new video::CImage(video::ECF_A8R8G8B8,
core::dimension2d<u32>(8,8)); core::dimension2d<u32>(8,8));
immagine->fill(color); immagine->fill(color);
tex = driver->addTexture("", immagine); tex = driver->addTexture("", immagine);
...@@ -239,7 +239,7 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file) ...@@ -239,7 +239,7 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
{ {
buffer->Material.MaterialType = video::EMT_SOLID; buffer->Material.MaterialType = video::EMT_SOLID;
const f32 mult = 100.0f - header.dmfShadow; const f32 mult = 100.0f - header.dmfShadow;
buffer->Material.AmbientColor=header.dmfAmbient.getInterpolated(SColor(255,0,0,0),mult/100.f); buffer->Material.AmbientColor=header.dmfAmbient.getInterpolated(video::SColor(255,0,0,0),mult/100.f);
} }
if (materiali[i].textureBlend==4) if (materiali[i].textureBlend==4)
......
...@@ -20,11 +20,13 @@ ...@@ -20,11 +20,13 @@
#ifndef __DMF_SUPPORT_H_INCLUDED__ #ifndef __DMF_SUPPORT_H_INCLUDED__
#define __DMF_SUPPORT_H_INCLUDED__ #define __DMF_SUPPORT_H_INCLUDED__
using namespace irr;
using namespace video;
#include "irrString.h" #include "irrString.h"
namespace irr
{
namespace scene
{
/** A structure representing some DeleD infos. /** A structure representing some DeleD infos.
This structure contains data about DeleD level file like: version, ambient colour, number of objects etc...*/ This structure contains data about DeleD level file like: version, ambient colour, number of objects etc...*/
struct dmfHeader struct dmfHeader
...@@ -32,7 +34,7 @@ struct dmfHeader ...@@ -32,7 +34,7 @@ struct dmfHeader
//main file header //main file header
core::stringc dmfName; //!<Scene name core::stringc dmfName; //!<Scene name
f32 dmfVersion; //!<File version f32 dmfVersion; //!<File version
SColor dmfAmbient; //!<Ambient color video::SColor dmfAmbient; //!<Ambient color
f32 dmfShadow; //!<Shadow intensity f32 dmfShadow; //!<Shadow intensity
u32 numObjects; //!<Number of objects in this scene u32 numObjects; //!<Number of objects in this scene
u32 numMaterials; //!<Number of materials in this scene u32 numMaterials; //!<Number of materials in this scene
...@@ -83,8 +85,8 @@ This structure contains light position coordinates, diffuse colour, specular col ...@@ -83,8 +85,8 @@ This structure contains light position coordinates, diffuse colour, specular col
struct dmfLight struct dmfLight
{ {
core::vector3df pos;//!<Position of this light. core::vector3df pos;//!<Position of this light.
SColorf diffuseColor;//!<Diffuse color. video::SColorf diffuseColor;//!<Diffuse color.
SColorf specularColor;//!<Specular color. video::SColorf specularColor;//!<Specular color.
f32 radius;//!<Maximum radius of light. f32 radius;//!<Maximum radius of light.
}; };
...@@ -595,12 +597,12 @@ bool GetDMFLights(const StringList& RawFile/**<StringList representing a DMF fil ...@@ -595,12 +597,12 @@ bool GetDMFLights(const StringList& RawFile/**<StringList representing a DMF fil
(float)atof(temp[6].c_str()), (float)atof(temp[6].c_str()),
(float)-atof(temp[7].c_str())); (float)-atof(temp[7].c_str()));
lights[d_lit].diffuseColor = SColorf( lights[d_lit].diffuseColor = video::SColorf(
SColor(255, atoi(temp[10].c_str()), atoi(temp[11].c_str()), video::SColor(255, atoi(temp[10].c_str()), atoi(temp[11].c_str()),
atoi(temp[12].c_str()))); atoi(temp[12].c_str())));
lights[d_lit].specularColor = SColorf( lights[d_lit].specularColor = video::SColorf(
SColor(255, atoi(temp[13].c_str()), atoi(temp[14].c_str()), video::SColor(255, atoi(temp[13].c_str()), atoi(temp[14].c_str()),
atoi(temp[15].c_str()))); atoi(temp[15].c_str())));
d_lit++; d_lit++;
...@@ -751,5 +753,8 @@ bool GetDMFWaterPlanes(const StringList& RawFile/**<StringList representing a DM ...@@ -751,5 +753,8 @@ bool GetDMFWaterPlanes(const StringList& RawFile/**<StringList representing a DM
return true; return true;
} }
} // end namespace
} // end namespace
#endif /* __DMF_SUPPORT_H__ */ #endif /* __DMF_SUPPORT_H__ */
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