Merged from 1.5 branch revisions 1837:1850. Light property changes, shader problems fixed, OSX resize fixed, meshloader debug messages disabled.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1851 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
0b03402773
commit
19491a579f
|
@ -1,5 +1,11 @@
|
|||
Changes in version 1.5 (...12.2008)
|
||||
|
||||
- Changed the preferred way of altering light node's radius: Use the new member methods of ILightSceneNode instead of directly modifying the SLight structure.
|
||||
|
||||
- Changed the initial attenuation back to (0,1/radius,0). To override this value simply change the attenuation in the SLight (lightnode->getLightData().Attenuation.set(x,y,z))
|
||||
|
||||
- Dirty fix for OSX device setResizable and a bug fix to do with resizing the device.
|
||||
|
||||
- Terrain heightmap and texture were flipped in order to draw them as expected (looking onto the terrain from high above will just look like the actual texture/heightmap).
|
||||
|
||||
- Significant internal change to the way that FPS camera jump speed and collision response animator gravity interact. The behaviour is now much more realistic, but it will require you to adjust your jump speed and gravity.
|
||||
|
|
|
@ -128,7 +128,7 @@ int main()
|
|||
// create light
|
||||
|
||||
node = smgr->addLightSceneNode(0, core::vector3df(0,0,0),
|
||||
video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 1200.0f);
|
||||
video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 800.0f);
|
||||
scene::ISceneNodeAnimator* anim = 0;
|
||||
anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
|
||||
node->addAnimator(anim);
|
||||
|
|
|
@ -39,6 +39,37 @@ public:
|
|||
//! Gets the light data associated with this ILightSceneNode
|
||||
/** \return The light data. */
|
||||
virtual video::SLight& getLightData() = 0;
|
||||
|
||||
//! Sets the light's radius of influence.
|
||||
/** Outside this radius the light won't lighten geometry and cast no
|
||||
shadows. Setting the radius will also influence the attenuation, setting
|
||||
it to (0,1/radius,0). If you want to override this behavior, set the
|
||||
attenuation after the radius.
|
||||
\param radius The new radius. */
|
||||
virtual void setRadius(f32 radius) = 0;
|
||||
|
||||
//! Gets the light's radius of influence.
|
||||
/** \return The current radius. */
|
||||
virtual f32 getRadius() const = 0;
|
||||
|
||||
//! Sets the light type.
|
||||
/** \param type The new type. */
|
||||
virtual void setLightType(video::E_LIGHT_TYPE type) = 0;
|
||||
|
||||
//! Gets the light type.
|
||||
/** \return The current light type. */
|
||||
virtual video::E_LIGHT_TYPE getLightType() const = 0;
|
||||
|
||||
//! Sets whether this light casts shadows.
|
||||
/** Enabling this flag won't automatically cast shadows, the meshes
|
||||
will still need shadow scene nodes attached. But one can enable or
|
||||
disable distinct lights for shadow casting for performance reasons.
|
||||
\param shadow True if this light shall cast shadows. */
|
||||
virtual void enableCastShadow(bool shadow=true) = 0;
|
||||
|
||||
//! Check whether this light casts shadows.
|
||||
/** \return True if light would cast shadows, else false. */
|
||||
virtual bool getCastShadow() const = 0;
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
|
|
|
@ -39,9 +39,9 @@ struct SLight
|
|||
{
|
||||
SLight() : AmbientColor(0.f,0.f,0.f), DiffuseColor(1.f,1.f,1.f),
|
||||
SpecularColor(1.f,1.f,1.f), Attenuation(1.f,0.f,0.f),
|
||||
Radius(100.f), OuterCone(45.f), InnerCone(0.f), Falloff(2.f),
|
||||
OuterCone(45.f), InnerCone(0.f), Falloff(2.f),
|
||||
Position(0.f,0.f,0.f), Direction(0.f,0.f,1.f),
|
||||
Type(ELT_POINT), CastShadows(true)
|
||||
Radius(100.f), Type(ELT_POINT), CastShadows(true)
|
||||
{}
|
||||
|
||||
//! Ambient color emitted by the light
|
||||
|
@ -56,12 +56,11 @@ struct SLight
|
|||
SColorf SpecularColor;
|
||||
|
||||
//! Attenuation factors (constant, linear, quadratic)
|
||||
/** Changes the light strength fading over distance */
|
||||
/** Changes the light strength fading over distance.
|
||||
Can also be altered by setting the radius, Attenuation will change to
|
||||
(0,1.f/radius,0). Can be overridden after radius was set. */
|
||||
core::vector3df Attenuation;
|
||||
|
||||
//! Radius of light. Everything within this radius be be lighted.
|
||||
f32 Radius;
|
||||
|
||||
//! The angle of the spot's outer cone. Ignored for other lights.
|
||||
f32 OuterCone;
|
||||
|
||||
|
@ -79,10 +78,13 @@ struct SLight
|
|||
/** If Type is ELT_POINT, it is ignored. Changed via light scene node's rotation. */
|
||||
core::vector3df Direction;
|
||||
|
||||
//! Type of the light. Default: ELT_POINT
|
||||
//! Read-ONLY! Radius of light. Everything within this radius be be lighted.
|
||||
f32 Radius;
|
||||
|
||||
//! Read-ONLY! Type of the light. Default: ELT_POINT
|
||||
E_LIGHT_TYPE Type;
|
||||
|
||||
//! Does the light cast shadows?
|
||||
//! Read-ONLY! Does the light cast shadows?
|
||||
bool CastShadows;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
#include "IVideoDriver.h"
|
||||
#include "IMeshManipulator.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define _IRR_DEBUG_3DS_LOADER_
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
|
|
@ -19,7 +19,9 @@ namespace irr
|
|||
namespace scene
|
||||
{
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define LWO_READER_DEBUG
|
||||
#endif
|
||||
|
||||
#define charsToUIntD(a, b, c, d) ((a << 24) | (b << 16) | (c << 8) | d)
|
||||
inline unsigned int charsToUInt(const char *str)
|
||||
|
|
|
@ -23,12 +23,11 @@ CLightSceneNode::CLightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
|
|||
setDebugName("CLightSceneNode");
|
||||
#endif
|
||||
|
||||
LightData.Radius = radius;
|
||||
LightData.DiffuseColor = color;
|
||||
|
||||
// set some useful specular color
|
||||
LightData.SpecularColor = color.getInterpolated(video::SColor(255,255,255,255),0.7f);
|
||||
|
||||
setRadius(radius);
|
||||
doLightRecalc();
|
||||
}
|
||||
|
||||
|
@ -105,6 +104,62 @@ const core::aabbox3d<f32>& CLightSceneNode::getBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
//! Sets the light's radius of influence.
|
||||
/** Outside this radius the light won't lighten geometry and cast no
|
||||
shadows. Setting the radius will also influence the attenuation, setting
|
||||
it to (0,1/radius,0). If you want to override this behavior, set the
|
||||
attenuation after the radius.
|
||||
\param radius The new radius. */
|
||||
void CLightSceneNode::setRadius(f32 radius)
|
||||
{
|
||||
LightData.Radius=radius;
|
||||
LightData.Attenuation.set(0.f, 1.f/radius, 0.f);
|
||||
}
|
||||
|
||||
|
||||
//! Gets the light's radius of influence.
|
||||
/** \return The current radius. */
|
||||
f32 CLightSceneNode::getRadius() const
|
||||
{
|
||||
return LightData.Radius;
|
||||
}
|
||||
|
||||
|
||||
//! Sets the light type.
|
||||
/** \param type The new type. */
|
||||
void CLightSceneNode::setLightType(video::E_LIGHT_TYPE type)
|
||||
{
|
||||
LightData.Type=type;
|
||||
}
|
||||
|
||||
|
||||
//! Gets the light type.
|
||||
/** \return The current light type. */
|
||||
video::E_LIGHT_TYPE CLightSceneNode::getLightType() const
|
||||
{
|
||||
return LightData.Type;
|
||||
}
|
||||
|
||||
|
||||
//! Sets whether this light casts shadows.
|
||||
/** Enabling this flag won't automatically cast shadows, the meshes
|
||||
will still need shadow scene nodes attached. But one can enable or
|
||||
disable distinct lights for shadow casting for performance reasons.
|
||||
\param shadow True if this light shall cast shadows. */
|
||||
void CLightSceneNode::enableCastShadow(bool shadow)
|
||||
{
|
||||
LightData.CastShadows=shadow;
|
||||
}
|
||||
|
||||
|
||||
//! Check whether this light casts shadows.
|
||||
/** \return True if light would cast shadows, else false. */
|
||||
bool CLightSceneNode::getCastShadow() const
|
||||
{
|
||||
return LightData.CastShadows;
|
||||
}
|
||||
|
||||
|
||||
void CLightSceneNode::doLightRecalc()
|
||||
{
|
||||
if ((LightData.Type == video::ELT_SPOT) || (LightData.Type == video::ELT_DIRECTIONAL))
|
||||
|
|
|
@ -54,6 +54,37 @@ public:
|
|||
//! Creates a clone of this scene node and its children.
|
||||
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
|
||||
|
||||
|
||||
//! Sets the light's radius of influence.
|
||||
/** Outside this radius the light won't lighten geometry and cast no
|
||||
shadows. Setting the radius will also influence the attenuation, setting
|
||||
it to (0,1/radius,0). If you want to override this behavior, set the
|
||||
attenuation after the radius.
|
||||
\param radius The new radius. */
|
||||
virtual void setRadius(f32 radius);
|
||||
|
||||
//! Gets the light's radius of influence.
|
||||
/** \return The current radius. */
|
||||
virtual f32 getRadius() const;
|
||||
|
||||
//! Sets the light type.
|
||||
/** \param type The new type. */
|
||||
virtual void setLightType(video::E_LIGHT_TYPE type);
|
||||
|
||||
//! Gets the light type.
|
||||
/** \return The current light type. */
|
||||
virtual video::E_LIGHT_TYPE getLightType() const;
|
||||
|
||||
//! Sets whether this light casts shadows.
|
||||
/** Enabling this flag won't automatically cast shadows, the meshes
|
||||
will still need shadow scene nodes attached. But one can enable or
|
||||
disable distinct lights for shadow casting for performance reasons.
|
||||
\param shadow True if this light shall cast shadows. */
|
||||
virtual void enableCastShadow(bool shadow=true);
|
||||
|
||||
//! Check whether this light casts shadows.
|
||||
/** \return True if light would cast shadows, else false. */
|
||||
virtual bool getCastShadow() const;
|
||||
private:
|
||||
|
||||
video::SLight LightData;
|
||||
|
|
|
@ -1805,6 +1805,7 @@ void COpenGLDriver::setRenderStates3DMode()
|
|||
{
|
||||
// Reset Texture Stages
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
|
||||
|
||||
// switch back the matrices
|
||||
|
|
|
@ -359,6 +359,9 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
|||
initKeycodes();
|
||||
if (CreationParams.DriverType != video::EDT_NULL)
|
||||
createWindow();
|
||||
|
||||
setResizeAble(false);
|
||||
|
||||
CursorControl = new CCursorControl(CreationParams.WindowSize, this);
|
||||
createDriver();
|
||||
createGUIAndScene();
|
||||
|
@ -569,10 +572,16 @@ bool CIrrDeviceMacOSX::createWindow()
|
|||
|
||||
void CIrrDeviceMacOSX::setResize(int width, int height)
|
||||
{
|
||||
// set new window size
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
// update the size of the opengl rendering context
|
||||
[(NSOpenGLContext *)_oglcontext update];
|
||||
getVideoDriver()->OnResize(core::dimension2d<s32>(width, height));
|
||||
|
||||
// resize the driver to the inner pane size
|
||||
NSRect driverFrame = [(NSWindow*)_window contentRectForFrameRect:[(NSWindow*)_window frame]];
|
||||
getVideoDriver()->OnResize(core::dimension2d<s32>( (s32)driverFrame.size.width, (s32)driverFrame.size.height));
|
||||
}
|
||||
|
||||
void CIrrDeviceMacOSX::createDriver()
|
||||
|
@ -946,10 +955,33 @@ void CIrrDeviceMacOSX::initKeycodes()
|
|||
}
|
||||
|
||||
|
||||
|
||||
//! Sets if the window should be resizeable in windowed mode.
|
||||
void CIrrDeviceMacOSX::setResizeAble(bool resize)
|
||||
{
|
||||
// todo: implement resize
|
||||
// todo: Hacky method, clicking the bottom right corner freezes the window.
|
||||
// We can't set the resize flag without destroying the window, so we'll set the max size to the current size
|
||||
|
||||
if (!_window)
|
||||
return;
|
||||
|
||||
NSSize s;
|
||||
|
||||
if (resize)
|
||||
{
|
||||
s.width = 0.0f;
|
||||
s.height = 0.0f;
|
||||
[(NSWindow *)_window setMinSize: s];
|
||||
s.width = float(_screenWidth);
|
||||
s.height = float(_screenHeight);
|
||||
[(NSWindow *)_window setMaxSize: s];
|
||||
}
|
||||
else
|
||||
{
|
||||
s = [(NSWindow *)_window frame].size;
|
||||
[(NSWindow *)_window setMinSize: s];
|
||||
[(NSWindow *)_window setMaxSize: s];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue