private static object PreProcessingDirective(string str) { if (str.StartsWith("mesh(")) { str = str.Substring(5, str.Length - 6); return(Meshes.GetMesh(str)); } else if (str.StartsWith("material(")) { str = str.Substring(9, str.Length - 10); return(typeof(Material).GetProperty(str).GetValue(null)); } return(null); }
private static void InitTestScene() { scene = new Scene(); var cam = scene.InitObject(new Camera()); cam.transform.position.z += 3; var ship = scene.InitObject(new MeshRenderer(Assets.OBJs["StarterShip.obj"].GenMesh(), Material.Brass), new PhysicsBody()); ship.GetComp <PhysicsBody>().AddForce(0, 10, -10); ship.transform.Rotate(new vec3(3.14f / 4f, 3.14f / 4f, 3.14f / 4f)); var frogmesh = Meshes.GetMesh("TheFrog"); var frog = scene.InitObject(new MeshRenderer(frogmesh, Material.Silver), new PlayerShipController(), new PhysicsBody(), new Particles.EngineFlames(-Vector3.UnitZ * 2.1f, .3f), new Particles.SpaceDustParticles(), new SphereCollider(2d) { offset = (0, 0, 3) },