Split texture layer properties from SMaterial. Changed all texture access etc. in source code and examples. There is also a method to access textures now, which would allow to grab and drop them...
Also disabled dx8 by default. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@992 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
81bfca34f7
commit
68cd81b194
10
changes.txt
10
changes.txt
|
@ -1,8 +1,12 @@
|
|||
Changes in version 1.4 (... 2007)
|
||||
|
||||
- Added ITexture::isRenderTarget()
|
||||
- Major API change: All material properties which are available per texture layer (curently texture, texture matrix, texture filters, and texture wrap mode) are separated into a new struct SMaterialLayer. You can access them via the array TextureLayer[] in SMaterial. The texture matrix methods in SMaterial are still alive, and also textures can be accessed via methods in SMaterial now. But still, many places in user code need some update (usually changing material.Textures[i] to material.TextureLayer[i].Texture etc.)
|
||||
|
||||
- Major API rewriting for proper const usage. Now, most getter methods are const and so are the larger parameters and return values. Moreover, mayn methods taking only unsigned numbers now use u32 instead of s32 to get his limitation from the method's signature.
|
||||
- Major API rewriting for proper const usage. Now, most getter methods are const and so are the larger parameters and return values. Moreover, many methods taking only unsigned numbers now use u32 instead of s32 in order to recognize this limitation from the method's signature.
|
||||
|
||||
- the base class for nearly all Irrlicht classes has been renamed from IUnknown to IReferenceCounted
|
||||
|
||||
- Added ITexture::isRenderTarget()
|
||||
|
||||
- Added STL mesh file format reader and writer.
|
||||
|
||||
|
@ -16,8 +20,6 @@ Changes in version 1.4 (... 2007)
|
|||
to obtain an interface with which you can write out meshes. Currently, an own .irrmesh
|
||||
file format is supported as well as the COLLADA file format.
|
||||
|
||||
- the base class for nearly all Irrlicht classes has been renamed from IUnknown to IReferenceCounted
|
||||
|
||||
- fixed the keyboard autorepeat difference betwenn Linux and Windows. Thanks to denton we now have only KeyPressed events on both systems in case of autorepeat.
|
||||
|
||||
- Added several new particle emitters and affectors from IrrSpintz. Also some new getter and setter methods were added.
|
||||
|
|
|
@ -16,7 +16,9 @@ a quake 3 level. I will not explain it, because it should already be known from
|
|||
|
||||
using namespace irr;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
#endif
|
||||
|
||||
|
||||
int main()
|
||||
|
@ -155,7 +157,7 @@ int main()
|
|||
// add 3 animated faeries.
|
||||
|
||||
video::SMaterial material;
|
||||
material.Textures[0] = driver->getTexture("../../media/faerie2.bmp");
|
||||
material.setTexture(0, driver->getTexture("../../media/faerie2.bmp"));
|
||||
material.Lighting = true;
|
||||
|
||||
scene::IAnimatedMeshSceneNode* node = 0;
|
||||
|
@ -179,7 +181,7 @@ int main()
|
|||
node->getMaterial(0) = material;
|
||||
}
|
||||
|
||||
material.Textures[0] = 0;
|
||||
material.setTexture(0, 0);
|
||||
material.Lighting = false;
|
||||
|
||||
// Add a light
|
||||
|
|
|
@ -458,6 +458,7 @@ int main()
|
|||
video::IVideoDriver* driver = Device->getVideoDriver();
|
||||
IGUIEnvironment* env = Device->getGUIEnvironment();
|
||||
scene::ISceneManager* smgr = Device->getSceneManager();
|
||||
smgr->getParameters()->setAttribute(scene::COLLADA_CREATE_SCENE_INSTANCES, true);
|
||||
|
||||
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@ namespace scene
|
|||
return;
|
||||
|
||||
for (u32 i=0; i<getMaterialCount(); ++i)
|
||||
getMaterial(i).Textures[textureLayer] = texture;
|
||||
getMaterial(i).setTexture(textureLayer, texture);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ to the compiler settings: -DIRR_COMPILE_WITH_DX9_DEV_PACK
|
|||
and this to the linker settings: -ld3dx9 -ld3dx8 **/
|
||||
#if defined(_IRR_WINDOWS_API_) && (!defined(__GNUC__) || defined(IRR_COMPILE_WITH_DX9_DEV_PACK))
|
||||
|
||||
#define _IRR_COMPILE_WITH_DIRECT3D_8_
|
||||
//#define _IRR_COMPILE_WITH_DIRECT3D_8_
|
||||
#define _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "irrArray.h"
|
||||
#include "EMaterialTypes.h"
|
||||
#include "EMaterialFlags.h"
|
||||
#include "SMaterialLayer.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -34,27 +35,6 @@ namespace video
|
|||
EBF_SRC_ALPHA_SATURATE // src (min(srcA, 1-destA), idem, ...)
|
||||
};
|
||||
|
||||
//! Texture coord clamp mode outside [0.0, 1.0]
|
||||
enum E_TEXTURE_CLAMP
|
||||
{
|
||||
//! Texture repeats
|
||||
ETC_REPEAT = 0,
|
||||
//! Texture is clamped to the last pixel
|
||||
ETC_CLAMP,
|
||||
//! Texture is clamped to the edge pixel
|
||||
ETC_CLAMP_TO_EDGE,
|
||||
//! Texture is clamped to the border pixel (if exists)
|
||||
ETC_CLAMP_TO_BORDER,
|
||||
//! Texture is alternatingly mirrored (0..1..0..1..0..)
|
||||
ETC_MIRROR
|
||||
};
|
||||
static const char* const aTextureClampNames[] = {
|
||||
"texture_clamp_repeat",
|
||||
"texture_clamp_clamp",
|
||||
"texture_clamp_clamp_to_edge",
|
||||
"texture_clamp_clamp_to_border",
|
||||
"texture_clamp_mirror", 0};
|
||||
|
||||
//! MaterialTypeParam: eg. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X
|
||||
enum E_MODULATE_FUNC
|
||||
{
|
||||
|
@ -81,7 +61,6 @@ namespace video
|
|||
//! Maximum number of texture an SMaterial can have.
|
||||
const u32 MATERIAL_MAX_TEXTURES = 4;
|
||||
|
||||
|
||||
//! struct for holding parameters for a material renderer
|
||||
class SMaterial
|
||||
{
|
||||
|
@ -94,34 +73,17 @@ namespace video
|
|||
Wireframe(false), PointCloud(false), GouraudShading(true), Lighting(true),
|
||||
ZBuffer(true), ZWriteEnable(true), BackfaceCulling(true),
|
||||
FogEnable(false), NormalizeNormals(false)
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
{
|
||||
Textures[i] = 0;
|
||||
TextureMatrix[i] = 0;
|
||||
TextureWrap[i] = ETC_REPEAT;
|
||||
BilinearFilter[i] = true;
|
||||
TrilinearFilter[i] = false;
|
||||
AnisotropicFilter[i] = false;
|
||||
}
|
||||
}
|
||||
{ }
|
||||
|
||||
//! copy constructor
|
||||
SMaterial(const SMaterial& other)
|
||||
{
|
||||
// These pointers are checked during assignment
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureMatrix[i] = 0;
|
||||
TextureLayer[i].TextureMatrix = 0;
|
||||
*this = other;
|
||||
}
|
||||
|
||||
//! destructor
|
||||
~SMaterial()
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
delete TextureMatrix[i];
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
SMaterial& operator=(const SMaterial& other)
|
||||
{
|
||||
|
@ -137,28 +99,7 @@ namespace video
|
|||
Thickness = other.Thickness;
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
{
|
||||
Textures[i] = other.Textures[i];
|
||||
if (TextureMatrix[i])
|
||||
{
|
||||
if (other.TextureMatrix[i])
|
||||
*TextureMatrix[i] = *other.TextureMatrix[i];
|
||||
else
|
||||
{
|
||||
delete TextureMatrix[i];
|
||||
TextureMatrix[i] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (other.TextureMatrix[i])
|
||||
TextureMatrix[i] = new core::matrix4(*other.TextureMatrix[i]);
|
||||
else
|
||||
TextureMatrix[i] = 0;
|
||||
}
|
||||
TextureWrap[i] = other.TextureWrap[i];
|
||||
BilinearFilter[i] = other.BilinearFilter[i];
|
||||
TrilinearFilter[i] = other.TrilinearFilter[i];
|
||||
AnisotropicFilter[i] = other.AnisotropicFilter[i];
|
||||
TextureLayer[i] = other.TextureLayer[i];
|
||||
}
|
||||
|
||||
Wireframe = other.Wireframe;
|
||||
|
@ -238,15 +179,7 @@ namespace video
|
|||
f32 Thickness;
|
||||
|
||||
//! Texture layer array.
|
||||
ITexture* Textures[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
//! Texture Matrix array
|
||||
//! Do not acces the elements directly as the internal
|
||||
//! ressource management has to cope with Null pointers etc.
|
||||
core::matrix4* TextureMatrix[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
//! Texture Clamp Mode
|
||||
E_TEXTURE_CLAMP TextureWrap[MATERIAL_MAX_TEXTURES];
|
||||
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
//! material flags
|
||||
/** The user can access the material flag using
|
||||
|
@ -276,21 +209,6 @@ namespace video
|
|||
//! Is backfaceculling enabled? Default: true
|
||||
bool BackfaceCulling;
|
||||
|
||||
//! Is bilinear filtering enabled? Default: true
|
||||
bool BilinearFilter[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
//! Is trilinear filtering enabled? Default: false
|
||||
/** If the trilinear filter flag is enabled,
|
||||
the bilinear filtering flag is ignored. */
|
||||
bool TrilinearFilter[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
//! Is anisotropic filtering enabled? Default: false
|
||||
/** In Irrlicht you can use anisotropic texture filtering
|
||||
in conjunction with bilinear or trilinear texture
|
||||
filtering to improve rendering results. Primitives
|
||||
will look less blurry with this flag switched on. */
|
||||
bool AnisotropicFilter[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
//! Is fog enabled? Default: false
|
||||
bool FogEnable;
|
||||
|
||||
|
@ -300,16 +218,15 @@ namespace video
|
|||
//! Gets the texture transformation matrix for level i
|
||||
core::matrix4& getTextureMatrix(u32 i)
|
||||
{
|
||||
if (i<MATERIAL_MAX_TEXTURES && !TextureMatrix[i])
|
||||
TextureMatrix[i] = new core::matrix4(core::matrix4::EM4CONST_IDENTITY);
|
||||
return *TextureMatrix[i];
|
||||
if (i<MATERIAL_MAX_TEXTURES)
|
||||
return TextureLayer[i].getTextureMatrix();
|
||||
}
|
||||
|
||||
//! Gets the immutable texture transformation matrix for level i
|
||||
const core::matrix4& getTextureMatrix(u32 i) const
|
||||
{
|
||||
if (i<MATERIAL_MAX_TEXTURES && TextureMatrix[i])
|
||||
return *TextureMatrix[i];
|
||||
if (i<MATERIAL_MAX_TEXTURES)
|
||||
return TextureLayer[i].getTextureMatrix();
|
||||
else
|
||||
return core::IdentityMatrix;
|
||||
}
|
||||
|
@ -319,10 +236,24 @@ namespace video
|
|||
{
|
||||
if (i>=MATERIAL_MAX_TEXTURES)
|
||||
return;
|
||||
if (!TextureMatrix[i])
|
||||
TextureMatrix[i] = new core::matrix4(mat);
|
||||
TextureLayer[i].setTextureMatrix(mat);
|
||||
}
|
||||
|
||||
//! Gets the i-th texture
|
||||
ITexture* getTexture(u32 i) const
|
||||
{
|
||||
if (i>=MATERIAL_MAX_TEXTURES)
|
||||
return 0;
|
||||
else
|
||||
*TextureMatrix[i] = mat;
|
||||
return TextureLayer[i].Texture;
|
||||
}
|
||||
|
||||
//! Sets the i-th texture
|
||||
void setTexture(u32 i, ITexture* tex)
|
||||
{
|
||||
if (i>=MATERIAL_MAX_TEXTURES)
|
||||
return;
|
||||
TextureLayer[i].Texture = tex;
|
||||
}
|
||||
|
||||
//! Sets the Material flag to the given value
|
||||
|
@ -347,19 +278,19 @@ namespace video
|
|||
case EMF_BILINEAR_FILTER:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
BilinearFilter[i] = value;
|
||||
TextureLayer[i].BilinearFilter = value;
|
||||
}
|
||||
break;
|
||||
case EMF_TRILINEAR_FILTER:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TrilinearFilter[i] = value;
|
||||
TextureLayer[i].TrilinearFilter = value;
|
||||
}
|
||||
break;
|
||||
case EMF_ANISOTROPIC_FILTER:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
AnisotropicFilter[i] = value;
|
||||
TextureLayer[i].AnisotropicFilter = value;
|
||||
}
|
||||
break;
|
||||
case EMF_FOG_ENABLE:
|
||||
|
@ -369,7 +300,7 @@ namespace video
|
|||
case EMF_TEXTURE_WRAP:
|
||||
{
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
TextureWrap[i] = (E_TEXTURE_CLAMP)value;
|
||||
TextureLayer[i].TextureWrap = (E_TEXTURE_CLAMP)value;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -397,17 +328,17 @@ namespace video
|
|||
case EMF_BACK_FACE_CULLING:
|
||||
return BackfaceCulling;
|
||||
case EMF_BILINEAR_FILTER:
|
||||
return BilinearFilter[0];
|
||||
return TextureLayer[0].BilinearFilter;
|
||||
case EMF_TRILINEAR_FILTER:
|
||||
return TrilinearFilter[0];
|
||||
return TextureLayer[0].TrilinearFilter;
|
||||
case EMF_ANISOTROPIC_FILTER:
|
||||
return AnisotropicFilter[0];
|
||||
return TextureLayer[0].AnisotropicFilter;
|
||||
case EMF_FOG_ENABLE:
|
||||
return FogEnable;
|
||||
case EMF_NORMALIZE_NORMALS:
|
||||
return NormalizeNormals;
|
||||
case EMF_TEXTURE_WRAP:
|
||||
return !(TextureWrap[0] || TextureWrap[1] || TextureWrap[2] || TextureWrap[3]);
|
||||
return !(TextureLayer[0].TextureWrap || TextureLayer[1].TextureWrap || TextureLayer[2].TextureWrap || TextureLayer[3].TextureWrap);
|
||||
case EMF_MATERIAL_FLAG_COUNT:
|
||||
break;
|
||||
}
|
||||
|
@ -439,17 +370,8 @@ namespace video
|
|||
NormalizeNormals != b.NormalizeNormals;
|
||||
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i)
|
||||
{
|
||||
different |= (Textures[i] != b.Textures[i]);
|
||||
different |= (TextureWrap[i] != b.TextureWrap[i]);
|
||||
different |= (BilinearFilter[i] != b.BilinearFilter[i]);
|
||||
different |= (TrilinearFilter[i] != b.TrilinearFilter[i]);
|
||||
different |= (AnisotropicFilter[i] != b.AnisotropicFilter[i]);
|
||||
different |= (TextureLayer[i] != b.TextureLayer[i]);
|
||||
}
|
||||
if (different)
|
||||
return true;
|
||||
else
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
different |= (TextureMatrix[i] != b.TextureMatrix[i]);
|
||||
return different;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
// Copyright (C) 2002-2007 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef __S_MATERIAL_LAYER_H_INCLUDED__
|
||||
#define __S_MATERIAL_LAYER_H_INCLUDED__
|
||||
|
||||
#include "matrix4.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
class ITexture;
|
||||
|
||||
//! Texture coord clamp mode outside [0.0, 1.0]
|
||||
enum E_TEXTURE_CLAMP
|
||||
{
|
||||
//! Texture repeats
|
||||
ETC_REPEAT = 0,
|
||||
//! Texture is clamped to the last pixel
|
||||
ETC_CLAMP,
|
||||
//! Texture is clamped to the edge pixel
|
||||
ETC_CLAMP_TO_EDGE,
|
||||
//! Texture is clamped to the border pixel (if exists)
|
||||
ETC_CLAMP_TO_BORDER,
|
||||
//! Texture is alternatingly mirrored (0..1..0..1..0..)
|
||||
ETC_MIRROR
|
||||
};
|
||||
static const char* const aTextureClampNames[] = {
|
||||
"texture_clamp_repeat",
|
||||
"texture_clamp_clamp",
|
||||
"texture_clamp_clamp_to_edge",
|
||||
"texture_clamp_clamp_to_border",
|
||||
"texture_clamp_mirror", 0};
|
||||
|
||||
//! struct for holding material parameters which exist per texture layer
|
||||
class SMaterialLayer
|
||||
{
|
||||
public:
|
||||
//! default constructor
|
||||
SMaterialLayer()
|
||||
: Texture(0), TextureMatrix(0),
|
||||
TextureWrap(ETC_REPEAT),
|
||||
BilinearFilter(true),
|
||||
TrilinearFilter(false),
|
||||
AnisotropicFilter(false)
|
||||
{}
|
||||
|
||||
//! copy constructor
|
||||
SMaterialLayer(const SMaterialLayer& other)
|
||||
{
|
||||
// This pointer is checked during assignment
|
||||
TextureMatrix = 0;
|
||||
*this = other;
|
||||
}
|
||||
|
||||
//! destructor
|
||||
~SMaterialLayer()
|
||||
{
|
||||
delete TextureMatrix;
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
SMaterialLayer& operator=(const SMaterialLayer& other)
|
||||
{
|
||||
Texture = other.Texture;
|
||||
if (TextureMatrix)
|
||||
{
|
||||
if (other.TextureMatrix)
|
||||
*TextureMatrix = *other.TextureMatrix;
|
||||
else
|
||||
{
|
||||
delete TextureMatrix;
|
||||
TextureMatrix = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (other.TextureMatrix)
|
||||
TextureMatrix = new core::matrix4(*other.TextureMatrix);
|
||||
else
|
||||
TextureMatrix = 0;
|
||||
}
|
||||
TextureWrap = other.TextureWrap;
|
||||
BilinearFilter = other.BilinearFilter;
|
||||
TrilinearFilter = other.TrilinearFilter;
|
||||
AnisotropicFilter = other.AnisotropicFilter;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Texture
|
||||
ITexture* Texture;
|
||||
|
||||
//! Texture Matrix
|
||||
//! Do not acces this element directly as the internal
|
||||
//! ressource management has to cope with Null pointers etc.
|
||||
core::matrix4* TextureMatrix;
|
||||
|
||||
//! Texture Clamp Mode
|
||||
E_TEXTURE_CLAMP TextureWrap;
|
||||
|
||||
//! Is bilinear filtering enabled? Default: true
|
||||
bool BilinearFilter;
|
||||
|
||||
//! Is trilinear filtering enabled? Default: false
|
||||
/** If the trilinear filter flag is enabled,
|
||||
the bilinear filtering flag is ignored. */
|
||||
bool TrilinearFilter;
|
||||
|
||||
//! Is anisotropic filtering enabled? Default: false
|
||||
/** In Irrlicht you can use anisotropic texture filtering
|
||||
in conjunction with bilinear or trilinear texture
|
||||
filtering to improve rendering results. Primitives
|
||||
will look less blurry with this flag switched on. */
|
||||
bool AnisotropicFilter;
|
||||
|
||||
//! Gets the texture transformation matrix
|
||||
core::matrix4& getTextureMatrix()
|
||||
{
|
||||
if (!TextureMatrix)
|
||||
TextureMatrix = new core::matrix4(core::matrix4::EM4CONST_IDENTITY);
|
||||
return *TextureMatrix;
|
||||
}
|
||||
|
||||
//! Gets the immutable texture transformation matrix
|
||||
const core::matrix4& getTextureMatrix() const
|
||||
{
|
||||
if (TextureMatrix)
|
||||
return *TextureMatrix;
|
||||
else
|
||||
return core::IdentityMatrix;
|
||||
}
|
||||
|
||||
//! Sets the texture transformation matrix to mat
|
||||
void setTextureMatrix(const core::matrix4& mat)
|
||||
{
|
||||
if (!TextureMatrix)
|
||||
TextureMatrix = new core::matrix4(mat);
|
||||
else
|
||||
*TextureMatrix = mat;
|
||||
}
|
||||
|
||||
//! Inequality operator
|
||||
inline bool operator!=(const SMaterialLayer& b) const
|
||||
{
|
||||
bool different =
|
||||
Texture != b.Texture ||
|
||||
TextureWrap != b.TextureWrap ||
|
||||
BilinearFilter != b.BilinearFilter ||
|
||||
TrilinearFilter != b.TrilinearFilter ||
|
||||
AnisotropicFilter != b.AnisotropicFilter;
|
||||
if (different)
|
||||
return true;
|
||||
else
|
||||
different |= (TextureMatrix != b.TextureMatrix);
|
||||
return different;
|
||||
}
|
||||
|
||||
//! Equality operator
|
||||
inline bool operator==(const SMaterialLayer& b) const
|
||||
{ return !(b!=*this); }
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif // __S_MATERIAL_LAYER_H_INCLUDED__
|
||||
|
|
@ -1035,7 +1035,7 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
os::Printer::log("Could not load a texture for entry in 3ds file",
|
||||
Materials[i].Filename[0].c_str(), ELL_WARNING);
|
||||
else
|
||||
m->getMaterial().Textures[0] = texture;
|
||||
m->getMaterial().setTexture(0, texture);
|
||||
}
|
||||
|
||||
if (Materials[i].Filename[2].size())
|
||||
|
@ -1057,7 +1057,7 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
}
|
||||
else
|
||||
{
|
||||
m->getMaterial().Textures[0] = texture;
|
||||
m->getMaterial().setTexture(0, texture);
|
||||
m->getMaterial().MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
|
||||
}
|
||||
}
|
||||
|
@ -1081,8 +1081,8 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
}
|
||||
else
|
||||
{
|
||||
m->getMaterial().Textures[1] = m->getMaterial().Textures[0];
|
||||
m->getMaterial().Textures[0] = texture;
|
||||
m->getMaterial().setTexture(1, m->getMaterial().getTexture(0));
|
||||
m->getMaterial().setTexture(0, texture);
|
||||
m->getMaterial().MaterialType = video::EMT_REFLECTION_2_LAYER;
|
||||
}
|
||||
}
|
||||
|
@ -1104,7 +1104,7 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
Materials[i].Filename[4].c_str(), ELL_WARNING);
|
||||
else
|
||||
{
|
||||
m->getMaterial().Textures[1] = texture;
|
||||
m->getMaterial().setTexture(1, texture);
|
||||
Driver->makeNormalMapTexture(texture, 9.0f);
|
||||
m->getMaterial().MaterialType=video::EMT_PARALLAX_MAP_SOLID;
|
||||
m->getMaterial().MaterialTypeParam=0.035f;
|
||||
|
|
|
@ -869,9 +869,9 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||
}
|
||||
|
||||
if (B3dMaterial.Textures[0] != 0)
|
||||
B3dMaterial.Material->Textures[0] = B3dMaterial.Textures[0]->Texture;
|
||||
B3dMaterial.Material->setTexture(0, B3dMaterial.Textures[0]->Texture);
|
||||
if (B3dMaterial.Textures[1] != 0)
|
||||
B3dMaterial.Material->Textures[1] = B3dMaterial.Textures[1]->Texture;
|
||||
B3dMaterial.Material->setTexture(1, B3dMaterial.Textures[1]->Texture);
|
||||
|
||||
//If the first texture is empty:
|
||||
if (B3dMaterial.Textures[1] != 0 && B3dMaterial.Textures[0] == 0)
|
||||
|
|
|
@ -457,8 +457,8 @@ namespace scene
|
|||
lmapName += "LMAP_";
|
||||
lmapName += (int)surface->getLightMapId();
|
||||
|
||||
buffer->Material.Textures[0] = texture;
|
||||
buffer->Material.Textures[1] = driver->getTexture(lmapName.c_str());
|
||||
buffer->Material.setTexture(0, texture);
|
||||
buffer->Material.setTexture(1, driver->getTexture(lmapName.c_str()));
|
||||
buffer->Material.Lighting = false;
|
||||
buffer->Material.MaterialType = video::EMT_LIGHTMAP_M4;
|
||||
|
||||
|
|
|
@ -776,7 +776,7 @@ void CColladaFileLoader::readMaterial(io::IXMLReaderUTF8* reader)
|
|||
for (u32 i=0; i<Textures.size(); ++i)
|
||||
if (textureName == Textures[i].Id)
|
||||
{
|
||||
material.Mat.Textures[0] = Textures[i].Texture;
|
||||
material.Mat.setTexture(0, Textures[i].Texture);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -624,7 +624,7 @@ void CD3D8Driver::setMaterial(const SMaterial& material)
|
|||
|
||||
for (u32 i=0; i<MaxTextureUnits; ++i)
|
||||
{
|
||||
setTexture(i, Material.Textures[i]);
|
||||
setTexture(i, Material.getTexture(i));
|
||||
setTransform((E_TRANSFORMATION_STATE) ( ETS_TEXTURE_0 + i ),
|
||||
material.getTextureMatrix(i));
|
||||
}
|
||||
|
@ -1343,10 +1343,10 @@ void CD3D8Driver::setBasicRenderStates(const SMaterial& material, const SMateria
|
|||
// texture address mode
|
||||
for (u32 st=0; st<MaxTextureUnits; ++st)
|
||||
{
|
||||
if (resetAllRenderstates || lastmaterial.TextureWrap[st] != material.TextureWrap[st])
|
||||
if (resetAllRenderstates || lastmaterial.TextureLayer[st].TextureWrap != material.TextureLayer[st].TextureWrap)
|
||||
{
|
||||
u32 mode = D3DTADDRESS_WRAP;
|
||||
switch (material.TextureWrap[st])
|
||||
switch (material.TextureLayer[st].TextureWrap)
|
||||
{
|
||||
case ETC_REPEAT:
|
||||
mode=D3DTADDRESS_WRAP;
|
||||
|
@ -1369,15 +1369,15 @@ void CD3D8Driver::setBasicRenderStates(const SMaterial& material, const SMateria
|
|||
|
||||
// Bilinear and/or trilinear
|
||||
if (resetAllRenderstates ||
|
||||
lastmaterial.BilinearFilter[st] != material.BilinearFilter[st] ||
|
||||
lastmaterial.TrilinearFilter[st] != material.TrilinearFilter[st] ||
|
||||
lastmaterial.AnisotropicFilter[st] != material.AnisotropicFilter[st] )
|
||||
lastmaterial.TextureLayer[st].BilinearFilter != material.TextureLayer[st].BilinearFilter ||
|
||||
lastmaterial.TextureLayer[st].TrilinearFilter != material.TextureLayer[st].TrilinearFilter ||
|
||||
lastmaterial.TextureLayer[st].AnisotropicFilter != material.TextureLayer[st].AnisotropicFilter )
|
||||
{
|
||||
if (material.BilinearFilter[st] || material.TrilinearFilter[st] || material.AnisotropicFilter[st])
|
||||
if (material.TextureLayer[st].BilinearFilter || material.TextureLayer[st].TrilinearFilter || material.TextureLayer[st].AnisotropicFilter)
|
||||
{
|
||||
D3DTEXTUREFILTERTYPE tftMag = ((Caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) && material.AnisotropicFilter[st]) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMin = ((Caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFANISOTROPIC) && material.AnisotropicFilter[st]) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMip = material.TrilinearFilter[st] ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
||||
D3DTEXTUREFILTERTYPE tftMag = ((Caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) && material.TextureLayer[st].AnisotropicFilter) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMin = ((Caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFANISOTROPIC) && material.TextureLayer[st].AnisotropicFilter) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMip = material.TextureLayer[st].TrilinearFilter ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
||||
|
||||
pID3DDevice->SetTextureStageState(st, D3DTSS_MAGFILTER, tftMag);
|
||||
pID3DDevice->SetTextureStageState(st, D3DTSS_MINFILTER, tftMin);
|
||||
|
|
|
@ -642,7 +642,7 @@ void CD3D9Driver::setMaterial(const SMaterial& material)
|
|||
|
||||
for (u32 i=0; i<MaxTextureUnits; ++i)
|
||||
{
|
||||
setTexture(i, Material.Textures[i]);
|
||||
setTexture(i, Material.getTexture(i));
|
||||
setTransform((E_TRANSFORMATION_STATE) ( ETS_TEXTURE_0 + i ),
|
||||
material.getTextureMatrix(i));
|
||||
}
|
||||
|
@ -1345,10 +1345,10 @@ void CD3D9Driver::setBasicRenderStates(const SMaterial& material, const SMateria
|
|||
// texture address mode
|
||||
for (u32 st=0; st<MaxTextureUnits; ++st)
|
||||
{
|
||||
if (resetAllRenderstates || lastmaterial.TextureWrap[st] != material.TextureWrap[st])
|
||||
if (resetAllRenderstates || lastmaterial.TextureLayer[st].TextureWrap != material.TextureLayer[st].TextureWrap)
|
||||
{
|
||||
u32 mode = D3DTADDRESS_WRAP;
|
||||
switch (material.TextureWrap[st])
|
||||
switch (material.TextureLayer[st].TextureWrap)
|
||||
{
|
||||
case ETC_REPEAT:
|
||||
mode=D3DTADDRESS_WRAP;
|
||||
|
@ -1369,17 +1369,17 @@ void CD3D9Driver::setBasicRenderStates(const SMaterial& material, const SMateria
|
|||
pID3DDevice->SetSamplerState(st, D3DSAMP_ADDRESSV, mode );
|
||||
}
|
||||
|
||||
// Bilinear and/or trilinear
|
||||
// Bilinear, trilinear, and anisotropic filter
|
||||
if (resetAllRenderstates ||
|
||||
lastmaterial.BilinearFilter[st] != material.BilinearFilter[st] ||
|
||||
lastmaterial.TrilinearFilter[st] != material.TrilinearFilter[st] ||
|
||||
lastmaterial.AnisotropicFilter[st] != material.AnisotropicFilter[st])
|
||||
lastmaterial.TextureLayer[st].BilinearFilter != material.TextureLayer[st].BilinearFilter ||
|
||||
lastmaterial.TextureLayer[st].TrilinearFilter != material.TextureLayer[st].TrilinearFilter ||
|
||||
lastmaterial.TextureLayer[st].AnisotropicFilter != material.TextureLayer[st].AnisotropicFilter)
|
||||
{
|
||||
if (material.BilinearFilter[st] || material.TrilinearFilter[st] || material.AnisotropicFilter[st])
|
||||
if (material.TextureLayer[st].BilinearFilter || material.TextureLayer[st].TrilinearFilter || material.TextureLayer[st].AnisotropicFilter)
|
||||
{
|
||||
D3DTEXTUREFILTERTYPE tftMag = ((Caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) && material.AnisotropicFilter[st]) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMin = ((Caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFANISOTROPIC) && material.AnisotropicFilter[st]) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMip = material.TrilinearFilter[st] ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
||||
D3DTEXTUREFILTERTYPE tftMag = ((Caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) && material.TextureLayer[st].AnisotropicFilter) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMin = ((Caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFANISOTROPIC) && material.TextureLayer[st].AnisotropicFilter) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
|
||||
D3DTEXTUREFILTERTYPE tftMip = material.TextureLayer[st].TrilinearFilter ? D3DTEXF_LINEAR : D3DTEXF_POINT;
|
||||
|
||||
pID3DDevice->SetSamplerState(st, D3DSAMP_MAGFILTER, tftMag);
|
||||
pID3DDevice->SetSamplerState(st, D3DSAMP_MINFILTER, tftMin);
|
||||
|
|
|
@ -387,8 +387,8 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
|
|||
lig->regenerateMipMapLevels();
|
||||
}
|
||||
|
||||
buffer->Material.Textures[0]=tex;
|
||||
buffer->Material.Textures[1]=lig;
|
||||
buffer->Material.setTexture(0, tex);
|
||||
buffer->Material.setTexture(1, lig);
|
||||
}
|
||||
|
||||
delete verts;
|
||||
|
@ -402,7 +402,7 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file)
|
|||
{
|
||||
if (Mesh->MeshBuffers[i]->getVertexCount() == 0 ||
|
||||
Mesh->MeshBuffers[i]->getIndexCount() == 0 ||
|
||||
Mesh->MeshBuffers[i]->getMaterial().Textures[0] == 0)
|
||||
Mesh->MeshBuffers[i]->getMaterial().getTexture(0) == 0)
|
||||
{
|
||||
// Meshbuffer is empty -- drop it
|
||||
Mesh->MeshBuffers[i]->drop();
|
||||
|
|
|
@ -213,14 +213,14 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture,
|
|||
|
||||
sprintf(textureName, "terrain%u_%u", tm, mesh->getMeshBufferCount());
|
||||
|
||||
material.Textures[0] = driver->addTexture(textureName, img);
|
||||
material.setTexture(0, driver->addTexture(textureName, img));
|
||||
|
||||
if (material.Textures[0])
|
||||
if (material.getTexture(0))
|
||||
{
|
||||
c8 tmp[255];
|
||||
sprintf(tmp, "Generated terrain texture (%dx%d): %s",
|
||||
material.Textures[0]->getSize().Width,
|
||||
material.Textures[0]->getSize().Height,
|
||||
material.getTexture(0)->getSize().Width,
|
||||
material.getTexture(0)->getSize().Height,
|
||||
textureName);
|
||||
os::Printer::log(tmp);
|
||||
}
|
||||
|
|
|
@ -308,11 +308,11 @@ void CLMTSMeshFileLoader::loadTextures(SMesh* mesh, u32 numTextures, u32 numLigh
|
|||
for (s32 i=0; i<Header.SubsetCount; ++i)
|
||||
{
|
||||
if (Subsets[i].TextID1 < Header.TextureCount)
|
||||
mesh->getMeshBuffer(i)->getMaterial().Textures[0] = tex[textureIDs[Subsets[i].TextID1]];
|
||||
mesh->getMeshBuffer(i)->getMaterial().setTexture(0, tex[textureIDs[Subsets[i].TextID1]]);
|
||||
if (Subsets[i].TextID2 < Header.TextureCount)
|
||||
mesh->getMeshBuffer(i)->getMaterial().Textures[1] = lig[textureIDs[Subsets[i].TextID2]];
|
||||
mesh->getMeshBuffer(i)->getMaterial().setTexture(1, lig[textureIDs[Subsets[i].TextID2]]);
|
||||
|
||||
if (!mesh->getMeshBuffer(i)->getMaterial().Textures[1])
|
||||
if (!mesh->getMeshBuffer(i)->getMaterial().getTexture(1))
|
||||
mesh->getMeshBuffer(i)->getMaterial().MaterialType = video::EMT_SOLID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -312,7 +312,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
|||
if (TexturePath!="")
|
||||
{
|
||||
TexturePath=stripPathFromString(file->getFileName(),true) + stripPathFromString(TexturePath,false);
|
||||
tmpBuffer->Material.Textures[0] = Driver->getTexture(TexturePath.c_str() );
|
||||
tmpBuffer->Material.setTexture(0, Driver->getTexture(TexturePath.c_str()) );
|
||||
}
|
||||
|
||||
core::stringc AlphamapPath=(const c8*)material->Alphamap;
|
||||
|
@ -320,7 +320,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
|||
if (AlphamapPath!="")
|
||||
{
|
||||
AlphamapPath=stripPathFromString(file->getFileName(),true) + stripPathFromString(AlphamapPath,false);
|
||||
tmpBuffer->Material.Textures[2] = Driver->getTexture(AlphamapPath.c_str() );
|
||||
tmpBuffer->Material.setTexture(2, Driver->getTexture(AlphamapPath.c_str()) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -562,13 +562,13 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
if (buffer->Material.MaterialType == video::EMT_REFLECTION_2_LAYER)
|
||||
{
|
||||
buffer->Material.Lighting = true;
|
||||
buffer->Material.Textures[1] = matEnt->Texture1;
|
||||
buffer->Material.Textures[0] = matEnt->Texture2;
|
||||
buffer->Material.setTexture(1, matEnt->Texture1);
|
||||
buffer->Material.setTexture(0, matEnt->Texture2);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->Material.Textures[0] = matEnt->Texture1;
|
||||
buffer->Material.Textures[1] = matEnt->Texture2;
|
||||
buffer->Material.setTexture(0, matEnt->Texture1);
|
||||
buffer->Material.setTexture(1, matEnt->Texture2);
|
||||
}
|
||||
|
||||
if (buffer->Material.MaterialType == video::EMT_TRANSPARENT_ALPHA_CHANNEL)
|
||||
|
@ -601,8 +601,8 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
}
|
||||
else
|
||||
{
|
||||
buffer->Material.Textures[0] = 0;
|
||||
buffer->Material.Textures[1] = 0;
|
||||
buffer->Material.setTexture(0, 0);
|
||||
buffer->Material.setTexture(1, 0);
|
||||
|
||||
buffer->Material.AmbientColor = video::SColor(255, 255, 255, 255);
|
||||
buffer->Material.DiffuseColor = video::SColor(255, 255, 255, 255);
|
||||
|
@ -626,7 +626,7 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
}
|
||||
}
|
||||
else if (
|
||||
!buffer->Material.Textures[1] &&
|
||||
!buffer->Material.getTexture(1) &&
|
||||
buffer->Material.MaterialType != video::EMT_TRANSPARENT_ALPHA_CHANNEL &&
|
||||
buffer->Material.MaterialType != video::EMT_SPHERE_MAP)
|
||||
{
|
||||
|
|
|
@ -1291,7 +1291,7 @@ io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMateria
|
|||
core::stringc prefix="Texture";
|
||||
u32 i;
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
attr->addTexture((prefix+(i+1)).c_str(), material.Textures[i]);
|
||||
attr->addTexture((prefix+(i+1)).c_str(), material.getTexture(i));
|
||||
|
||||
attr->addBool("Wireframe", material.Wireframe);
|
||||
attr->addBool("GouraudShading", material.GouraudShading);
|
||||
|
@ -1304,16 +1304,16 @@ io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMateria
|
|||
|
||||
prefix = "BilinearFilter";
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
attr->addBool((prefix+(i+1)).c_str(), material.BilinearFilter[i]);
|
||||
attr->addBool((prefix+(i+1)).c_str(), material.TextureLayer[i].BilinearFilter);
|
||||
prefix = "TrilinearFilter";
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
attr->addBool((prefix+(i+1)).c_str(), material.TrilinearFilter[i]);
|
||||
attr->addBool((prefix+(i+1)).c_str(), material.TextureLayer[i].TrilinearFilter);
|
||||
prefix = "AnisotropicFilter";
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
attr->addBool((prefix+(i+1)).c_str(), material.AnisotropicFilter[i]);
|
||||
attr->addBool((prefix+(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter);
|
||||
prefix="TextureWrap";
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
attr->addEnum((prefix+(i+1)).c_str(), material.TextureWrap[i], aTextureClampNames);
|
||||
attr->addEnum((prefix+(i+1)).c_str(), material.TextureLayer[i].TextureWrap, aTextureClampNames);
|
||||
|
||||
return attr;
|
||||
}
|
||||
|
@ -1346,7 +1346,7 @@ void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMater
|
|||
|
||||
core::stringc prefix="Texture";
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
outMaterial.Textures[i] = attr->getAttributeAsTexture((prefix+(i+1)).c_str());
|
||||
outMaterial.setTexture(i, attr->getAttributeAsTexture((prefix+(i+1)).c_str()));
|
||||
|
||||
outMaterial.Wireframe = attr->getAttributeAsBool("Wireframe");
|
||||
outMaterial.GouraudShading = attr->getAttributeAsBool("GouraudShading");
|
||||
|
@ -1361,25 +1361,25 @@ void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMater
|
|||
outMaterial.setFlag(EMF_BILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));
|
||||
else
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
outMaterial.BilinearFilter[i] = attr->getAttributeAsBool((prefix+(i+1)).c_str());
|
||||
outMaterial.TextureLayer[i].BilinearFilter = attr->getAttributeAsBool((prefix+(i+1)).c_str());
|
||||
|
||||
prefix = "TrilinearFilter";
|
||||
if (attr->existsAttribute(prefix.c_str())) // legacy
|
||||
outMaterial.setFlag(EMF_TRILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));
|
||||
else
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
outMaterial.TrilinearFilter[i] = attr->getAttributeAsBool((prefix+(i+1)).c_str());
|
||||
outMaterial.TextureLayer[i].TrilinearFilter = attr->getAttributeAsBool((prefix+(i+1)).c_str());
|
||||
|
||||
prefix = "AnisotropicFilter";
|
||||
if (attr->existsAttribute(prefix.c_str())) // legacy
|
||||
outMaterial.setFlag(EMF_ANISOTROPIC_FILTER, attr->getAttributeAsBool(prefix.c_str()));
|
||||
else
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
outMaterial.AnisotropicFilter[i] = attr->getAttributeAsBool((prefix+(i+1)).c_str());
|
||||
outMaterial.TextureLayer[i].AnisotropicFilter = attr->getAttributeAsBool((prefix+(i+1)).c_str());
|
||||
|
||||
prefix = "TextureWrap";
|
||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
outMaterial.TextureWrap[i] = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+(i+1)).c_str(), aTextureClampNames);
|
||||
outMaterial.TextureLayer[i].TextureWrap = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+(i+1)).c_str(), aTextureClampNames);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -448,16 +448,16 @@ void COBJMeshFileLoader::readMTL(const c8* pFileName, core::stringc relPath)
|
|||
if ( pTexture )
|
||||
{
|
||||
if (type==0)
|
||||
pCurrMaterial->Meshbuffer->Material.Textures[0] = pTexture;
|
||||
pCurrMaterial->Meshbuffer->Material.setTexture(0, pTexture);
|
||||
else if (type==1)
|
||||
{
|
||||
Driver->makeNormalMapTexture(pTexture);
|
||||
pCurrMaterial->Meshbuffer->Material.Textures[1] = pTexture;
|
||||
pCurrMaterial->Meshbuffer->Material.setTexture(1, pTexture);
|
||||
pCurrMaterial->Meshbuffer->Material.MaterialType=video::EMT_PARALLAX_MAP_SOLID;
|
||||
}
|
||||
else if (type==2)
|
||||
{
|
||||
pCurrMaterial->Meshbuffer->Material.Textures[0] = pTexture;
|
||||
pCurrMaterial->Meshbuffer->Material.setTexture(0, pTexture);
|
||||
pCurrMaterial->Meshbuffer->Material.MaterialType=video::EMT_TRANSPARENT_ADD_COLOR;
|
||||
}
|
||||
else if (type==3)
|
||||
|
|
|
@ -301,17 +301,17 @@ IAnimatedMesh* COCTLoader::createMesh(io::IReadFile* file)
|
|||
{
|
||||
u32 mb = i * (header.numTextures + 1) + j;
|
||||
SMeshBufferLightMap * meshBuffer = (SMeshBufferLightMap*)Mesh->getMeshBuffer(mb);
|
||||
meshBuffer->Material.Textures[0] = tex[j];
|
||||
meshBuffer->Material.Textures[1] = lig[i];
|
||||
meshBuffer->Material.setTexture(0, tex[j]);
|
||||
meshBuffer->Material.setTexture(1, lig[i]);
|
||||
|
||||
if (meshBuffer->Material.Textures[0] == 0)
|
||||
if (meshBuffer->Material.getTexture(0) == 0)
|
||||
{
|
||||
// This material has no texture, so we'll just show the lightmap if there is one.
|
||||
// We swapped the texture coordinates earlier.
|
||||
meshBuffer->Material.Textures[0] = meshBuffer->Material.Textures[1];
|
||||
meshBuffer->Material.Textures[1] = 0;
|
||||
meshBuffer->Material.setTexture(0, meshBuffer->Material.getTexture(1));
|
||||
meshBuffer->Material.setTexture(1, 0);
|
||||
}
|
||||
if (meshBuffer->Material.Textures[1] == 0)
|
||||
if (meshBuffer->Material.getTexture(1) == 0)
|
||||
{
|
||||
// If there is only one texture, it should be solid and lit.
|
||||
// Among other things, this way you can preview OCT lights.
|
||||
|
@ -328,7 +328,7 @@ IAnimatedMesh* COCTLoader::createMesh(io::IReadFile* file)
|
|||
{
|
||||
if (Mesh->MeshBuffers[i]->getVertexCount() == 0 ||
|
||||
Mesh->MeshBuffers[i]->getIndexCount() == 0 ||
|
||||
Mesh->MeshBuffers[i]->getMaterial().Textures[0] == 0)
|
||||
Mesh->MeshBuffers[i]->getMaterial().getTexture(0) == 0)
|
||||
{
|
||||
// Meshbuffer is empty -- drop it
|
||||
Mesh->MeshBuffers[i]->drop();
|
||||
|
|
|
@ -373,8 +373,8 @@ void COgreMeshFileLoader::composeMeshBufferMaterial(scene::IMeshBuffer* mb, cons
|
|||
material=Materials[k].Techniques[0].Passes[0].Material;
|
||||
if (Materials[k].Techniques[0].Passes[0].Texture.Filename.size())
|
||||
{
|
||||
material.Textures[0]=Driver->getTexture(Materials[k].Techniques[0].Passes[0].Texture.Filename.c_str());
|
||||
if (!material.Textures[0])
|
||||
material.setTexture(0, Driver->getTexture(Materials[k].Techniques[0].Passes[0].Texture.Filename.c_str()));
|
||||
if (!material.getTexture(0))
|
||||
{
|
||||
// retry with relative path
|
||||
core::stringc relative = Materials[k].Techniques[0].Passes[0].Texture.Filename;
|
||||
|
@ -384,7 +384,7 @@ void COgreMeshFileLoader::composeMeshBufferMaterial(scene::IMeshBuffer* mb, cons
|
|||
idx = relative.findLast('/');
|
||||
if (idx != -1)
|
||||
relative = relative.subString(idx+1, relative.size()-idx-1);
|
||||
material.Textures[0] = Driver->getTexture((CurrentlyLoadingFromPath+"/"+relative).c_str());
|
||||
material.setTexture(0, Driver->getTexture((CurrentlyLoadingFromPath+"/"+relative).c_str()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -472,7 +472,7 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri
|
|||
case ETS_TEXTURE_3:
|
||||
{
|
||||
const u32 i = state - ETS_TEXTURE_0;
|
||||
const bool isRTT = (Material.Textures[i] && Material.Textures[i]->isRenderTarget());
|
||||
const bool isRTT = Material.getTexture(i) && Material.getTexture(i)->isRenderTarget();
|
||||
|
||||
if (MultiTextureExtension)
|
||||
extGlActiveTexture(GL_TEXTURE0_ARB + i);
|
||||
|
@ -484,7 +484,7 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri
|
|||
{
|
||||
createGLTextureMatrix(glmat, mat);
|
||||
if (isRTT)
|
||||
glmat[5] *= -1;
|
||||
glmat[5] *= -1.0f;
|
||||
glLoadMatrixf(glmat);
|
||||
}
|
||||
break;
|
||||
|
@ -1281,7 +1281,7 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
// Filtering has to be set for each texture layer
|
||||
for (u32 i=0; i<MaxTextureUnits; ++i)
|
||||
{
|
||||
if (!material.Textures[i])
|
||||
if (!material.getTexture(i))
|
||||
continue;
|
||||
if (MultiTextureExtension)
|
||||
extGlActiveTexture(GL_TEXTURE0_ARB + i);
|
||||
|
@ -1289,19 +1289,19 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
break;
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||
(material.BilinearFilter[i] || material.TrilinearFilter[i]) ? GL_LINEAR : GL_NEAREST);
|
||||
(material.TextureLayer[i].BilinearFilter || material.TextureLayer[i].TrilinearFilter) ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
if (material.Textures[i] && material.Textures[i]->hasMipMaps())
|
||||
if (material.getTexture(i) && material.getTexture(i)->hasMipMaps())
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
material.TrilinearFilter[i] ? GL_LINEAR_MIPMAP_LINEAR : material.BilinearFilter[i] ? GL_LINEAR_MIPMAP_NEAREST : GL_NEAREST_MIPMAP_NEAREST );
|
||||
material.TextureLayer[i].TrilinearFilter ? GL_LINEAR_MIPMAP_LINEAR : material.TextureLayer[i].BilinearFilter ? GL_LINEAR_MIPMAP_NEAREST : GL_NEAREST_MIPMAP_NEAREST );
|
||||
else
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
(material.BilinearFilter[i] || material.TrilinearFilter[i]) ? GL_LINEAR : GL_NEAREST);
|
||||
(material.TextureLayer[i].BilinearFilter || material.TextureLayer[i].TrilinearFilter) ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
#ifdef GL_EXT_texture_filter_anisotropic
|
||||
if (AnisotropyExtension)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
|
||||
material.AnisotropicFilter[i] ? MaxAnisotropy : 1.0f );
|
||||
material.TextureLayer[i].AnisotropicFilter ? MaxAnisotropy : 1.0f );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1397,10 +1397,10 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||
// texture address mode
|
||||
for (u32 u=0; u<MaxTextureUnits; ++u)
|
||||
{
|
||||
if (resetAllRenderStates || lastmaterial.TextureWrap[u] != material.TextureWrap[u])
|
||||
if (resetAllRenderStates || lastmaterial.TextureLayer[u].TextureWrap != material.TextureLayer[u].TextureWrap)
|
||||
{
|
||||
GLint mode=GL_REPEAT;
|
||||
switch (material.TextureWrap[u])
|
||||
switch (material.TextureLayer[u].TextureWrap)
|
||||
{
|
||||
case ETC_REPEAT:
|
||||
mode=GL_REPEAT;
|
||||
|
@ -2399,10 +2399,9 @@ IVideoDriver* createOpenGLDriver(const core::dimension2d<s32>& screenSize,
|
|||
}
|
||||
#endif // _IRR_USE_SDL_DEVICE_
|
||||
|
||||
} // end namespace
|
||||
} // end namespace
|
||||
|
||||
} // end namespace
|
||||
} // end namespace
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(1);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(1);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
// if (material.MaterialType != lastMaterial.MaterialType ||
|
||||
|
@ -161,8 +161,8 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(2);
|
||||
Driver->setTexture(1, material.Textures[1]);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(1, material.getTexture(1));
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
|
@ -193,7 +193,7 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(1);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if ((material.MaterialType != lastMaterial.MaterialType) || resetAllRenderstates)
|
||||
|
@ -229,7 +229,7 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(1);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
|
@ -283,7 +283,7 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(1);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates
|
||||
|
@ -336,7 +336,7 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(1);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
|
@ -372,8 +372,8 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(2);
|
||||
Driver->setTexture(1, material.Textures[1]);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(1, material.getTexture(1));
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
|
@ -466,8 +466,8 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(2);
|
||||
Driver->setTexture(1, material.Textures[1]);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(1, material.getTexture(1));
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
|
@ -510,7 +510,7 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(1);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
|
@ -545,8 +545,8 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(2);
|
||||
Driver->setTexture(1, material.Textures[1]);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(1, material.getTexture(1));
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
|
@ -607,8 +607,8 @@ public:
|
|||
bool resetAllRenderstates, IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->disableTextures(2);
|
||||
Driver->setTexture(1, material.Textures[1]);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
Driver->setTexture(1, material.getTexture(1));
|
||||
Driver->setTexture(0, material.getTexture(0));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
|
|
|
@ -142,7 +142,7 @@ void COpenGLSLMaterialRenderer::OnSetMaterial(const video::SMaterial& material,
|
|||
}
|
||||
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
Driver->setTexture(i, material.Textures[i]);
|
||||
Driver->setTexture(i, material.getTexture(i));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ void COpenGLShaderMaterialRenderer::OnSetMaterial(const video::SMaterial& materi
|
|||
}
|
||||
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
Driver->setTexture(i, material.Textures[i]);
|
||||
Driver->setTexture(i, material.getTexture(i));
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
}
|
||||
|
||||
|
|
|
@ -631,10 +631,10 @@ s32 CQ3LevelMesh::setShaderMaterial ( video::SMaterial &material, const tBSPFace
|
|||
material.Wireframe = false;
|
||||
material.Lighting = false;
|
||||
material.BackfaceCulling = true;
|
||||
material.Textures[0] = 0;
|
||||
material.Textures[1] = 0;
|
||||
material.Textures[2] = 0;
|
||||
material.Textures[3] = 0;
|
||||
material.setTexture(0, 0);
|
||||
material.setTexture(1, 0);
|
||||
material.setTexture(2, 0);
|
||||
material.setTexture(3, 0);
|
||||
material.ZBuffer = true;
|
||||
material.ZWriteEnable = true;
|
||||
material.MaterialTypeParam = 0.f;
|
||||
|
@ -643,13 +643,13 @@ s32 CQ3LevelMesh::setShaderMaterial ( video::SMaterial &material, const tBSPFace
|
|||
|
||||
if ( face->textureID >= 0 )
|
||||
{
|
||||
material.Textures[0] = Tex [ face->textureID ].Texture;
|
||||
material.setTexture(0, Tex [ face->textureID ].Texture);
|
||||
shaderState = Tex [ face->textureID ].ShaderID;
|
||||
}
|
||||
|
||||
if ( face->lightmapID >= 0 )
|
||||
{
|
||||
material.Textures[1] = Lightmap [ face->lightmapID ];
|
||||
material.setTexture(1, Lightmap [ face->lightmapID ]);
|
||||
material.MaterialType = quake3::defaultLightMap;
|
||||
}
|
||||
|
||||
|
@ -674,7 +674,7 @@ s32 CQ3LevelMesh::setShaderMaterial ( video::SMaterial &material, const tBSPFace
|
|||
if ( group->isDefined ( "surfaceparm", "nolightmap" ) )
|
||||
{
|
||||
material.MaterialType = video::EMT_SOLID;
|
||||
material.Textures[1] = 0;
|
||||
material.setTexture(1, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ void CQ3LevelMesh::constructMesh2()
|
|||
{
|
||||
if ( 0 == shader )
|
||||
{
|
||||
item.takeVertexColor = material.Textures[0] == 0 || material.Textures[1] == 0;
|
||||
item.takeVertexColor = material.getTexture(0) == 0 || material.getTexture(1) == 0;
|
||||
item.index = quake3::E_Q3_MESH_GEOMETRY;
|
||||
toBuffer.push_back ( item );
|
||||
}
|
||||
|
@ -837,7 +837,7 @@ void CQ3LevelMesh::constructMesh2()
|
|||
{
|
||||
if ( 0 == toBuffer[g].takeVertexColor )
|
||||
{
|
||||
toBuffer[g].takeVertexColor = material.Textures[0] == 0 || material.Textures[1];
|
||||
toBuffer[g].takeVertexColor = material.getTexture(0) == 0 || material.getTexture(1);
|
||||
}
|
||||
if (Faces[i].lightmapID < -1 || Faces[i].lightmapID > NumLightMaps-1)
|
||||
{
|
||||
|
@ -1680,20 +1680,20 @@ void CQ3LevelMesh::loadTextures()
|
|||
|
||||
// attach textures to materials.
|
||||
for (s32 l=0; l<NumLightMaps+1; ++l)
|
||||
{
|
||||
for (t=0; t<NumTextures+1; ++t)
|
||||
{
|
||||
SMeshBufferLightMap* b = (SMeshBufferLightMap*)Mesh[0]->getMeshBuffer(l*(NumTextures+1) + t);
|
||||
b->Material.Textures[1] = lig[l];
|
||||
b->Material.Textures[0] = tex[t];
|
||||
b->Material.setTexture(1, lig[l]);
|
||||
b->Material.setTexture(0, tex[t]);
|
||||
|
||||
if (!b->Material.Textures[1])
|
||||
if (!b->Material.getTexture(1))
|
||||
b->Material.MaterialType = video::EMT_SOLID;
|
||||
|
||||
if ( !b->Material.Textures[0] )
|
||||
if (!b->Material.getTexture(0))
|
||||
b->Material.MaterialType = video::EMT_SOLID;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// delete all buffers without geometry in it.
|
||||
|
@ -1708,7 +1708,7 @@ void CQ3LevelMesh::cleanMeshes ()
|
|||
{
|
||||
if (Mesh[g]->MeshBuffers[i]->getVertexCount() == 0 ||
|
||||
Mesh[g]->MeshBuffers[i]->getIndexCount() == 0 ||
|
||||
( texture0important && Mesh[g]->MeshBuffers[i]->getMaterial().Textures[0] == 0 )
|
||||
( texture0important && Mesh[g]->MeshBuffers[i]->getMaterial().getTexture(0) == 0 )
|
||||
)
|
||||
{
|
||||
// delete Meshbuffer
|
||||
|
|
|
@ -72,7 +72,7 @@ void CQuake3ShaderSceneNode::cloneBuffer ( scene::SMeshBufferLightMap * buffer )
|
|||
|
||||
MeshBuffer.recalculateBoundingBox ();
|
||||
// used for sorting
|
||||
MeshBuffer.Material.Textures[0] = (video::ITexture*) Shader;
|
||||
MeshBuffer.Material.setTexture(0, (video::ITexture*) Shader);
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,7 +106,7 @@ void CQuake3ShaderSceneNode::loadTextures ( io::IFileSystem * fileSystem )
|
|||
// our lightmap is passed in material.Texture[2]
|
||||
if ( mapname == "$lightmap" )
|
||||
{
|
||||
Q3Texture [i].Texture.push_back ( Original.getMaterial().Textures[1] );
|
||||
Q3Texture [i].Texture.push_back ( Original.getMaterial().getTexture(1) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -216,8 +216,8 @@ void CQuake3ShaderSceneNode::render()
|
|||
SQ3Texture &q = Q3Texture [ stage];
|
||||
|
||||
material.Lighting = false;
|
||||
material.Textures[0] = q.Texture [ q.TextureIndex ];
|
||||
material.Textures[1] = 0;
|
||||
material.setTexture(0, q.Texture [ q.TextureIndex ]);
|
||||
material.setTexture(1, 0);
|
||||
material.ZBuffer = quake3::getDepthFunction ( group->get ( "depthfunc" ) );
|
||||
material.ZWriteEnable = (0 == StageCall );
|
||||
material.NormalizeNormals = false;
|
||||
|
@ -235,8 +235,8 @@ void CQuake3ShaderSceneNode::render()
|
|||
transformtex ( texture, q.TextureAddressMode );
|
||||
}
|
||||
*/
|
||||
material.TextureWrap[0] = q.TextureAddressMode;
|
||||
material.TextureWrap[1] = material.TextureWrap[0];
|
||||
material.TextureLayer[0].TextureWrap = q.TextureAddressMode;
|
||||
material.TextureLayer[1].TextureWrap = material.TextureLayer[0].TextureWrap;
|
||||
driver->setTransform ( video::ETS_TEXTURE_0, texture );
|
||||
|
||||
driver->setMaterial( material );
|
||||
|
@ -692,9 +692,9 @@ u32 CQuake3ShaderSceneNode::getMaterialCount() const
|
|||
video::SMaterial& CQuake3ShaderSceneNode::getMaterial(u32 i)
|
||||
{
|
||||
video::SMaterial& m = MeshBuffer.getMaterial();
|
||||
m.Textures[0] = 0;
|
||||
m.setTexture(0, 0);
|
||||
if ( Q3Texture [ i ].TextureIndex )
|
||||
m.Textures[0] = Q3Texture [ i ].Texture [ Q3Texture [ i ].TextureIndex ];
|
||||
m.setTexture(0, Q3Texture [ i ].Texture [ Q3Texture [ i ].TextureIndex ]);
|
||||
return m;
|
||||
}
|
||||
|
||||
|
|
|
@ -468,7 +468,7 @@ namespace scene
|
|||
textureValue = 0;
|
||||
|
||||
if (n->getMaterialCount())
|
||||
textureValue = (n->getMaterial(0).Textures[0]);
|
||||
textureValue = (n->getMaterial(0).getTexture(0));
|
||||
|
||||
node = n;
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ namespace scene
|
|||
|
||||
ShaderNodeEntry(ISceneNode* n, u32 sceneTime )
|
||||
{
|
||||
textureValue = n->getMaterial( sceneTime ).Textures[0];
|
||||
textureValue = n->getMaterial( sceneTime ).getTexture(0);
|
||||
|
||||
node = n;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
|
|||
mat.Lighting = false;
|
||||
mat.ZBuffer = false;
|
||||
mat.ZWriteEnable = false;
|
||||
mat.TextureWrap[0] = video::ETC_CLAMP;
|
||||
mat.TextureLayer[0].TextureWrap = video::ETC_CLAMP;
|
||||
|
||||
/* Hey, I am no artist, but look at that
|
||||
cool ASCII art I made! ;)
|
||||
|
@ -78,7 +78,7 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
|
|||
f32 o = 0.0f + onepixel;
|
||||
|
||||
Material[0] = mat;
|
||||
Material[0].Textures[0] = front;
|
||||
Material[0].setTexture(0, front);
|
||||
Vertices[0] = video::S3DVertex(-l,-l,-l, 0,0,1, video::SColor(255,255,255,255), o, t);
|
||||
Vertices[1] = video::S3DVertex( l,-l,-l, 0,0,1, video::SColor(255,255,255,255), t, t);
|
||||
Vertices[2] = video::S3DVertex( l, l,-l, 0,0,1, video::SColor(255,255,255,255), t, o);
|
||||
|
@ -87,7 +87,7 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
|
|||
// create left side
|
||||
|
||||
Material[1] = mat;
|
||||
Material[1].Textures[0] = left;
|
||||
Material[1].setTexture(0, left);
|
||||
Vertices[4] = video::S3DVertex( l,-l,-l, -1,0,0, video::SColor(255,255,255,255), o, t);
|
||||
Vertices[5] = video::S3DVertex( l,-l, l, -1,0,0, video::SColor(255,255,255,255), t, t);
|
||||
Vertices[6] = video::S3DVertex( l, l, l, -1,0,0, video::SColor(255,255,255,255), t, o);
|
||||
|
@ -96,7 +96,7 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
|
|||
// create back side
|
||||
|
||||
Material[2] = mat;
|
||||
Material[2].Textures[0] = back;
|
||||
Material[2].setTexture(0, back);
|
||||
Vertices[8] = video::S3DVertex( l,-l, l, 0,0,-1, video::SColor(255,255,255,255), o, t);
|
||||
Vertices[9] = video::S3DVertex(-l,-l, l, 0,0,-1, video::SColor(255,255,255,255), t, t);
|
||||
Vertices[10] = video::S3DVertex(-l, l, l, 0,0,-1, video::SColor(255,255,255,255), t, o);
|
||||
|
@ -105,7 +105,7 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
|
|||
// create right side
|
||||
|
||||
Material[3] = mat;
|
||||
Material[3].Textures[0] = right;
|
||||
Material[3].setTexture(0, right);
|
||||
Vertices[12] = video::S3DVertex(-l,-l, l, 1,0,0, video::SColor(255,255,255,255), o, t);
|
||||
Vertices[13] = video::S3DVertex(-l,-l,-l, 1,0,0, video::SColor(255,255,255,255), t, t);
|
||||
Vertices[14] = video::S3DVertex(-l, l,-l, 1,0,0, video::SColor(255,255,255,255), t, o);
|
||||
|
@ -114,7 +114,7 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
|
|||
// create top side
|
||||
|
||||
Material[4] = mat;
|
||||
Material[4].Textures[0] = top;
|
||||
Material[4].setTexture(0, top);
|
||||
Vertices[16] = video::S3DVertex( l, l, l, 0,-1,0, video::SColor(255,255,255,255), o, o);
|
||||
Vertices[17] = video::S3DVertex(-l, l, l, 0,-1,0, video::SColor(255,255,255,255), o, t);
|
||||
Vertices[18] = video::S3DVertex(-l, l,-l, 0,-1,0, video::SColor(255,255,255,255), t, t);
|
||||
|
@ -123,7 +123,7 @@ CSkyBoxSceneNode::CSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom
|
|||
// create bottom side
|
||||
|
||||
Material[5] = mat;
|
||||
Material[5].Textures[0] = bottom;
|
||||
Material[5].setTexture(0, bottom);
|
||||
Vertices[20] = video::S3DVertex(-l,-l, l, 0,1,0, video::SColor(255,255,255,255), o, o);
|
||||
Vertices[21] = video::S3DVertex( l,-l, l, 0,1,0, video::SColor(255,255,255,255), o, t);
|
||||
Vertices[22] = video::S3DVertex( l,-l,-l, 0,1,0, video::SColor(255,255,255,255), t, t);
|
||||
|
@ -194,7 +194,7 @@ void CSkyBoxSceneNode::render()
|
|||
idx = lookVect.Z > 0 ? 1 : 3;
|
||||
}
|
||||
|
||||
video::ITexture* tex = Material[idx].Textures[0];
|
||||
video::ITexture* tex = Material[idx].getTexture(0);
|
||||
|
||||
if ( tex )
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ CSkyDomeSceneNode::CSkyDomeSceneNode(video::ITexture* sky, u32 horiRes, u32 vert
|
|||
Buffer.Material.Lighting = false;
|
||||
Buffer.Material.ZBuffer = false;
|
||||
Buffer.Material.ZWriteEnable = false;
|
||||
Buffer.Material.Textures[0] = sky;
|
||||
Buffer.Material.setTexture(0, sky);
|
||||
Buffer.BoundingBox.MaxEdge.set(0,0,0);
|
||||
Buffer.BoundingBox.MinEdge.set(0,0,0);
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ void CSoftwareDriver::setMaterial(const SMaterial& material)
|
|||
|
||||
for (u32 i = 0; i < 1; ++i)
|
||||
{
|
||||
setTexture(Material.Textures[i]);
|
||||
setTexture(Material.getTexture(i));
|
||||
setTransform ((E_TRANSFORMATION_STATE) ( ETS_TEXTURE_0 + i ),
|
||||
material.getTextureMatrix(i));
|
||||
}
|
||||
|
|
|
@ -212,16 +212,16 @@ void CSoftwareDriver2::setCurrentShader()
|
|||
break;
|
||||
|
||||
case EMT_LIGHTMAP_LIGHTING_M4:
|
||||
if ( Material.org.Textures[1] )
|
||||
if ( Material.org.getTexture(1) )
|
||||
shader = ETR_TEXTURE_GOURAUD_LIGHTMAP_M4;
|
||||
break;
|
||||
case EMT_LIGHTMAP_M4:
|
||||
if ( Material.org.Textures[1] )
|
||||
if ( Material.org.getTexture(1) )
|
||||
shader = ETR_TEXTURE_LIGHTMAP_M4;
|
||||
break;
|
||||
|
||||
case EMT_LIGHTMAP_ADD:
|
||||
if ( Material.org.Textures[1] )
|
||||
if ( Material.org.getTexture(1) )
|
||||
shader = ETR_TEXTURE_GOURAUD_LIGHTMAP_ADD;
|
||||
break;
|
||||
|
||||
|
@ -239,7 +239,7 @@ void CSoftwareDriver2::setCurrentShader()
|
|||
shader = ETR_TEXTURE_GOURAUD_NOZ;
|
||||
}
|
||||
|
||||
if ( 0 == Material.org.Textures[0] )
|
||||
if ( 0 == Material.org.getTexture(0) )
|
||||
{
|
||||
shader = ETR_GOURAUD;
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ void CSoftwareDriver2::setMaterial(const SMaterial& material)
|
|||
|
||||
for (u32 i = 0; i < 2; ++i)
|
||||
{
|
||||
setTexture( i, Material.org.Textures[i] );
|
||||
setTexture( i, Material.org.getTexture(i) );
|
||||
setTransform((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i),
|
||||
material.getTextureMatrix(i));
|
||||
}
|
||||
|
@ -963,7 +963,7 @@ void CSoftwareDriver2::VertexCache_fill(const u32 sourceIndex,
|
|||
for ( t = 0; t != vSize[VertexCache.vType].TexSize; ++t )
|
||||
{
|
||||
const core::matrix4& M = Transformation [ ETS_TEXTURE_0 + t ].m;
|
||||
if ( Material.org.TextureWrap[0]==ETC_REPEAT )
|
||||
if ( Material.org.TextureLayer[0].TextureWrap==ETC_REPEAT )
|
||||
{
|
||||
dest->Tex[t].x = M[0] * src[t].X + M[4] * src[t].Y + M[8];
|
||||
dest->Tex[t].y = M[1] * src[t].X + M[5] * src[t].Y + M[9];
|
||||
|
|
|
@ -122,7 +122,7 @@ CBillboardTextSceneNode::CBillboardTextSceneNode(ISceneNode* parent, ISceneManag
|
|||
{
|
||||
SMeshBuffer *mb = new SMeshBuffer();
|
||||
mb->Material = Material;
|
||||
mb->Material.Textures[0] = Font->getSpriteBank()->getTexture(i);
|
||||
mb->Material.setTexture(0, Font->getSpriteBank()->getTexture(i));
|
||||
Mesh->addMeshBuffer(mb);
|
||||
mb->drop();
|
||||
}
|
||||
|
|
|
@ -1258,13 +1258,13 @@ bool CXMeshFileLoader::parseDataObjectMaterial(video::SMaterial& material)
|
|||
// original name
|
||||
SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() );
|
||||
// mesh path
|
||||
if (!material.Textures[0])
|
||||
if (!material.getTexture(0))
|
||||
{
|
||||
TextureFileName=FilePath + stripPathFromString(TextureFileName,false);
|
||||
material.Textures[0]=SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() );
|
||||
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() ));
|
||||
}
|
||||
// working directory
|
||||
if (!material.Textures[0])
|
||||
if (!material.getTexture(0))
|
||||
SceneManager->getVideoDriver()->getTexture ( stripPathFromString(TextureFileName,false).c_str() );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -70,8 +70,8 @@ staticlib sharedlib : CXXINCS += -I/usr/X11R6/include
|
|||
|
||||
#Windows specific options
|
||||
sharedlib_win32 staticlib_win32: SYSTEM = Win32-gcc
|
||||
sharedlib_win32: LDFLAGS = -lgdi32 -lwinspool -lcomdlg32 -lole32 -loleaut32 -luuid -lopengl32
|
||||
sharedlib_win32 staticlib_win32: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL
|
||||
sharedlib_win32: LDFLAGS = -lgdi32 -lwinspool -lcomdlg32 -lole32 -loleaut32 -luuid -lopengl32 -ld3dx9d -lSDL
|
||||
sharedlib_win32 staticlib_win32: CPPFLAGS += -DIRR_COMPILE_WITH_DX9_DEV_PACK -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL
|
||||
staticlib_win32: CPPFLAGS += -D_IRR_STATIC_LIB_
|
||||
|
||||
####################
|
||||
|
|
Loading…
Reference in New Issue