mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-07 10:40:35 +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:
@ -98,18 +98,18 @@ namespace scene
|
||||
CVertexBuffer(video::E_VERTEX_TYPE vertexType) : Vertices(0),
|
||||
MappingHint(EHM_NEVER), ChangedID(1)
|
||||
{
|
||||
setType(vertexType);
|
||||
CVertexBuffer::setType(vertexType);
|
||||
}
|
||||
|
||||
CVertexBuffer(const IVertexBuffer &VertexBufferCopy) :
|
||||
Vertices(0), MappingHint(EHM_NEVER),
|
||||
ChangedID(1)
|
||||
{
|
||||
setType(VertexBufferCopy.getType());
|
||||
reallocate(VertexBufferCopy.size());
|
||||
CVertexBuffer::setType(VertexBufferCopy.getType());
|
||||
CVertexBuffer::reallocate(VertexBufferCopy.size());
|
||||
|
||||
for (u32 n=0;n<VertexBufferCopy.size();++n)
|
||||
push_back(VertexBufferCopy[n]);
|
||||
CVertexBuffer::push_back(VertexBufferCopy[n]);
|
||||
}
|
||||
|
||||
virtual ~CVertexBuffer()
|
||||
|
34
include/ESceneNodeUpdateAbs.h
Normal file
34
include/ESceneNodeUpdateAbs.h
Normal file
@ -0,0 +1,34 @@
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef IRR_E_SCENE_NODE_UPDATE_ABS_H_INCLUDED
|
||||
#define IRR_E_SCENE_NODE_UPDATE_ABS_H_INCLUDED
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
{
|
||||
//! Options how ISceneNode::updateAbsolutePosition calculates the AbsoluteTransformation
|
||||
enum ESCENE_NODE_UPDATE_ABS
|
||||
{
|
||||
//! Node and parent transformation matrices are multiplied (default)
|
||||
ESNUA_TRANSFORM_MATRIX,
|
||||
|
||||
//! Only transform the position of the node transformation matrix
|
||||
//! by the parent transformation matrix.
|
||||
//! Parent will not affect the rotation/scale of the node transformation.
|
||||
ESNUA_TRANSFORM_POSITION
|
||||
};
|
||||
|
||||
//! Names for culling type
|
||||
const c8* const SceneNodeUpdateAbsNames[] =
|
||||
{
|
||||
"matrix",
|
||||
"pos",
|
||||
0
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
@ -87,7 +87,7 @@ namespace scene
|
||||
s32 numTags; //number of 'tags' per frame
|
||||
s32 numMeshes; //number of meshes/skins
|
||||
s32 numMaxSkins;//maximum number of unique skins used in md3 file. artefact md2
|
||||
s32 frameStart; //starting position of frame-structur
|
||||
s32 frameStart; //starting position of frame-structure
|
||||
s32 tagStart; //starting position of tag-structures
|
||||
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
|
||||
s32 fileSize;
|
||||
|
@ -102,7 +102,7 @@ namespace scene
|
||||
zfail method, if not, zpass is used.
|
||||
\param infinity: Value used by the shadow volume algorithm to
|
||||
scale the shadow volume. For zfail shadow volumes on some drivers
|
||||
only suppport finite shadows, so camera zfar must be larger than
|
||||
only support finite shadows, so camera zfar must be larger than
|
||||
shadow back cap,which is depending on the infinity parameter).
|
||||
Infinity value also scales by the scaling factors of the model.
|
||||
If shadows don't show up with zfail then try reducing infinity.
|
||||
|
@ -635,7 +635,7 @@ public:
|
||||
//! Adds an attribute as 3d triangle
|
||||
virtual void addTriangle3d(const c8* attributeName, const core::triangle3df& v) = 0;
|
||||
|
||||
//! Sets an attribute as 3d trianle
|
||||
//! Sets an attribute as 3d triangle
|
||||
virtual void setAttribute(const c8* attributeName, const core::triangle3df& v) = 0;
|
||||
|
||||
//! Gets an attribute as a 3d triangle
|
||||
|
@ -26,7 +26,7 @@ namespace gui
|
||||
ECI_HELP, // Arrow and question mark
|
||||
ECI_IBEAM, // typical text-selection cursor
|
||||
ECI_NO, // should not click icon
|
||||
ECI_WAIT, // hourclass
|
||||
ECI_WAIT, // hourglass
|
||||
ECI_SIZEALL, // arrow in all directions
|
||||
ECI_SIZENESW, // resizes in direction north-east or south-west
|
||||
ECI_SIZENWSE, // resizes in direction north-west or south-east
|
||||
@ -160,6 +160,12 @@ namespace gui
|
||||
\param rect: A pointer to an reference rectangle or 0 to disable the reference rectangle.*/
|
||||
virtual void setReferenceRect(core::rect<s32>* rect=0) = 0;
|
||||
|
||||
//! Returns the current absolute reference rect used for the cursor position
|
||||
/** \param rect Will receive the reference rectangle when the function returns true
|
||||
When the result is false drivers can still write some platform specific values in there.
|
||||
Generally at least the width/height of the returned rect will correspond to the current window size.
|
||||
\return Return true when a reference rectangle has been set and is used by this driver */
|
||||
virtual bool getReferenceRect(core::rect<s32>& rect) { return false; }
|
||||
|
||||
//! Sets the active cursor icon
|
||||
/** Setting cursor icons is so far only supported on Win32 and Linux */
|
||||
|
@ -54,9 +54,9 @@ namespace gui
|
||||
|
||||
//! Sets text justification of the text area
|
||||
/** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
|
||||
EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
|
||||
EGUIA_LOWERRIGHT for right justified, or EGUIA_CENTER for centered text.
|
||||
\param vertical: EGUIA_UPPERLEFT to align with top edge,
|
||||
EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
|
||||
EGUIA_LOWERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
|
||||
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
|
||||
|
||||
//! Set the maximal number of rows for the selection listbox
|
||||
|
@ -434,7 +434,7 @@ public:
|
||||
if (el)
|
||||
{
|
||||
// find the highest element number
|
||||
el->getNextElement(-1, true, IsTabGroup, first, closest, true);
|
||||
el->getNextElement(-1, true, IsTabGroup, first, closest, true, true);
|
||||
if (first)
|
||||
{
|
||||
TabOrder = first->getTabOrder() + 1;
|
||||
@ -720,7 +720,7 @@ public:
|
||||
}
|
||||
}
|
||||
// search within children
|
||||
if ((*it)->getNextElement(startOrder, reverse, group, first, closest))
|
||||
if ((*it)->getNextElement(startOrder, reverse, group, first, closest, includeInvisible, includeDisabled))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -26,6 +26,11 @@ namespace gui
|
||||
EGUI_LBC_ICON,
|
||||
//! Color of selected icon
|
||||
EGUI_LBC_ICON_HIGHLIGHT,
|
||||
//! Color of background.
|
||||
//! Note that this one is drawn over the listbox background and when not used there is no other default
|
||||
EGUI_LBC_BACKGROUND,
|
||||
//! Color of selected background
|
||||
EGUI_LBC_BACKGROUND_HIGHLIGHT,
|
||||
//! Not used, just counts the number of available colors
|
||||
EGUI_LBC_COUNT
|
||||
};
|
||||
|
@ -51,6 +51,12 @@ namespace gui
|
||||
//! Get the current value of the spinbox
|
||||
virtual f32 getValue() const = 0;
|
||||
|
||||
//! Get the value the spinbox would have for the given text
|
||||
/** Note: There is no rounding for decimal places going on here
|
||||
The reason is that so far spinbox doesn't restrict entering longer
|
||||
numbers (or any other text) (TODO)*/
|
||||
virtual f32 getValueFor(const wchar_t* text) const = 0;
|
||||
|
||||
//! set the range of values which can be used in the spinbox
|
||||
/** \param min: minimum value
|
||||
\param max: maximum value */
|
||||
@ -68,7 +74,8 @@ namespace gui
|
||||
virtual void setStepSize(f32 step=1.f) = 0;
|
||||
|
||||
//! Sets the number of decimal places to display.
|
||||
//! Note that this also rounds the range to the same number of decimal places.
|
||||
//! Note: This also rounds the range to the same number of decimal places.
|
||||
//! Note: This is only used for the buttons so far, text-input ignores it (TODO)
|
||||
/** \param places: The number of decimal places to display, use -1 to reset */
|
||||
virtual void setDecimalPlaces(s32 places) = 0;
|
||||
|
||||
@ -82,6 +89,12 @@ namespace gui
|
||||
//! Gets when the spinbox has to validate entered text.
|
||||
/** \return A combination of EGUI_SPINBOX_VALIDATION bit flags */
|
||||
virtual u32 getValidateOn() const = 0;
|
||||
|
||||
//! Gets previous value in EGET_SPINBOX_CHANGED events
|
||||
/** Note: That value changes as soon as a new value is set (to the new value).
|
||||
So it's only useful to check for last value in the event and has no use otherwise.
|
||||
Also it's possible to mess it up by setting text via the editbox sub-element directly. */
|
||||
virtual f32 getOldValue() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -88,9 +88,9 @@ namespace gui
|
||||
|
||||
//! Sets text justification mode
|
||||
/** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
|
||||
EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
|
||||
EGUIA_LOWERRIGHT for right justified, or EGUIA_CENTER for centered text.
|
||||
\param vertical: EGUIA_UPPERLEFT to align with top edge (default),
|
||||
EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text. */
|
||||
EGUIA_LOWERRIGHT for bottom edge, or EGUIA_CENTER for centered text. */
|
||||
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
|
||||
|
||||
//! Enables or disables word wrap for using the static text as multiline text control.
|
||||
|
@ -135,8 +135,8 @@ public:
|
||||
|
||||
//! Create an arrow mesh, composed of a cylinder and a cone.
|
||||
/**
|
||||
\param tesselationCylinder Number of quads composing the cylinder.
|
||||
\param tesselationCone Number of triangles composing the cone's roof.
|
||||
\param tessellationCylinder Number of quads composing the cylinder.
|
||||
\param tessellationCone Number of triangles composing the cone's roof.
|
||||
\param height Total height of the arrow
|
||||
\param cylinderHeight Total height of the cylinder, should be lesser
|
||||
than total height
|
||||
@ -147,8 +147,8 @@ public:
|
||||
\param colorCone color of the cone
|
||||
\return Generated mesh.
|
||||
*/
|
||||
virtual IMesh* createArrowMesh(const u32 tesselationCylinder = 4,
|
||||
const u32 tesselationCone = 8, const f32 height = 1.f,
|
||||
virtual IMesh* createArrowMesh(const u32 tessellationCylinder = 4,
|
||||
const u32 tessellationCone = 8, const f32 height = 1.f,
|
||||
const f32 cylinderHeight = 0.6f, const f32 widthCylinder = 0.05f,
|
||||
const f32 widthCone = 0.3f, const video::SColor colorCylinder = 0xFFFFFFFF,
|
||||
const video::SColor colorCone = 0xFFFFFFFF) const =0;
|
||||
@ -168,7 +168,7 @@ public:
|
||||
/**
|
||||
\param radius Radius of the cylinder.
|
||||
\param length Length of the cylinder.
|
||||
\param tesselation Number of quads around the circumference of the cylinder.
|
||||
\param tessellation Number of quads around the circumference of the cylinder.
|
||||
\param color The color of the cylinder.
|
||||
\param closeTop If true, close the ends of the cylinder, otherwise leave them open.
|
||||
\param oblique X-offset (shear) of top compared to bottom.
|
||||
@ -183,7 +183,7 @@ public:
|
||||
\return Generated mesh.
|
||||
*/
|
||||
virtual IMesh* createCylinderMesh(f32 radius, f32 length,
|
||||
u32 tesselation,
|
||||
u32 tessellation,
|
||||
const video::SColor& color=video::SColor(0xffffffff),
|
||||
bool closeTop=true, f32 oblique=0.f, u32 normalType=0) const =0;
|
||||
|
||||
@ -191,13 +191,13 @@ public:
|
||||
/**
|
||||
\param radius Radius of the cone.
|
||||
\param length Length of the cone.
|
||||
\param tesselation Number of quads around the circumference of the cone.
|
||||
\param tessellation Number of quads around the circumference of the cone.
|
||||
\param colorTop The color of the top of the cone.
|
||||
\param colorBottom The color of the bottom of the cone.
|
||||
\param oblique (to be documented)
|
||||
\return Generated mesh.
|
||||
*/
|
||||
virtual IMesh* createConeMesh(f32 radius, f32 length, u32 tesselation,
|
||||
virtual IMesh* createConeMesh(f32 radius, f32 length, u32 tessellation,
|
||||
const video::SColor& colorTop=video::SColor(0xffffffff),
|
||||
const video::SColor& colorBottom=video::SColor(0xffffffff),
|
||||
f32 oblique=0.f) const =0;
|
||||
|
@ -19,7 +19,7 @@ enum ELOG_LEVEL
|
||||
//! Used for printing information helpful in debugging
|
||||
ELL_DEBUG,
|
||||
|
||||
//! Useful information to print. For example hardware infos or something started/stopped.
|
||||
//! Useful information to print. For example hardware info or something started/stopped.
|
||||
ELL_INFORMATION,
|
||||
|
||||
//! Warnings that something isn't as expected and can cause oddities
|
||||
|
@ -40,7 +40,7 @@ namespace quake3
|
||||
:defaultLightMapMaterial ( video::EMT_LIGHTMAP_M4 ),
|
||||
defaultModulate ( video::EMFN_MODULATE_4X ),
|
||||
defaultFilter ( video::EMF_BILINEAR_FILTER ),
|
||||
patchTesselation ( 8 ),
|
||||
patchTessellation ( 8 ),
|
||||
verbose ( 0 ),
|
||||
startTime ( 0 ), endTime ( 0 ),
|
||||
mergeShaderBuffer ( 1 ),
|
||||
@ -61,7 +61,7 @@ namespace quake3
|
||||
video::E_MATERIAL_TYPE defaultLightMapMaterial;
|
||||
video::E_MODULATE_FUNC defaultModulate;
|
||||
video::E_MATERIAL_FLAG defaultFilter;
|
||||
s32 patchTesselation;
|
||||
s32 patchTessellation;
|
||||
s32 verbose;
|
||||
u32 startTime;
|
||||
u32 endTime;
|
||||
|
@ -754,6 +754,8 @@ namespace scene
|
||||
//! Adds a skydome scene node to the scene graph.
|
||||
/** A skydome is a large (half-) sphere with a panoramic texture
|
||||
on the inside and is drawn around the camera position.
|
||||
Note: If the texture is mirrored you can use a negative scale for
|
||||
the texture-matrix of the node to still work with it.
|
||||
\param texture: Texture for the dome.
|
||||
\param horiRes: Number of vertices of a horizontal layer of the sphere.
|
||||
\param vertRes: Number of vertices of a vertical layer of the sphere.
|
||||
@ -1013,8 +1015,8 @@ namespace scene
|
||||
/** \param name Name of the mesh
|
||||
\param vtxColorCylinder color of the cylinder
|
||||
\param vtxColorCone color of the cone
|
||||
\param tesselationCylinder Number of quads the cylinder side consists of
|
||||
\param tesselationCone Number of triangles the cone's roof consists of
|
||||
\param tessellationCylinder Number of quads the cylinder side consists of
|
||||
\param tessellationCone Number of triangles the cone's roof consists of
|
||||
\param height Total height of the arrow
|
||||
\param cylinderHeight Total height of the cylinder, should be lesser than total height
|
||||
\param widthCylinder Diameter of the cylinder
|
||||
@ -1024,7 +1026,7 @@ namespace scene
|
||||
virtual IAnimatedMesh* addArrowMesh(const io::path& name,
|
||||
video::SColor vtxColorCylinder=0xFFFFFFFF,
|
||||
video::SColor vtxColorCone=0xFFFFFFFF,
|
||||
u32 tesselationCylinder=4, u32 tesselationCone=8,
|
||||
u32 tessellationCylinder=4, u32 tessellationCone=8,
|
||||
f32 height=1.f, f32 cylinderHeight=0.6f,
|
||||
f32 widthCylinder=0.05f, f32 widthCone=0.3f) = 0;
|
||||
|
||||
@ -1140,7 +1142,7 @@ namespace scene
|
||||
|
||||
//! Clear all nodes which are currently registered for rendering
|
||||
/** Usually you don't have to care about this as drawAll will clear nodes
|
||||
after rendering them. But sometimes you might have to manully reset this.
|
||||
after rendering them. But sometimes you might have to manually reset this.
|
||||
For example when you deleted nodes between registering and rendering. */
|
||||
virtual void clearAllRegisteredNodesForRendering() = 0;
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "IAttributeExchangingObject.h"
|
||||
#include "ESceneNodeTypes.h"
|
||||
#include "ESceneNodeUpdateAbs.h"
|
||||
#include "ECullingTypes.h"
|
||||
#include "EDebugSceneTypes.h"
|
||||
#include "ISceneNodeAnimator.h"
|
||||
@ -29,6 +30,7 @@ namespace scene
|
||||
//! Typedef for list of scene node animators
|
||||
typedef core::list<ISceneNodeAnimator*> ISceneNodeAnimatorList;
|
||||
|
||||
|
||||
//! Scene node interface.
|
||||
/** A scene node is a node in the hierarchical scene graph. Every scene
|
||||
node may have children, which are also scene nodes. Children move
|
||||
@ -48,7 +50,8 @@ namespace scene
|
||||
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f))
|
||||
: RelativeTranslation(position), RelativeRotation(rotation), RelativeScale(scale),
|
||||
Parent(0), SceneManager(mgr), TriangleSelector(0), ID(id),
|
||||
AutomaticCullingState(EAC_BOX), DebugDataVisible(EDS_OFF),
|
||||
AbsPosUpdateBehavior(ESNUA_TRANSFORM_MATRIX), AutomaticCullingState(EAC_BOX),
|
||||
DebugDataVisible(EDS_OFF),
|
||||
IsVisible(true), IsDebugObject(false)
|
||||
{
|
||||
if (parent)
|
||||
@ -76,7 +79,7 @@ namespace scene
|
||||
|
||||
//! This method is called just before the rendering process of the whole scene.
|
||||
/** Nodes may register themselves in the render pipeline during this call,
|
||||
precalculate the geometry which should be renderered, and prevent their
|
||||
precalculate the geometry which should be rendered, and prevent their
|
||||
children from being able to register themselves if they are clipped by simply
|
||||
not calling their OnRegisterSceneNode method.
|
||||
If you are implementing your own scene node, you should overwrite this method
|
||||
@ -558,6 +561,18 @@ namespace scene
|
||||
return AutomaticCullingState;
|
||||
}
|
||||
|
||||
//! Set how updateAbsolutePosition calculates the absolute transformation matrix
|
||||
void setUpdateAbsolutePosBehavior(ESCENE_NODE_UPDATE_ABS behavior)
|
||||
{
|
||||
AbsPosUpdateBehavior = behavior;
|
||||
}
|
||||
|
||||
//! Get how updateAbsolutePosition calculates the absolute transformation matrix
|
||||
ESCENE_NODE_UPDATE_ABS getUpdateAbsolutePosBehavior() const
|
||||
{
|
||||
return AbsPosUpdateBehavior;
|
||||
}
|
||||
|
||||
|
||||
//! Sets if debug data like bounding boxes should be drawn.
|
||||
/** A bitwise OR of the types from @ref irr::scene::E_DEBUG_SCENE_TYPE.
|
||||
@ -659,15 +674,24 @@ namespace scene
|
||||
}
|
||||
|
||||
|
||||
//! Updates the absolute position based on the relative and the parents position
|
||||
/** Note: This does not recursively update the parents absolute positions, so if you have a deeper
|
||||
//! Updates the absolute transformation or position based on the relative and the parents transformation
|
||||
/** It's exact behavior can be controlled by setUpdateAbsolutePosBehavior.
|
||||
Note: This does not recursively update the parents absolute positions, so if you have a deeper
|
||||
hierarchy you might want to update the parents first.*/
|
||||
virtual void updateAbsolutePosition()
|
||||
{
|
||||
if (Parent)
|
||||
{
|
||||
AbsoluteTransformation =
|
||||
Parent->getAbsoluteTransformation() * getRelativeTransformation();
|
||||
if ( AbsPosUpdateBehavior == ESNUA_TRANSFORM_MATRIX )
|
||||
{
|
||||
AbsoluteTransformation =
|
||||
Parent->getAbsoluteTransformation() * getRelativeTransformation();
|
||||
}
|
||||
else if ( AbsPosUpdateBehavior == ESNUA_TRANSFORM_POSITION )
|
||||
{
|
||||
AbsoluteTransformation = getRelativeTransformation();
|
||||
Parent->getAbsoluteTransformation().transformVect(reinterpret_cast<irr::core::vector3df&>(AbsoluteTransformation[12]));
|
||||
}
|
||||
}
|
||||
else
|
||||
AbsoluteTransformation = getRelativeTransformation();
|
||||
@ -709,6 +733,7 @@ namespace scene
|
||||
out->addVector3d("Scale", getScale() );
|
||||
|
||||
out->addBool("Visible", IsVisible );
|
||||
out->addEnum("AbsPosUpdate", (s32)AbsPosUpdateBehavior, SceneNodeUpdateAbsNames);
|
||||
out->addInt("AutomaticCulling", AutomaticCullingState);
|
||||
out->addInt("DebugDataVisible", DebugDataVisible );
|
||||
out->addBool("IsDebugObject", IsDebugObject );
|
||||
@ -734,8 +759,12 @@ namespace scene
|
||||
setScale(in->getAttributeAsVector3d("Scale", RelativeScale));
|
||||
|
||||
IsVisible = in->getAttributeAsBool("Visible", IsVisible);
|
||||
|
||||
AbsPosUpdateBehavior = (ESCENE_NODE_UPDATE_ABS)in->getAttributeAsEnumeration("AbsPosUpdate", SceneNodeUpdateAbsNames, (s32)AbsPosUpdateBehavior);
|
||||
|
||||
if (in->existsAttribute("AutomaticCulling"))
|
||||
{
|
||||
// compatibility for older version, new one uses int's
|
||||
const s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling",
|
||||
scene::AutomaticCullingNames);
|
||||
if (tmpState != -1)
|
||||
@ -779,6 +808,7 @@ namespace scene
|
||||
RelativeScale = toCopyFrom->RelativeScale;
|
||||
ID = toCopyFrom->ID;
|
||||
setTriangleSelector(toCopyFrom->TriangleSelector);
|
||||
AbsPosUpdateBehavior = toCopyFrom->AbsPosUpdateBehavior;
|
||||
AutomaticCullingState = toCopyFrom->AutomaticCullingState;
|
||||
DebugDataVisible = toCopyFrom->DebugDataVisible;
|
||||
IsVisible = toCopyFrom->IsVisible;
|
||||
@ -853,6 +883,9 @@ namespace scene
|
||||
//! ID of the node.
|
||||
s32 ID;
|
||||
|
||||
//! How updateAbsolutePosition calculates AbsoluteTransformation
|
||||
ESCENE_NODE_UPDATE_ABS AbsPosUpdateBehavior;
|
||||
|
||||
//! Automatic culling state
|
||||
u32 AutomaticCullingState;
|
||||
|
||||
|
@ -22,6 +22,14 @@ class IShaderConstantSetCallBack : public virtual IReferenceCounted
|
||||
{
|
||||
public:
|
||||
|
||||
//! Called by the engine after a shader material has been created successfully
|
||||
/** If you are using one callback instance per shader (much recommended)
|
||||
this is a good place to get shader constant id's for high level shaders.
|
||||
\param services: Pointer to an interface providing methods to set/get the constants for the shader.
|
||||
\param userData: Userdata int which can be specified when creating the shader. */
|
||||
virtual void OnCreate(IMaterialRendererServices* services, s32 userData) { }
|
||||
|
||||
|
||||
//! Called to let the callBack know the used material (optional method)
|
||||
/**
|
||||
\code
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
u32 Minute;
|
||||
// Second of the minute, due to extra seconds from 0 to 61
|
||||
u32 Second;
|
||||
// Year of the Gregorian calender
|
||||
// Year of the Gregorian calendar
|
||||
s32 Year;
|
||||
// Month of the year, from 1 to 12
|
||||
u32 Month;
|
||||
|
@ -514,8 +514,8 @@ namespace video
|
||||
- For a 32-bit texture only the red channel is regarded
|
||||
- For a 16-bit texture the rgb-values are averaged.
|
||||
Output channels red/green for X/Y and blue for up (Z).
|
||||
For a 32-bit texture we store additionally the height value in the
|
||||
alpha channel. This value is used by the video::EMT_PARALLAX_MAP_SOLID
|
||||
For a 32-bit texture we store additionally the height value in the
|
||||
alpha channel. This value is used by the video::EMT_PARALLAX_MAP_SOLID
|
||||
material and similar materials.
|
||||
On the borders the texture is considered to repeat.
|
||||
\param texture Height map texture which is converted to a normal map.
|
||||
@ -789,7 +789,7 @@ namespace video
|
||||
//! Draws a 2d image without any special effects
|
||||
/** \param texture Pointer to texture to use.
|
||||
\param destPos Upper left 2d destination position where the
|
||||
image will be drawn.
|
||||
image will be drawn.
|
||||
\param useAlphaChannelOfTexture: If true, the alpha channel of
|
||||
the texture is used to draw the image.*/
|
||||
virtual void draw2DImage(const video::ITexture* texture,
|
||||
@ -1231,7 +1231,7 @@ namespace video
|
||||
\param data A byte array with pixel color information
|
||||
\param ownForeignMemory If true, the image will use the data
|
||||
pointer directly and own it afterward. If false, the memory
|
||||
will by copied internally.
|
||||
will by copied internally.
|
||||
WARNING: Setting this to 'true' will not work across dll boundaries.
|
||||
So unless you link Irrlicht statically you should keep this to 'false'.
|
||||
The parameter is mainly for internal usage.
|
||||
@ -1334,7 +1334,7 @@ namespace video
|
||||
E_MATERIAL_TYPE enum or a value which was returned by
|
||||
addMaterialRenderer().
|
||||
\return String with the name of the renderer, or 0 if not
|
||||
exisiting */
|
||||
existing */
|
||||
virtual const c8* getMaterialRendererName(u32 idx) const =0;
|
||||
|
||||
//! Sets the name of a material renderer.
|
||||
@ -1429,7 +1429,9 @@ namespace video
|
||||
}
|
||||
|
||||
//! Make a screenshot of the last rendered frame.
|
||||
/** \return An image created from the last rendered frame. */
|
||||
/**
|
||||
\param target All current drivers only support ERT_FRAME_BUFFER
|
||||
\return An image created from the last rendered frame. */
|
||||
virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) =0;
|
||||
|
||||
//! Check if the image is already loaded.
|
||||
|
@ -351,7 +351,7 @@ you will not be able to use anything provided by the GUI Environment, including
|
||||
#undef _IRR_COMPILE_WITH_GUI_
|
||||
#endif
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_PARTICLES to compile the engine the withe build-in particle system
|
||||
//! Define _IRR_COMPILE_WITH_PARTICLES to compile the engine the with the build-in particle system
|
||||
/** You can disable this if you don't need particles or use an external particle system. */
|
||||
#define _IRR_COMPILE_WITH_PARTICLES_
|
||||
#ifdef NO_IRR_COMPILE_WITH_PARTICLES_
|
||||
|
@ -76,13 +76,17 @@ namespace irr
|
||||
virtual bool run() = 0;
|
||||
|
||||
//! Cause the device to temporarily pause execution and let other processes run.
|
||||
/** This should bring down processor usage without major
|
||||
performance loss for Irrlicht */
|
||||
/** This should bring down processor usage without major performance loss for Irrlicht.
|
||||
But this is system dependent, so there's a chance your thread won't get control back quickly.
|
||||
*/
|
||||
virtual void yield() = 0;
|
||||
|
||||
//! Pause execution and let other processes to run for a specified amount of time.
|
||||
/** It may not wait the full given time, as sleep may be interrupted
|
||||
\param timeMs: Time to sleep for in milliseconds.
|
||||
/** It may not wait the full given time, as sleep may be interrupted and also may wait longer on some OS.
|
||||
\param timeMs: Time to sleep for in milliseconds. Note that the OS can round up this number.
|
||||
On Windows you usually get at least 15ms sleep time minium for any value > 0.
|
||||
So if you call this in your main loop you can't get more than 65 FPS anymore in your game.
|
||||
On most Linux systems it's relatively exact, but also no guarantee.
|
||||
\param pauseTimer: If true, pauses the device timer while sleeping
|
||||
*/
|
||||
virtual void sleep(u32 timeMs, bool pauseTimer=false) = 0;
|
||||
|
@ -25,7 +25,7 @@ enum E_VERTEX_TYPE
|
||||
EVT_2TCOORDS,
|
||||
|
||||
//! Vertex with a tangent and binormal vector, video::S3DVertexTangents.
|
||||
/** Usually used for tangent space normal mapping.
|
||||
/** Usually used for tangent space normal mapping.
|
||||
Usually tangent and binormal get send to shaders as texture coordinate sets 1 and 2.
|
||||
*/
|
||||
EVT_TANGENTS
|
||||
@ -150,21 +150,21 @@ struct S3DVertex2TCoords : public S3DVertex
|
||||
//! Equality operator
|
||||
bool operator==(const S3DVertex2TCoords& other) const
|
||||
{
|
||||
return ((static_cast<S3DVertex>(*this)==other) &&
|
||||
return ((static_cast<S3DVertex>(*this)==static_cast<const S3DVertex&>(other)) &&
|
||||
(TCoords2 == other.TCoords2));
|
||||
}
|
||||
|
||||
//! Inequality operator
|
||||
bool operator!=(const S3DVertex2TCoords& other) const
|
||||
{
|
||||
return ((static_cast<S3DVertex>(*this)!=other) ||
|
||||
return ((static_cast<S3DVertex>(*this)!=static_cast<const S3DVertex&>(other)) ||
|
||||
(TCoords2 != other.TCoords2));
|
||||
}
|
||||
|
||||
bool operator<(const S3DVertex2TCoords& other) const
|
||||
{
|
||||
return ((static_cast<S3DVertex>(*this) < other) ||
|
||||
((static_cast<S3DVertex>(*this) == other) && (TCoords2 < other.TCoords2)));
|
||||
((static_cast<S3DVertex>(*this) == static_cast<const S3DVertex&>(other)) && (TCoords2 < other.TCoords2)));
|
||||
}
|
||||
|
||||
static E_VERTEX_TYPE getType()
|
||||
@ -186,7 +186,7 @@ struct S3DVertex2TCoords : public S3DVertex
|
||||
|
||||
|
||||
//! Vertex with a tangent and binormal vector.
|
||||
/** Usually used for tangent space normal mapping.
|
||||
/** Usually used for tangent space normal mapping.
|
||||
Usually tangent and binormal get send to shaders as texture coordinate sets 1 and 2.
|
||||
*/
|
||||
struct S3DVertexTangents : public S3DVertex
|
||||
@ -225,14 +225,14 @@ struct S3DVertexTangents : public S3DVertex
|
||||
|
||||
bool operator==(const S3DVertexTangents& other) const
|
||||
{
|
||||
return ((static_cast<S3DVertex>(*this)==other) &&
|
||||
return ((static_cast<S3DVertex>(*this)==static_cast<const S3DVertex&>(other)) &&
|
||||
(Tangent == other.Tangent) &&
|
||||
(Binormal == other.Binormal));
|
||||
}
|
||||
|
||||
bool operator!=(const S3DVertexTangents& other) const
|
||||
{
|
||||
return ((static_cast<S3DVertex>(*this)!=other) ||
|
||||
return ((static_cast<S3DVertex>(*this)!=static_cast<const S3DVertex&>(other)) ||
|
||||
(Tangent != other.Tangent) ||
|
||||
(Binormal != other.Binormal));
|
||||
}
|
||||
@ -240,8 +240,8 @@ struct S3DVertexTangents : public S3DVertex
|
||||
bool operator<(const S3DVertexTangents& other) const
|
||||
{
|
||||
return ((static_cast<S3DVertex>(*this) < other) ||
|
||||
((static_cast<S3DVertex>(*this) == other) && (Tangent < other.Tangent)) ||
|
||||
((static_cast<S3DVertex>(*this) == other) && (Tangent == other.Tangent) && (Binormal < other.Binormal)));
|
||||
((static_cast<S3DVertex>(*this) == static_cast<const S3DVertex&>(other)) && (Tangent < other.Tangent)) ||
|
||||
((static_cast<S3DVertex>(*this) == static_cast<const S3DVertex&>(other)) && (Tangent == other.Tangent) && (Binormal < other.Binormal)));
|
||||
}
|
||||
|
||||
static E_VERTEX_TYPE getType()
|
||||
|
@ -258,7 +258,7 @@ namespace video
|
||||
//! This is also the value which is set when SMaterial::setFlag(EMF_ZWRITE_ENABLE) is enabled.
|
||||
//! Usually zwriting is enabled non-transparent materials - as far as Irrlicht can recognize those.
|
||||
//! Basically Irrlicht tries to handle the zwriting for you and assumes transparent materials don't need it.
|
||||
//! This is addionally affected by IVideoDriver::setAllowZWriteOnTransparent
|
||||
//! This is additionally affected by IVideoDriver::setAllowZWriteOnTransparent
|
||||
EZW_AUTO,
|
||||
|
||||
//! zwrite always enabled for this material
|
||||
@ -299,7 +299,7 @@ namespace video
|
||||
IRRLICHT_API extern u32 MATERIAL_MAX_TEXTURES_USED;
|
||||
|
||||
//! Struct for holding parameters for a material renderer
|
||||
// Note for implementors: Serialization is in CNullDriver
|
||||
// Note for implementers: Serialization is in CNullDriver
|
||||
class SMaterial
|
||||
{
|
||||
public:
|
||||
@ -310,8 +310,8 @@ namespace video
|
||||
Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f),
|
||||
ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
|
||||
ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE), BlendFactor(0.0f),
|
||||
PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT),
|
||||
PolygonOffsetDepthBias(0.f), PolygonOffsetSlopeScale(0.f),
|
||||
PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT),
|
||||
Wireframe(false), PointCloud(false), GouraudShading(true),
|
||||
Lighting(true), ZWriteEnable(EZW_AUTO), BackfaceCulling(true), FrontfaceCulling(false),
|
||||
FogEnable(false), NormalizeNormals(false), UseMipMaps(true)
|
||||
@ -413,7 +413,7 @@ namespace video
|
||||
|
||||
//! Store the blend operation of choice
|
||||
/** Values to be chosen from E_BLEND_OPERATION. */
|
||||
E_BLEND_OPERATION BlendOperation:4;
|
||||
E_BLEND_OPERATION BlendOperation:8;
|
||||
|
||||
//! Store the blend factors
|
||||
/** textureBlendFunc/textureBlendFuncSeparate functions should be used to write
|
||||
@ -427,18 +427,6 @@ namespace video
|
||||
(setting it to EBO_ADD is probably the most common one value). */
|
||||
f32 BlendFactor;
|
||||
|
||||
//! DEPRECATED. Will be removed after Irrlicht 1.9. Please use PolygonOffsetDepthBias instead.
|
||||
/** Factor specifying how far the polygon offset should be made.
|
||||
Specifying 0 disables the polygon offset. The direction is specified separately.
|
||||
The factor can be from 0 to 7.
|
||||
Note: This probably never worked on Direct3D9 (was coded for D3D8 which had different value ranges) */
|
||||
u8 PolygonOffsetFactor:3;
|
||||
|
||||
//! DEPRECATED. Will be removed after Irrlicht 1.9.
|
||||
/** Flag defining the direction the polygon offset is applied to.
|
||||
Can be to front or to back, specified by values from E_POLYGON_OFFSET. */
|
||||
E_POLYGON_OFFSET PolygonOffsetDirection:1;
|
||||
|
||||
//! A constant z-buffer offset for a polygon/line/point
|
||||
/** The range of the value is driver specific.
|
||||
On OpenGL you get units which are multiplied by the smallest value that is guaranteed to produce a resolvable offset.
|
||||
@ -457,6 +445,18 @@ namespace video
|
||||
and -1.f to pull them towards the camera. */
|
||||
f32 PolygonOffsetSlopeScale;
|
||||
|
||||
//! DEPRECATED. Will be removed after Irrlicht 1.9. Please use PolygonOffsetDepthBias instead.
|
||||
/** Factor specifying how far the polygon offset should be made.
|
||||
Specifying 0 disables the polygon offset. The direction is specified separately.
|
||||
The factor can be from 0 to 7.
|
||||
Note: This probably never worked on Direct3D9 (was coded for D3D8 which had different value ranges) */
|
||||
u8 PolygonOffsetFactor:3;
|
||||
|
||||
//! DEPRECATED. Will be removed after Irrlicht 1.9.
|
||||
/** Flag defining the direction the polygon offset is applied to.
|
||||
Can be to front or to back, specified by values from E_POLYGON_OFFSET. */
|
||||
E_POLYGON_OFFSET PolygonOffsetDirection:2;
|
||||
|
||||
//! Draw as wireframe or filled triangles? Default: false
|
||||
/** The user can access a material flag using
|
||||
\code material.Wireframe=true \endcode
|
||||
@ -475,7 +475,7 @@ namespace video
|
||||
//! Is the zbuffer writable or is it read-only. Default: EZW_AUTO.
|
||||
/** If this parameter is not EZW_OFF, you probably also want to set ZBuffer
|
||||
to values other than ECFN_DISABLED */
|
||||
E_ZWRITE ZWriteEnable:2;
|
||||
E_ZWRITE ZWriteEnable:3;
|
||||
|
||||
//! Is backface culling enabled? Default: true
|
||||
bool BackfaceCulling:1;
|
||||
@ -710,10 +710,10 @@ namespace video
|
||||
ColorMaterial != b.ColorMaterial ||
|
||||
BlendOperation != b.BlendOperation ||
|
||||
BlendFactor != b.BlendFactor ||
|
||||
PolygonOffsetFactor != b.PolygonOffsetFactor ||
|
||||
PolygonOffsetDirection != b.PolygonOffsetDirection ||
|
||||
PolygonOffsetDepthBias != b.PolygonOffsetDepthBias ||
|
||||
PolygonOffsetSlopeScale != b.PolygonOffsetSlopeScale ||
|
||||
PolygonOffsetFactor != b.PolygonOffsetFactor ||
|
||||
PolygonOffsetDirection != b.PolygonOffsetDirection ||
|
||||
UseMipMaps != b.UseMipMaps
|
||||
;
|
||||
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES_USED) && !different; ++i)
|
||||
|
@ -201,7 +201,7 @@ namespace io
|
||||
//! An xml cdata section like <![CDATA[ this is some CDATA ]]>
|
||||
EXN_CDATA,
|
||||
|
||||
//! Unknown element.
|
||||
//! Unknown element. Also xml headers nodes (which currently also don't read attributes)
|
||||
EXN_UNKNOWN
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ class line2d
|
||||
vector2d<T> getVector() const { return vector2d<T>( end.X - start.X, end.Y - start.Y); }
|
||||
|
||||
/*! Check if this segment intersects another segment,
|
||||
or if segments are coincindent (colinear). */
|
||||
or if segments are coincident (colinear). */
|
||||
bool intersectAsSegments( const line2d<T>& other) const
|
||||
{
|
||||
// Taken from:
|
||||
@ -83,7 +83,7 @@ class line2d
|
||||
if (o1 != o2 && o3 != o4)
|
||||
return true;
|
||||
|
||||
// Special Cases to check if segments are coolinear
|
||||
// Special Cases to check if segments are colinear
|
||||
if (o1 == 0 && other.start.isBetweenPoints( start, end)) return true;
|
||||
if (o2 == 0 && other.end.isBetweenPoints( start, end)) return true;
|
||||
if (o3 == 0 && start.isBetweenPoints( other.start, other.end)) return true;
|
||||
|
@ -142,7 +142,7 @@ namespace core
|
||||
|
||||
//! Set this matrix to the product of two matrices
|
||||
/** Calculate b*a, no optimization used,
|
||||
use it if you know you never have a identity matrix */
|
||||
use it if you know you never have an identity matrix */
|
||||
CMatrix4<T>& setbyproduct_nocheck(const CMatrix4<T>& other_a,const CMatrix4<T>& other_b );
|
||||
|
||||
//! Multiply by another matrix.
|
||||
@ -150,7 +150,8 @@ namespace core
|
||||
CMatrix4<T> operator*(const CMatrix4<T>& other) const;
|
||||
|
||||
//! Multiply by another matrix.
|
||||
/** Calculate and return other*this */
|
||||
/** Like calling: (*this) = (*this) * other
|
||||
*/
|
||||
CMatrix4<T>& operator*=(const CMatrix4<T>& other);
|
||||
|
||||
//! Multiply by scalar.
|
||||
@ -186,14 +187,25 @@ namespace core
|
||||
//! Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
|
||||
CMatrix4<T>& setRotationDegrees( const vector3d<T>& rotation );
|
||||
|
||||
//! Get the rotation, as set by setRotation() when you already know the scale.
|
||||
/** If you already know the scale then this function is faster than the other getRotationDegrees overload.
|
||||
NOTE: You will have the same end-rotation as used in setRotation, but it might not use the same axis values.
|
||||
//! Get the rotation, as set by setRotation() when you already know the scale used to create the matrix
|
||||
/** NOTE: The scale needs to be the correct one used to create this matrix.
|
||||
You can _not_ use the result of getScale(), but have to save your scale
|
||||
variable in another place (like ISceneNode does).
|
||||
NOTE: No scale value can be 0 or the result is undefined.
|
||||
NOTE: It does not necessarily return the *same* Euler angles as those set by setRotationDegrees(),
|
||||
but the rotation will be equivalent, i.e. will have the same result when used to rotate a vector or node.
|
||||
NOTE: It will (usually) give wrong results when further transformations have been added in the matrix (like shear).
|
||||
WARNING: There have been troubles with this function over the years and we may still have missed some corner cases.
|
||||
It's generally safer to keep the rotation and scale you used to create the matrix around and work with those.
|
||||
*/
|
||||
core::vector3d<T> getRotationDegrees(const vector3d<T>& scale) const;
|
||||
|
||||
//! Returns the rotation, as set by setRotation().
|
||||
/** NOTE: You will have the same end-rotation as used in setRotation, but it might not use the same axis values.
|
||||
NOTE: This only works correct if no other matrix operations have been done on the inner 3x3 matrix besides
|
||||
setting rotation (so no scale/shear). Thought it (probably) works as long as scale doesn't flip handedness.
|
||||
NOTE: It does not necessarily return the *same* Euler angles as those set by setRotationDegrees(),
|
||||
but the rotation will be equivalent, i.e. will have the same result when used to rotate a vector or node.
|
||||
*/
|
||||
core::vector3d<T> getRotationDegrees() const;
|
||||
|
||||
@ -221,7 +233,7 @@ namespace core
|
||||
//! Translate a vector by the inverse of the translation part of this matrix.
|
||||
void inverseTranslateVect( vector3df& vect ) const;
|
||||
|
||||
//! Tranform (rotate/scale) a vector by the inverse of the rotation part this matrix
|
||||
//! Transform (rotate/scale) a vector by the inverse of the rotation part this matrix
|
||||
void inverseRotateVect( vector3df& vect ) const;
|
||||
|
||||
//! Transform (rotate/scale) a vector by the rotation part of this matrix.
|
||||
@ -827,11 +839,9 @@ namespace core
|
||||
|
||||
//! Returns the absolute values of the scales of the matrix.
|
||||
/**
|
||||
Note that this returns the absolute (positive) values unless only scale is set.
|
||||
Unfortunately it does not appear to be possible to extract any original negative
|
||||
values. The best that we could do would be to arbitrarily make one scale
|
||||
negative if one or three of them were negative.
|
||||
FIXME - return the original values.
|
||||
Note: You only get back original values if the matrix only set the scale.
|
||||
Otherwise the result is a scale you can use to normalize the matrix axes,
|
||||
but it's usually no longer what you did set with setScale.
|
||||
*/
|
||||
template <class T>
|
||||
inline vector3d<T> CMatrix4<T>::getScale() const
|
||||
@ -894,33 +904,16 @@ namespace core
|
||||
}
|
||||
|
||||
|
||||
//! Returns a rotation that is equivalent to that set by setRotationDegrees().
|
||||
/** This code was sent in by Chev. Note that it does not necessarily return
|
||||
the *same* Euler angles as those set by setRotationDegrees(), but the rotation will
|
||||
be equivalent, i.e. will have the same result when used to rotate a vector or node.
|
||||
This code was originally written by by Chev.
|
||||
//! Returns a rotation which (mostly) works in combination with the given scale
|
||||
/**
|
||||
This code was originally written by by Chev (assuming no scaling back then,
|
||||
we can be blamed for all problems added by regarding scale)
|
||||
*/
|
||||
template <class T>
|
||||
inline core::vector3d<T> CMatrix4<T>::getRotationDegrees(const vector3d<T>& scale_) const
|
||||
{
|
||||
const CMatrix4<T> &mat = *this;
|
||||
core::vector3d<T> scale(scale_);
|
||||
// we need to check for negative scale on to axes, which would bring up wrong results
|
||||
if (scale.Y<0 && scale.Z<0)
|
||||
{
|
||||
scale.Y =-scale.Y;
|
||||
scale.Z =-scale.Z;
|
||||
}
|
||||
else if (scale.X<0 && scale.Z<0)
|
||||
{
|
||||
scale.X =-scale.X;
|
||||
scale.Z =-scale.Z;
|
||||
}
|
||||
else if (scale.X<0 && scale.Y<0)
|
||||
{
|
||||
scale.X =-scale.X;
|
||||
scale.Y =-scale.Y;
|
||||
}
|
||||
const core::vector3d<f64> scale(core::iszero(scale_.X) ? FLT_MAX : scale_.X , core::iszero(scale_.Y) ? FLT_MAX : scale_.Y, core::iszero(scale_.Z) ? FLT_MAX : scale_.Z);
|
||||
const core::vector3d<f64> invScale(core::reciprocal(scale.X),core::reciprocal(scale.Y),core::reciprocal(scale.Z));
|
||||
|
||||
f64 Y = -asin(core::clamp(mat[2]*invScale.X, -1.0, 1.0));
|
||||
@ -929,7 +922,7 @@ namespace core
|
||||
|
||||
f64 rotx, roty, X, Z;
|
||||
|
||||
if (!core::iszero(C))
|
||||
if (!core::iszero((T)C))
|
||||
{
|
||||
const f64 invC = core::reciprocal(C);
|
||||
rotx = mat[10] * invC * invScale.Z;
|
||||
@ -956,14 +949,37 @@ namespace core
|
||||
}
|
||||
|
||||
//! Returns a rotation that is equivalent to that set by setRotationDegrees().
|
||||
/** This code was sent in by Chev. Note that it does not necessarily return
|
||||
the *same* Euler angles as those set by setRotationDegrees(), but the rotation will
|
||||
be equivalent, i.e. will have the same result when used to rotate a vector or node.
|
||||
This code was originally written by by Chev. */
|
||||
template <class T>
|
||||
inline core::vector3d<T> CMatrix4<T>::getRotationDegrees() const
|
||||
{
|
||||
return getRotationDegrees(getScale());
|
||||
// Note: Using getScale() here make it look like it could do matrix decomposition.
|
||||
// It can't! It works (or should work) as long as rotation doesn't flip the handedness
|
||||
// aka scale swapping 1 or 3 axes. (I think we could catch that as well by comparing
|
||||
// cross product of first 2 axes to direction of third axis, but TODO)
|
||||
// And maybe it should also offer the solution for the simple calculation
|
||||
// without regarding scaling as Irrlicht did before 1.7
|
||||
core::vector3d<T> scale(getScale());
|
||||
|
||||
// We assume the matrix uses rotations instead of negative scaling 2 axes.
|
||||
// Otherwise it fails even for some simple cases, like rotating around
|
||||
// 2 axes by 180<38> which getScale thinks is a negative scaling.
|
||||
if (scale.Y<0 && scale.Z<0)
|
||||
{
|
||||
scale.Y =-scale.Y;
|
||||
scale.Z =-scale.Z;
|
||||
}
|
||||
else if (scale.X<0 && scale.Z<0)
|
||||
{
|
||||
scale.X =-scale.X;
|
||||
scale.Z =-scale.Z;
|
||||
}
|
||||
else if (scale.X<0 && scale.Y<0)
|
||||
{
|
||||
scale.X =-scale.X;
|
||||
scale.Y =-scale.Y;
|
||||
}
|
||||
|
||||
return getRotationDegrees(scale);
|
||||
}
|
||||
|
||||
|
||||
@ -2076,7 +2092,7 @@ namespace core
|
||||
core::vector3df v(vs);
|
||||
v.normalize();
|
||||
|
||||
// cosinus angle
|
||||
// cosine angle
|
||||
T ca = f.dotProduct(t);
|
||||
|
||||
core::vector3df vt(v * (1 - ca));
|
||||
@ -2137,7 +2153,7 @@ namespace core
|
||||
// axis multiplication by sin
|
||||
const core::vector3df vs = look.crossProduct(from);
|
||||
|
||||
// cosinus angle
|
||||
// cosine angle
|
||||
const f32 ca = from.dotProduct(look);
|
||||
|
||||
core::vector3df vt(up * (1.f - ca));
|
||||
|
@ -141,7 +141,7 @@ public:
|
||||
bool nearlyParallel( const vector2d<T> & other, const T factor = relativeErrorFactor<T>()) const
|
||||
{
|
||||
// https://eagergames.wordpress.com/2017/04/01/fast-parallel-lines-and-vectors-test/
|
||||
// if a || b then a.x/a.y = b.x/b.y (similiar triangles)
|
||||
// if a || b then a.x/a.y = b.x/b.y (similar triangles)
|
||||
// if a || b then either both x are 0 or both y are 0.
|
||||
|
||||
return equalsRelative( X*other.Y, other.X* Y, factor)
|
||||
|
@ -153,7 +153,7 @@ namespace core
|
||||
|
||||
//! Calculates the cross product with another vector.
|
||||
/** \param p Vector to multiply with.
|
||||
\return Crossproduct of this vector with p. */
|
||||
\return Cross product of this vector with p. */
|
||||
vector3d<T> crossProduct(const vector3d<T>& p) const
|
||||
{
|
||||
return vector3d<T>(Y * p.Z - Z * p.Y, Z * p.X - X * p.Z, X * p.Y - Y * p.X);
|
||||
|
Reference in New Issue
Block a user