Page 4 of 6

Posted: Sun Oct 02, 2005 8:51 pm
by katoun
Or Paging Landscape Manager(like the Ogre users call it).

Posted: Mon Oct 03, 2005 2:04 pm
by etcaptor
Spintz wrote: It would be nice to modify animators at real time, instead of dropping them and creating new ones.
It's not hard to modify animators at real time by me but another thinks hurts me about:
Spintz wrote:Yeah, that's kind of a pain, because there is nothing common between the different animators. The only thing, they use time for something, but for all different times

At now not one part of Irrlicht program knows something about current condition and parameters of any animator.
Let imagine how we can create simple sequence of action for any mechanism based on animators:
For example we want any node which must spin around circle three times /CSceneNodeAnimatorFlyCircle/, after that to make five straight moves/CSceneNodeAnimatorFlyStraight/ and after that to rotate around its axis 50 times/CSceneNodeAnimatorRotation/. No way right?

What we need for this? I have two ideas, but will describe only current.
We need any event system for animators. Something like Irrlicht event system.

For each animator must be defined any events related with type of animator.
Also each animator must have Start and Stop function or variable, Also SendEvend() function is needed, for sending of parameters and values. They should be described in Event type structure. By this way you can catch every event from each animator and manipulate all animators at runtime. I tried this only for my derived animators, because wont change engine code, but if you have any ideas about can post it.

Posted: Mon Oct 03, 2005 3:30 pm
by Spintz
I've already implemented a callback for all sceneNodeAnimators. The thing that is nice though, is the event structure for specifying which type of event the animator is firing off.

As far as events go, I can think of, Start, Stop and Loop.

Posted: Mon Oct 03, 2005 3:39 pm
by etcaptor
It's this feature already in your current uploaded version?

Posted: Mon Oct 03, 2005 5:59 pm
by Spintz
No, it's not uploaded yet, I've got a lot of things I'm working on right now. 3rd person camera, an irr::map implementation, similar to stl::map, finishing up this scene node animator callback stuff and now adding the event enumeration to callbacks, and a few other things. Prolly be end of this week, or beginning of next week when I will update and upload a new version. If you'd like, I can make the code available for you to download and test, although the delete animator callback, already works, as you can see in this demo here :

http://irrlicht.spintz.com/downloads/spintzfundemo.rar

When you hit the globes with a rocket or bullet ( left mouse shoots and right mouse changes weapon ), particle systems are spawn, for an explostion type effect and a 2 second delete animator is created. The callback is registered with the delete animator, and is called right before the actual deletion of the sceneNode. In that callback, the particle systems are removed, so when the globe is removed, the particle systems for explosion effect are removed as well.

Posted: Mon Oct 03, 2005 8:16 pm
by Spintz
Ok, so the summary of events and callbacks for animators :

Animators with callback events being added -
  • Delete Animator - STOP event only
  • FlyStraight Animator - STOP and LOOP events
  • FollowSpline Animator - STOP, LOOP and WAYPOINT events
These are the only events I can think of that make sense.

Animators with no callback events being added -
  • FlyCircle is meant to fly indefinitely, so I see no point in adding a counter to send a LOOP event every full circle of rotation ( it would be very easy, however, if anyone would be interested in that ).
  • Texture animator - the only event that would make sense here, is an event everytime the texture changed. Again, I see no point in that event, so am not adding it, unless anyone thinks it necessary.
  • Rotation animator - new to IrrSpintz-0.12, but same as flycircle, no real point in having animator call LOOP event every full rotation, unless anyone wants it.
  • CollisionResponse animtor - I can think of a few things here that may make some sense to implement, like falling events, collision events, etc. I really don't see that much of a need for any of them, unless, maybe you were using this collision animator, and wanted to set animations for your character based on their state, falling etc. Don't really think that's a good way to do it though, unless, again, if anyone wants it, I'll implement it.
So any other ideas for events for animators, or even more ideas for new animators, particle emitters/affectors???

Hope this covers what you were expecting Etcaptor, if not, let me know, gimme more ideas! :D

