Skip to content

Commit

Permalink
Add IsYoungerRigidBodyFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvux committed Feb 15, 2018
1 parent 5b3320e commit d09899c
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ChangeLog
* [Nodes] Add WithinSphere (DX11.Validator) : Only draw objects which have a bounding box contained within a sphere.
* [Core] Added ConstantFactor preset in Blend (DX11.RenderState), to allow to use BlendFactor (DX11.RenderState) more easily.
* [Bullet] All Create Body nodes now have custom string input (which was missing from previous version)
* [Bullet] IsYoungerThan (Bullet Rigid.Filter) new node
* [Nodes] Add AlphaOperation (DX11.RenderState) : Allows to control how the alpha channel is written in the texture (independently of color blending).
* [Nodes] Add S+H (DX11.Texture 2d) , Same as standard S+H nodes, copies a resource if the set pin is on, blocks evaluation and render otherwise (also optimize resource flags/usage behind the scenes).
* [Nodes] Add S+H (DX11.Texture 3d) , for 3d textures
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using BulletSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VVVV.Bullet.Core.Filters
{
public class IsYoungerRigidBodyFilter : IRigidBodyFilter
{
public float MinimumAge = 0.0f;

public bool Filter(RigidBody body)
{
BodyCustomData data = (BodyCustomData)body.UserObject;
return data.LifeTime <= MinimumAge;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VVVV.Bullet.Core.Filters;
using VVVV.PluginInterfaces.V2;

namespace VVVV.Bullet.Nodes.Bodies.Rigid.Filters
{
[PluginInfo(Name = "IsYoungerThan", Category = "Bullet", Version = "Rigid.Filter", Author = "vux", Help = "Filter interfact to check for a maximum age")]
public class BulletYoungerThanRigidBodyFilter : IPluginEvaluate, IPartImportsSatisfiedNotification
{
[Input("Age", IsSingle = true, DefaultValue = 1.0)]
protected ISpread<float> age;

[Output("Output", IsSingle = true)]
protected ISpread<IsYoungerRigidBodyFilter> output;

public void OnImportsSatisfied()
{
this.output[0] = new IsYoungerRigidBodyFilter();
}

public void Evaluate(int SpreadMax)
{
this.output[0].MinimumAge = age[0];
}
}
}
2 changes: 2 additions & 0 deletions Nodes/VVVV.DX11.Nodes.Bullet/VVVV.Nodes.Bullet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<Compile Include="Core\ConstraintPersister.cs" />
<Compile Include="Core\Delegates.cs" />
<Compile Include="Core\Filters\BoolTypeFilters.cs" />
<Compile Include="Core\Filters\IsYoungerRigidBodyFilter.cs" />
<Compile Include="Core\Filters\IsOlderRigidBodyFilter.cs" />
<Compile Include="Core\Filters\ContainsIdRigidBodyFilter.cs" />
<Compile Include="Core\Filters\EqualsIdRigidBodyFilter.cs" />
Expand Down Expand Up @@ -124,6 +125,7 @@
<Compile Include="Nodes\Bodies\Rigid\BulletGetRigidBodyIdNode.cs" />
<Compile Include="Nodes\Bodies\Rigid\BulletGetRigidBodyTransformNode.cs" />
<Compile Include="Nodes\Bodies\Rigid\Filters\AggregateRigidBodyFilterNodes.cs" />
<Compile Include="Nodes\Bodies\Rigid\Filters\YoungerThanThanRigidBodyFilterNode.cs" />
<Compile Include="Nodes\Bodies\Rigid\Filters\StaticRigidBodyFilterNode.cs" />
<Compile Include="Nodes\Bodies\Rigid\Filters\IsOfShapeRigidbodyFilterNode.cs" />
<Compile Include="Nodes\Bodies\Rigid\Filters\IdEqualsRigidbodyFilterNode.cs" />
Expand Down
2 changes: 1 addition & 1 deletion girlpower

0 comments on commit d09899c

Please sign in to comment.