Ejemplo n.º 1
0
 // Methods
 internal Enumerator(Transform outer)
 {
     this.outer = outer;
 }
Ejemplo n.º 2
0
        public override void Start()
        {
            this.Configuration.BackgroundColour = Rgba32.LightSlateGrey;

            CommonDemoResources.Create (Platform, Engine);

            returnScene = this;

            // create a sprite
            var billboard = new BillboardPrimitive(this.Platform.Graphics);

            billboardGo = this.SceneGraph.CreateSceneObject("billboard");

            var mr = billboardGo.AddTrait<MeshRendererTrait>();
            mr.Mesh = billboard.Mesh;
            mr.Material = new Material("Default", CommonDemoResources.UnlitShader);
            mr.Material.SetColour("MaterialColour", RandomGenerator.Default.GetRandomColour());

            target = billboardGo.Transform;

            markerGo = this.SceneGraph.CreateSceneObject ("marker");

            markerGo.Transform.LocalScale = new Vector3 (0.05f, 0.05f, 0.05f);

            var markerMR = markerGo.AddTrait<MeshRendererTrait> ();
            markerMR.Mesh = new CubePrimitive(this.Platform.Graphics).Mesh;
            markerMR.Material = new Material("Default", CommonDemoResources.UnlitShader);
            markerMR.Material.SetColour("MaterialColour", Rgba32.Red);

            cam = this.CameraManager.GetRenderPassCamera ("Default");

            this.SceneGraph.DestroySceneObject(this.CameraManager.GetRenderPassCamera ("Debug"));
            this.SceneGraph.DestroySceneObject(this.CameraManager.GetRenderPassCamera ("Gui"));

            this.RuntimeConfiguration.SetRenderPassCameraTo ("Debug", cam);
            cam.Transform.Position = new Vector3(2, 1, 5);
            cam.RemoveTrait<OrbitAroundSubjectTrait> ();

            las = cam.GetTrait<LookAtSubjectTrait> ();
            las.Subject = billboardGo.Transform;

            this.Engine.InputEventSystem.Tap += this.OnTap;
        }
Ejemplo n.º 3
0
 public void Translate(Single x, Single y, Single z, Transform relativeTo)
 {
     this.Translate (new Vector3 (x, y, z), relativeTo);
 }
Ejemplo n.º 4
0
 public void Translate(Vector3 translation, Transform relativeTo)
 {
     Vector3 pointInWorld = relativeTo.TransformPoint (translation);
     Vector3 worldTrans = pointInWorld - relativeTo.Position;
     this.Position += worldTrans;
 }
Ejemplo n.º 5
0
 public void LookAt(Transform target, Vector3 worldUp)
 {
     LookAt (target.Position, worldUp);
 }
Ejemplo n.º 6
0
 //Rotates the transform so the forward vector points at /target/'s current position.
 //
 // Then it rotates the transform to point its up direction vector in the direction
 // hinted at by the worldUp vector. If you leave out the worldUp parameter, the
 // function will use the world y axis. worldUp is only a hint vector. The up
 // vector of the rotation will only match the worldUp vector if the forward
 // direction is perpendicular to worldUp
 public void LookAt(Transform target)
 {
     LookAt (target, Vector3.Up);
 }
Ejemplo n.º 7
0
        // Returns a Booleanean value that indicates whether the transform
        // is a child of a given transform. true if this transform is a child,
        // deep child (child of a child...) or identical to this transform, otherwise false.
        public Boolean IsChildOf(Transform parent)
        {
            Transform temp = this;
            while (temp != null) {
                if (temp == parent)
                    return true;

                temp = temp.Parent;
            }

            return false;
        }