ModelDrawer Issue

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Kataan
Posts: 10
Joined: Tue Mar 22, 2011 10:57 am

ModelDrawer Issue

Post by Kataan »

Hey Norbo,

I've updated my references to the dev fork - Change Set: a10bfc511282 and now i get:

InvalidCastException was unhandled. Specified cast is not valid.
on line 220 worldTransformsParameter.SetValue(worldTransforms); in BEPUphysicsDrawer.Models.ModelDisplayObjectBatch

Code: Select all

public void Draw(Effect effect, EffectParameter worldTransformsParameter, EffectParameter textureIndicesParameter, EffectPass pass)
{
     if (vertices.Length > 0)     
     {
          graphicsDevice.SetVertexBuffers(bindings);
          graphicsDevice.Indices = indexBuffer;
          worldTransformsParameter.SetValue(worldTransforms);
          textureIndicesParameter.SetValue(textureIndices);
          pass.Apply();

          graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList,
                                                     0, 0, vertices.Length,
                                                     0, indices.Length / 3);
     }
}
Previously I had no problems (using fork 08f38f1dd70d). If I dont call the ModelDrawer.Draw method in my draw method, then no errors arise (but obviously that doesnt fix the error). Do I need to update any particular aspect of my code to accommodate a recent change, or is it something in the BEPU code?

Sorry if I've made a rookie mistake somewhere along the way.

Thanks for any help,

Kataan
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: ModelDrawer Issue

Post by Norbo »

The instancing method was changed a bit. It now accepts 61 instances per batch. The latest BEPUphysicsDrawer must be paired with the latest InstancedEffect.fx to work properly. The latest effect file can be found in the BEPUphysicsDemos content project.
Post Reply