Page 1 of 1

ModelDrawer Issue

Posted: Tue Jun 14, 2011 12:50 pm
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

Re: ModelDrawer Issue

Posted: Tue Jun 14, 2011 3:11 pm
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.