Irrlicht-Spintz-0.12
It's not hard to modify animators at real time by me but another thinks hurts me about:Spintz wrote: It would be nice to modify animators at real time, instead of dropping them and creating new ones.
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.
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.
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.
Last edited by Spintz on Mon Oct 03, 2005 10:58 pm, edited 1 time in total.
Ok, so the summary of events and callbacks for animators :
Animators with callback events being added -
Animators with no callback events being added -
Hope this covers what you were expecting Etcaptor, if not, let me know, gimme more ideas!
Animators with callback events being added -
- Delete Animator - STOP event only
- FlyStraight Animator - STOP and LOOP events
- FollowSpline Animator - STOP, LOOP and WAYPOINT events
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.
Hope this covers what you were expecting Etcaptor, if not, let me know, gimme more ideas!
that link doesnt work SpintzSpintz wrote: http://irrlicht.spintz.com/spintzfundemo.rar
Sorry fixed link in other post, here it is again as well -
http://irrlicht.spintz.com/downloads/spintzfundemo.rar
http://irrlicht.spintz.com/downloads/spintzfundemo.rar
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.
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.
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.
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.
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.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!
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
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:
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
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:(.
-
- Posts: 142
- Joined: Sat Dec 11, 2004 8:13 am
- Contact: