Problems with XEffects and DirectX 9

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yeah, I also fell into that trap. Somehow, the RTTs are not stored in the texture cache, and hence my algo didn't work last time (because I only searched the texture cache for RTTs :roll: ). So it should be enough to simply drop the RTT, reset should work then. However, I got the whole problem fixed as well - automatically - so with some time tonight I should get a fully working fix into trunk.
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

Hybrid

The latest patch in the trunk certainly fixed the issue when resetting the DX device - fantastic - thanks very much.

I have been looking at 1.5 in a bit more detail and there does appear to be some problems overall. How do I go about reporting problems (should I even bother) or should I try and fix the problems myself. I found problems with the LWO loader and there has been some regression on the .OBJ loader. Does the 1.5 trunk support arbitrarily large RTT's in DX mode? I am not sure if it should be capable of doing this.

On another issue - mentioned before (sorry to use the same thread). I am still having a problem with casting when using a ISceneNode * iterator to then cast to IBillboardSceneNode * :

Code: Select all

   core::list<ISceneNode *>::ConstIterator it;
   ILightSceneNode     *pLight;
   IBillboardSceneNode *pNode;

   :
   :
   for (Pos = m_Lights.GetHeadPosition(); Pos;) 
      {
      Light = (LIGHTSOURCEPTR) m_Lights.GetNext(Pos);
      pLight = Light->pIRRLight;
      
      it = pLight->getChildren().begin();
      if (*it)
         ((IBillboardSceneNode *) *it)->setSize(Size * pLight->getPosition().getDistanceFrom(pos) * A1_SIZE);
The error messages I get are :

1>c:\msdev\onyx\src\commonstuff\Drawing3D.cpp(353) : error C2635: cannot convert a 'irr::scene::ISceneNode*' to a 'irr::scene::IBillboardSceneNode*'; conversion from a virtual base class is implied
1> c:\msdev\onyx\src\trunk\include\ISceneNode.h(35) : see declaration of 'irr::scene::ISceneNode'
1> c:\msdev\onyx\src\trunk\include\IBillboardSceneNode.h(20) : see declaration of 'irr::scene::IBillboardSceneNode'
1>c:\msdev\onyx\src\commonstuff\Drawing3D.cpp(353) : error C2039: 'setSize' : is not a member of 'irr::scene::ISceneNode'
1> c:\msdev\onyx\src\trunk\include\ISceneNode.h(35) : see declaration of 'irr::scene::ISceneNode'

Any ideas?

Thanks

Anton
Last edited by aheymann on Fri Oct 10, 2008 6:57 am, edited 1 time in total.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Thats great news.

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

Blindside

I have some questions/problems with the xeffects shadowing - should I start a new thread for that?

Thanks

Anton
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You should definitely post some threads in the bug forum, and probably also on the SF bug tracker. Please make separate threads for all separate problems.
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

Hybrid

Do you mind giving some advice on the iterator casting. In 1.5 ISceneNode appears to be an abstract class and that is causing the problem. I could really do with some help on this.

Thanks

Anton
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

ISceneNode has been an abstract class ever since, but we have virtual inheritance now, in order to avoid multiple scene node base classes in case of multiple interfaces inherited. Try the static_cast<IBillboard*> instead.
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

Hallo

I tried that :

it = pLight->getChildren().begin();
if (*it)
{
(static_cast<IBillboardSceneNode *>(*it))->setSize(Size * pLight->getPosition().getDistanceFrom(pos) * A1_SIZE);
}

and compiler generates :

1>c:\msdev\onyx\src\commonstuff\Drawing3D.cpp(354) : error C2635: cannot convert a 'irr::scene::ISceneNode*' to a 'irr::scene::IBillboardSceneNode*'; conversion from a virtual base class is implied
1> c:\msdev\onyx\src\trunk\include\ISceneNode.h(35) : see declaration of 'irr::scene::ISceneNode'
1> c:\msdev\onyx\src\trunk\include\IBillboardSceneNode.h(20) : see declaration of 'irr::scene::IBillboardSceneNode'
1>c:\msdev\onyx\src\commonstuff\Drawing3D.cpp(354) : error C2039: 'setSize' : is not a member of 'irr::scene::ISceneNode'
1> c:\msdev\onyx\src\trunk\include\ISceneNode.h(35) : see declaration of 'irr::scene::ISceneNode'


I replaced it with a dynamic_cast, which generated no errors, but then it crashed at runtime.

I basically have a lightsource (ILightSceneNode), with billboards attached (IBillboardSceneNode) showing the light position and I want to change the size of the billboard.

Thanks

Anton
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Well normally to go from base to derived you need a dynamic cast, because it needs to query the vtable for info at runtime, hence dynamic. The next issue is fixing the crash.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

I do not understand this. In 1.4.2 it all worked fine. Why I am having problems casting in 1.5 - surely something basic have changed.

I have tried declaring the iterator as Iterator and not ConstIterator :

core::list<ISceneNode *>::Iterator it;

:
:
it = pLight->getChildren().begin();

but the following error is being generated :

1>c:\msdev\onyx\src\commonstuff\Drawing3D.cpp(351) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'irr::core::list<T>::ConstIterator' (or there is no acceptable conversion)
1> with
1> [
1> T=irr::scene::ISceneNode *
1> ]
1> c:\msdev\onyx\src\trunk\include\irrList.h(81): could be 'irr::core::list<T>::Iterator &irr::core::list<T>::Iterator::operator =(const irr::core::list<T>::Iterator &)'
1> with
1> [
1> T=irr::scene::ISceneNode *
1> ]
1> while trying to match the argument list '(irr::core::list<T>::Iterator, irr::core::list<T>::ConstIterator)'
1> with
1> [
1> T=irr::scene::ISceneNode *
1> ]


What am I doing wrong!!!

In 1.4.2 the declaration for ISceneNode is

class ISceneNode : public io::IAttributeExchangingObject

and in 1.5 it is

class ISceneNode : virtual public io::IAttributeExchangingObject

I am no c++ language design expert - but is this not where the problem is - it is a major change from 1.4.

Please this is driving me nuts!!!!!!

Anton
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The problem is that we have multiple inheritance of ISceneNode in IBillboardTextSceneNode (as you can see from its name :wink: ) And virtual base classes (in this case ISceneNode) cannot be casted to derived ones without dynamic_cast (or major errors with other casts). So I'll simply remove the virtual inheritance of ISceneNode and duplicate the interface into an IBillboardTextSceneNode. Not a clean solution, but the only one which avoids dynamic_cast and RTTI, at least AFAIK.
Post Reply