Commit Graph

436 Commits

Author SHA1 Message Date
cutealien ac341472d6 Add error checks and log warnings in CIrrDeviceWin32::CCursorControl::addIcon
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6601 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-03-15 14:52:22 +00:00
cutealien 8f8a4ef5e1 CImageLoaderBMP now supports loading 1-bit images with palette data
The feature everyone has been waiting for!!! Or not...
Anyway it works now :-)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6600 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-03-13 19:30:48 +00:00
cutealien b17fe835bc Hardware meshbuffers are now deleted when they hold the last reference to a meshbuffer
HW buffers were keeping meshbuffers alive for 20000 frames even when no one else was using them anymore.
In cases of rapid creating/destroying static meshbuffers this could lead to serious memory leaks (which then kinda topped out after 5 minutes, but at that point it could already be too late).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6599 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-02-29 13:42:22 +00:00
cutealien 989e82d5dd Initialize SJoint.Animatedscale to 1,1,1
No scale should be 1,1,1 not 0,0,0
Wasn't a bug as animation system ensured the initial value is never used, but more correct and no extra cost (vectors initialize to 0 otherwise).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6598 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-02-24 19:11:42 +00:00
cutealien ec4e690f02 Change order of variables in SMaterial for better packing
Saves 8 byte when compiling for 64-bit with VS.
Breaks binary compatibility which I'd usually avoid, but as this happened before since 1.8, I don't care.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6597 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-02-22 17:57:37 +00:00
cutealien d9de5f2306 Optimize memory layout for SMaterialLayer
SMaterialLayer going down from 40 to 32 bytes on 64-bit systems according to the new VS memory layout tool (nice toy!)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6596 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-02-22 11:19:58 +00:00
cutealien e3f3f753de Make text about available texture memory in d3d9 more precise
The value returned doesn't seem that useful :-/

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6595 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-02-13 19:53:16 +00:00
cutealien cd1ce549ab Update documentation for EMT_SOLID_2_LAYER
Remove comment that it's not working on OpenGL. Not sure when it got fixed, but it's implemented and seems to work as described.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6594 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-02-01 20:49:37 +00:00
cutealien ffec673146 line3d::getClosestPoint can now chose between using line or line segment
Also the case of start/end points being identical now avoids invalid numbers from division by 0 and just returns the start point
Basically it's now the same again as line2d::getClosestPoint (which also got a comment fix)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6593 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-30 14:51:08 +00:00
cutealien c7dddff71c Simplify aabbox3d::getSideCenters
Unnecessary computations in my last version

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6592 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-29 16:23:43 +00:00
cutealien ea9a001808 Add aabbox3d::getSideCenters
Returns centers of the side faces.
Just another tool function to fatten up Irrlicht

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6591 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-29 16:05:31 +00:00
cutealien 2d880e4cfe Update comments about getEdges (it's about corners...)
Wish I could rename those functions, but that breaks a bit too much. So at least document that getEdges is about getting corners and not about getting edges.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6590 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-29 15:41:42 +00:00
cutealien 67fa713038 Minor code cleanup
fixing trivial level 4 warnings

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6589 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-27 15:57:28 +00:00
cutealien 56db5a39ea Deprecated and disable MY3D loader
I tried to find out about this format, but last info seems to be from 2005 (https://irrlicht.sourceforge.io/forum/viewtopic.php?p=37385)
Website for it no longer exists and I also couldn't find My3DTools on any other place on the web.
We don't even have an example for it in Irrlicht.
Also CMY3DHelper.h introduces quite a bunch of functions and global variables in the irr::core namespace and I'm not really interested in spending time in cleaning this up.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6588 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-27 15:14:28 +00:00
cutealien 1d3794c8b4 Reduce redundant code in core::quaternion
Instead of using same matrix calculations 3 times, getMatrixCenter and getMatrix now both call getMatrixFast.
Additional function call might be slight cost in debug, in release compilers hopefully inline it away.
Also getMatrix_transposed now split into getMatrix_transposed and getMatrixFast_transposed to make it similar to getMatrix.
This also avoids a bunch of level 4 warnings in VS about function variables hiding class variables, which was why I started on this. Thought I also prefer having less code here.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6587 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-27 14:31:08 +00:00
cutealien c35e0412a3 Remove unused variable
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6586 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-25 18:08:53 +00:00
cutealien b3e228ef43 Make more internals for CVertexBuffer and CIndexBuffer public
I don't see the point of giving access to Indices and Vertices if they are of a class type which is private.
Now it's at least possible (with a few casts) to access the freaking array having the data which is often all we want.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6585 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-24 11:44:49 +00:00
cutealien 1a86bbd38a Update VS code analysis ruleset
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6584 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-24 11:38:50 +00:00
cutealien bff1a50c34 Minor code cleanup
Mostly const fixes in headers to make it easier for users to have more warnings enabled in static code analysis
Also updating our own rules a bit (kicking some out we won't need yet).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6583 dfc29bdd-3216-0410-991c-e03cc46cb475
2024-01-01 15:29:28 +00:00
cutealien 2fdb1fc156 Fix changes.txt
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6582 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-12-31 18:11:20 +00:00
cutealien 6b2a0fab78 Fix tessellation numbers in createCylinderMesh, createConeMesh, createArrowMesh
Double tessellation numbers for these 3 functions in your code to get same results as in Irrlicht 1.8

I noticed in last commit those all tessellated semi-circles instead of circles. I just documented it there, but it's annoying as that bug doesn't allow odd numbered tessellation. So for example one couldn't create a triangle pyramid. 
I considered adding another parameter to describe what this number means, but... just too ugly. And it was always documented otherwise, so this could be considered a bug. Sorry if this changes the look of existing apps.

Also cleaned up code in CGeometryCreator::createCylinderMesh. No idea what the idea behind old code was. Aside from creating twice the tessellation numbers.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6581 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-12-31 18:04:15 +00:00
cutealien 245dd395cb Add default UV's for CGeometryCreator::createConeMesh
Thanks @randomMesh for reporting that they were missing: https://irrlicht.sourceforge.io/forum/viewtopic.php?p=307308
Also simplified that code a bit (same could probably also be done for createCylinderMesh, but too lazy right now)
Changed also UV's for top/bottom center vertex in CGeometryCreator::createCylinderMesh to use center for X (slight improvement, but would have to copy vertices to make it better)



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6580 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-12-31 16:48:36 +00:00
cutealien 8372a70f21 Fix uninitialized variable in CTriangleSelector and code cleanup
CTriangleSelector constructor with IAnimatedMeshSceneNode parameter didn't initialize MeshBuffer.
Not used internally, so no big problem, but it got passed back to users in some cases
Replaced SCollisionTriangleRange, by CTriangleSelector::SBufferTriangleRange. Was a bad idea to use a struct which is for something else just because some member were the same (my fault, sorry).
Also started unifying the case of using ranges vs not using them. 
Can maybe even get rid of the non-ranges case in future. Or unify the duplicated code for getting triangles at least.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6579 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-12-13 16:10:50 +00:00
cutealien 70b2e3a255 Can often copy instead of multiply matrix in CTriangleSelector
If we already know we start with an identity matrix (which is usually the case) then copy will do.
Also unifying code to create matrix of different CTriangleSelector::getTriangles functions


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6578 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-12-13 15:05:08 +00:00
cutealien 66d189ce63 Bugfix: CTriangleSelector::getTriangles with bbox no longer ignores transform matrix
So far it only used the inverse of the node transformation to calculate the box used to check
Which gave wrong results as soon as one tried to pass an additional matrix transformation
Wasn't ever used internally or by examples in Irrlicht, so I guess no one ever noticed (also in some cases this still worked accidentally).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6577 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-12-13 14:14:12 +00:00
cutealien 952f11f806 Fix: CGUITabControl now catching EMIE_LMOUSE_PRESSED_DOWN
Same as most elements. Other behaviour a bit unexpected and unlikely to be useful.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6576 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-12-05 13:40:33 +00:00
cutealien 8985248142 Add comment about transparency sorting.
Sometimes you only think about better implementations when the work is done *sigh*
Can get back to it when we add custom sorting for solid nodes some day (another very old open feature request...)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6575 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-22 17:15:03 +00:00
cutealien c9e71e26f2 Switch default transparency sorting back from ETNS_PLANE_CENTER to ETNS_CENTER
While there are some cases this fixes, like MartinVee's nice example for orthographic camera at https://irrlicht.sourceforge.io/forum/viewtopic.php?t=51598
it seemed to cause more problems in complex 3d scenes with perspective cameras.
Well anyway - both options are available now for those which need it.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6574 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-22 16:59:24 +00:00
cutealien 3752bd9bd4 Add more transparent node sorting algorithms
Adding 2 algorithms to sort by distance to camera plane instead of camera position.
This is better in quite a few situations and extra cost is just one vector subtraction per node and an additional function parameter per call, I think that's worth it. So made the camera-plane to object-center now the new default.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6573 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-22 16:34:55 +00:00
cutealien 3c4ac201ce Add options for transparency node sorting algorithm
Until last summer we sorted by object origin to camera distance
Since then we used nearest transformed bbox-extent to camera.
I've now added an enum to allow switching those plus 2 new:
- none (so sorting based on scenegraph instead)
- object center to camera. Which I made the new default as it worked the best in my tests.

I already experimented with a few more ones like different sphere sizes (bbox radius, minimal inbound radius, maximal inbound radius) around center or origin to handle objects with different sizes, but that just gave worse results for all my test cases.

Likely algorithms we should still try:
- Collision point with bounding-box in line between camera and object center (sounds a bit slow, but maybe worth it)
- Distance to camera plane (instead of camera position). But needs additional parameter to distance functions first (maybe normalized view vector will do). That should be useful when working with planar objects.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6572 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-22 14:52:19 +00:00
cutealien ad4cd6ca7d Grammar
Had missing word in comment

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6571 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-13 15:04:40 +00:00
cutealien 8bf9cf5471 writeImageToFile param now used by CImageWriterPNG for compression level
A bit annoying that it kinda has the opposite meaning for png and jpg compression for same parameter (png compression goes up, jpg goes down).
Also unfortunate we chose u32 instead of int here or we could at least use the usual zlib value range for png.
But I think it still won't mess up in many cases. Defaults (value 0) stay the same as before.
And setting a jpg range <= 10 is rarely done and even if so it just changes png sizes a bit now if people use writer for both. 
People just have to be careful now when they override defaults for png and then also write jpg - but can't help it.
And it's too  useful to not have this - this can massively change the write-speed for png's (like up to 3 times faster with no compression on my system).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6570 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-13 14:53:44 +00:00
cutealien 3fa020d03c Change how SMaterial handles equality for UserData for more flexibility
Different UserData values are no longer by default causing materials to be different.
It now always checks in this case the IUserData != operator.
This allows more user control. Can still have them be different by checking pointers in overloaded compare function.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6569 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-10 15:52:40 +00:00
cutealien feaed624f7 Remove serialization again from IUserData
This can't work as on deserialize it would need to have the type for IUserData already.
And that's impossible with the way it's used right now.
Would need some kind of factory or so probably, but I'll ignore this for now.
Note that it's still possible to call some serialization manually on the derived classes by adding it there if needed.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6568 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-07 17:43:01 +00:00
cutealien 3c9a856e6d Add SMaterial::IUserData to make it easier passing additional values to shaders
Irrlicht generally avoided user pointers in the past, but after trying all kind of ugly workarounds - this is just easier and
not that much downsides really. Tiny speed costs due to additional SMaterial memory size and new comparison tests. 
But allows to keep SMaterial alive and useful for a while longer without needing a complete rewrite and it can now be used for stuff like writing PBR shaders.
Using a new interface io::IUserData for this which also allows serialization the user data (that part is untested so far, sorry)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6567 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-07 15:43:49 +00:00
cutealien d0605cf397 Update scene.irr test file to fix tests
LensShift got added recently.
Also there was some change in PolygonOffsetDirection longer ago (although that one didn't cause tests to fail)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6566 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-11-07 15:11:54 +00:00
cutealien d4f6d8c17b Add lens shift support for the camera and the perspective projection functions
As Blender docs describe it so nicely: Using lens shift is equivalent to rendering an image with a larger FOV and cropping it off-center.
This can be quite useful for architecture renderings, but I guess also has it's use in other situations.
Note: Didn't make the ICameraSceneNode functions pure virtual so users don't have to update their cameras for this
Also some change in serialization - same as in other places by now, do use existing values as defaults values when they are not found instead of resetting them to 0.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6565 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-19 16:04:43 +00:00
cutealien 567f8688e2 Mention in more places that ECFN_DISABLED disables zwrite as well
Easy to miss... 

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6564 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-18 16:51:56 +00:00
cutealien 2b08c37f89 CSoftwareTexture::lock no longer returns image data when a mipmapLevel is requested
Returns now getMipMapsData instead which for now will always be 0 in this case (but might work one day)
Also removing comment about ITexture::lock() mipmapLevel parameter being broken. It got fixed in November 2019.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6563 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-17 17:55:39 +00:00
cutealien 614308e19c Merging r6555 through r6560 from branch releases/1.8 to trunk
- Fixing buffer overflow in tga loader


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6561 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-16 20:59:41 +00:00
cutealien e5c8a75d40 Document deviant ITexture::lock behaviour for EDT_SOFTWARE drivers
Software driver sometimes works with original image (in 2D) and sometimes with POT version of the image (in 3D).
That is probably useful so it can draw the UI in best quality while having relative fast 3D.
The problem is that lock() only returns one data - so it decided to return the original data and then in unlock it updates the other data. But lock() data usually depends on getSize() so using EDT_SOFTWARE like other drivers causes crashes.
Not sure what the best solution here would be (maybe more flags or more lock functions?), so I just document the deviating behaviour and leave it as is.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6559 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 21:38:06 +00:00
cutealien f06347c8b7 Load top-down bmp images correctly
Previously we handled all sizes as unsigned, but Windows BMP files can have negative height to signal top-down images.
No clue about left-right (would be trivial to swap as well, but found no info so far if that would be correct)

Also casting away some new compile warning in gcc for COBJMeshFileLoader


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6558 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-05 21:04:55 +00:00
cutealien 099f83c023 Fix compiler warning in COBJMeshFileLoader
Caused by recent patches for 1.8 - which still had different parameter types in IReadFile::read

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6557 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-03 15:55:45 +00:00
cutealien 857c75f37d Merging r6555 from branch releases/1.8 to trunk
- Fixing buffer ovverread in CXMeshFileLoader (sfan5 patch)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6556 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-03 15:21:39 +00:00
cutealien b6e9202272 Merging r6551 through r6553 from branch releases/1.8 to trunk
All about bounds checks and preventing buffer overruns in b3d and obj files based on sfan5 patches for Minetest


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6554 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-03 15:08:40 +00:00
cutealien b93dac3ee1 Merging r6547 from branch releases/1.8 to trunk
Just updating changes.txt (stuff got backported, so changes are now mentioned in 1.8.6 instead of 1.9)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6550 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-03 12:56:33 +00:00
cutealien 7fd0f2b1fb COBJMeshFileLoader: Avoid memory leak when handling files with invalid vertex indices
Thanks @sfan5 for report and patch
Was part of the Minetest commit 80e1609 patch which was applied earlier
(couldn't apply this with the rest as the rest could be fixed in Irrlicht 1.8, while this one is about new Irrlicht 1.9 code)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6548 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-02 21:49:08 +00:00
cutealien 5a6e8c9d65 Merging r6522 through r6546 from branch releases/1.8 to trunk
- Fixing buffer overflows in bmp and obj loaders
- Fixed loading of rle4 encoded bmp images


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6547 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-02 21:42:40 +00:00
cutealien cd70803500 Add warning about rotateXZBy using right handed rotation
Rest of Irrlicht is using left-handed rotatations.
But 2d vector rotations all uses ccw which is kinda the same direction as this one if you consider those as rotations around Y, so I guess that was maybe the reason back then.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6536 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-09-26 21:31:35 +00:00
cutealien 298623541b Fix number overflows in TGA loader causing crashes
Image size calculation could overflow s32 in one place (but not others where it was done correct), which first lead to wrong amount of memory getting allocated for image data and later crash in the CColorConverter.
Thanks @sfan5 for his fuzzing tests @https://github.com/minetest/irrlicht/issues/236
and @erlehmann for passing them on: https://irrlicht.sourceforge.io/forum/viewtopic.php?t=52925
Also updating changes.txt with TGA loader changes from this and previous commits.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6535 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-09-23 19:01:01 +00:00