LightElem RegisterToThreeScene(LightNode n) { LightElem node = null; if (n.Type == LightType.Point) { node = new PointLightElem(n); } else if (n.Type == LightType.Directional) { node = new DirectionalLightElem(n); } else if (n.Type == LightType.Spot) { node = new SpotLightElem(n); } if (node != null) { node.Uuid = n.Guid; var parent = objNodeTable[n.CurrentObject.GetInstanceID().ToString()]; parent.AddChild(node); return(node); } else { throw new NotImplementedException(); } }
public AFrameNode Create(DirectionalLightElem el) { var node = new AFrameNode("a-light"); WriteCommonAFrameNode(el, node); node.AddAttribute("type", "directional"); var helper = new LightHelper(node, el); helper.WriteColor(); helper.WriteIntensity(); return(node); }
public void Visit(DirectionalLightElem el) { // matrix 조작 // 유니티에서는 회전된 방향으로 빛을 쏘지만 three.js에서는 카메라의 위치에서 빚을 쏜다 var forward = Vector3.forward; var direction = el.UnityMatrix.MultiplyVector(forward); var mat = Matrix4x4.TRS(-direction, Quaternion.identity, Vector3.one); el.UnityMatrix = mat; using (var scope = new JsonScopeObjectWriter(writer)) { WriteCommonObjectNode(scope, el); var helper = new LightHelper(scope, el); helper.WriteColor(); helper.WriteIntensity(); } }
public void Visit(DirectionalLightElem el) { Node = factory.Create(el); }