void Update() { Render(); viewCamera.aspect = (float)Screen.width / (float)Screen.height; for (int i = 0; i < scene.children.Count; i++) { THREE.RenderableObject threeMesh = scene.children [i]; Quaternion rot = Quaternion.Euler(threeMesh.eulerAngles); Matrix4x4 matrix = Matrix4x4.TRS(threeMesh.position, rot, threeMesh.scale); //Graphics.DrawMesh(threeMesh.GetMesh(), threeMesh.position, rot, threeMesh.mat, 0); Graphics.DrawMesh(threeMesh.GetMesh(), matrix, threeMesh.mat, 0); // TODO: threeMesh.GetMesh()... } }
protected override void Render() { float timer = -Time.time * 1.0f; float camRotationSpeed = 0.15f; float x = Mathf.Cos(timer * camRotationSpeed) * 800; float z = Mathf.Sin(timer * camRotationSpeed) * 800; viewCamera.transform.position = new Vector3(x, 400, z); viewCamera.transform.LookAt(Vector3.zero); float amp = 5.0f; for (int i = 0, l = scene.children.Count; i < l; i++) { THREE.RenderableObject threeMesh = scene.children[i]; threeMesh.eulerAngles.x = timer * 5.0f * amp; threeMesh.eulerAngles.y = timer * 2.5f * amp; } }
public void Add(RenderableObject mesh) { children.Add(mesh); }