Posted: Mon Oct 03, 2005 9:30 pm
by sRc
that link doesnt work Spintz :(

Posted: Mon Oct 03, 2005 9:35 pm
by katoun
Cool.Realy want to see the stl::map code.How are you going to do the search, what method are you going to use, red-black,quick-search,binari-search,trinary-search-tree, because that's the bigeest part of the stl::map code.(something like the array from Irrlicht).

Posted: Mon Oct 03, 2005 10:58 pm
by Spintz
Sorry fixed link in other post, here it is again as well -

http://irrlicht.spintz.com/downloads/spintzfundemo.rar

Posted: Tue Oct 04, 2005 12:10 am
by Spintz
Callback data was very easy to implement, and is working.

The same link as before has a cool little demo -

http://irrlicht.spintz.com/downloads/spintzfundemo.rar

You can use V to zoom in/out.

You'll notice printouts in the console window for Waypoint events and deletion events.

Posted: Tue Oct 04, 2005 5:10 am
by etcaptor
Well, callbacks method is another way.
Are needed two things:
- some callback event
- changing of parameters of animator at runtime.

So, I suppose that for animators set and get methods already is added.
Basically, when some condition appears in body of animate function, animator execute callbacks onEvent function.
Another thing that maybe you can estimate like useful is some Boolean value for animator, that enables/disables execution of whole part of animate function. For example:
- private:
- bool enabled
- public:
- setAnimationEnabled(enabled)
- isAnimationEnabled(enabled)

animateNode(ISceneNode* node, u32 timeMs)
{
if(!enabled)
return;

}

So, you will be able to start/stop current animation from any part of your application.

Another thing which I use for my purposes is defining of getNodeAnimators() function for ISceneNode, so we can extract animator list for this node.

Posted: Tue Oct 04, 2005 5:25 am
by etcaptor
Spintz wrote: So any other ideas for events for animators, or even more ideas for new animators, particle emitters/affectors???
Hope this covers what you were expecting Etcaptor, if not, let me know, gimme more ideas! :D
What about for scale animator? I saw this animator in Arrena of Honor project and added loop and autoreverse features. I added this animator in my VisualEditor for test.

IScaleAnimator.h

Code: Select all

//---------------------------------------------------------------------------

#ifndef IScaleAnimatorH
#define IScaleAnimatorH
//---------------------------------------------------------------------------
#endif


#include <irrlicht.h>

    namespace irr
    {
        namespace scene
        {

            class IScaleAnimator : public scene::ISceneNodeAnimator
            {
                public:
            	IScaleAnimator(u32 TimeToScale, core::vector3df StartScale, core::vector3df EndScale, bool autoreverse = false, bool loop = false);
            	virtual ~IScaleAnimator ();
            	virtual void animateNode (scene::ISceneNode *node, u32 timeMs);
                virtual ISceneNode* getNode(){return Node;}   //etcaptor

                private:

                u32 mStartTime;
            	u32 mTimeToScale;
            	core::vector3df mStartScale;
            	core::vector3df mEndScale;
                bool AutoReverse;
                bool Loop;

                ISceneNode* Node;//etcaptor
            };



       } // end namespace scene
   }   // end namespace irr

IScaleAnimator.cpp

Code: Select all

/* ------------------------------------------------------------- */

 namespace irr
 {
  namespace scene
   {

    IScaleAnimator::IScaleAnimator(u32 TimeToScale, core::vector3df StartScale, core::vector3df EndScale, bool autoreverse, bool loop)
    {
        mStartTime = 0;
        mTimeToScale = TimeToScale;

        mStartScale = StartScale;
        mEndScale = EndScale;

        AutoReverse = autoreverse;
        if(AutoReverse && loop)
            Loop = true;
        else
            Loop = false;
    }

    IScaleAnimator::~IScaleAnimator ()
    {

    }

    void IScaleAnimator::animateNode (scene::ISceneNode *node, u32 timeMs)
    {
        Node = node;

    	if (mStartTime == 0)
    	{
    	    mStartTime = timeMs;
    	}

	    u32 passedTime = timeMs - mStartTime;


       	if ( passedTime > mTimeToScale )
    	{
            if(!Loop)                    //etcaptor
        		return ; //end of process
    	}

    	f32 progress = f32(passedTime) / f32(mTimeToScale);
    	core::vector3df scale = mStartScale + (mEndScale-mStartScale) * progress;

    	node->setScale(scale);


        if(AutoReverse && passedTime > mTimeToScale/2) //etcaptor
        {
            core::vector3df scale = mEndScale - (mEndScale-mStartScale) * progress;
            node->setScale(scale);
            if (passedTime > mTimeToScale)
                mStartTime = timeMs;
        }



    }


  } // end namespace scene
 }   // end namespace irr

Posted: Sat Oct 29, 2005 12:39 am
by Guest
edited by GFXstyLER: too much stupid questions and comments, everything´s solved now!

Posted: Sun Nov 06, 2005 6:00 am
by Guest
hi!

i dont know if this is a bug or if its my fault, but it seems that irrlicht-spintz does not work right for linux:

Code: Select all

../../libs/irrlicht-spintz-0.12/lib/Linux/libIrrlicht-Spintz.a(CParticleSystemSceneNode.o): In function `irr::scene::CParticleSystemSceneNode::createSphereEmitter(irr::core::vector3d<float>, float, irr::core::vector3d<float>, unsigned, unsigned, irr::video::SColor, irr::video::SColor, unsigned, unsigned, int)':
CParticleSystemSceneNode.cpp:(.text+0xbe6): undefined reference to `irr::scene::CParticleSphereEmitter::CParticleSphereEmitter[in-charge](irr::core::vector3d<float>, float, irr::core::vector3d<float>, unsigned, unsigned, irr::video::SColor, irr::video::SColor, unsigned, unsigned, int)'
../../libs/irrlicht-spintz-0.12/lib/Linux/libIrrlicht-Spintz.a(CParticleSystemSceneNode.o): In function `irr::scene::CParticleSystemSceneNode::createRingEmitter(irr::core::vector3d<float>, float, float, irr::core::vector3d<float>, unsigned, unsigned, irr::video::SColor, irr::video::SColor, unsigned, unsigned, int)':
CParticleSystemSceneNode.cpp:(.text+0xcbb): undefined reference to `irr::scene::CParticleRingEmitter::CParticleRingEmitter[in-charge](irr::core::vector3d<float>, float, float, irr::core::vector3d<float>, unsigned, unsigned, irr::video::SColor, irr::video::SColor, unsigned, unsigned, int)'
../../libs/irrlicht-spintz-0.12/lib/Linux/libIrrlicht-Spintz.a(CParticleSystemSceneNode.o): In function `irr::scene::CParticleSystemSceneNode::createMeshEmitter(irr::scene::IMesh*, bool, irr::core::vector3d<float>, float, int, bool, unsigned, unsigned, irr::video::SColor, irr::video::SColor, unsigned, unsigned, int)':
CParticleSystemSceneNode.cpp:(.text+0xd9b): undefined reference to `irr::scene::CParticleMeshEmitter::CParticleMeshEmitter[in-charge](irr::scene::IMesh*, bool, irr::core::vector3d<float>, float, int, bool, unsigned, unsigned, irr::video::SColor, irr::video::SColor, unsigned, unsigned, int)'
../../libs/irrlicht-spintz-0.12/lib/Linux/libIrrlicht-Spintz.a(CParticleSystemSceneNode.o): In function `irr::scene::CParticleSystemSceneNode::createAttractionAffector(irr::core::vector3d<float>, float, bool, bool, bool)':
CParticleSystemSceneNode.cpp:(.text+0xf35): undefined reference to `irr::scene::CParticleAttractionAffector::CParticleAttractionAffector[in-charge](irr::core::vector3d<float>, float, bool, bool, bool)'
../../libs/irrlicht-spintz-0.12/lib/Linux/libIrrlicht-Spintz.a(CParticleSystemSceneNode.o): In function `irr::scene::CParticleSystemSceneNode::createRotationAffector(float, float, float, irr::core::vector3d<float>)':
CParticleSystemSceneNode.cpp:(.
the exact same code works 100% in windows, and irrlicht .012 original works fine in linux. i just noticed it because i compiled irrlicht-spintz for linux :)

Posted: Fri Nov 11, 2005 7:50 pm
by dracflamloc
This is cool spintz thanks you for the directional and spot lights!