public override void Run(RenderControl render) { // Create material var mMaterial1 = MeshPhongMaterial.Create("phong.texture"); mMaterial1.SetFaceSide(EnumFaceSide.DoubleSide); var texture = ImageTexture2D.Create(GetResourcePath("textures/bricks2.jpg")); mMaterial1.SetColorMap(texture); var plane = GeometryBuilder.CreatePlane(500, 500); var planeNode = new PrimitiveSceneNode(plane, mMaterial1); planeNode.SetTransform(Matrix4.makeTranslation(new Vector3(0, 0, -100))); render.ShowSceneNode(planeNode); var box = GeometryBuilder.CreateBox(100, 100, 200); var boxNode = new PrimitiveSceneNode(box, mMaterial1); render.ShowSceneNode(boxNode); var sphere = GeometryBuilder.CreateSphere(50, 32, 32); var sphereNode = new PrimitiveSceneNode(sphere, mMaterial1); sphereNode.SetTransform(Matrix4.makeTranslation(new Vector3(0, 0, 150))); render.ShowSceneNode(sphereNode); }
public override void Run(RenderControl render) { // add a plane var mMaterial1 = MeshPhongMaterial.Create("phong.texture"); mMaterial1.SetFaceSide(EnumFaceSide.DoubleSide); var texture = ImageTexture2D.Create(GetResourcePath("textures/bricks2.jpg")); mMaterial1.SetColorMap(texture); var plane = GeometryBuilder.CreatePlane(500, 500); var planeNode = new PrimitiveSceneNode(plane, mMaterial1); planeNode.SetTransform(Matrix4.makeTranslation(new Vector3(0, 0, -2.5f))); planeNode.SetPickable(false); render.ShowSceneNode(planeNode); mDevice = new PrimitiveSceneNode(GeometryBuilder.CreateSphere(5), null); render.ShowSceneNode(mDevice); mCome = new RigidAnimation(); mCome.Add(new MoveAnimationClip(mDevice, mWorkingPosition, 0, 5)); mGo = new RigidAnimation(); mGo.Add(new MoveAnimationClip(mDevice, new Vector3(-200, -200, 0), 0, 5)); }
public override void Run(RenderControl render) { CreateShader(); mMaterial = MaterialManager.Instance().FindInstance("blackHole_instance"); if (mMaterial == null) { var template = MaterialManager.Instance().CreateTemplateByName("blackHole_shader_template", shaderName); mMaterial = MaterialManager.Instance().Create("blackHole_instance", template); } var plane = GeometryBuilder.CreatePlane(2, 2); var node = new PrimitiveSceneNode(plane, mMaterial); node.SetPickable(false); render.ShowSceneNode(node); }