Commit Graph

317 Commits

Author SHA1 Message Date
cutealien
f1a572e8a7 Add VC17 (VS 2022) project files and solutions
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6441 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-11-19 14:22:50 +00:00
cutealien
e57a713377 Fix some bitfield sizes in SMaterial
Bitfields for PolygonOffsetDirection, ZWriteEnable and BlendOperation were chosen too small.
As we have pre c++11 code and therefore didn't use unsigned qualifiers for enums they were generally signed (up to compiler in theory, but I think they all choose signed).
Which means the bitfield also had a sign. 
So for example setting PolygonOffsetDirection to EPO_FRONT set it to -1 instead of 1.
Which then would fail with comparison checks (PolygonOffsetDirection == EPO_FRONT would be false).
We kind of got lucky that we usually not checked for the last enum inside Irrlicht, so it worked to due being the "else" case.
Or in the ZWriteEnable case the last one was identical to the default return value so it also worked accidentally.
But obviously still wrong and user code could be messed up.

While at it I also re-ordered SMaterial variable so most bitfield variables are close together again to give compiler at least a chance to use packing. Thought at least in my quick debug compile test it didn't seem to use any packing (but maybe on other compilers).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6440 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-11-17 16:42:39 +00:00
cutealien
3f372af486 Fix some problems with CMatrix4::getRotationDegrees
- Only the getRotationDegrees without parameter is allowed to try fixing scale.
  My fault when I added a new function which takes scale parameter, that one is 
  not allowed to be changed.
  On the up-side - we know have for the first time an option which works in cases only
  scale and rotation had been used and the user still has the correct scale. 
  Before any solution for that was broken
- getRotationDegrees fixes 2 places which caused wrong results due to floating point inaccuracies
  New test for that got added
