#include "IAnimatedMeshSceneNode.h"\r
#include "CMeshManipulator.h"\r
#include "CColorConverter.h"\r
-#include "IAttributeExchangingObject.h"\r
+#include "IReferenceCounted.h"\r
#include "IRenderTarget.h"\r
\r
\r
//! creates a loader which is able to load targa images\r
IImageLoader* createImageLoaderTGA();\r
\r
-//! creates a loader which is able to load psd images\r
-IImageLoader* createImageLoaderPSD();\r
-\r
-//! creates a loader which is able to load psd images\r
-IImageLoader* createImageLoaderPVR();\r
-\r
-//! creates a loader which is able to load dds images\r
-IImageLoader* createImageLoaderDDS();\r
-\r
-//! creates a loader which is able to load pcx images\r
-IImageLoader* createImageLoaderPCX();\r
-\r
//! creates a loader which is able to load png images\r
IImageLoader* createImageLoaderPNG();\r
\r
-//! creates a loader which is able to load WAL images\r
-IImageLoader* createImageLoaderWAL();\r
-\r
-//! creates a loader which is able to load halflife images\r
-IImageLoader* createImageLoaderHalfLife();\r
-\r
-//! creates a loader which is able to load lmp images\r
-IImageLoader* createImageLoaderLMP();\r
-\r
-//! creates a loader which is able to load ppm/pgm/pbm images\r
-IImageLoader* createImageLoaderPPM();\r
-\r
-//! creates a loader which is able to load rgb images\r
-IImageLoader* createImageLoaderRGB();\r
-\r
-\r
-//! creates a writer which is able to save bmp images\r
-IImageWriter* createImageWriterBMP();\r
-\r
//! creates a writer which is able to save jpg images\r
IImageWriter* createImageWriterJPG();\r
\r
-//! creates a writer which is able to save tga images\r
-IImageWriter* createImageWriterTGA();\r
-\r
-//! creates a writer which is able to save psd images\r
-IImageWriter* createImageWriterPSD();\r
-\r
-//! creates a writer which is able to save pcx images\r
-IImageWriter* createImageWriterPCX();\r
-\r
//! creates a writer which is able to save png images\r
IImageWriter* createImageWriterPNG();\r
\r
-//! creates a writer which is able to save ppm images\r
-IImageWriter* createImageWriterPPM();\r
\r
//! constructor\r
CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize)\r
#endif\r
\r
DriverAttributes = new io::CAttributes();\r
- DriverAttributes->addInt("MaxTextures", _IRR_MATERIAL_MAX_TEXTURES_);\r
- DriverAttributes->addInt("MaxSupportedTextures", _IRR_MATERIAL_MAX_TEXTURES_);\r
- DriverAttributes->addInt("MaxLights", getMaximalDynamicLightAmount());\r
+ DriverAttributes->addInt("MaxTextures", MATERIAL_MAX_TEXTURES);\r
+ DriverAttributes->addInt("MaxSupportedTextures", MATERIAL_MAX_TEXTURES);\r
DriverAttributes->addInt("MaxAnisotropy", 1);\r
// DriverAttributes->addInt("MaxUserClipPlanes", 0);\r
// DriverAttributes->addInt("MaxAuxBuffers", 0);\r
if (FileSystem)\r
FileSystem->grab();\r
\r
- // create surface loader\r
-\r
-#ifdef _IRR_COMPILE_WITH_WAL_LOADER_\r
- SurfaceLoader.push_back(video::createImageLoaderHalfLife());\r
- SurfaceLoader.push_back(video::createImageLoaderWAL());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_LMP_LOADER_\r
- SurfaceLoader.push_back(video::createImageLoaderLMP());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_PPM_LOADER_\r
- SurfaceLoader.push_back(video::createImageLoaderPPM());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_RGB_LOADER_\r
- SurfaceLoader.push_back(video::createImageLoaderRGB());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_PSD_LOADER_\r
- SurfaceLoader.push_back(video::createImageLoaderPSD());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_PVR_LOADER_\r
- SurfaceLoader.push_back(video::createImageLoaderPVR());\r
-#endif\r
-#if defined(_IRR_COMPILE_WITH_DDS_LOADER_) || defined(_IRR_COMPILE_WITH_DDS_DECODER_LOADER_)\r
- SurfaceLoader.push_back(video::createImageLoaderDDS());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_PCX_LOADER_\r
- SurfaceLoader.push_back(video::createImageLoaderPCX());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_TGA_LOADER_\r
+ // create surface loaders and writers\r
SurfaceLoader.push_back(video::createImageLoaderTGA());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_PNG_LOADER_\r
SurfaceLoader.push_back(video::createImageLoaderPNG());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_JPG_LOADER_\r
SurfaceLoader.push_back(video::createImageLoaderJPG());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_BMP_LOADER_\r
SurfaceLoader.push_back(video::createImageLoaderBMP());\r
-#endif\r
-\r
-\r
-#ifdef _IRR_COMPILE_WITH_PPM_WRITER_\r
- SurfaceWriter.push_back(video::createImageWriterPPM());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_PCX_WRITER_\r
- SurfaceWriter.push_back(video::createImageWriterPCX());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_PSD_WRITER_\r
- SurfaceWriter.push_back(video::createImageWriterPSD());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_TGA_WRITER_\r
- SurfaceWriter.push_back(video::createImageWriterTGA());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_JPG_WRITER_\r
+\r
SurfaceWriter.push_back(video::createImageWriterJPG());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_PNG_WRITER_\r
SurfaceWriter.push_back(video::createImageWriterPNG());\r
-#endif\r
-#ifdef _IRR_COMPILE_WITH_BMP_WRITER_\r
- SurfaceWriter.push_back(video::createImageWriterBMP());\r
-#endif\r
\r
\r
// set ExposedData to 0\r
}\r
\r
\r
-//! deletes all dynamic lights there are\r
-void CNullDriver::deleteAllDynamicLights()\r
-{\r
- Lights.set_used(0);\r
-}\r
-\r
-\r
-//! adds a dynamic light\r
-s32 CNullDriver::addDynamicLight(const SLight& light)\r
-{\r
- Lights.push_back(light);\r
- return Lights.size() - 1;\r
-}\r
-\r
-//! Turns a dynamic light on or off\r
-//! \param lightIndex: the index returned by addDynamicLight\r
-//! \param turnOn: true to turn the light on, false to turn it off\r
-void CNullDriver::turnLightOn(s32 lightIndex, bool turnOn)\r
-{\r
- // Do nothing\r
-}\r
-\r
-\r
-//! returns the maximal amount of dynamic lights the device can handle\r
-u32 CNullDriver::getMaximalDynamicLightAmount() const\r
-{\r
- return 0;\r
-}\r
-\r
-\r
-//! Returns current amount of dynamic lights set\r
-//! \return Current amount of dynamic lights set\r
-u32 CNullDriver::getDynamicLightCount() const\r
-{\r
- return Lights.size();\r
-}\r
-\r
-\r
-//! Returns light data which was previously set by IVideoDriver::addDynamicLight().\r
-//! \param idx: Zero based index of the light. Must be greater than 0 and smaller\r
-//! than IVideoDriver()::getDynamicLightCount.\r
-//! \return Light data.\r
-const SLight& CNullDriver::getDynamicLight(u32 idx) const\r
-{\r
- if ( idx < Lights.size() )\r
- return Lights[idx];\r
- else\r
- {\r
- _IRR_DEBUG_BREAK_IF(true)\r
- static const SLight dummy;\r
- return dummy;\r
- }\r
-}\r
-\r
-\r
//! Creates a boolean alpha channel of the texture based of an color key.\r
void CNullDriver::makeColorKeyTexture(video::ITexture* texture,\r
video::SColor color,\r
}\r
\r
\r
-\r
-//! Creates a normal map from a height map texture.\r
-//! \param amplitude: Constant value by which the height information is multiplied.\r
-void CNullDriver::makeNormalMapTexture(video::ITexture* texture, f32 amplitude) const\r
-{\r
- if (!texture)\r
- return;\r
-\r
- if (texture->getColorFormat() != ECF_A1R5G5B5 &&\r
- texture->getColorFormat() != ECF_A8R8G8B8 )\r
- {\r
- os::Printer::log("Error: Unsupported texture color format for making normal map.", ELL_ERROR);\r
- return;\r
- }\r
-\r
- core::dimension2d<u32> dim = texture->getSize();\r
- amplitude = amplitude / 255.0f;\r
- f32 vh = dim.Height / (f32)dim.Width;\r
- f32 hh = dim.Width / (f32)dim.Height;\r
-\r
- if (texture->getColorFormat() == ECF_A8R8G8B8)\r
- {\r
- // ECF_A8R8G8B8 version\r
-\r
- s32 *p = (s32*)texture->lock();\r
-\r
- if (!p)\r
- {\r
- os::Printer::log("Could not lock texture for making normal map.", ELL_ERROR);\r
- return;\r
- }\r
-\r
- // copy texture\r
-\r
- u32 pitch = texture->getPitch() / 4;\r
-\r
- s32* in = new s32[dim.Height * pitch];\r
- memcpy(in, p, dim.Height * pitch * 4);\r
-\r
- for (s32 x=0; x < s32(pitch); ++x)\r
- for (s32 y=0; y < s32(dim.Height); ++y)\r
- {\r
- // TODO: this could be optimized really a lot\r
-\r
- core::vector3df h1((x-1)*hh, nml32(x-1, y, pitch, dim.Height, in)*amplitude, y*vh);\r
- core::vector3df h2((x+1)*hh, nml32(x+1, y, pitch, dim.Height, in)*amplitude, y*vh);\r
- //core::vector3df v1(x*hh, nml32(x, y-1, pitch, dim.Height, in)*amplitude, (y-1)*vh);\r
- //core::vector3df v2(x*hh, nml32(x, y+1, pitch, dim.Height, in)*amplitude, (y+1)*vh);\r
- core::vector3df v1(x*hh, nml32(x, y+1, pitch, dim.Height, in)*amplitude, (y-1)*vh);\r
- core::vector3df v2(x*hh, nml32(x, y-1, pitch, dim.Height, in)*amplitude, (y+1)*vh);\r
-\r
- core::vector3df v = v1-v2;\r
- core::vector3df h = h1-h2;\r
-\r
- core::vector3df n = v.crossProduct(h);\r
- n.normalize();\r
- n *= 0.5f;\r
- n += core::vector3df(0.5f,0.5f,0.5f); // now between 0 and 1\r
- n *= 255.0f;\r
-\r
- s32 height = (s32)nml32(x, y, pitch, dim.Height, in);\r
- p[y*pitch + x] = video::SColor(\r
- height, // store height in alpha\r
- (s32)n.X, (s32)n.Z, (s32)n.Y).color;\r
- }\r
-\r
- delete [] in;\r
- texture->unlock();\r
- }\r
- else\r
- {\r
- // ECF_A1R5G5B5 version\r
-\r
- s16 *p = (s16*)texture->lock();\r
-\r
- if (!p)\r
- {\r
- os::Printer::log("Could not lock texture for making normal map.", ELL_ERROR);\r
- return;\r
- }\r
-\r
- u32 pitch = texture->getPitch() / 2;\r
-\r
- // copy texture\r
-\r
- s16* in = new s16[dim.Height * pitch];\r
- memcpy(in, p, dim.Height * pitch * 2);\r
-\r
- for (s32 x=0; x < s32(pitch); ++x)\r
- for (s32 y=0; y < s32(dim.Height); ++y)\r
- {\r
- // TODO: this could be optimized really a lot\r
-\r
- core::vector3df h1((x-1)*hh, nml16(x-1, y, pitch, dim.Height, in)*amplitude, y*vh);\r
- core::vector3df h2((x+1)*hh, nml16(x+1, y, pitch, dim.Height, in)*amplitude, y*vh);\r
- core::vector3df v1(x*hh, nml16(x, y-1, pitch, dim.Height, in)*amplitude, (y-1)*vh);\r
- core::vector3df v2(x*hh, nml16(x, y+1, pitch, dim.Height, in)*amplitude, (y+1)*vh);\r
-\r
- core::vector3df v = v1-v2;\r
- core::vector3df h = h1-h2;\r
-\r
- core::vector3df n = v.crossProduct(h);\r
- n.normalize();\r
- n *= 0.5f;\r
- n += core::vector3df(0.5f,0.5f,0.5f); // now between 0 and 1\r
- n *= 255.0f;\r
-\r
- p[y*pitch + x] = video::RGBA16((u32)n.X, (u32)n.Z, (u32)n.Y);\r
- }\r
-\r
- delete [] in;\r
- texture->unlock();\r
- }\r
-\r
- texture->regenerateMipMapLevels();\r
-}\r
-\r
-\r
//! Returns the maximum amount of primitives (mostly vertices) which\r
//! the device is able to render with one drawIndexedTriangleList\r
//! call.\r
\r
if (prmCount > m)\r
{\r
- char tmp[1024];\r
- sprintf(tmp,"Could not draw triangles, too many primitives(%u), maximum is %u.", prmCount, m);\r
+ char tmp[128];\r
+ snprintf_irr(tmp, sizeof(tmp), "Could not draw triangles, too many primitives(%u), maximum is %u.", prmCount, m);\r
os::Printer::log(tmp, ELL_ERROR);\r
return false;\r
}\r
return 0;\r
\r
//search for hardware links\r
- core::map< const scene::IMeshBuffer*,SHWBufferLink* >::Node* node = HWBufferMap.find(mb);\r
- if (node)\r
- return node->getValue();\r
+ SHWBufferLink *HWBuffer = reinterpret_cast<SHWBufferLink*>(mb->getHWBuffer());\r
+ if (HWBuffer)\r
+ return HWBuffer;\r
\r
return createHardwareBuffer(mb); //no hardware links, and mesh wants one, create it\r
}\r
//! Update all hardware buffers, remove unused ones\r
void CNullDriver::updateAllHardwareBuffers()\r
{\r
- core::map<const scene::IMeshBuffer*,SHWBufferLink*>::ParentFirstIterator Iterator=HWBufferMap.getParentFirstIterator();\r
-\r
- for (;!Iterator.atEnd();Iterator++)\r
- {\r
- SHWBufferLink *Link=Iterator.getNode()->getValue();\r
+ auto it = HWBufferList.begin();\r
+ while (it != HWBufferList.end()) {\r
+ SHWBufferLink *Link = *it;\r
+ ++it;\r
\r
- Link->LastUsed++;\r
- if (Link->LastUsed>20000)\r
- {\r
+ if (!Link->MeshBuffer || Link->MeshBuffer->getReferenceCount() == 1)\r
deleteHardwareBuffer(Link);\r
-\r
- // todo: needs better fix\r
- Iterator = HWBufferMap.getParentFirstIterator();\r
- }\r
}\r
}\r
\r
{\r
if (!HWBuffer)\r
return;\r
- HWBufferMap.remove(HWBuffer->MeshBuffer);\r
+ HWBufferList.erase(HWBuffer->listPosition);\r
delete HWBuffer;\r
}\r
\r
//! Remove hardware buffer\r
void CNullDriver::removeHardwareBuffer(const scene::IMeshBuffer* mb)\r
{\r
- core::map<const scene::IMeshBuffer*,SHWBufferLink*>::Node* node = HWBufferMap.find(mb);\r
- if (node)\r
- deleteHardwareBuffer(node->getValue());\r
+ if (!mb)\r
+ return;\r
+ SHWBufferLink *HWBuffer = reinterpret_cast<SHWBufferLink*>(mb->getHWBuffer());\r
+ if (HWBuffer)\r
+ deleteHardwareBuffer(HWBuffer);\r
}\r
\r
\r
//! Remove all hardware buffers\r
void CNullDriver::removeAllHardwareBuffers()\r
{\r
- while (HWBufferMap.size())\r
- deleteHardwareBuffer(HWBufferMap.getRoot()->getValue());\r
+ while (!HWBufferList.empty())\r
+ deleteHardwareBuffer(HWBufferList.front());\r
}\r
\r
\r
}\r
}\r
\r
-//! Creates material attributes list from a material, usable for serialization and more.\r
-io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMaterial& material,\r
- io::SAttributeReadWriteOptions* options)\r
-{\r
- io::CAttributes* attr = new io::CAttributes(this);\r
-\r
- attr->addEnum("Type", material.MaterialType, sBuiltInMaterialTypeNames);\r
-\r
- attr->addColor("Ambient", material.AmbientColor);\r
- attr->addColor("Diffuse", material.DiffuseColor);\r
- attr->addColor("Emissive", material.EmissiveColor);\r
- attr->addColor("Specular", material.SpecularColor);\r
-\r
- attr->addFloat("Shininess", material.Shininess);\r
- attr->addFloat("Param1", material.MaterialTypeParam);\r
- attr->addFloat("Param2", material.MaterialTypeParam2);\r
- attr->addFloat("Thickness", material.Thickness);\r
-\r
- core::stringc prefix="Texture";\r
- u32 i;\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- {\r
- video::ITexture* texture = material.getTexture(i);\r
- if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename && texture)\r
- {\r
- io::path path = FileSystem->getRelativeFilename(\r
- FileSystem->getAbsolutePath(material.getTexture(i)->getName()), options->Filename);\r
- attr->addTexture((prefix+core::stringc(i+1)).c_str(), material.getTexture(i), path);\r
- }\r
- else\r
- {\r
- attr->addTexture((prefix+core::stringc(i+1)).c_str(), texture);\r
- }\r
- }\r
-\r
- attr->addBool("Wireframe", material.Wireframe);\r
- attr->addBool("PointCloud", material.PointCloud);\r
- attr->addBool("GouraudShading", material.GouraudShading);\r
- attr->addBool("Lighting", material.Lighting);\r
- attr->addEnum("ZWriteEnable", (irr::s32)material.ZWriteEnable, video::ZWriteNames);\r
- attr->addInt("ZBuffer", material.ZBuffer);\r
- attr->addBool("BackfaceCulling", material.BackfaceCulling);\r
- attr->addBool("FrontfaceCulling", material.FrontfaceCulling);\r
- attr->addBool("FogEnable", material.FogEnable);\r
- attr->addBool("NormalizeNormals", material.NormalizeNormals);\r
- attr->addBool("UseMipMaps", material.UseMipMaps);\r
- attr->addInt("AntiAliasing", material.AntiAliasing);\r
- attr->addInt("ColorMask", material.ColorMask);\r
- attr->addInt("ColorMaterial", material.ColorMaterial);\r
- attr->addInt("BlendOperation", material.BlendOperation);\r
- attr->addFloat("BlendFactor", material.BlendFactor);\r
- attr->addInt("PolygonOffsetFactor", material.PolygonOffsetFactor);\r
- attr->addEnum("PolygonOffsetDirection", material.PolygonOffsetDirection, video::PolygonOffsetDirectionNames);\r
- attr->addFloat("PolygonOffsetDepthBias", material.PolygonOffsetDepthBias);\r
- attr->addFloat("PolygonOffsetSlopeScale", material.PolygonOffsetSlopeScale);\r
-\r
- // TODO: Would be nice to have a flag that only serializes rest of texture data when a texture pointer exists.\r
- prefix = "BilinearFilter";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].BilinearFilter);\r
- prefix = "TrilinearFilter";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TrilinearFilter);\r
- prefix = "AnisotropicFilter";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter);\r
- prefix="TextureWrapU";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapU, aTextureClampNames);\r
- prefix="TextureWrapV";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapV, aTextureClampNames);\r
- prefix="TextureWrapW";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapW, aTextureClampNames);\r
- prefix="LODBias";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- attr->addInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].LODBias);\r
-\r
- return attr;\r
-}\r
-\r
-\r
-//! Fills an SMaterial structure from attributes.\r
-void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attr)\r
-{\r
- outMaterial.MaterialType = video::EMT_SOLID;\r
-\r
- core::stringc name = attr->getAttributeAsString("Type");\r
-\r
- u32 i;\r
-\r
- for ( i=0; i < MaterialRenderers.size(); ++i)\r
- if ( name == MaterialRenderers[i].Name )\r
- {\r
- outMaterial.MaterialType = (video::E_MATERIAL_TYPE)i;\r
- break;\r
- }\r
-\r
- outMaterial.AmbientColor = attr->getAttributeAsColor("Ambient", outMaterial.AmbientColor);\r
- outMaterial.DiffuseColor = attr->getAttributeAsColor("Diffuse", outMaterial.DiffuseColor);\r
- outMaterial.EmissiveColor = attr->getAttributeAsColor("Emissive", outMaterial.EmissiveColor);\r
- outMaterial.SpecularColor = attr->getAttributeAsColor("Specular", outMaterial.SpecularColor);\r
-\r
- outMaterial.Shininess = attr->getAttributeAsFloat("Shininess", outMaterial.Shininess);\r
- outMaterial.MaterialTypeParam = attr->getAttributeAsFloat("Param1", outMaterial.MaterialTypeParam);\r
- outMaterial.MaterialTypeParam2 = attr->getAttributeAsFloat("Param2", outMaterial.MaterialTypeParam2);\r
- outMaterial.Thickness = attr->getAttributeAsFloat("Thickness", outMaterial.Thickness);\r
-\r
- core::stringc prefix="Texture";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.setTexture(i, attr->getAttributeAsTexture((prefix+core::stringc(i+1)).c_str()));\r
-\r
- outMaterial.Wireframe = attr->getAttributeAsBool("Wireframe", outMaterial.Wireframe);\r
- outMaterial.PointCloud = attr->getAttributeAsBool("PointCloud", outMaterial.PointCloud);\r
- outMaterial.GouraudShading = attr->getAttributeAsBool("GouraudShading", outMaterial.GouraudShading);\r
- outMaterial.Lighting = attr->getAttributeAsBool("Lighting", outMaterial.Lighting);\r
-\r
- io::E_ATTRIBUTE_TYPE attType = attr->getAttributeType("ZWriteEnable");\r
- if (attType == io::EAT_BOOL ) // Before Irrlicht 1.9\r
- outMaterial.ZWriteEnable = attr->getAttributeAsBool("ZWriteEnable", outMaterial.ZWriteEnable != video::EZW_OFF ) ? video::EZW_AUTO : video::EZW_OFF;\r
- else if (attType == io::EAT_ENUM )\r
- outMaterial.ZWriteEnable = (video::E_ZWRITE)attr->getAttributeAsEnumeration("ZWriteEnable", video::ZWriteNames, outMaterial.ZWriteEnable);\r
-\r
- outMaterial.ZBuffer = (u8)attr->getAttributeAsInt("ZBuffer", outMaterial.ZBuffer);\r
- outMaterial.BackfaceCulling = attr->getAttributeAsBool("BackfaceCulling", outMaterial.BackfaceCulling);\r
- outMaterial.FrontfaceCulling = attr->getAttributeAsBool("FrontfaceCulling", outMaterial.FrontfaceCulling);\r
- outMaterial.FogEnable = attr->getAttributeAsBool("FogEnable", outMaterial.FogEnable);\r
- outMaterial.NormalizeNormals = attr->getAttributeAsBool("NormalizeNormals", outMaterial.NormalizeNormals);\r
- outMaterial.UseMipMaps = attr->getAttributeAsBool("UseMipMaps", outMaterial.UseMipMaps);\r
-\r
- outMaterial.AntiAliasing = attr->getAttributeAsInt("AntiAliasing", outMaterial.AntiAliasing);\r
- outMaterial.ColorMask = attr->getAttributeAsInt("ColorMask", outMaterial.ColorMask);\r
- outMaterial.ColorMaterial = attr->getAttributeAsInt("ColorMaterial", outMaterial.ColorMaterial);\r
- outMaterial.BlendOperation = (video::E_BLEND_OPERATION)attr->getAttributeAsInt("BlendOperation", outMaterial.BlendOperation);\r
- outMaterial.BlendFactor = attr->getAttributeAsFloat("BlendFactor", outMaterial.BlendFactor);\r
- outMaterial.PolygonOffsetFactor = attr->getAttributeAsInt("PolygonOffsetFactor", outMaterial.PolygonOffsetFactor);\r
- outMaterial.PolygonOffsetDirection = (video::E_POLYGON_OFFSET)attr->getAttributeAsEnumeration("PolygonOffsetDirection", video::PolygonOffsetDirectionNames, outMaterial.PolygonOffsetDirection);\r
- outMaterial.PolygonOffsetDepthBias = attr->getAttributeAsFloat("PolygonOffsetDepthBias", outMaterial.PolygonOffsetDepthBias);\r
- outMaterial.PolygonOffsetSlopeScale = attr->getAttributeAsFloat("PolygonOffsetSlopeScale", outMaterial.PolygonOffsetSlopeScale);\r
-\r
- prefix = "BilinearFilter";\r
- if (attr->existsAttribute(prefix.c_str())) // legacy\r
- outMaterial.setFlag(EMF_BILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));\r
- else\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.TextureLayer[i].BilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].BilinearFilter);\r
-\r
- prefix = "TrilinearFilter";\r
- if (attr->existsAttribute(prefix.c_str())) // legacy\r
- outMaterial.setFlag(EMF_TRILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));\r
- else\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.TextureLayer[i].TrilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].TrilinearFilter);\r
-\r
- prefix = "AnisotropicFilter";\r
- if (attr->existsAttribute(prefix.c_str())) // legacy\r
- outMaterial.setFlag(EMF_ANISOTROPIC_FILTER, attr->getAttributeAsBool(prefix.c_str()));\r
- else\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.TextureLayer[i].AnisotropicFilter = attr->getAttributeAsInt((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].AnisotropicFilter);\r
-\r
- prefix = "TextureWrap";\r
- if (attr->existsAttribute(prefix.c_str())) // legacy\r
- {\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- {\r
- outMaterial.TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+core::stringc(i+1)).c_str(), aTextureClampNames);\r
- outMaterial.TextureLayer[i].TextureWrapV = outMaterial.TextureLayer[i].TextureWrapU;\r
- outMaterial.TextureLayer[i].TextureWrapW = outMaterial.TextureLayer[i].TextureWrapW;\r
- }\r
- }\r
- else\r
- {\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- {\r
- outMaterial.TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"U"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapU);\r
- outMaterial.TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"V"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapV);\r
- outMaterial.TextureLayer[i].TextureWrapW = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"W"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapW);\r
- }\r
- }\r
-\r
- prefix="LODBias";\r
- for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
- outMaterial.TextureLayer[i].LODBias = attr->getAttributeAsInt((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].LODBias);\r
-}\r
-\r
\r
//! Returns driver and operating system specific data about the IVideoDriver.\r
const SExposedVideoData& CNullDriver::getExposedVideoData()\r