Commit Graph

223 Commits

Author SHA1 Message Date
cutealien
c4bbbe1aaf Add IMaterialRendererServices::startUseProgram/stopUseProgram
This makes it possible to set high-level shader constants (which are attached to shader programs) to be set outside
of OnSetConstants.
IShaderConstantSetCallBack::OnCreate has it set automatically now so it works the same as OnSetConstants.
D3D9 and burnings both work different, so there hadn't been a problem with those.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6469 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-24 14:46:09 +00:00
cutealien
16c960c5ed Add IShaderConstantSetCallBack::OnCreate to allow earlier access to IMaterialRendererServices
Accessing IMaterialRendererServices outside of OnSetConstants can be useful and Irrlicht made this a bit too hard to access.
Also OnCreate allows actually for nicer code where initialization and update of shader constants are strictly separated (see changed example).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6465 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-21 14:41:01 +00:00
cutealien
02165eccc8 CD3D9HLSLMaterialRenderer now implementing IMaterialRendererServices itself
Basically now the same as GLSL material renderer already worked.
Before it was using IMaterialRendererServices from CD3D9Driver, but there had been several problems with that:
- The d3d9 driver called functions through the CD3D9MaterialRenderer interface, but CD3D9HLSLMaterialRenderer is not (or maybe no longer?) derived from that class. Reason it still worked was accidental luck - the same functions had been in the same order and due to casts the compiler wasn't noticing it was calling the functions of an unrelated class.
- It was making calls to set shader constants depend on the currently set material in the driver. Which was not necessary and just prevents we can use the IMaterialRendererServices interface without setting the material first (how I found the bug).
Still some problems left for now:
- There's 2 ways to call shader constants. One seems to be only used by hi-level shaders which links constants to the shader. The the other only by low-level shaders which uses global (shader independent) registers.
So maybe this should be 2 interfaces? But not certain, glsl material renderer seems to prevent setting the global registers, but maybe those could be used additionally? I've still allowed it for now in HLSL, just in case it had it's uses.
- setBasicRenderStates probably should not be in IMaterialRendererServices. I'm not seeing any case where this isn't just passed on to the driver. And all classes using it have access to the driver unless I missed one. So probably can just avoid that additional indirection and kick that out of the IMaterialRendererServices interface.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6464 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-21 14:04:57 +00:00
cutealien
ce3dcfde56 Fix recently broken scroll behaviour of listbox with moveOverSelect
This also fixes the combobox which users the listbox like that.
This got broken in [r6454] which had fixed the events send out by the listbox
Note: Still a bit strange behaviour when leaving the combobox at the bottom, but that was already that way in Irrlicht 1.8, so I've got to investigate that on it's own.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6463 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-19 15:17:39 +00:00
cutealien
41bc7a1430 Tiny spelling fixes
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6462 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-16 21:52:36 +00:00
cutealien
0887770a1e Fix spelling (comments)
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6461 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-12 13:22:03 +00:00
cutealien
f9a0cbbf95 Avoid warning in VS 2022
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6460 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-11 13:19:12 +00:00
cutealien
a3adfc196b CIrrDeviceWin32::yield() now uses Sleep(0) instead of Sleep(1).
We had changed that once before in the other direction in svn r421
Reason back then was "Sleep(0) doesn't allow any lower priority threads to execute"
But Microsoft changed the behaviour of Sleep(0) after Windows XP so that's no longer true.
And the costs of it is pretty high - due to this using a timer with a 15ms resolutions it meant not just giving up the thread but it also always waited for 15ms on Windows.
I also replaced a few sleep calls in examples for that reason with yield() calls.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6459 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-03 15:32:41 +00:00
cutealien
920e327d33 Spelling fixes
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6458 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-01 15:50:08 +00:00
cutealien
3a9875cc77 Spelling fixes
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6456 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-03-31 13:12:47 +00:00
cutealien
a23af985e4 Add ICursorControl::getReferenceRect
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6455 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-03-14 22:05:45 +00:00
cutealien
f989112dcb Fix: Listbox was sometimes sending EGET_LISTBOX_SELECTED_AGAIN instead of EGET_LISTBOX_CHANGED.
When pressed mouse was moved over an item before releasing the mouse button it was sending immediately EGET_LISTBOX_SELECTED_AGAIN instead of expected EGET_LISTBOX_CHANGED (mouse  move changes do not send any events).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6454 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-03-06 14:34:16 +00:00
cutealien
75d485b5cd Listbox items can now change individual background colors
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6453 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-03-06 13:42:05 +00:00
cutealien
bda6bb8595 Avoid undefined arithmetic on nullptr in buffer_offset function
Not quite sure why it was done that way. Maybe to ensure we work with byte-pointers of correct size or something? 
Anyway, this doesn't seem to be defined in c++, so let's try working with a cast instead.
Just something cppcheck tool complained about.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6447 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-01-04 19:51:24 +00:00
cutealien
f2c93d80be Prevent memory leaks when loding broken ms3d files
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6446 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-01-04 19:02:42 +00:00
cutealien
817d59f379 Prevent potential 0 pointer access when release not acquired joystick.
Found by clang analyser. Not sure if it could really ever have happened, but won't hurt to fix

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6443 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-11-19 16:41:11 +00:00
cutealien
fc96c50e53 Fix newly added Irrlicht17.sln file for VC2022
Was internally still using a VC16 project file

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6442 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-11-19 14:28:27 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
cutealien
cfde879801 Add checks for sane image sizes in some image loaders (bmp, jpg, tga, png)
Thanks @sfan5 for the original patch (got modified a bit): dbd39120e7
Forum: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819&p=306518
Those are the common formats, but rest of image loaders should also call this some day.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6387 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-08 14:42:59 +00:00
cutealien
72b1522083 Add IImage::checkDataSizeLimit and make IImage getDataSizeFromFormat return size_t
It's to allow image loader to check for sane limits for image sizes.
Idea came from this patch from sfan5 for Minetest: dbd39120e7
Thought solution is a bit different. 
Image loader checks not yet added (will come soon).
Also note that limit is to s32. While u32 might work mostly it will run into some troubles with color converter for now (which maybe could be changes). Also 2GB ought to be enough for anybody, right?

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6386 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-06 19:47:38 +00:00
cutealien
76d013d9d6 Fix crash with large jpg files.
Based somewhat on a patch in Minetest from sfan5 594de99153
There might be more problems which may be the reason they checked for other values in Minetest, but don't have more info for now and so far this works.
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@6385 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-06 16:00:26 +00:00
cutealien
156463da4f Simplify/unify IGUIListBox interface.
Only needs one addItem function when using default parameters for icon.
Add default parameters for setIcon, insertIcon so they can be used easier with pure text.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6384 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-05 15:19:35 +00:00
cutealien
7b6115bcf1 Update VS and c::b project files for burningvideo 0.54
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6381 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-05 13:07:45 +00:00
engineer_apple
83851413a6 clang warnings (OnSetMaterial multiple inheritance IMaterialRendererServices,IShaderConstantSetCallBack)
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6378 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-04 10:29:41 +00:00