Commit Graph

241 Commits

Author SHA1 Message Date
cutealien
92564435f4 Fix bad cast in CIndexBuffer. Modify IIndexBuffer interface for cleanup and safety.
CIndexBuffer::setType could end up casting a temporary u16 variable to u32& (reference!).
Probably never noticed as this tended to mostly works (guess next byte on stack often 0?).
To prevent this from happening again I modifed IIndexBuffer::push_back to work with copies instead of references.
While breaking the interface anyway I also deprecated pointer() which is just identical to getData() anyway.
I get the idea of staying similar to core::array interface, but it's just confusing (and not same due to lack of types anyway).
Also added a const version for getData()

On a side-note - same setType bug still in CVertexBuffer, but a bit harder to fix there. So will be an new patch.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6357 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-22 16:28:29 +00:00
cutealien
8a9e82fed9 Bit cleanup of IDynamicMeshBuffer.
No point in repeating pure virtual functions
(maybe wasn't meant to be derived from IMeshBuffer at first?)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6356 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-22 14:22:41 +00:00
cutealien
5163d74e3f Remove trivial copy constructors and assignment operators
Thanks @sfan5 for patch for Mintest: 4931b34625
Forum: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819
Note - patch is not applied exaclty yet. SMaterial and matrix4 still missing (might be applied later).
Also patch was based on older Irrlicht and we removed a few already earlier this year (around r6280).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6355 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-21 22:24:14 +00:00
cutealien
df17e52a05 CXMeshFileLoader: initialize normals (and other S3DVertex values ) to 0 when loading
Thanks @sfan5 for patch in Minetest: 0500a7798b
Changed it slightly as more value were not initialized than just normals.
Forum: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819&p=306518#p306518


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6354 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-21 21:11:48 +00:00
cutealien
8fcc572845 CB3DMeshFileLoader: abort if offsets point outside of file
Thanks @sfan5 for patch in Mintest: 195759100f
Forum: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819&p=306518


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6353 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-21 20:50:15 +00:00
cutealien
0317f678fb Fix bounds checking in CMemoryWriteFile::seek
Thanks @sfan5 for patch: a3d848ff8b
Note I also modified the bounds checks for CMemoryReadFile once more to unify it with how Minetest fixed it. 
Due to some strange coincidence I had run into that bug yesterday for CMemoryReadFile and fixed it without realizing a fix was also part of a bunch of patches I had gotten 3 days earlier in the forum:
https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819&p=306518#p306518


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6352 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-21 20:39:31 +00:00
cutealien
a48b3a8d00 Fix not properly resizing on macOS due to incorrect window size
Thanks @torleif, Jordach and sfan5 for patch in Minetest: fa7a5dbdef
Forum: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819&p=306518#p306518
Note: Not tested by me, as usual with OSX patches I just apply it as it seems to make sense.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6351 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-21 20:21:56 +00:00
cutealien
4d8d638ce2 Avoid warning
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6350 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-20 22:16:33 +00:00
cutealien
439667b369 Speed up stl format loading, especially with text format.
Loading whole file now in memory (unless it's already a memory file).
And avoiding lots of memory allocations otherwise by buffering token string in class object.
Was a bit unusable before for large files (several minute loading times now down to a second)-

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6349 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-20 22:09:03 +00:00
cutealien
9504b3da21 Prevent CMemoryFile to seek to a point before the start.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6348 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-20 21:57:25 +00:00
cutealien
3f2f98d7bd stl mesh writer can now write 32 bit meshbuffers.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6347 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-20 18:31:03 +00:00
cutealien
28e092673f b3d writer can now write 32-bit meshbuffers.
Still can't read it though - reader needs SSkinMeshBuffer which only supports 16 bit so far
(changes in loader are just spelling fixes in comments)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6346 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-20 17:56:40 +00:00
cutealien
8cd7e46506 Add non-const version of IVertexBuffer::operator[]
Yeah, setValue is not enough and if getLast() works then this should work as well (when users are very careful...)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6345 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-20 11:03:23 +00:00
cutealien
57bcc52ca1 Add IVertexBuffer::setValue. Add comments.
Same as in IIndexBuffer. Needed as replacement for non const operator[] which can't be done for this interface (as type is dynamic).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6344 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-20 10:38:26 +00:00
cutealien
dd36699ad2 Set default for MeshLoader IndexTypeHint to EITH_OPTIMAL.
Did some tests and the overhead speed cost on loading and rendering where both not really measurable even in a pretty huge scene.
While some Irrlicht parts might still have a problem with 32-bit meshes (octree for example, also some meshmanipulator functions), it's probably still less of a problem than having broken meshes and just a nicer default. Also the troubling parts in Irrlicht can be improved over time.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6343 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-19 21:44:50 +00:00
cutealien
3ce2f0c0dd stl meshloader can now load 32 bit buffers (with corresponding hint)
Thanks @Foaly for the patch (https://irrlicht.sourceforge.io/forum/viewtopic.php?f=9&t=51441)
Applied with some minor changes.
Also mesh-type in that loader now set to EAMT_STATIC (was EAMT_OBJ before, probably some copy-pasting going on).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6342 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-19 21:32:11 +00:00
cutealien
a2bb74096d IVertexBuffer and IIndexBuffer reallocate functions now pass through canShrink parameter to array
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6341 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-19 15:43:39 +00:00
cutealien
24f2a1e9ab Rename IMeshLoader::setPreferredIndexType to setIndexTypeHint and give it a new enum.
Giving the loader it's own enum allowed me to add more options. 
EITH_OPTIMAL which reduces buffers back to 16-bit if they don't need 32-bit.
Using that in obj loader.
Also 32-bit meshes with EMT_PARALLAX_MAP_SOLID material should now work in obj loader (untested as I got no test-case)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6340 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-19 13:10:16 +00:00
cutealien
d484711f2e CVertexBuffer no longer re-allocates stuff when type doesn't change
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6339 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-19 12:21:44 +00:00
cutealien
49616fd438 CIndexBuffer no longer re-allocates stuff when type doesn't change
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6338 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-19 12:18:15 +00:00
cutealien
fc1e2c3b91 Rename some internal/unused draw2DImage function in COpenGLDriver to draw2DImageQuad to avoid warnings.
Also added a bit documentation about what it's purpose seems to be (hope I got it right...).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6336 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-15 18:36:56 +00:00
cutealien
c5b349ddb0 Add IMeshBufffer::clone for buffer copies, use it in CMeshManipulator::createMeshCopy
CMeshManipulator::createMeshCopy creates new meshes which have copies of the actual meshbuffers instead of copying everything into SMeshBuffers (which didn't support 32 bit or any of the other special features).



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6335 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-14 16:54:06 +00:00
cutealien
8447d3f531 obj writer can now write 32 bit buffers
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6334 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-14 14:39:31 +00:00
cutealien
c58afe8038 IMeshLoader can now set hints to prefer 16/32 bit buffers. Obj loader can now load 32 bit buffers.
- IMeshLoader::setPreferredIndexType and getPreferredIndexType allow setting hints for the loaders if users prefer 16 or 32 bit meshbuffers. Loaders are free to ignore those hints (all but .obj will do that for now).
- obj meshloader loads now 32-bit buffers when setPreferredIndexType is set to EIT_32BIT.
NOTE: It's 16 bit meshes use now also an IDynamicMeshbuffer instead of an SMeshBuffer.
That will break the code of people who accessed meshbuffer before by casting to SMeshBuffer*
And might even be somewhat slower (lot's of virtual functions...), but shouldn't really matter and can maybe be a bit improved.
Sorry about that, I considered keeping SMeshBuffer for 16-bit (still considering it), but it would add some overhead in code and I don't think it's worth that. If there are any complains I'll maybe consider it again.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6333 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-14 14:03:39 +00:00
cutealien
456bf86e66 Add missing IRR_OVERRIDE in some functions.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6332 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-12 21:58:35 +00:00
cutealien
f9c85f380d Adding comments.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6331 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-12 16:04:56 +00:00
cutealien
71e9798d2a Add IMeshBuffer::getType
Allows to find out which class a meshbuffer has.
I used the same kind of style as ISceneNode::getType. So using four CC codes and virtual functions (instead of type variable).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6330 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-11 14:36:49 +00:00
cutealien
64fc9113fc Split CNullDriver::checkImage into 2 functions to avoid some memory allocations in addTexture
Avoid creating dummy arrays when we work with non array images.
Just a minor speed improvement.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6329 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-06 20:20:36 +00:00
engineer_apple
2ddd6f5355 typo
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6328 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-04-04 16:37:55 +00:00
cutealien
3dc5f8fd9f Replace more getSize() with getOriginalSize() calls in tests.
Textures involved had all power of two sizes anyway, so no real difference in this case, just a bit cleaner.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6326 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-30 21:52:26 +00:00
cutealien
3aac180dc7 Print out colorformat when screenshot test fails
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6325 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-30 16:54:46 +00:00
cutealien
5785b73d47 Add documentation that sourceRect of draw2dImage is based on the OriginalSize
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6324 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-30 10:49:13 +00:00
engineer_apple
8e2e2886a9 for using correct subimage tex-coordinates in the gui texture->getOriginalSize has to be used
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6323 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-30 08:11:58 +00:00
cutealien
ddb2028231 Add another screenshot test
Drawing the screenshot itself before taking final result to see if the problem is in the render or the screenshot
Note: Test-images for software-drivers show some other problems there which this test wasn't about.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6322 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-29 20:24:24 +00:00
cutealien
aa839d45a1 Stop linking to libs which the tests Makefile does not seem to need
Tests seem to work fine without -Xext and -Xcursor so kicking those out for now.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6321 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-28 22:11:26 +00:00
cutealien
044fe29f3d Slow down switching drivers in orthoCam test.
Add 2 missing test-files to c::b project file.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6320 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-28 19:52:00 +00:00
cutealien
71d952acfc Add version 130 requirement to cubeMapReflection.frag
Thanks @juozas for reporting the bug: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=7&t=13869&start=390


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6319 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-27 19:27:19 +00:00
cutealien
da77810fb5 Comment fixes in example 25
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6318 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-25 18:25:33 +00:00
cutealien
f0c890d3ff Minor improvements and cleanup for example 24.CursorControl
- ESC now also makes cursor visible again (probably first key users press in panic usually)
- Bunch of spelling fixes
- Let all words in UI elements start with upper-case

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6317 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-25 17:54:28 +00:00
cutealien
60538c3646 Fix comment.
(Did I have a stroke when I was typing the old one?)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6316 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-24 22:24:13 +00:00
cutealien
f013a95a0e Improve UI behavior in resizing in example 22.MaterialViewer
Also a bit better defaults for sizes and positions of nodes&camera

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6315 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-24 21:32:12 +00:00
cutealien
3f13323e60 Allow switching between cube/sphere in example 22.MaterialViewer
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6314 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-24 21:14:37 +00:00
cutealien
669ad7860a Add new cube mesh type ECMT_1BUF_24VTX_NP. CubeSceneNodes can now use different cube mesh types.
1 Meshbuffer with 24 vertices, so each side has it's own vertices.
Normals perpendicular to the cube-sides.
CubeSceneNode accepts now a ECUBE_MESH_TYPE
CubeSceneNode::clone now also clones rotation and scale (not sure why it didn't do that before - hope there was no reason, but can't think of any).
ISceneManager::addCubeSceneNode accepts now a ECUBE_MESH_TYPE and passes it through.
Example 22.MaterialViewer using new cube type. Also a few more beauty fixes there.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6313 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-22 22:08:33 +00:00
cutealien
f61b8614ab Cleanup example 22.MaterialViewer
Using default light values which work a bit better with cube.
But really needs another cube-type (which Irrlicht has not yet, needs single material with 24 vertices)
as a cube with vertex normals which average connected sides is horrible with vertex-lighting
(the problem is that the light get's behind the plane formed by the vertex-normal this way which is super confusing).
Will probably add another cube-type soon.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6312 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-20 19:09:40 +00:00
cutealien
73247f4a21 Make UI in example 22.MaterialViewer a bit nicer.
Less black on grey text.
Prevent controlling light and ui-elements same time.
Bit more compact code in a few places.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6311 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-19 16:07:38 +00:00
cutealien
8254c0848c Minor cleanup and comment fixes in example 21
Mostly spelling stuff. 
Only real code change is that Irrlicht has by now a function to fill images, so no more extra code for that needed.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6310 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-17 20:12:40 +00:00
cutealien
3035e27e67 Remove unused variable in example 19
Added that one accidentally in my last commit (leftover from a failed experiment)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6309 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-17 19:16:28 +00:00
cutealien
713018cae1 Minor update for example 19.MouseAndJoystick.
Don't move the mouse anymore when the mouse hasn't moved.
This was sometimes confusing because events are only caught inside the window (at least on Windows),
which lead to the node moving seemingly randomly when the mouse was outside.
Also added a few more comments to mention CursorControl as an alternative.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6308 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-16 20:59:43 +00:00
cutealien
e50adc3066 Add tiny UI to SplitScreen example and some minor cleanup.
Just to show that GUI can be used print usable keys on screen.
Also ESC can be used now to quit.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6307 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-15 19:31:04 +00:00
cutealien
d31b7aa261 Minor comment changes in example 16
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6306 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-03-14 17:59:47 +00:00