- Document the current restrains and problems of getRotationDegrees and getScale some more.
- Improve docs for other matrix4 functions.
- Add some comments about further improvements (I'll try if I find time)

Note: Irrlicht still assumes in at least 2 places (getting bone animations and Collada loader) that matrix
decomposing works. Which it doesn't yet for matrices which switch handedness (or have further transformations like skewing axes)
The bone animation is mostly fine for now with recent workaround (but that might cause other problems as it may be used too often), haven't checked Collada yet in detail.

TL/DR: This improves things with getRotationDegrees, but does not yet fix all troubles.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6439 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-10-15 15:46:03 +00:00
cutealien
3f00ea004e Avoid some broken calculations for IBoneSceneNode positions.
This is based on bugreport #458 reported by viwrap who also made a nice test-case model.
Note: While solution seems to work and would even be faster, I'm not 100% sure yet if there are no downsides.
The other solution seems to regard last column in matrices - thought I don't think we ever set or use that.
And I also haven't found out yet _why_ the original solution goes wrong. 
But animation system uses right-hand quaternions unlike rest of Irrlicht which is obviously a bit dangerous, will have to check the conversions some day.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6438 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-10-11 22:54:44 +00:00
cutealien
3c5a2387cf Handle missing 3d models in example 08
Ugly replacement if dwarf is missing.
Doing this because Debian currently discussing to remove the dwarf due to a conflict of it's license with Debian policy.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6436 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-10-07 18:28:04 +00:00
cutealien
b3fff12423 Handle missing 3d models in example 07
No more crashing if some models are not found


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6435 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-10-07 18:10:50 +00:00
cutealien
41f2f8654f Fix warning
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6434 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-10-04 12:32:27 +00:00
cutealien
51f1ff6716 Avoid newly introduced reorder warnings in ISceneNode
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6433 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-29 19:03:51 +00:00
cutealien
b627ce805d Add option to allow nodes to ignore the scale/rotation parts of their parents transformation.
ISceneNode::setUpdateAbsolutePosBehavior can now control what ISceneNode::updateAbsolutePosition really does.
Having only the position and not the rotation/scale of a child node affected by the parent transformation was previously impossible inside the scene-graph. So people always had to break the scene-graph and code it themselves.
Old behaviour is default. 
Extra check for new variable has a small cost, thought new behaviour can actually be faster when it's used.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6432 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-29 16:34:37 +00:00
cutealien
91f281229b Fix: Make CBillboardSceneNode bounding-box large enough to fit the billboard inside.
It still won't work yet for scaled boundingboxes (or parents being scaled). 
But at least it's now large enough for typical unscaled boundingboxes.
Before it was always too small - even for the simplest quadratic billboard case seen without rotation.
Now it's always a bit too large, but that's way less of a problem (collisions still work and culling simply happens a bit less often, but not too often which is way worse)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6431 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-29 14:12:12 +00:00
cutealien
5114c18b79 Fix and simplify IGUISpinBox::getOldValue
Was going wrong when setValue was called inside an event function for EGET_SPINBOX_CHANGED.
But last solution was overly complicated anyway as I tried too hard to avoid extra getValue calculations.
But noticing now those calculations got done anyway in all places where the event is triggered.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6430 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-28 14:56:22 +00:00
cutealien
a883d464f9 Add IGUISpinBox functions getValueFor and getOldValue
Also documenting some missing feature (decimal places ignored with direct text input)
getValueFor allows to check the value a given text would have 
getOldValue can be used to check the previous value in a EGET_SPINBOX_CHANGED event

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6429 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-28 14:25:18 +00:00
cutealien
0ef9102ac6 Fix IGUIElements not getting a tab order because of invisible or disabled parents.
First problem was that IGUIElement::getNextElement wasn't passing includeInvisible and includeDisabled flags recursively, so anything deeper than one level could fail if an element was disabled/invisible in between while it was created.
Second problem was that setTabOrder(-1) did ignore disabled elements. So when any parent was disabled when elements were created they never got a tab order.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6428 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-27 16:02:39 +00:00
cutealien
582bb54ce2 Avoid ambigious conversions when compiling with c++20
Yay, more ugly casts needed.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6427 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-25 11:18:55 +00:00
cutealien
389ec11a58 Add comment when running tests on Linux how to see results
Thanks @juozas for mentioning this (https://irrlicht.sourceforge.io/forum/viewtopic.php?p=306758#p306758)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6426 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-24 13:55:03 +00:00
cutealien
1803413b49 Fix: SDL device can support FPS camera animator again
Also no longer restricting mouse position to 0-windowsize (restriction for other devices got removed earlier)
And adding some commented out lines to Makesfile for easier testing of SDL. We probably should use some parameter which can be passed to Makefiles for that in the future.
Note: This does not fix all cursor troubles for SDL - it still does not support relative rectangle
Bit arguably how to handle setting/getting mouse position for SDL, for example it still doesn't support a reference rectangle.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6424 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-22 21:47:19 +00:00
cutealien
a69969d6f9 Fix MouseButtonStates for mouse events in CIrrDeviceSDL when middle or right button are released
Needed to use bitwise not instead of logical not to clear bits for EMBSM_RIGHT and EMBSM_MIDDLE.
Thanks @gcc for it's warnings


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6423 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-22 21:34:08 +00:00
cutealien
88b7bed20f Merging r6286 through r6421 from branch releases/1.8 to trunk
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6422 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-09-21 20:09:28 +00:00
cutealien
ca7000aea8 Fix documentation of IMeshManipulator::transform
(I forgot normal update is certainly also needed on rotation)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6420 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-08-26 14:23:18 +00:00
cutealien
eafbe063be IMeshManipulator::transform can now also normalize normals
Also only update normals now using inner 3x3 matrix (same result usually as last column is 0,0,0 but faster)
And adding some comments.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6419 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-08-26 14:09:04 +00:00
cutealien
662001566b ILightManager now uses empty instead of pure virtual functions
Making it a bit more comfortable for users to implement the class.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6418 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-08-26 10:38:14 +00:00
cutealien
31965fe599 CMeshManipulator::createMeshWelded now cloning buffers it can't weld.
Not optimal, but making this real 32-bit is sadly a bit more work.
This way at lest meshes with mixed 16/32 bit buffers can weld the 16-bit ones.
And hopefully a bit of step in the right direction to fully support 32-bit another day.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6417 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-08-24 22:14:50 +00:00
cutealien
38e5bfe234 Fix Collada (.dae) writing with 32 bit meshbuffers
Was still handling them as 16-bit buffers.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6416 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-08-24 12:55:45 +00:00
cutealien
9025fcc377 Add IMeshBuffer::getColor functions
Lazy access function - same as for all other members of S3DVertex (getPosition/getNormal/getTCoords).
Not sure why color was missing, maybe got added later?
Would probably be better to have a getS3DVertex function instead which would cover them all, but it's only some slow (but nice) helper function anyway.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6415 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-08-19 12:33:56 +00:00
cutealien
7d2dbdd0c8 Unify & improve log messages
Lots of places where coders did not realize our Printer::log with hint adds a ": " string between message and hint
Which caused uglier messages in a few places (added documentation for that, maybe helps?)
Some added info in a few places
Some whitespace unification
Some spelling unification


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6414 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-30 16:23:48 +00:00
engineer_apple
30834665ff Example 27.PostProcessing turn off depth buffer again
BurningVideo Shader emulation pp_opengl.frag/vert frag_BFT_385_0xa0194718
 - currently only implemented with depth-buffer disabled inside CTRTextureGouraudNoZ2
 - special case of not power of 2 RTT TextureSampler without mipmap and no bilinear filter


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6413 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-25 07:24:55 +00:00
cutealien
17c7a1bd6e CGUIContextMenu no longer marks EMIE_MOUSE_MOVED as handled
This got in the way of allowing to move a camera with right-mouse-button while having a context menu.
Hard to tell which way is "more" correct as this break of behavior probably can also mess up some situations.
There also would be 3rd option of only catching the event when highlighting happens.
Anyway - usually if this should be caught it should be caught for all ui elements and people will check focused or hovered.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6412 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-23 13:25:55 +00:00
cutealien
f2896fae5a Fix some comments in example 28
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6411 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-21 18:50:45 +00:00
cutealien
2dc5d89967 Make example 27 run with burnings again.
Sorry, last change removed a bit too much.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6410 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-21 18:28:13 +00:00
cutealien
501185e9cc Fix checkDataSizeLimit test in png loader.
I thought BitDepth was per pixel back then, but it's per channel. So limit could be broken.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6409 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-21 18:19:00 +00:00
cutealien
338af5c0ea Simplify example 27 slightly.
Also use tab instead of spaces (as usual in Irrlicht)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6408 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-20 19:57:35 +00:00
cutealien
d70d96031b Show number polygons in example 26
Just useful to understand what's going on.
Also removing the _CRT_SECURE_NO_WARNINGS as I don't get warnings my VS versions and other examples don't do that (so maybe that was fixed otherwise?)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6407 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-16 14:26:53 +00:00
cutealien
8dbeba57cd Fix camera render when it wasn't animated. Tiny improvement for fps camera animator. Add documentation.
Cameras can render even when they are not in the scenemanager or onAnimate didn't get called for example because they are their parent are invisible.
So let's be safe and add another call to updateAbsolutePosition(). Some cost, but usually we don't have that many rendering cameras, so shouldn't matter (if it ever matters I suppose we could override OnAnimate and add a flag if it _was_ animated since last render call. Maybe that's even useful in general for SceneNodes?).
Similar CSceneNodeAnimatorCameraFPS was using getAbsolutePosition which was only updated after animators, so it was one frame behind.
And documented ICameraSceneNode functions a bit. Especially updateMatrices is a bit of a confusing name unfortunately.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6406 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-16 13:59:58 +00:00
cutealien
94e84b1686 Prevent crash when creating CCameraSceneNode while rendertarget has height 0
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6405 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-30 20:13:28 +00:00
cutealien
4450b532c2 Amendment to [r6389] Change all CColorConverter functions to work with u32 instead of s32 for sizes
Missed it as that part is only use by OGL_ES branch.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6403 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-15 15:51:55 +00:00
cutealien
5d27ca38a7 Minor const changes.
Also kicked out "Use constexpr for constants" warning in VS analyser ruleset (we haven't switched to c++11 yet)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6402 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-15 13:43:32 +00:00
cutealien
f9e5ef76bd IVideoDriver::getOcclusionQueryResult works now with const node pointer.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6401 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-15 11:51:42 +00:00
cutealien
ea0f2555ed type in changes.txt
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6400 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-14 18:54:21 +00:00
cutealien
06415994ce Partly revert previous commit. Works only for linear search functions, binary_search changes were wrong.
Sorry, didn't think it through. Seemed to work at first, but works only if sort() ended up creating the same sorting as is used then for search.
While often the case, this is obviously not guaranteed. And can't do sort per type easily (this works with flags which remember if sorting had been done).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6399 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-14 18:53:28 +00:00
cutealien
0f7eb1f6e1 core::array search functions can now work with other template types.
Previously search functions only worked when called with the same type as the array elements had.
Which forced users sometimes to create dummy objects to be able to search for elements by another type.
linear_search and linear_reverse_search now work with any type for which <T>::operator== is implemented.
Similar binary_search now works when <T>::operator< is implemented in both directions (T < E and E < T).
Note: It might be possible to further improve binary_search so only one operator< is needed (I think STL managed that somehow).
So if someone likes a challenge - have a go at it! :-)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6398 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-14 18:27:35 +00:00
cutealien
ca4bbcb71f Fix compiling on MinGW (broke in [r6394])
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6397 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-14 15:10:22 +00:00
cutealien
66dcb86e5f Make SCollisionHit::TriangleSelector and SCollisionTriangleRange::Selector both const.
Avoids lots of const casts and there shouldn't be a good reason to have those non-const.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6396 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-14 14:29:56 +00:00
cutealien
bd7e357f77 Add checks for valid skin pointer in CGUIMenu
Found with VS analyser

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6395 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-14 14:03:30 +00:00
cutealien
3eee408cac Avoid potential call to GetProcAddress with 0 for HMODULE
Found by VS code analyser

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6394 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-13 15:03:27 +00:00
cutealien
c0f5b839a0 Avoid potential number overflows.
Found by VS code analyser

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6393 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-13 14:56:22 +00:00
cutealien
d90d1ae93b Make some local variables in public headers const
Shutting up code analyser.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6392 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-13 14:42:13 +00:00
cutealien
cc9edcb973 CIrrMeshFileLoader::readMeshBuffer avoid accessing pointer before it's not 0 check.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6391 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-13 14:20:41 +00:00
cutealien
dd7020c27b Cleanup: Adding break
Just safer in case we add more cases. Also shuts up code analyser.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6390 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-13 12:31:00 +00:00
cutealien
10f0e39e46 Change all CColorConverter functions to work with u32 instead of s32 for sizes.
Nothing good could come out of putting negative values into any of those functions.
And they are used a lot in image loaders which often can be tricked into passing large enough values to make those functions be called with negative numbers.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6389 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-08 15:40:38 +00:00
engineer_apple
f64732cd7e CBillboardTextSceneNode null-pointer check on missing Texture
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6388 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-08 14:43:24 +00:00