oyk 0.4.1

OYK is ODE (Open Dynamics Engine) bindings for Rust yaw kinetics
Documentation
oyk-0.4.1 has been yanked.

oyk

OYK is ODE (Open Dynamics Engine) bindings for Rust yaw kinetics

ODE

Now this crate is tested on ode-0.16.2 dll version.

ode.dll drawstuff.dll for x64 Windows binary compiled with -DdDOUBLE by mingw

(It may work with VC, or other platforms.)

Requirements

to build dll

  • premake4 --with-demos --only-double --with-libccd --cc=gcc --platform--x64 --os=windows codeblocks
  • premake4 --with-demos --only-double --with-libccd --platform--x64 --os=windows vs2010

in the running directory

  • drawstuff.dll
  • ode.dll
  • libstdc++-6.dll
  • libgcc_s_seh-1.dll
  • libwinpthread-1.dll

Samples

use oyk::ode::*;

use impl_sim::{impl_sim_fn, impl_sim_derive};

pub struct SimApp {
}

#[impl_sim_derive(draw_objects, near_callback, step_callback, stop_callback)]
impl Sim for SimApp {

fn start_callback(&mut self) {
  let t_delta = &mut self.super_mut().t_delta;
  *t_delta = 0.002;
  let obgs = &mut self.super_mut().obgs;
  let m: dReal = 1.0;
  let r: dReal = 0.2;
  for i in 0..16 {
    let c: dVector4 = vec4_from_u32(COLORS[i]);
    let p: dVector3 = [(i%4) as dReal - 1.5, (i/4) as dReal - 1.5, 2.0, 1.0];
    obgs.push(ODE::mk_sphere(m, r, &c, &p));
  }
  let c: dVector4 = [1.0, 1.0, 0.0, 0.8];
  let p: dVector3 = [0.0, 0.0, 10.0, 1.0];
  obgs.push(ODE::mk_sphere(0.1, 1.0, &c, &p));
  self.super_mut().start_callback();
}

fn command_callback(&mut self, cmd: i32) {
  match cmd as u8 as char {
    'a' => {
      println!("anything to do");
    },
    _ => {}
  }
  self.super_mut().command_callback(cmd);
}

} // impl Sim for SimApp

fn main() {
  ODE::open();
  ODE::sim_loop(
    640, 480, // 800, 600,
    Some(Box::new(SimApp{})),
    b"./resources");
  ODE::close();
}

see also

License

MIT License