From: Hedayat V. <hed...@ai...> - 2010-02-20 08:54:57
|
Hi! On ۱۰/۰۲/۲۰ 09:40, Joschka Boedecker wrote: > Hi Hedayat and all, > > On Feb 19, 2010, at 11:41 PM, Hedayat Vatankhah wrote: > > >> Hi Andreas! >> >> On ۱۰/۰۲/۱۹ 09:27, ah...@un... wrote: >> >>> Hi, >>> >>> >>> As you see in my recent commit, all classes that implement ODE physics >>> objects are now in a separated plugin directory. >>> >>> The plan right now is to rename them from ODE(...) to (...)Imp. So, there >>> would be BoxColliderImp, RigidBodyImp, JointImp et.al. in the odeimps >>> directory. For other Physics engines, we'd have a bulletimps or physximps >>> directory that redifine those classes with their corresponding >>> engine-specific code. >>> The abstract physics classes will then retrieve an instance of their >>> corresponding implementation class from the scenegraph and upcast it to >>> (...)Int. By delegating calls to this instance, they will be able to work >>> with it without even knowing which engine is currently in use. >>> >>> >> Well, there is no need to have these classes in the scenegraph. All you >> need is to register them with zeitgeist (as you've apparently done with >> the AngularMotorImp class), and then you should be able to retrieve new >> class instances in ruby or in C++ (e.g. using >> GetCore()->New("AngularMotorImp") in C++). >> > IIRC the ClassObjects (i.e. the factories) are installed in the scene graph under /sys/classes (or just /classes ?) when the bundle is imported. In the call you described above, the core would get the ClassObject from there and use it to create an instance of that class. > Oops, yes you should be right :P. > >> But, as you mentioned before, you've planned to have a PhysicsServer >> class implementation for each engine which acts as a factory for other >> engine implementation classes. I prefer that approach too! Specially >> notice that the above case is still inflexible: consider that we have >> both Bullet and ODE classes, which one is going to be registered as >> AngularMotorImp? >> >> > I guess it depends on whether we will need to have Bullet and ODE classes (and maybe others in the future) registered at the same time. I actually don't think we do, since I can't imagine a case where we would need to switch between engines during run-time, but if anyone has a good example of why we should implement that, we can discuss it. > > If we don't need different engine-specific sets of classes loaded at the same time, we will not need separate PhysicsServers for each engine, and the approach described by Andreas above should work fine. I argued against having a separate factory because it kind of duplicates work that Zeitgeist gives us for free anyways. > Sorry again! It was because of my mistake, I just didn't notice that if we don't want to use a physics engine, we won't import its bundle at the first place! :P So, I thought that we WILL register all physics engine at the same time and I was looking for a solution. Therefore, my comments were completely misleading! We will certainly import a single physics implementation bundle each time, so there is no need for a factory class (I was not comfortable with having another factory when Zeitgeist is already there too!!), and there is no need for a prefix as I said before. So the whole email was garbage! :D :P Sorry for that. > [...]All I need to know now is how to make these Imp classes show up > in the >>> scenegraph. Right now, I tried to do this with AngularMotorImp and did the >>> following: >>> >>> - derived AngularMotorImp from BaseNode >>> - put "DECLARE_CLASS(AngularMotorImp)" in odeangularmotor.h >>> - created odeangularmotor_c.cpp with CLASS(AngularMotorImp)::DefineClass() >>> - created an export.cpp file with ZEITGEIST_EXPORT(AngularMotorImp); >>> - put "importbundle(odeimps)" at the bottom of spark.rb >>> >>> According to rsgedit, AngularMotorImp is still not showing up in the >>> SceneGraph, so maybe someone can tell me what I forgot or even give me a >>> step-by-step guide on how to put these classes in the SceneGraph (and >>> later retrieve objects). >>> > @Andreas: did you have a look below /sys/classes in the scene graph? Are you sure the bundle was imported correctly? If they were not there, maybe a step is missing to get the bundle imported. The steps you described look correct to me though. I'll try to have a look. > The gendot utility in simspark-utilities is another way to look at the registered classes. Import your odeimps bundle in gendot.rb and look at the zeitgeist.dot output file. You should be able to see the classes. Good luck! Hedayat > Cheers, > Joschka= > |