Added args to ApplyEffect
This commit is contained in:
parent
f96c5a9f7e
commit
6148783fe4
|
@ -128,13 +128,13 @@ void Octree::Visit(ICustomBody* customBodyRef, VisitorAction hitAction )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Octree::Visit(const Oyster::Collision3D::ICollideable& collideable, VisitorActionCollideable hitAction)
|
void Octree::Visit(const Oyster::Collision3D::ICollideable& collideable, void* args, VisitorActionCollideable hitAction)
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i<this->leafData.size(); i++)
|
for(unsigned int i = 0; i<this->leafData.size(); i++)
|
||||||
{
|
{
|
||||||
if(collideable.Intersects(this->leafData[i].container))
|
if(collideable.Intersects(this->leafData[i].container))
|
||||||
{
|
{
|
||||||
hitAction( this->GetCustomBody(i) );
|
hitAction( this->GetCustomBody(i), args );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Oyster
|
||||||
static const unsigned int invalid_ref;
|
static const unsigned int invalid_ref;
|
||||||
|
|
||||||
typedef void(*VisitorAction)(Octree&, unsigned int, unsigned int);
|
typedef void(*VisitorAction)(Octree&, unsigned int, unsigned int);
|
||||||
typedef void(*VisitorActionCollideable)(ICustomBody*);
|
typedef void(*VisitorActionCollideable)(ICustomBody*, void*);
|
||||||
|
|
||||||
struct Data
|
struct Data
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ namespace Oyster
|
||||||
std::vector<ICustomBody*>& Sample(ICustomBody* customBodyRef, std::vector<ICustomBody*>& updateList);
|
std::vector<ICustomBody*>& Sample(ICustomBody* customBodyRef, std::vector<ICustomBody*>& updateList);
|
||||||
std::vector<ICustomBody*>& Sample(const Oyster::Collision3D::ICollideable& collideable, std::vector<ICustomBody*>& updateList);
|
std::vector<ICustomBody*>& Sample(const Oyster::Collision3D::ICollideable& collideable, std::vector<ICustomBody*>& updateList);
|
||||||
void Visit(ICustomBody* customBodyRef, VisitorAction hitAction );
|
void Visit(ICustomBody* customBodyRef, VisitorAction hitAction );
|
||||||
void Visit(const Oyster::Collision3D::ICollideable& collideable, VisitorActionCollideable hitAction );
|
void Visit(const Oyster::Collision3D::ICollideable& collideable, void* args, VisitorActionCollideable hitAction );
|
||||||
|
|
||||||
ICustomBody* GetCustomBody(const unsigned int tempRef);
|
ICustomBody* GetCustomBody(const unsigned int tempRef);
|
||||||
|
|
||||||
|
|
|
@ -276,9 +276,9 @@ void API_Impl::RemoveGravity( const API::Gravity &g )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void API_Impl::ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void(hitAction)(ICustomBody*) )
|
void API_Impl::ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void* args, void(hitAction)(ICustomBody*, void*) )
|
||||||
{
|
{
|
||||||
this->worldScene.Visit(collideable, hitAction);
|
this->worldScene.Visit(collideable, args, hitAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void API_Impl::ApplyForceAt( const ICustomBody* objRef, const Float3 &worldPos, const Float3 &worldF )
|
//void API_Impl::ApplyForceAt( const ICustomBody* objRef, const Float3 &worldPos, const Float3 &worldF )
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Oyster
|
||||||
void AddGravity( const API::Gravity &g );
|
void AddGravity( const API::Gravity &g );
|
||||||
void RemoveGravity( const API::Gravity &g );
|
void RemoveGravity( const API::Gravity &g );
|
||||||
|
|
||||||
void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void(hitAction)(ICustomBody*) );
|
void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void* args, void(hitAction)(ICustomBody*, void*) );
|
||||||
|
|
||||||
//void ApplyForceAt( const ICustomBody* objRef, const ::Oyster::Math::Float3 &worldPos, const ::Oyster::Math::Float3 &worldF );
|
//void ApplyForceAt( const ICustomBody* objRef, const ::Oyster::Math::Float3 &worldPos, const ::Oyster::Math::Float3 &worldF );
|
||||||
|
|
||||||
|
|
|
@ -139,9 +139,11 @@ namespace Oyster
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Applies an effect to objects that collide with the set volume.
|
* Applies an effect to objects that collide with the set volume.
|
||||||
* @param collideable: An ICollideable that defines the volume of the effect.
|
* @param collideable: An ICollideable that defines the volume of the effect.
|
||||||
* @param hitAction: A function that contains the effect.
|
* @param args: The arguments needed for the hitAction function.
|
||||||
|
* @param hitAction: A function that contains the effect. Parameterlist contains the custom body
|
||||||
|
the collideable hits, and the arguments sent to the function.
|
||||||
********************************************************/
|
********************************************************/
|
||||||
virtual void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void(hitAction)(ICustomBody*) ) = 0;
|
virtual void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void* args, void(hitAction)(ICustomBody*, void*) ) = 0;
|
||||||
|
|
||||||
///********************************************************
|
///********************************************************
|
||||||
// * Apply force on an object.
|
// * Apply force on an object.
|
||||||
|
|
Loading…
Reference in New Issue