vidalsasoon

Members
  • Content count

    174
  • Joined

  • Last visited

Community Reputation

100 Neutral

About vidalsasoon

  • Rank
    Member
  1. http://www.thejamesrainenetwork.co.uk/ode/samples/car/car.html look at the source of this sample.
  2. MDX (2.0) - DrawIndexedPrimitives

    This is XNA code that I used to draw a cube. use what you need... btw, make sure lighting is working correctly and turn culling off. using System; using System.Collections.Generic; using Microsoft.Xna.Framework; //using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Components; using Microsoft.Xna.Framework.Graphics; //using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using ODE; using ODE.Geoms; namespace ODEComponents { public partial class ODEBox : Microsoft.Xna.Framework.GameComponent { private IGraphicsDeviceService gds; private Helpers.ICameraService camService; private VertexDeclaration vertexDecl; //private IndexBuffer indexBuffer; private VertexPositionNormalTexture[] cubeVerts = new VertexPositionNormalTexture[8]; private int[] cubeIndices = new int[36]; private Effect effect; //EffectParams private EffectParameter WorldITParam; private EffectParameter WorldParam; private EffectParameter WorldViewProjParam; private EffectParameter ViewIParam; private EffectParameter SpecColorParam; private EffectParameter DiffColorParam; private EffectParameter SubColorParam; private EffectParameter LightPosParam; private EffectParameter RollOffParam; private EffectParameter ColorTextureParam; Box box; Body body; public ODEBox() { InitializeComponent(); } public override void Start() { box = new Box(1, 1, 1); body = new Body(ODE_NET2.world); body.Mass = Mass.BoxTotal(1f, 1, 1, 1); box.RigidBody = this.body; //test System.Random RandNum = new System.Random(); this.Position = new Vector3(RandNum.Next(-10, 10), RandNum.Next(10, 100), RandNum.Next(-10, 10)); gds = this.Game.GameServices.GetService<IGraphicsDeviceService>(); camService = this.Game.GameServices.GetService<Helpers.ICameraService>(); ODE_NET2.space.Add(box); CompiledEffect compiledEffect = Effect.CompileEffectFromFile(@".\Media\velvety.fx", null, null, CompilerOptions.None, TargetPlatform.Windows); effect = new Effect(gds.GraphicsDevice, compiledEffect.GetShaderCode(), CompilerOptions.None, null); effect.CurrentTechnique = effect.Techniques["UntexturedPS"]; //Console.WriteLine(compiledEffect.ErrorsAndWarnings); WorldITParam = effect.Parameters["WorldIT"]; WorldParam = effect.Parameters["World"]; WorldViewProjParam = effect.Parameters["WorldViewProj"]; ViewIParam = effect.Parameters["ViewI"]; SpecColorParam = effect.Parameters["SpecColor"]; DiffColorParam = effect.Parameters["DiffColor"]; LightPosParam = effect.Parameters["LightPos"]; SubColorParam = effect.Parameters["SubColor"]; RollOffParam = effect.Parameters["RollOff"]; ColorTextureParam = effect.Parameters["ColorTexture"]; LightPosParam.SetValue(new Vector3(0.0f, 100.0f, 0.0f)); DiffColorParam.SetValue(new Vector3(0.0f, 0.0f, 0.0f)); SubColorParam.SetValue(new Vector3(1.0f, 1.0f, 1.0f)); ColorTextureParam.SetValue(Texture2D.FromFile(gds.GraphicsDevice, @".\Media\default_color.dds")); RollOffParam.SetValue(0.2f); SpecColorParam.SetValue(new Vector3(RandNum.Next(0, 100) / 100f, RandNum.Next(0, 100) / 100f, RandNum.Next(0, 100) / 100f)); cubeVerts[0] = new VertexPositionNormalTexture(new Vector3(-0.5f, 0.5f, 0.5f), Vector3.Backward, new Vector2(0.0f, 0.0f)); //front-left-top cubeVerts[1] = new VertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, 0.5f), Vector3.Backward, new Vector2(0.0f, 1.0f)); //front-left-bottom cubeVerts[2] = new VertexPositionNormalTexture(new Vector3(0.5f, 0.5f, 0.5f), Vector3.Backward, new Vector2(1.0f, 0.0f)); //front-right-top cubeVerts[3] = new VertexPositionNormalTexture(new Vector3(0.5f, -0.5f, 0.5f), Vector3.Backward, new Vector2(1.0f, 1.0f)); //front-right-bottm cubeVerts[4] = new VertexPositionNormalTexture(new Vector3(-0.5f, 0.5f, -0.5f), Vector3.Forward, new Vector2(0.0f, 0.0f)); //back-left-top cubeVerts[5] = new VertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, -0.5f), Vector3.Forward, new Vector2(0.0f, 1.0f)); //back-left-bottom cubeVerts[6] = new VertexPositionNormalTexture(new Vector3(0.5f, 0.5f, -0.5f), Vector3.Forward, new Vector2(1.0f, 0.0f)); //back-right-top cubeVerts[7] = new VertexPositionNormalTexture(new Vector3(0.5f, -0.5f, -0.5f), Vector3.Forward, new Vector2(1.0f, 1.0f)); //back-right-bottom // Indices will improve performance by avoiding redundent vertices cubeIndices[0] = 0; //front cubeIndices[1] = 1; cubeIndices[2] = 2; cubeIndices[3] = 1; cubeIndices[4] = 3; cubeIndices[5] = 2; cubeIndices[6] = 4; //back cubeIndices[7] = 5; cubeIndices[8] = 6; cubeIndices[9] = 5; cubeIndices[10] = 7; cubeIndices[11] = 6; cubeIndices[12] = 0; //top cubeIndices[13] = 4; cubeIndices[14] = 6; cubeIndices[15] = 0; cubeIndices[16] = 2; cubeIndices[17] = 6; cubeIndices[18] = 0; //left cubeIndices[19] = 4; cubeIndices[20] = 5; cubeIndices[21] = 0; cubeIndices[22] = 5; cubeIndices[23] = 1; cubeIndices[24] = 1; //bottom cubeIndices[25] = 5; cubeIndices[26] = 7; cubeIndices[27] = 1; cubeIndices[28] = 3; cubeIndices[29] = 7; cubeIndices[30] = 3; //right cubeIndices[31] = 7; cubeIndices[32] = 6; cubeIndices[33] = 3; cubeIndices[34] = 6; cubeIndices[35] = 2; // Vertex declaration vertexDecl = new VertexDeclaration(gds.GraphicsDevice, VertexPositionNormalTexture.VertexElements); gds.GraphicsDevice.VertexDeclaration = vertexDecl; //gds.GraphicsDevice.RenderState.FillMode = FillMode.WireFrame; } // ODE knows where this box is at all times. public Matrix mWorld { get { return (box.Rotation * Matrix.CreateTranslation(box.Position)); } } public Vector3 Position { get { return box.Position; } set { box.Position = value; } } public override void Update() { //Matrix mWorld = Matrix.Identity; // SetValues WorldITParam.SetValue(Matrix.Transpose(Matrix.Invert(mWorld))); WorldParam.SetValue(mWorld); WorldViewProjParam.SetValue(mWorld * camService.View * camService.Projection); ViewIParam.SetValue(Matrix.Invert(camService.View)); //Console.WriteLine("updating box"); } public override void Draw() { effect.Begin( EffectStateOptions.Default ); foreach( EffectPass pass in effect.CurrentTechnique.Passes ) { pass.Begin(); effect.CommitChanges(); // Draw Cube gds.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, 0, 36, 12, cubeIndices, cubeVerts); //gds.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, 12, cubeVerts); pass.End(); } effect.End(); } } }
  3. XNA Framework & Xbox 360 Details

    Quote:Original post by paulble Quote:Original post by headfonez So how will this limit a developer from building and selling a commercial game for the PC for free, using XNA? Are there any restrictions or licensing fees that they will have to pay? Thanks in advance. There are no limitations on using XNA Game Studio Express or the XNA Framework for creating or distributing games targeting Windows -- commercial or not. Games targeting Xbox 360 must be non commercial. Our Pro offering will allow commercial titles on Xbox 360 and will require a Xbox 360 developer kit. Paul What about people who make commercial smaller arcade style games? they'll have to fork over a lot of money for a pro license?
  4. XNA Framework & Xbox 360 Details

    I guess i'll be buying a controller for my PC. Pigs are flying.
  5. Update SDK trouble

    I got this error too. I think it's a bug.
  6. August 2006 DirectX SDK is released

    Quote:Original post by Muhammad Haggag I'd like to take the opportunity to whine about the SDK size. 506 MB is way too much--I don't care about D3D10 and all the beta stuff, and downloading and installing 506 MB every 2 months for only a couple of improvements, regardless of how important they are (e.g. shader debugging is great) is silly. you're probably gonna have a heart attack when the XNA download is available.
  7. August 2006 DirectX SDK is released

    For those interested in DX10: I tried with Vista v5472 (the version rumored to be used as RC1). The DX10 samples didnt work at all unless they had a DX9 fallback...
  8. Math Execises (book or website)?

    http://www.wikipedia.org/ is a good start for anything.
  9. ODE Trimesh-trimesh collision

    ODE Trimesh-Trimesh is very flaky. Most ODE users make their terrain as a Trimesh and everything else is composed of primitives.
  10. what is all that X-File data

    I'm no expert but keep in mind that an X-file has a lot of legacy semantics that aren't used anymore. There's a big push to shaders these days... Depends what you want to do.
  11. refresher math for 3d physics

    thank you
  12. ODE supports stress?

    well are we talking about bending/breaking joints or bending primitives? from the OP, i had the impression he wanted to change the shape of a primitive (or see the stress on it). The ODE API does not support this. Like I said, since a bridge does not usually have joints you could fake it by adding joints to the bridge and seeing it bend with stress but it would be inaccurate and cumbersome to code.
  13. refresher math for 3d physics

    Hi, I'm trying to create a physics engine from scratch but i'm having a hard time with my vectors and matrices... I used this stuff in college about 10 years ago... I forget 99% of it :( would anyone have a good link for reference. i.e. Why would I use the dot product of 2 vectors? (random question) what happens in 3d space if I add 2 matrices? what happens in 3d space if I multiply 2 matrices? etc...
  14. ODE supports stress?

    no. you may be able to implement something similar with a rigid spring or something but it would be cumbersome to program.
  15. Trouble Beginning With ODE

    Might want to check out my web site... www.pepperboy.net Look at the sample code from ODE.NET2.