mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-02 08:10:26 +02:00
Merging r6426 through r6466 from trunk to ogl-es branch
Note: Updated IShaderConstantSetCallBack not yet supported by ogl-es drivers git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6467 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -143,7 +143,7 @@ void CBillboardSceneNode::updateMesh(const irr::scene::ICameraSceneNode* camera)
|
||||
//! returns the axis aligned bounding box of this node
|
||||
const core::aabbox3d<f32>& CBillboardSceneNode::getBoundingBox() const
|
||||
{
|
||||
// Really wrong when scaled.
|
||||
// Really wrong when scaled (as the node does not scale it's vertices - maybe it should?)
|
||||
return BBoxSafe;
|
||||
}
|
||||
|
||||
@ -164,9 +164,9 @@ void CBillboardSceneNode::setSize(const core::dimension2d<f32>& size)
|
||||
if (core::equals(Size.Height, 0.0f))
|
||||
Size.Height = 1.0f;
|
||||
|
||||
const f32 avg = (Size.Width + Size.Height)/6;
|
||||
BBoxSafe.MinEdge.set(-avg,-avg,-avg);
|
||||
BBoxSafe.MaxEdge.set(avg,avg,avg);
|
||||
const f32 extent = 0.5f*sqrtf(Size.Width*Size.Width + Size.Height*Size.Height);
|
||||
BBoxSafe.MinEdge.set(-extent,-extent,-extent);
|
||||
BBoxSafe.MaxEdge.set(extent,extent,extent);
|
||||
}
|
||||
|
||||
|
||||
@ -184,9 +184,9 @@ void CBillboardSceneNode::setSize(f32 height, f32 bottomEdgeWidth, f32 topEdgeWi
|
||||
TopEdgeWidth = 1.0f;
|
||||
}
|
||||
|
||||
const f32 avg = (core::max_(Size.Width,TopEdgeWidth) + Size.Height)/6;
|
||||
BBoxSafe.MinEdge.set(-avg,-avg,-avg);
|
||||
BBoxSafe.MaxEdge.set(avg,avg,avg);
|
||||
const f32 extent = 0.5f*sqrtf(Size.Width*Size.Width + Size.Height*Size.Height);
|
||||
BBoxSafe.MinEdge.set(-extent,-extent,-extent);
|
||||
BBoxSafe.MaxEdge.set(extent,extent,extent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3101,31 +3101,6 @@ const core::matrix4& CD3D9Driver::getTransform(E_TRANSFORMATION_STATE state) con
|
||||
}
|
||||
|
||||
|
||||
//! Get a vertex shader constant index.
|
||||
s32 CD3D9Driver::getVertexShaderConstantID(const c8* name)
|
||||
{
|
||||
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
|
||||
{
|
||||
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
|
||||
return r->getVariableID(true, name);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//! Get a pixel shader constant index.
|
||||
s32 CD3D9Driver::getPixelShaderConstantID(const c8* name)
|
||||
{
|
||||
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
|
||||
{
|
||||
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
|
||||
return r->getVariableID(false, name);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//! Sets a vertex shader constant.
|
||||
void CD3D9Driver::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
||||
{
|
||||
@ -3133,7 +3108,6 @@ void CD3D9Driver::setVertexShaderConstant(const f32* data, s32 startRegister, s3
|
||||
pID3DDevice->SetVertexShaderConstantF(startRegister, data, constantAmount);
|
||||
}
|
||||
|
||||
|
||||
//! Sets a pixel shader constant.
|
||||
void CD3D9Driver::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
||||
{
|
||||
@ -3141,86 +3115,55 @@ void CD3D9Driver::setPixelShaderConstant(const f32* data, s32 startRegister, s32
|
||||
pID3DDevice->SetPixelShaderConstantF(startRegister, data, constantAmount);
|
||||
}
|
||||
|
||||
s32 CD3D9Driver::getVertexShaderConstantID(const c8* name)
|
||||
{
|
||||
os::Printer::log("Error: Please call services->getVertexShaderConstantID(), not VideoDriver->getVertexShaderConstantID().");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 CD3D9Driver::getPixelShaderConstantID(const c8* name)
|
||||
{
|
||||
os::Printer::log("Error: Please call services->getPixelShaderConstantID(), not VideoDriver->getPixelShaderConstantID().");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//! Sets a constant for the vertex shader based on an index.
|
||||
bool CD3D9Driver::setVertexShaderConstant(s32 index, const f32* floats, int count)
|
||||
{
|
||||
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
|
||||
{
|
||||
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
|
||||
return r->setVariable(true, index, floats, count);
|
||||
}
|
||||
|
||||
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant().");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//! Int interface for the above.
|
||||
bool CD3D9Driver::setVertexShaderConstant(s32 index, const s32* ints, int count)
|
||||
{
|
||||
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
|
||||
{
|
||||
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
|
||||
return r->setVariable(true, index, ints, count);
|
||||
}
|
||||
|
||||
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant().");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//! Uint interface for the above.
|
||||
bool CD3D9Driver::setVertexShaderConstant(s32 index, const u32* ints, int count)
|
||||
{
|
||||
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
|
||||
{
|
||||
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
|
||||
return r->setVariable(true, index, ints, count);
|
||||
}
|
||||
|
||||
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant().");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//! Sets a constant for the pixel shader based on an index.
|
||||
bool CD3D9Driver::setPixelShaderConstant(s32 index, const f32* floats, int count)
|
||||
{
|
||||
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
|
||||
{
|
||||
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
|
||||
return r->setVariable(false, index, floats, count);
|
||||
}
|
||||
|
||||
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//! Int interface for the above.
|
||||
bool CD3D9Driver::setPixelShaderConstant(s32 index, const s32* ints, int count)
|
||||
{
|
||||
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
|
||||
{
|
||||
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
|
||||
return r->setVariable(false, index, ints, count);
|
||||
}
|
||||
|
||||
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//! Uint interface for the above.
|
||||
bool CD3D9Driver::setPixelShaderConstant(s32 index, const u32* ints, int count)
|
||||
{
|
||||
if (Material.MaterialType >= 0 && Material.MaterialType < (s32)MaterialRenderers.size())
|
||||
{
|
||||
CD3D9MaterialRenderer* r = (CD3D9MaterialRenderer*)MaterialRenderers[Material.MaterialType].Renderer;
|
||||
return r->setVariable(false, index, ints, count);
|
||||
}
|
||||
|
||||
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! Adds a new material renderer to the VideoDriver, using pixel and/or
|
||||
//! vertex shaders to render geometry.
|
||||
s32 CD3D9Driver::addShaderMaterial(const c8* vertexShaderProgram,
|
||||
@ -3234,6 +3177,10 @@ s32 CD3D9Driver::addShaderMaterial(const c8* vertexShaderProgram,
|
||||
callback, getMaterialRenderer(baseMaterial), userData);
|
||||
|
||||
r->drop();
|
||||
|
||||
if (callback && nr >= 0)
|
||||
callback->OnCreate(this, userData);
|
||||
|
||||
return nr;
|
||||
}
|
||||
|
||||
@ -3271,6 +3218,9 @@ s32 CD3D9Driver::addHighLevelShaderMaterial(
|
||||
|
||||
r->drop();
|
||||
|
||||
if (callback && nr >= 0)
|
||||
callback->OnCreate(r, userData);
|
||||
|
||||
return nr;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "CD3D9HLSLMaterialRenderer.h"
|
||||
#include "IShaderConstantSetCallBack.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "CD3D9Driver.h"
|
||||
#include "os.h"
|
||||
#include "irrString.h"
|
||||
|
||||
@ -24,7 +25,7 @@ namespace video
|
||||
|
||||
//! Public constructor
|
||||
CD3D9HLSLMaterialRenderer::CD3D9HLSLMaterialRenderer(IDirect3DDevice9* d3ddev,
|
||||
video::IVideoDriver* driver, s32& outMaterialTypeNr,
|
||||
video::CD3D9Driver* driver, s32& outMaterialTypeNr,
|
||||
const c8* vertexShaderProgram,
|
||||
const c8* vertexShaderEntryPointName,
|
||||
E_VERTEX_SHADER_TYPE vsCompileTarget,
|
||||
@ -274,6 +275,69 @@ bool CD3D9HLSLMaterialRenderer::createHLSLPixelShader(const char* pixelShaderPro
|
||||
return false;
|
||||
}
|
||||
|
||||
void CD3D9HLSLMaterialRenderer::setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates)
|
||||
{
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
}
|
||||
|
||||
s32 CD3D9HLSLMaterialRenderer::getVertexShaderConstantID(const c8* name)
|
||||
{
|
||||
return getVariableID(true, name);
|
||||
}
|
||||
|
||||
s32 CD3D9HLSLMaterialRenderer::getPixelShaderConstantID(const c8* name)
|
||||
{
|
||||
return getVariableID(false, name);
|
||||
}
|
||||
|
||||
void CD3D9HLSLMaterialRenderer::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
||||
{
|
||||
// TODO: Not sure if setting constants which are not bound to the shader in hlsl
|
||||
// I mainly kept this here so it works same as in Irrlicht 1.8 and it probably won't hurt
|
||||
Driver->setVertexShaderConstant(data, startRegister, constantAmount);
|
||||
}
|
||||
|
||||
void CD3D9HLSLMaterialRenderer::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
||||
{
|
||||
// TODO: Not sure if setting constants which are not bound to the shader in hlsl
|
||||
// I mainly kept this here so it works same as in Irrlicht 1.8 and it probably won't hurt
|
||||
static_cast<CD3D9Driver*>(Driver)->setPixelShaderConstant(data, startRegister, constantAmount);
|
||||
}
|
||||
|
||||
bool CD3D9HLSLMaterialRenderer::setVertexShaderConstant(s32 index, const f32* floats, int count)
|
||||
{
|
||||
return setVariable(true, index, floats, count);
|
||||
}
|
||||
|
||||
bool CD3D9HLSLMaterialRenderer::setVertexShaderConstant(s32 index, const s32* ints, int count)
|
||||
{
|
||||
return setVariable(true, index, ints, count);
|
||||
}
|
||||
|
||||
bool CD3D9HLSLMaterialRenderer::setVertexShaderConstant(s32 index, const u32* ints, int count)
|
||||
{
|
||||
return setVariable(true, index, ints, count);
|
||||
}
|
||||
|
||||
bool CD3D9HLSLMaterialRenderer::setPixelShaderConstant(s32 index, const f32* floats, int count)
|
||||
{
|
||||
return setVariable(false, index, floats, count);
|
||||
}
|
||||
|
||||
bool CD3D9HLSLMaterialRenderer::setPixelShaderConstant(s32 index, const s32* ints, int count)
|
||||
{
|
||||
return setVariable(false, index, ints, count);
|
||||
}
|
||||
|
||||
bool CD3D9HLSLMaterialRenderer::setPixelShaderConstant(s32 index, const u32* ints, int count)
|
||||
{
|
||||
return setVariable(false, index, ints, count);
|
||||
}
|
||||
|
||||
IVideoDriver* CD3D9HLSLMaterialRenderer::getVideoDriver()
|
||||
{
|
||||
return Driver;
|
||||
}
|
||||
|
||||
s32 CD3D9HLSLMaterialRenderer::getVariableID(bool vertexShader, const c8* name)
|
||||
{
|
||||
@ -305,7 +369,6 @@ s32 CD3D9HLSLMaterialRenderer::getVariableID(bool vertexShader, const c8* name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool CD3D9HLSLMaterialRenderer::setVariable(bool vertexShader, s32 index,
|
||||
const f32* floats, int count)
|
||||
{
|
||||
@ -383,7 +446,7 @@ bool CD3D9HLSLMaterialRenderer::OnRender(IMaterialRendererServices* service, E_V
|
||||
if (VSConstantsTable)
|
||||
VSConstantsTable->SetDefaults(pID3DDevice);
|
||||
|
||||
return CD3D9ShaderMaterialRenderer::OnRender(service, vtxtype);
|
||||
return CD3D9ShaderMaterialRenderer::OnRender(this, vtxtype);
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "CD3D9ShaderMaterialRenderer.h"
|
||||
#include "IGPUProgrammingServices.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
@ -23,12 +24,12 @@ class IShaderConstantSetCallBack;
|
||||
class IMaterialRenderer;
|
||||
|
||||
//! Class for using vertex and pixel shaders via HLSL with D3D9
|
||||
class CD3D9HLSLMaterialRenderer : public CD3D9ShaderMaterialRenderer
|
||||
class CD3D9HLSLMaterialRenderer : public CD3D9ShaderMaterialRenderer, public IMaterialRendererServices
|
||||
{
|
||||
public:
|
||||
|
||||
//! Public constructor
|
||||
CD3D9HLSLMaterialRenderer(IDirect3DDevice9* d3ddev, video::IVideoDriver* driver,
|
||||
CD3D9HLSLMaterialRenderer(IDirect3DDevice9* d3ddev, video::CD3D9Driver* driver,
|
||||
s32& outMaterialTypeNr,
|
||||
const c8* vertexShaderProgram,
|
||||
const c8* vertexShaderEntryPointName,
|
||||
@ -43,7 +44,25 @@ public:
|
||||
//! Destructor
|
||||
~CD3D9HLSLMaterialRenderer();
|
||||
|
||||
virtual s32 getVariableID(bool vertexShader, const c8* name);
|
||||
bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) IRR_OVERRIDE;
|
||||
|
||||
// implementations for IMaterialRendererServices
|
||||
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) IRR_OVERRIDE;
|
||||
virtual s32 getVertexShaderConstantID(const c8* name) IRR_OVERRIDE;
|
||||
virtual s32 getPixelShaderConstantID(const c8* name) IRR_OVERRIDE;
|
||||
virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) IRR_OVERRIDE;
|
||||
virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) IRR_OVERRIDE;
|
||||
virtual bool setVertexShaderConstant(s32 index, const f32* floats, int count) IRR_OVERRIDE;
|
||||
virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) IRR_OVERRIDE;
|
||||
virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) IRR_OVERRIDE;
|
||||
virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count) IRR_OVERRIDE;
|
||||
virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) IRR_OVERRIDE;
|
||||
virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) IRR_OVERRIDE;
|
||||
virtual IVideoDriver* getVideoDriver() IRR_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
s32 getVariableID(bool vertexShader, const c8* name);
|
||||
|
||||
//! sets a variable in the shader.
|
||||
//! \param vertexShader: True if this should be set in the vertex shader, false if
|
||||
@ -51,17 +70,14 @@ public:
|
||||
//! \param index: Index of the variable
|
||||
//! \param floats: Pointer to array of floats
|
||||
//! \param count: Amount of floats in array.
|
||||
virtual bool setVariable(bool vertexShader, s32 index, const f32* floats, int count);
|
||||
bool setVariable(bool vertexShader, s32 index, const f32* floats, int count);
|
||||
|
||||
//! Int interface for the above.
|
||||
virtual bool setVariable(bool vertexShader, s32 index, const s32* ints, int count);
|
||||
bool setVariable(bool vertexShader, s32 index, const s32* ints, int count);
|
||||
|
||||
//! Uint interface for the above.
|
||||
virtual bool setVariable(bool vertexShader, s32 index, const u32* ints, int count);
|
||||
bool setVariable(bool vertexShader, s32 index, const u32* ints, int count);
|
||||
|
||||
bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) IRR_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
bool createHLSLVertexShader(const char* vertexShaderProgram,
|
||||
const char* shaderEntryPointName,
|
||||
|
@ -53,7 +53,7 @@ inline void setTextureAlphaStage(IDirect3DDevice9* dev, DWORD i, DWORD arg1)
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
//! Base class for all internal D3D9 material renderers
|
||||
//! Base class for all internal D3D9 fixed function material renderers
|
||||
class CD3D9MaterialRenderer : public IMaterialRenderer
|
||||
{
|
||||
public:
|
||||
@ -64,38 +64,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual s32 getVariableID(bool vertexShader, const c8* name)
|
||||
{
|
||||
os::Printer::log("Invalid material to set variable in.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//! sets a variable in the shader.
|
||||
//! \param vertexShader: True if this should be set in the vertex shader, false if
|
||||
//! in the pixel shader.
|
||||
//! \param index: Index of the variable
|
||||
//! \param floats: Pointer to array of floats
|
||||
//! \param count: Amount of floats in array.
|
||||
virtual bool setVariable(bool vertexShader, s32 index, const f32* floats, int count)
|
||||
{
|
||||
os::Printer::log("Invalid material to set variable in.");
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Int interface for the above.
|
||||
virtual bool setVariable(bool vertexShader, s32 index, const s32* ints, int count)
|
||||
{
|
||||
os::Printer::log("Invalid material to set variable in.");
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Uint interface for the above.
|
||||
virtual bool setVariable(bool vertexShader, s32 index, const u32* ints, int count)
|
||||
{
|
||||
os::Printer::log("Invalid material to set variable in.");
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
IDirect3DDevice9* pID3DDevice;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
|
||||
#include "CD3D9NormalMapRenderer.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "CD3D9Driver.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
#include "os.h"
|
||||
#include "SLight.h"
|
||||
@ -164,7 +164,7 @@ namespace video
|
||||
"";
|
||||
|
||||
CD3D9NormalMapRenderer::CD3D9NormalMapRenderer(
|
||||
IDirect3DDevice9* d3ddev, video::IVideoDriver* driver,
|
||||
IDirect3DDevice9* d3ddev, video::CD3D9Driver* driver,
|
||||
s32& outMaterialTypeNr, IMaterialRenderer* baseMaterial)
|
||||
: CD3D9ShaderMaterialRenderer(d3ddev, driver, 0, baseMaterial)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ class CD3D9NormalMapRenderer :
|
||||
public:
|
||||
|
||||
CD3D9NormalMapRenderer(
|
||||
IDirect3DDevice9* d3ddev, video::IVideoDriver* driver,
|
||||
IDirect3DDevice9* d3ddev, video::CD3D9Driver* driver,
|
||||
s32& outMaterialTypeNr, IMaterialRenderer* baseMaterial);
|
||||
|
||||
~CD3D9NormalMapRenderer();
|
||||
|
@ -6,8 +6,8 @@
|
||||
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
|
||||
#include "CD3D9ParallaxMapRenderer.h"
|
||||
#include "CD3D9Driver.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "os.h"
|
||||
#include "SLight.h"
|
||||
|
||||
@ -222,7 +222,7 @@ namespace video
|
||||
"\n";
|
||||
|
||||
CD3D9ParallaxMapRenderer::CD3D9ParallaxMapRenderer(
|
||||
IDirect3DDevice9* d3ddev, video::IVideoDriver* driver,
|
||||
IDirect3DDevice9* d3ddev, video::CD3D9Driver* driver,
|
||||
s32& outMaterialTypeNr, IMaterialRenderer* baseMaterial)
|
||||
: CD3D9ShaderMaterialRenderer(d3ddev, driver, 0, baseMaterial),
|
||||
CurrentScale(0.0f)
|
||||
|
@ -29,7 +29,7 @@ class CD3D9ParallaxMapRenderer :
|
||||
public:
|
||||
|
||||
CD3D9ParallaxMapRenderer(
|
||||
IDirect3DDevice9* d3ddev, video::IVideoDriver* driver,
|
||||
IDirect3DDevice9* d3ddev, video::CD3D9Driver* driver,
|
||||
s32& outMaterialTypeNr, IMaterialRenderer* baseMaterial);
|
||||
|
||||
~CD3D9ParallaxMapRenderer();
|
||||
|
@ -6,9 +6,9 @@
|
||||
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
|
||||
#include "CD3D9ShaderMaterialRenderer.h"
|
||||
#include "CD3D9Driver.h"
|
||||
#include "IShaderConstantSetCallBack.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "os.h"
|
||||
#include "irrString.h"
|
||||
|
||||
@ -23,7 +23,7 @@ namespace video
|
||||
{
|
||||
|
||||
//! Public constructor
|
||||
CD3D9ShaderMaterialRenderer::CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3ddev, video::IVideoDriver* driver,
|
||||
CD3D9ShaderMaterialRenderer::CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3ddev, video::CD3D9Driver* driver,
|
||||
s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram,
|
||||
IShaderConstantSetCallBack* callback, IMaterialRenderer* baseMaterial, s32 userData)
|
||||
: pID3DDevice(d3ddev), Driver(driver), CallBack(callback), BaseMaterial(baseMaterial),
|
||||
@ -46,7 +46,7 @@ CD3D9ShaderMaterialRenderer::CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3dde
|
||||
//! constructor only for use by derived classes who want to
|
||||
//! create a fall back material for example.
|
||||
CD3D9ShaderMaterialRenderer::CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3ddev,
|
||||
video::IVideoDriver* driver,
|
||||
video::CD3D9Driver* driver,
|
||||
IShaderConstantSetCallBack* callback,
|
||||
IMaterialRenderer* baseMaterial, s32 userData)
|
||||
: pID3DDevice(d3ddev), Driver(driver), CallBack(callback), BaseMaterial(baseMaterial),
|
||||
|
@ -21,7 +21,7 @@ namespace irr
|
||||
namespace video
|
||||
{
|
||||
|
||||
class IVideoDriver;
|
||||
class CD3D9Driver;
|
||||
class IShaderConstantSetCallBack;
|
||||
class IMaterialRenderer;
|
||||
|
||||
@ -31,7 +31,7 @@ class CD3D9ShaderMaterialRenderer : public IMaterialRenderer
|
||||
public:
|
||||
|
||||
//! Public constructor
|
||||
CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3ddev, video::IVideoDriver* driver,
|
||||
CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3ddev, video::CD3D9Driver* driver,
|
||||
s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram,
|
||||
IShaderConstantSetCallBack* callback, IMaterialRenderer* baseMaterial, s32 userData);
|
||||
|
||||
@ -59,7 +59,7 @@ protected:
|
||||
//! constructor only for use by derived classes who want to
|
||||
//! create a fall back material for example.
|
||||
CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3ddev,
|
||||
video::IVideoDriver* driver,
|
||||
video::CD3D9Driver* driver,
|
||||
IShaderConstantSetCallBack* callback,
|
||||
IMaterialRenderer* baseMaterial,
|
||||
s32 userData=0);
|
||||
@ -88,7 +88,7 @@ protected:
|
||||
LPD3DXCONSTANTTABLE* ppConstantTable);
|
||||
|
||||
IDirect3DDevice9* pID3DDevice;
|
||||
video::IVideoDriver* Driver;
|
||||
video::CD3D9Driver* Driver;
|
||||
IShaderConstantSetCallBack* CallBack;
|
||||
IMaterialRenderer* BaseMaterial;
|
||||
|
||||
|
@ -57,7 +57,7 @@ void CGUIContextMenu::setCloseHandling(ECONTEXT_MENU_CLOSE onClose)
|
||||
CloseHandling = onClose;
|
||||
}
|
||||
|
||||
//! get current behavior when the menue will be closed
|
||||
//! get current behavior when the menu will be closed
|
||||
ECONTEXT_MENU_CLOSE CGUIContextMenu::getCloseHandling() const
|
||||
{
|
||||
return CloseHandling;
|
||||
|
@ -34,7 +34,7 @@ namespace gui
|
||||
//! set behavior when menus are closed
|
||||
virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) IRR_OVERRIDE;
|
||||
|
||||
//! get current behavior when the menue will be closed
|
||||
//! get current behavior when the menu will be closed
|
||||
virtual ECONTEXT_MENU_CLOSE getCloseHandling() const IRR_OVERRIDE;
|
||||
|
||||
//! Returns amount of menu items
|
||||
|
@ -23,10 +23,10 @@ namespace gui
|
||||
CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
|
||||
s32 id, core::rect<s32> rectangle, bool clip,
|
||||
bool drawBack, bool moveOverSelect)
|
||||
: IGUIListBox(environment, parent, id, rectangle), Selected(-1),
|
||||
: IGUIListBox(environment, parent, id, rectangle), Selected(-1), HoverSelected(-1),
|
||||
ItemHeight(0),ItemHeightOverride(0),
|
||||
TotalItemHeight(0), ItemsIconWidth(0), Font(0), IconBank(0),
|
||||
ScrollBar(0), selectTime(0), LastKeyTime(0), Selecting(false), DrawBack(drawBack),
|
||||
ScrollBar(0), SelectTime(0), LastKeyTime(0), Selecting(false), DrawBack(drawBack),
|
||||
MoveOverSelect(moveOverSelect), AutoScroll(true), HighlightWhenNotFocused(true)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@ -110,7 +110,7 @@ void CGUIListBox::removeItem(u32 id)
|
||||
else if ((u32)Selected > id)
|
||||
{
|
||||
Selected -= 1;
|
||||
selectTime = os::Timer::getTime();
|
||||
SelectTime = os::Timer::getTime();
|
||||
}
|
||||
|
||||
Items.erase(id);
|
||||
@ -142,6 +142,7 @@ void CGUIListBox::clear()
|
||||
Items.clear();
|
||||
ItemsIconWidth = 0;
|
||||
Selected = -1;
|
||||
HoverSelected = -1;
|
||||
|
||||
ScrollBar->setPos(0);
|
||||
|
||||
@ -186,7 +187,7 @@ void CGUIListBox::recalculateItemHeight()
|
||||
//! returns id of selected item. returns -1 if no item is selected.
|
||||
s32 CGUIListBox::getSelected() const
|
||||
{
|
||||
return Selected;
|
||||
return HoverSelected >= 0 ? HoverSelected : Selected;
|
||||
}
|
||||
|
||||
|
||||
@ -198,7 +199,8 @@ void CGUIListBox::setSelected(s32 id)
|
||||
else
|
||||
Selected = id;
|
||||
|
||||
selectTime = os::Timer::getTime();
|
||||
HoverSelected = -1;
|
||||
SelectTime = os::Timer::getTime();
|
||||
|
||||
recalculateScrollPos();
|
||||
}
|
||||
@ -448,14 +450,19 @@ void CGUIListBox::selectNew(s32 ypos, bool onlyHover)
|
||||
u32 now = os::Timer::getTime();
|
||||
s32 oldSelected = Selected;
|
||||
|
||||
Selected = getItemAt(AbsoluteRect.UpperLeftCorner.X, ypos);
|
||||
if (Selected<0 && !Items.empty())
|
||||
Selected = 0;
|
||||
HoverSelected = getItemAt(AbsoluteRect.UpperLeftCorner.X, ypos);
|
||||
if (HoverSelected<0 && !Items.empty())
|
||||
HoverSelected = 0;
|
||||
if (!onlyHover)
|
||||
{
|
||||
Selected = HoverSelected;
|
||||
HoverSelected = -1;
|
||||
}
|
||||
|
||||
recalculateScrollPos();
|
||||
|
||||
gui::EGUI_EVENT_TYPE eventType = (Selected == oldSelected && now < selectTime + 500) ? EGET_LISTBOX_SELECTED_AGAIN : EGET_LISTBOX_CHANGED;
|
||||
selectTime = now;
|
||||
gui::EGUI_EVENT_TYPE eventType = (Selected == oldSelected && now < SelectTime + 500) ? EGET_LISTBOX_SELECTED_AGAIN : EGET_LISTBOX_CHANGED;
|
||||
SelectTime = now;
|
||||
// post the news
|
||||
if (Parent && !onlyHover)
|
||||
{
|
||||
@ -521,14 +528,21 @@ void CGUIListBox::draw()
|
||||
frameRect.LowerRightCorner.Y -= ScrollBar->getPos();
|
||||
|
||||
bool hl = (HighlightWhenNotFocused || Environment->hasFocus(this) || Environment->hasFocus(ScrollBar));
|
||||
const irr::s32 selected = getSelected();
|
||||
|
||||
for (s32 i=0; i<(s32)Items.size(); ++i)
|
||||
{
|
||||
if (frameRect.LowerRightCorner.Y >= AbsoluteRect.UpperLeftCorner.Y &&
|
||||
frameRect.UpperLeftCorner.Y <= AbsoluteRect.LowerRightCorner.Y)
|
||||
{
|
||||
if (i == Selected && hl)
|
||||
skin->draw2DRectangle(this, skin->getColor(EGDC_HIGH_LIGHT), frameRect, &clientClip);
|
||||
if (i == selected && hl)
|
||||
{
|
||||
skin->draw2DRectangle(this, hasItemOverrideColor(i, EGUI_LBC_BACKGROUND_HIGHLIGHT) ? getItemOverrideColor(i, EGUI_LBC_BACKGROUND_HIGHLIGHT) : getItemDefaultColor(EGUI_LBC_BACKGROUND_HIGHLIGHT), frameRect, &clientClip);
|
||||
}
|
||||
else if ( hasItemOverrideColor(i, EGUI_LBC_BACKGROUND ) )
|
||||
{
|
||||
skin->draw2DRectangle(this, getItemOverrideColor(i, EGUI_LBC_BACKGROUND), frameRect, &clientClip);
|
||||
}
|
||||
|
||||
core::rect<s32> textRect = frameRect;
|
||||
textRect.UpperLeftCorner.X += 3;
|
||||
@ -541,24 +555,24 @@ void CGUIListBox::draw()
|
||||
iconPos.Y += textRect.getHeight() / 2;
|
||||
iconPos.X += ItemsIconWidth/2;
|
||||
|
||||
if ( i==Selected && hl )
|
||||
if ( i==selected && hl )
|
||||
{
|
||||
IconBank->draw2DSprite( (u32)Items[i].Icon, iconPos, &clientClip,
|
||||
hasItemOverrideColor(i, EGUI_LBC_ICON_HIGHLIGHT) ?
|
||||
getItemOverrideColor(i, EGUI_LBC_ICON_HIGHLIGHT) : getItemDefaultColor(EGUI_LBC_ICON_HIGHLIGHT),
|
||||
selectTime, os::Timer::getTime(), false, true);
|
||||
SelectTime, os::Timer::getTime(), false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
IconBank->draw2DSprite( (u32)Items[i].Icon, iconPos, &clientClip,
|
||||
hasItemOverrideColor(i, EGUI_LBC_ICON) ? getItemOverrideColor(i, EGUI_LBC_ICON) : getItemDefaultColor(EGUI_LBC_ICON),
|
||||
0 , (i==Selected) ? os::Timer::getTime() : 0, false, true);
|
||||
0 , (i==selected) ? os::Timer::getTime() : 0, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
textRect.UpperLeftCorner.X += ItemsIconWidth+3;
|
||||
|
||||
if ( i==Selected && hl )
|
||||
if ( i==selected && hl )
|
||||
{
|
||||
Font->draw(Items[i].Text.c_str(), textRect,
|
||||
hasItemOverrideColor(i, EGUI_LBC_TEXT_HIGHLIGHT) ?
|
||||
@ -617,7 +631,7 @@ void CGUIListBox::recalculateScrollPos()
|
||||
if (!AutoScroll)
|
||||
return;
|
||||
|
||||
const s32 selPos = (Selected == -1 ? TotalItemHeight : Selected * ItemHeight) - ScrollBar->getPos();
|
||||
const s32 selPos = (getSelected() == -1 ? TotalItemHeight : getSelected() * ItemHeight) - ScrollBar->getPos();
|
||||
|
||||
if (selPos < 0)
|
||||
{
|
||||
@ -671,6 +685,14 @@ bool CGUIListBox::getSerializationLabels(EGUI_LISTBOX_COLOR colorType, core::str
|
||||
useColorLabel = "UseColIconHl";
|
||||
colorLabel = "ColIconHl";
|
||||
break;
|
||||
case EGUI_LBC_BACKGROUND:
|
||||
useColorLabel = "UseColBg";
|
||||
colorLabel = "ColBg";
|
||||
break;
|
||||
case EGUI_LBC_BACKGROUND_HIGHLIGHT:
|
||||
useColorLabel = "UseColBgHl";
|
||||
colorLabel = "ColBgHl";
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -754,6 +776,7 @@ void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW
|
||||
}
|
||||
}
|
||||
Selected = in->getAttributeAsInt("Selected", Selected);
|
||||
HoverSelected = -1;
|
||||
recalculateScrollPos();
|
||||
}
|
||||
|
||||
@ -887,6 +910,10 @@ video::SColor CGUIListBox::getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) con
|
||||
return skin->getColor(EGDC_ICON);
|
||||
case EGUI_LBC_ICON_HIGHLIGHT:
|
||||
return skin->getColor(EGDC_ICON_HIGH_LIGHT);
|
||||
case EGUI_LBC_BACKGROUND:
|
||||
return skin->getColor(EGDC_3D_HIGH_LIGHT);
|
||||
case EGUI_LBC_BACKGROUND_HIGHLIGHT:
|
||||
return skin->getColor(EGDC_HIGH_LIGHT);
|
||||
default:
|
||||
return video::SColor();
|
||||
}
|
||||
|
@ -164,6 +164,7 @@ namespace gui
|
||||
|
||||
core::array< ListItem > Items;
|
||||
s32 Selected;
|
||||
s32 HoverSelected; // When >= 0 we're in the middle of changing selection while mouse is pressed. We need to know so selected again isn't called too often.
|
||||
s32 ItemHeight;
|
||||
s32 ItemHeightOverride;
|
||||
s32 TotalItemHeight;
|
||||
@ -171,7 +172,7 @@ namespace gui
|
||||
gui::IGUIFont* Font;
|
||||
gui::IGUISpriteBank* IconBank;
|
||||
gui::IGUIScrollBar* ScrollBar;
|
||||
u32 selectTime;
|
||||
u32 SelectTime;
|
||||
u32 LastKeyTime;
|
||||
core::stringw KeyBuffer;
|
||||
bool Selecting;
|
||||
|
@ -23,7 +23,8 @@ CGUISpinBox::CGUISpinBox(const wchar_t* text, bool border,IGUIEnvironment* envir
|
||||
: IGUISpinBox(environment, parent, id, rectangle),
|
||||
EditBox(0), ButtonSpinUp(0), ButtonSpinDown(0), StepSize(1.f),
|
||||
RangeMin(-FLT_MAX), RangeMax(FLT_MAX), FormatString(L"%f"),
|
||||
DecimalPlaces(-1), ValidateOn(EGUI_SBV_ENTER|EGUI_SBV_LOSE_FOCUS)
|
||||
DecimalPlaces(-1), ValidateOn(EGUI_SBV_ENTER|EGUI_SBV_LOSE_FOCUS),
|
||||
OldValue(0.f)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CGUISpinBox");
|
||||
@ -104,23 +105,25 @@ IGUIEditBox* CGUISpinBox::getEditBox() const
|
||||
void CGUISpinBox::setValue(f32 val)
|
||||
{
|
||||
wchar_t str[100];
|
||||
|
||||
swprintf_irr(str, 99, FormatString.c_str(), val);
|
||||
EditBox->setText(str);
|
||||
verifyValueRange();
|
||||
verifyValueRange(getValue());
|
||||
}
|
||||
|
||||
|
||||
f32 CGUISpinBox::getValue() const
|
||||
{
|
||||
const wchar_t* val = EditBox->getText();
|
||||
return getValueFor(EditBox->getText());
|
||||
}
|
||||
|
||||
f32 CGUISpinBox::getValueFor(const wchar_t* val) const
|
||||
{
|
||||
if ( !val )
|
||||
return 0.f;
|
||||
core::stringc tmp(val);
|
||||
return core::fast_atof(tmp.c_str());
|
||||
}
|
||||
|
||||
|
||||
void CGUISpinBox::setRange(f32 min, f32 max)
|
||||
{
|
||||
if (max<min)
|
||||
@ -135,7 +138,7 @@ void CGUISpinBox::setRange(f32 min, f32 max)
|
||||
swprintf_irr(str, 99, FormatString.c_str(), RangeMax);
|
||||
RangeMax = core::fast_atof(core::stringc(str).c_str());
|
||||
|
||||
verifyValueRange();
|
||||
verifyValueRange(getValue());
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +206,8 @@ bool CGUISpinBox::OnEvent(const SEvent& event)
|
||||
{
|
||||
case EMIE_MOUSE_WHEEL:
|
||||
{
|
||||
f32 val = getValue() + (StepSize * (event.MouseInput.Wheel < 0 ? -1.f : 1.f));
|
||||
OldValue = getValue();
|
||||
f32 val = OldValue + (StepSize * (event.MouseInput.Wheel < 0 ? -1.f : 1.f));
|
||||
setValue(val);
|
||||
changeEvent = true;
|
||||
eatEvent = true;
|
||||
@ -220,15 +224,15 @@ bool CGUISpinBox::OnEvent(const SEvent& event)
|
||||
{
|
||||
if (event.GUIEvent.Caller == ButtonSpinUp)
|
||||
{
|
||||
f32 val = getValue();
|
||||
val += StepSize;
|
||||
OldValue = getValue();
|
||||
f32 val = OldValue + StepSize;
|
||||
setValue(val);
|
||||
changeEvent = true;
|
||||
}
|
||||
else if ( event.GUIEvent.Caller == ButtonSpinDown)
|
||||
{
|
||||
f32 val = getValue();
|
||||
val -= StepSize;
|
||||
OldValue = getValue();
|
||||
f32 val = OldValue - StepSize;
|
||||
setValue(val);
|
||||
changeEvent = true;
|
||||
}
|
||||
@ -240,7 +244,8 @@ bool CGUISpinBox::OnEvent(const SEvent& event)
|
||||
|| (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST && ValidateOn & EGUI_SBV_LOSE_FOCUS)
|
||||
)
|
||||
{
|
||||
verifyValueRange();
|
||||
OldValue = getValue(); // no call to setValue when text was changed without setText call
|
||||
verifyValueRange(OldValue);
|
||||
changeEvent = true;
|
||||
}
|
||||
}
|
||||
@ -251,14 +256,16 @@ bool CGUISpinBox::OnEvent(const SEvent& event)
|
||||
|
||||
if ( changeEvent )
|
||||
{
|
||||
SEvent e;
|
||||
e.EventType = EET_GUI_EVENT;
|
||||
e.GUIEvent.Caller = this;
|
||||
e.GUIEvent.Element = 0;
|
||||
|
||||
e.GUIEvent.EventType = EGET_SPINBOX_CHANGED;
|
||||
if ( Parent )
|
||||
{
|
||||
SEvent e;
|
||||
e.EventType = EET_GUI_EVENT;
|
||||
e.GUIEvent.Caller = this;
|
||||
e.GUIEvent.Element = 0;
|
||||
e.GUIEvent.EventType = EGET_SPINBOX_CHANGED;
|
||||
|
||||
Parent->OnEvent(e);
|
||||
}
|
||||
if ( eatEvent )
|
||||
return true;
|
||||
}
|
||||
@ -286,17 +293,12 @@ void CGUISpinBox::draw()
|
||||
IGUISpinBox::draw();
|
||||
}
|
||||
|
||||
void CGUISpinBox::verifyValueRange()
|
||||
void CGUISpinBox::verifyValueRange(f32 val)
|
||||
{
|
||||
f32 val = getValue();
|
||||
if ( val+core::ROUNDING_ERROR_f32 < RangeMin )
|
||||
val = RangeMin;
|
||||
setValue(RangeMin);
|
||||
else if ( val-core::ROUNDING_ERROR_f32 > RangeMax )
|
||||
val = RangeMax;
|
||||
else
|
||||
return;
|
||||
|
||||
setValue(val);
|
||||
setValue(RangeMax);
|
||||
}
|
||||
|
||||
|
||||
@ -305,7 +307,6 @@ void CGUISpinBox::setText(const wchar_t* text)
|
||||
{
|
||||
EditBox->setText(text);
|
||||
setValue(getValue());
|
||||
verifyValueRange();
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,6 +41,9 @@ namespace gui
|
||||
//! Get the current value of the spinbox
|
||||
virtual f32 getValue() const IRR_OVERRIDE;
|
||||
|
||||
//! Get the value the spinbox would have for the given text
|
||||
virtual f32 getValueFor(const wchar_t* text) const IRR_OVERRIDE;
|
||||
|
||||
//! set the range of values which can be used in the spinbox
|
||||
/** \param min: minimum value
|
||||
\param max: maximum value */
|
||||
@ -83,6 +86,12 @@ namespace gui
|
||||
//! Gets when the spinbox has to validate entered text.
|
||||
virtual u32 getValidateOn() const IRR_OVERRIDE;
|
||||
|
||||
//! Gets previous value in EGET_SPINBOX_CHANGED events
|
||||
virtual f32 getOldValue() const IRR_OVERRIDE
|
||||
{
|
||||
return OldValue;
|
||||
}
|
||||
|
||||
//! Writes attributes of the element.
|
||||
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const IRR_OVERRIDE;
|
||||
|
||||
@ -90,7 +99,7 @@ namespace gui
|
||||
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) IRR_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void verifyValueRange();
|
||||
void verifyValueRange(f32 val);
|
||||
void refreshSprites();
|
||||
|
||||
IGUIEditBox * EditBox;
|
||||
@ -104,6 +113,7 @@ namespace gui
|
||||
core::stringw FormatString;
|
||||
s32 DecimalPlaces;
|
||||
u32 ValidateOn; // combination of EGUI_SPINBOX_VALIDATION bit-flags
|
||||
f32 OldValue;
|
||||
};
|
||||
|
||||
|
||||
|
@ -549,8 +549,8 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture,
|
||||
a cylinder, a cone and a cross
|
||||
point up on (0,1.f, 0.f )
|
||||
*/
|
||||
IMesh* CGeometryCreator::createArrowMesh(const u32 tesselationCylinder,
|
||||
const u32 tesselationCone,
|
||||
IMesh* CGeometryCreator::createArrowMesh(const u32 tessellationCylinder,
|
||||
const u32 tessellationCone,
|
||||
const f32 height,
|
||||
const f32 cylinderHeight,
|
||||
const f32 width0,
|
||||
@ -558,9 +558,9 @@ IMesh* CGeometryCreator::createArrowMesh(const u32 tesselationCylinder,
|
||||
const video::SColor vtxColor0,
|
||||
const video::SColor vtxColor1) const
|
||||
{
|
||||
SMesh* mesh = (SMesh*)createCylinderMesh(width0, cylinderHeight, tesselationCylinder, vtxColor0, false);
|
||||
SMesh* mesh = (SMesh*)createCylinderMesh(width0, cylinderHeight, tessellationCylinder, vtxColor0, false);
|
||||
|
||||
IMesh* mesh2 = createConeMesh(width1, height-cylinderHeight, tesselationCone, vtxColor1, vtxColor0);
|
||||
IMesh* mesh2 = createConeMesh(width1, height-cylinderHeight, tessellationCone, vtxColor1, vtxColor0);
|
||||
for (u32 i=0; i<mesh2->getMeshBufferCount(); ++i)
|
||||
{
|
||||
IMeshBuffer* buffer = mesh2->getMeshBuffer(i);
|
||||
@ -745,23 +745,23 @@ IMesh* CGeometryCreator::createSphereMesh(f32 radius, u32 polyCountX, u32 polyCo
|
||||
|
||||
/* A cylinder with proper normals and texture coords */
|
||||
IMesh* CGeometryCreator::createCylinderMesh(f32 radius, f32 length,
|
||||
u32 tesselation, const video::SColor& color,
|
||||
u32 tessellation, const video::SColor& color,
|
||||
bool closeTop, f32 oblique, u32 normalType) const
|
||||
{
|
||||
SMeshBuffer* buffer = new SMeshBuffer();
|
||||
|
||||
const f32 recTesselation = core::reciprocal((f32)tesselation);
|
||||
const f32 recTesselationHalf = recTesselation * 0.5f;
|
||||
const f32 angleStep = (core::PI * 2.f ) * recTesselation;
|
||||
const f32 recTessellation = core::reciprocal((f32)tessellation);
|
||||
const f32 recTessellationHalf = recTessellation * 0.5f;
|
||||
const f32 angleStep = (core::PI * 2.f ) * recTessellation;
|
||||
const f32 angleStepHalf = angleStep*0.5f;
|
||||
|
||||
u32 i;
|
||||
video::S3DVertex v;
|
||||
v.Color = color;
|
||||
buffer->Vertices.reallocate(tesselation*4+4+(closeTop?2:1));
|
||||
buffer->Indices.reallocate((tesselation*2+1)*(closeTop?12:9));
|
||||
buffer->Vertices.reallocate(tessellation*4+4+(closeTop?2:1));
|
||||
buffer->Indices.reallocate((tessellation*2+1)*(closeTop?12:9));
|
||||
f32 tcx = 0.f;
|
||||
for ( i = 0; i <= tesselation; ++i )
|
||||
for ( i = 0; i <= tessellation; ++i )
|
||||
{
|
||||
const f32 angle = angleStep * i;
|
||||
v.Pos.X = radius * cosf(angle);
|
||||
@ -797,7 +797,7 @@ IMesh* CGeometryCreator::createCylinderMesh(f32 radius, f32 length,
|
||||
case 1: v.Normal = v.Pos; break;
|
||||
}
|
||||
v.Normal.normalize();
|
||||
v.TCoords.X=tcx+recTesselationHalf;
|
||||
v.TCoords.X=tcx+recTessellationHalf;
|
||||
v.TCoords.Y=0.f;
|
||||
buffer->Vertices.push_back(v);
|
||||
|
||||
@ -811,11 +811,11 @@ IMesh* CGeometryCreator::createCylinderMesh(f32 radius, f32 length,
|
||||
v.Normal.normalize();
|
||||
v.TCoords.Y=1.f;
|
||||
buffer->Vertices.push_back(v);
|
||||
tcx += recTesselation;
|
||||
tcx += recTessellation;
|
||||
}
|
||||
|
||||
// indices for the main hull part
|
||||
const u32 nonWrappedSize = tesselation* 4;
|
||||
const u32 nonWrappedSize = tessellation* 4;
|
||||
for (i=0; i != nonWrappedSize; i += 2)
|
||||
{
|
||||
buffer->Indices.push_back(i + 2);
|
||||
@ -898,21 +898,21 @@ IMesh* CGeometryCreator::createCylinderMesh(f32 radius, f32 length,
|
||||
|
||||
|
||||
/* A cone with proper normals and texture coords */
|
||||
IMesh* CGeometryCreator::createConeMesh(f32 radius, f32 length, u32 tesselation,
|
||||
IMesh* CGeometryCreator::createConeMesh(f32 radius, f32 length, u32 tessellation,
|
||||
const video::SColor& colorTop,
|
||||
const video::SColor& colorBottom,
|
||||
f32 oblique) const
|
||||
{
|
||||
SMeshBuffer* buffer = new SMeshBuffer();
|
||||
|
||||
const f32 angleStep = (core::PI * 2.f ) / tesselation;
|
||||
const f32 angleStep = (core::PI * 2.f ) / tessellation;
|
||||
const f32 angleStepHalf = angleStep*0.5f;
|
||||
|
||||
video::S3DVertex v;
|
||||
u32 i;
|
||||
|
||||
v.Color = colorTop;
|
||||
for ( i = 0; i != tesselation; ++i )
|
||||
for ( i = 0; i != tessellation; ++i )
|
||||
{
|
||||
f32 angle = angleStep * f32(i);
|
||||
|
||||
|
@ -34,19 +34,19 @@ public:
|
||||
const core::dimension2d<u32>& defaultVertexBlockSize,
|
||||
bool debugBorders=false) const IRR_OVERRIDE;
|
||||
|
||||
virtual IMesh* createArrowMesh(const u32 tesselationCylinder,
|
||||
const u32 tesselationCone, const f32 height,
|
||||
virtual IMesh* createArrowMesh(const u32 tessellationCylinder,
|
||||
const u32 tessellationCone, const f32 height,
|
||||
const f32 cylinderHeight, const f32 width0,
|
||||
const f32 width1, const video::SColor vtxColor0,
|
||||
const video::SColor vtxColor1) const IRR_OVERRIDE;
|
||||
|
||||
virtual IMesh* createSphereMesh(f32 radius, u32 polyCountX, u32 polyCountY) const IRR_OVERRIDE;
|
||||
|
||||
virtual IMesh* createCylinderMesh(f32 radius, f32 length, u32 tesselation,
|
||||
virtual IMesh* createCylinderMesh(f32 radius, f32 length, u32 tessellation,
|
||||
const video::SColor& color=0xffffffff,
|
||||
bool closeTop=true, f32 oblique=0.f, u32 normalType=0) const IRR_OVERRIDE;
|
||||
|
||||
virtual IMesh* createConeMesh(f32 radius, f32 length, u32 tesselation,
|
||||
virtual IMesh* createConeMesh(f32 radius, f32 length, u32 tessellation,
|
||||
const video::SColor& colorTop=0xffffffff,
|
||||
const video::SColor& colorBottom=0xffffffff,
|
||||
f32 oblique=0.f) const IRR_OVERRIDE;
|
||||
|
@ -197,6 +197,20 @@ namespace irr
|
||||
UseReferenceRect = false;
|
||||
}
|
||||
|
||||
virtual bool getReferenceRect(core::rect<s32>& rect) IRR_OVERRIDE
|
||||
{
|
||||
if ( UseReferenceRect )
|
||||
{
|
||||
rect = ReferenceRect;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.UpperLeftCorner = core::vector2di(0,0);
|
||||
rect.LowerRightCorner.X = (irr::s32)WindowSize.Width;
|
||||
rect.LowerRightCorner.Y = (irr::s32)WindowSize.Height;
|
||||
}
|
||||
return UseReferenceRect;
|
||||
}
|
||||
|
||||
//! Updates the internal cursor position
|
||||
void setInternalCursorPosition(const core::position2di &pos)
|
||||
|
@ -160,6 +160,14 @@ namespace irr
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool getReferenceRect(core::rect<s32>& rect) IRR_OVERRIDE
|
||||
{
|
||||
rect.UpperLeftCorner = core::vector2di(0,0);
|
||||
rect.LowerRightCorner.X = (irr::s32)Device->CreationParams.WindowSize.Width;
|
||||
rect.LowerRightCorner.Y = (irr::s32)Device->CreationParams.WindowSize.Height;
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void updateCursorPos()
|
||||
|
@ -1035,7 +1035,7 @@ bool CIrrDeviceLinux::run()
|
||||
os::Printer::log("XLookupNone", ELL_INFORMATION);
|
||||
else if ( status == XLookupKeySym )
|
||||
// Getting this also when user did not set setlocale(LC_ALL, ""); and using an unknown locale
|
||||
// XSupportsLocale doesn't seeem to catch that unfortunately - any other ideas to catch it are welcome.
|
||||
// XSupportsLocale doesn't seem to catch that unfortunately - any other ideas to catch it are welcome.
|
||||
os::Printer::log("XLookupKeySym", ELL_INFORMATION);
|
||||
else if ( status == XBufferOverflow )
|
||||
os::Printer::log("XBufferOverflow", ELL_INFORMATION);
|
||||
@ -1409,7 +1409,7 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
|
||||
else
|
||||
#endif
|
||||
{
|
||||
os::Printer::log("VidMode or RandR X11 extension requireed for VideoModeList." , ELL_WARNING);
|
||||
os::Printer::log("VidMode or RandR X11 extension required for VideoModeList." , ELL_WARNING);
|
||||
}
|
||||
}
|
||||
if (XDisplay && temporaryDisplay)
|
||||
@ -2080,7 +2080,7 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, co
|
||||
ZPixmap, // XYBitmap (depth=1), ZPixmap(depth=x)
|
||||
0, 0, sourceRect.getWidth(), sourceRect.getHeight(),
|
||||
32, // bitmap_pad,
|
||||
0// bytes_per_line (0 means continuos in memory)
|
||||
0// bytes_per_line (0 means continuous in memory)
|
||||
);
|
||||
sourceImage->data = new char[sourceImage->height * sourceImage->bytes_per_line];
|
||||
XImage * maskImage = XCreateImage(XDisplay, VisualInfo->visual,
|
||||
@ -2263,7 +2263,7 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null)
|
||||
CIrrDeviceLinux::CCursorControl::~CCursorControl()
|
||||
{
|
||||
// Do not clearCursors here as the display is already closed
|
||||
// TODO (cutealien): droping cursorcontrol earlier might work, not sure about reason why that's done in stub currently.
|
||||
// TODO (cutealien): dropping cursorcontrol earlier might work, not sure about reason why that's done in stub currently.
|
||||
}
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
|
@ -318,6 +318,21 @@ namespace irr
|
||||
UseReferenceRect = false;
|
||||
}
|
||||
|
||||
virtual bool getReferenceRect(core::rect<s32>& rect) IRR_OVERRIDE
|
||||
{
|
||||
if ( UseReferenceRect )
|
||||
{
|
||||
rect = ReferenceRect;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.UpperLeftCorner = core::vector2di(0,0);
|
||||
rect.LowerRightCorner.X = (irr::s32)Device->Width;
|
||||
rect.LowerRightCorner.Y = (irr::s32)Device->Height;
|
||||
}
|
||||
return UseReferenceRect;
|
||||
}
|
||||
|
||||
//! Sets the active cursor icon
|
||||
virtual void setActiveIcon(gui::ECURSOR_ICON iconId) IRR_OVERRIDE;
|
||||
|
||||
|
@ -178,6 +178,14 @@ namespace irr
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool getReferenceRect(core::rect<s32>& rect) IRR_OVERRIDE
|
||||
{
|
||||
rect.UpperLeftCorner = core::vector2di(0,0);
|
||||
rect.LowerRightCorner.X = (irr::s32)Device->Width;
|
||||
rect.LowerRightCorner.Y = (irr::s32)Device->Height;
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void updateCursorPos()
|
||||
|
@ -130,8 +130,8 @@ namespace irr
|
||||
if (dev)
|
||||
{
|
||||
dev->Unacquire();
|
||||
dev->Release();
|
||||
}
|
||||
dev->Release();
|
||||
}
|
||||
|
||||
if (DirectInputDevice)
|
||||
@ -1281,7 +1281,7 @@ bool CIrrDeviceWin32::run()
|
||||
//! Pause the current process for the minimum time allowed only to allow other processes to execute
|
||||
void CIrrDeviceWin32::yield()
|
||||
{
|
||||
Sleep(1);
|
||||
Sleep(0);
|
||||
}
|
||||
|
||||
//! Pause execution and let other processes to run for a specified amount of time.
|
||||
|
@ -275,6 +275,30 @@ namespace irr
|
||||
UseReferenceRect = false;
|
||||
}
|
||||
|
||||
virtual bool getReferenceRect(core::rect<s32>& rect) IRR_OVERRIDE
|
||||
{
|
||||
if ( UseReferenceRect )
|
||||
{
|
||||
rect = ReferenceRect;
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT wndRect;
|
||||
if (GetWindowRect(HWnd, &wndRect))
|
||||
{
|
||||
rect.UpperLeftCorner.X = wndRect.left+BorderX;
|
||||
rect.UpperLeftCorner.Y = wndRect.top+BorderY;
|
||||
}
|
||||
else // error case - not sure if it matters what we set here as coordinates returned will be -1, -1
|
||||
{
|
||||
rect.UpperLeftCorner = core::vector2di(0,0);
|
||||
}
|
||||
rect.LowerRightCorner.X = rect.UpperLeftCorner.X + (irr::s32)WindowSize.Width;
|
||||
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + (irr::s32)WindowSize.Height;
|
||||
}
|
||||
return UseReferenceRect;
|
||||
}
|
||||
|
||||
/** Used to notify the cursor that the window was resized. */
|
||||
void OnResize(const core::dimension2d<u32>& size)
|
||||
{
|
||||
|
@ -238,13 +238,13 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
#endif
|
||||
|
||||
pPtr += sizeof(u16);
|
||||
MS3DVertex *vertices = new MS3DVertex[numVertices];
|
||||
if (pPtr + ((sizeof(MS3DVertex) - MS3DVERTEX_NUM_PAD_BYTES) * numVertices) > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
MS3DVertex *vertices = new MS3DVertex[numVertices];
|
||||
for (u16 tmp=0; tmp<numVertices; ++tmp)
|
||||
{
|
||||
//printf("&vertices[tmp].Vertex[0] = %p (%d)\n", &vertices[tmp].Vertex[0], (int)((long long)(&vertices[tmp].Vertex[0]) % 4));
|
||||
@ -269,13 +269,14 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
os::Printer::log("Load Triangles", core::stringc(numTriangles).c_str());
|
||||
#endif
|
||||
pPtr += sizeof(u16);
|
||||
MS3DTriangle *triangles = new MS3DTriangle[numTriangles];
|
||||
if (pPtr + ((sizeof(MS3DTriangle) - MS3DTRIANGLE_NUM_PAD_BYTES) * numTriangles) > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
delete [] vertices;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
MS3DTriangle *triangles = new MS3DTriangle[numTriangles];
|
||||
for (u16 tmp=0; tmp<numTriangles; ++tmp)
|
||||
{
|
||||
memcpy(&triangles[tmp].Flags, pPtr, sizeof(struct MS3DTriangle) - MS3DTRIANGLE_NUM_PAD_BYTES);
|
||||
@ -349,6 +350,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
if (pPtr > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
delete [] vertices;
|
||||
delete [] triangles;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
@ -390,6 +393,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
if (pPtr > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
delete [] vertices;
|
||||
delete [] triangles;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
@ -452,6 +457,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
if (pPtr > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
delete [] vertices;
|
||||
delete [] triangles;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
@ -479,6 +486,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
if (pPtr > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
delete [] vertices;
|
||||
delete [] triangles;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
@ -529,6 +538,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
if (pPtr > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
delete [] vertices;
|
||||
delete [] triangles;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
@ -569,6 +580,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
if (pPtr > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
delete [] vertices;
|
||||
delete [] triangles;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
@ -625,6 +638,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
if (pPtr > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
delete [] vertices;
|
||||
delete [] triangles;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
@ -657,6 +672,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
if (pPtr > buffer+fileSize)
|
||||
{
|
||||
delete [] buffer;
|
||||
delete [] vertices;
|
||||
delete [] triangles;
|
||||
os::Printer::log("Loading failed. Corrupted data found", file->getFileName(), ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
@ -837,8 +854,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
||||
}
|
||||
|
||||
delete [] buffer;
|
||||
delete [] triangles;
|
||||
delete [] vertices;
|
||||
delete [] triangles;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -330,12 +330,12 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
if ( Materials[m]->Meshbuffer->getIndexCount() > 0 )
|
||||
{
|
||||
if ( getIndexTypeHint() == EITH_OPTIMAL
|
||||
if ( getIndexTypeHint() == EITH_OPTIMAL
|
||||
&& Materials[m]->Meshbuffer->getVertexCount() <= 65536 )
|
||||
{
|
||||
Materials[m]->Meshbuffer->getIndexBuffer().setType(video::EIT_16BIT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Materials[m]->Meshbuffer->recalculateBoundingBox();
|
||||
if (Materials[m]->RecalculateNormals)
|
||||
@ -794,7 +794,7 @@ COBJMeshFileLoader::SObjMtl* COBJMeshFileLoader::findMtl(const core::stringc& mt
|
||||
Materials.getLast()->Group = grpName;
|
||||
return Materials.getLast();
|
||||
}
|
||||
// we found a new group for a non-existant material
|
||||
// we found a new group for a non-existent material
|
||||
else if (grpName.size())
|
||||
{
|
||||
Materials.push_back(new SObjMtl(*Materials[0]));
|
||||
|
@ -805,10 +805,10 @@ IRenderTarget* COpenGLDriver::addRenderTarget()
|
||||
}
|
||||
|
||||
|
||||
// small helper function to create vertex buffer object adress offsets
|
||||
static inline u8* buffer_offset(const long offset)
|
||||
// small helper function to create vertex buffer object address offsets
|
||||
static inline const GLvoid * buffer_offset(const size_t offset)
|
||||
{
|
||||
return ((u8*)0 + offset);
|
||||
return (const GLvoid *)offset;
|
||||
}
|
||||
|
||||
|
||||
@ -3728,6 +3728,10 @@ s32 COpenGLDriver::addShaderMaterial(const c8* vertexShaderProgram,
|
||||
callback, baseMaterial, userData);
|
||||
|
||||
r->drop();
|
||||
|
||||
if (callback && nr >= 0)
|
||||
callback->OnCreate(this, userData);
|
||||
|
||||
return nr;
|
||||
}
|
||||
|
||||
@ -3762,6 +3766,9 @@ s32 COpenGLDriver::addHighLevelShaderMaterial(
|
||||
|
||||
r->drop();
|
||||
|
||||
if (callback && nr >= 0)
|
||||
callback->OnCreate(r, userData);
|
||||
|
||||
return nr;
|
||||
}
|
||||
|
||||
|
@ -465,7 +465,7 @@ namespace video
|
||||
core::matrix4 Matrices[ETS_COUNT];
|
||||
core::array<u8> ColorBuffer;
|
||||
|
||||
//! enumeration for rendering modes such as 2d and 3d for minizing the switching of renderStates.
|
||||
//! enumeration for rendering modes such as 2d and 3d for minimizing the switching of renderStates.
|
||||
enum E_RENDER_MODE
|
||||
{
|
||||
ERM_NONE = 0, // no render state has been set yet.
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
return CallBack;
|
||||
}
|
||||
|
||||
// implementations for the render services
|
||||
// implementations for IMaterialRendererServices
|
||||
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) IRR_OVERRIDE;
|
||||
virtual s32 getVertexShaderConstantID(const c8* name) IRR_OVERRIDE;
|
||||
virtual s32 getPixelShaderConstantID(const c8* name) IRR_OVERRIDE;
|
||||
|
@ -971,7 +971,7 @@ scene::SMesh** CQ3LevelMesh::buildMesh(s32 num)
|
||||
break;
|
||||
case 2: // patches
|
||||
createCurvedSurface_bezier( buffer, i,
|
||||
LoadParam.patchTesselation,
|
||||
LoadParam.patchTessellation,
|
||||
item[g].takeVertexColor
|
||||
);
|
||||
break;
|
||||
@ -1274,7 +1274,7 @@ void CQ3LevelMesh::SBezier::tesselate( s32 level )
|
||||
*/
|
||||
void CQ3LevelMesh::createCurvedSurface_nosubdivision(SMeshBufferLightMap* meshBuffer,
|
||||
s32 faceIndex,
|
||||
s32 patchTesselation,
|
||||
s32 patchTessellation,
|
||||
s32 storevertexcolor)
|
||||
{
|
||||
tBSPFace * face = &Faces[faceIndex];
|
||||
@ -1318,7 +1318,7 @@ void CQ3LevelMesh::createCurvedSurface_nosubdivision(SMeshBufferLightMap* meshBu
|
||||
*/
|
||||
void CQ3LevelMesh::createCurvedSurface_bezier(SMeshBufferLightMap* meshBuffer,
|
||||
s32 faceIndex,
|
||||
s32 patchTesselation,
|
||||
s32 patchTessellation,
|
||||
s32 storevertexcolor)
|
||||
{
|
||||
|
||||
@ -1372,7 +1372,7 @@ void CQ3LevelMesh::createCurvedSurface_bezier(SMeshBufferLightMap* meshBuffer,
|
||||
Bezier.control[7] = controlPoint[ inx + controlWidth * 2 + 1];
|
||||
Bezier.control[8] = controlPoint[ inx + controlWidth * 2 + 2];
|
||||
|
||||
Bezier.tesselate( patchTesselation );
|
||||
Bezier.tesselate( patchTessellation );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,10 +324,10 @@ namespace scene
|
||||
|
||||
//bi-quadratic bezier patches
|
||||
void createCurvedSurface_bezier(SMeshBufferLightMap* meshBuffer,
|
||||
s32 faceIndex, s32 patchTesselation, s32 storevertexcolor);
|
||||
s32 faceIndex, s32 patchTessellation, s32 storevertexcolor);
|
||||
|
||||
void createCurvedSurface_nosubdivision(SMeshBufferLightMap* meshBuffer,
|
||||
s32 faceIndex, s32 patchTesselation, s32 storevertexcolor);
|
||||
s32 faceIndex, s32 patchTessellation, s32 storevertexcolor);
|
||||
|
||||
struct S3DVertex2TCoords_64
|
||||
{
|
||||
|
@ -1095,14 +1095,14 @@ IAnimatedMesh* CSceneManager::addTerrainMesh(const io::path& name,
|
||||
//! Adds an arrow mesh to the mesh pool.
|
||||
IAnimatedMesh* CSceneManager::addArrowMesh(const io::path& name,
|
||||
video::SColor vtxColor0, video::SColor vtxColor1,
|
||||
u32 tesselationCylinder, u32 tesselationCone, f32 height,
|
||||
u32 tessellationCylinder, u32 tessellationCone, f32 height,
|
||||
f32 cylinderHeight, f32 width0,f32 width1)
|
||||
{
|
||||
if (MeshCache->isMeshLoaded(name))
|
||||
return MeshCache->getMeshByName(name);
|
||||
|
||||
IMesh* mesh = GeometryCreator->createArrowMesh( tesselationCylinder,
|
||||
tesselationCone, height, cylinderHeight, width0,width1,
|
||||
IMesh* mesh = GeometryCreator->createArrowMesh( tessellationCylinder,
|
||||
tessellationCone, height, cylinderHeight, width0,width1,
|
||||
vtxColor0, vtxColor1);
|
||||
if (!mesh)
|
||||
return 0;
|
||||
|
@ -229,7 +229,7 @@ namespace scene
|
||||
//! Add a arrow mesh to the mesh pool
|
||||
virtual IAnimatedMesh* addArrowMesh(const io::path& name,
|
||||
video::SColor vtxColor0, video::SColor vtxColor1,
|
||||
u32 tesselationCylinder, u32 tesselationCone,
|
||||
u32 tessellationCylinder, u32 tessellationCone,
|
||||
f32 height, f32 cylinderHeight, f32 width0,
|
||||
f32 width1) IRR_OVERRIDE;
|
||||
|
||||
|
@ -1317,9 +1317,24 @@ void CSkinnedMesh::recoverJointsFromMesh(core::array<IBoneSceneNode*> &jointChil
|
||||
{
|
||||
IBoneSceneNode* node=jointChildSceneNodes[i];
|
||||
SJoint *joint=AllJoints[i];
|
||||
node->setPosition(joint->LocalAnimatedMatrix.getTranslation());
|
||||
node->setRotation(joint->LocalAnimatedMatrix.getRotationDegrees());
|
||||
node->setScale(joint->LocalAnimatedMatrix.getScale());
|
||||
|
||||
if ( joint->UseAnimationFrom ) // Seems to work better (else solution seems to mess up sometimes) and would be faster. Any disadvantage?
|
||||
{
|
||||
node->setPosition(joint->Animatedposition);
|
||||
core::quaternion qrot = joint->Animatedrotation;
|
||||
qrot.W *= -1.f; // Animation system uses right-handed rotations? Argh...
|
||||
irr::core::vector3df euler;
|
||||
qrot.toEuler(euler);
|
||||
euler *= core::RADTODEG;
|
||||
node->setRotation(euler);
|
||||
node->setScale(joint->Animatedscale);
|
||||
}
|
||||
else
|
||||
{
|
||||
node->setPosition(joint->LocalAnimatedMatrix.getTranslation());
|
||||
node->setRotation(joint->LocalAnimatedMatrix.getRotationDegrees());
|
||||
node->setScale(joint->LocalAnimatedMatrix.getScale());
|
||||
}
|
||||
|
||||
node->positionHint=joint->positionHint;
|
||||
node->scaleHint=joint->scaleHint;
|
||||
|
@ -4654,6 +4654,9 @@ s32 CBurningVideoDriver::addShaderMaterial(const c8* vertexShaderProgram,
|
||||
|
||||
shader->drop();
|
||||
|
||||
if (callback && materialID >= 0)
|
||||
callback->OnCreate(shader, userData);
|
||||
|
||||
return materialID;
|
||||
}
|
||||
|
||||
@ -4691,6 +4694,9 @@ s32 CBurningVideoDriver::addHighLevelShaderMaterial(
|
||||
|
||||
shader->drop();
|
||||
|
||||
if (callback && materialID >= 0)
|
||||
callback->OnCreate(shader, userData);
|
||||
|
||||
return materialID;
|
||||
}
|
||||
|
||||
|
@ -846,6 +846,7 @@
|
||||
<ClInclude Include="..\..\include\EMaterialTypes.h" />
|
||||
<ClInclude Include="..\..\include\EMeshBufferTypes.h" />
|
||||
<ClInclude Include="..\..\include\EReadFileType.h" />
|
||||
<ClInclude Include="..\..\include\ESceneNodeUpdateAbs.h" />
|
||||
<ClInclude Include="..\..\include\EShaderTypes.h" />
|
||||
<ClInclude Include="..\..\include\fast_atof.h" />
|
||||
<ClInclude Include="..\..\include\IAnimatedMeshMD3.h" />
|
||||
|
@ -1486,6 +1486,9 @@
|
||||
<ClInclude Include="..\..\include\EMeshBufferTypes.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\ESceneNodeUpdateAbs.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\changes.txt">
|
||||
|
49
source/Irrlicht/Irrlicht17.0.sln
Normal file
49
source/Irrlicht/Irrlicht17.0.sln
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33110.190
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "Irrlicht17.0.vcxproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
SDL-Debug|x64 = SDL-Debug|x64
|
||||
SDL-Debug|x86 = SDL-Debug|x86
|
||||
Static lib - Debug|x64 = Static lib - Debug|x64
|
||||
Static lib - Debug|x86 = Static lib - Debug|x86
|
||||
Static lib - Release|x64 = Static lib - Release|x64
|
||||
Static lib - Release|x86 = Static lib - Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.Build.0 = Debug|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.ActiveCfg = Release|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.Build.0 = Release|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x86.ActiveCfg = Release|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x86.Build.0 = Release|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|x64.ActiveCfg = SDL-Debug|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|x64.Build.0 = SDL-Debug|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|x86.ActiveCfg = SDL-Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|x86.Build.0 = SDL-Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.ActiveCfg = Static lib - Debug|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.Build.0 = Static lib - Debug|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x86.ActiveCfg = Static lib - Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x86.Build.0 = Static lib - Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.ActiveCfg = Static lib - Release|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.Build.0 = Static lib - Release|x64
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x86.ActiveCfg = Static lib - Release|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x86.Build.0 = Static lib - Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {CA4D3DBA-854D-443E-9C2B-700DA84286D9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
1351
source/Irrlicht/Irrlicht17.0.vcxproj
Normal file
1351
source/Irrlicht/Irrlicht17.0.vcxproj
Normal file
File diff suppressed because it is too large
Load Diff
2391
source/Irrlicht/Irrlicht17.0.vcxproj.filters
Normal file
2391
source/Irrlicht/Irrlicht17.0.vcxproj.filters
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user