Object3DElem VisitGameObjectNode_r(IGameObjectNode n) { Debug.Assert(n != null); Object3DElem elem = null; if (n.SuperRoot) { elem = new SceneElem(); elem.Name = "KanauScene"; } else { elem = new GroupElem(n); } if (n.HasTag) { elem.Tag = n.Tag; } if (n.HasLayer) { elem.Layer = n.Layer; } elem.IsStatic = n.IsStatic; objNodeTable[n.InstanceId] = elem; foreach (var child in n.Children) { var childelem = VisitGameObjectNode_r(child); elem.AddChild(childelem); } return(elem); }
public AFrameNode Create(SceneElem el) { var node = new AFrameNode("a-scene"); var aframe = ExportSettings.Instance.aframe; if (aframe.enablePerformanceStatistics) { node.AddAttribute("stats", "true"); } // assets var assetsNode = new AFrameNode("a-assets"); // export mesh foreach (var elem in sharedNodeTable.GetEnumerable <AbstractGeometryElem>()) { // TODO 타입에 따라서 obj 굽는게 바뀔텐데 var bufferGeom = elem as BufferGeometryElem; if (bufferGeom == null) { continue; } var assetNode = new AFrameNode("a-asset-item"); assetNode.AddAttribute("id", bufferGeom.CreateSafeMeshName("-obj")); string filepath = "./models/" + bufferGeom.CreateMeshFileName(".obj"); assetNode.AddAttribute("src", filepath); assetsNode.AddChild(assetNode); var assetNode_mtl = new AFrameNode("a-asset-item"); assetNode_mtl.AddAttribute("id", bufferGeom.CreateSafeMeshName("-mtl")); string filepath_mtl = "./models/" + bufferGeom.CreateMeshFileName(".mtl"); assetNode_mtl.AddAttribute("src", filepath_mtl); assetsNode.AddChild(assetNode_mtl); } node.AddChild(assetsNode); var sky = ExportSettings.Instance.sky; if (sky.mode != SkySettings.SkyMode.None) { var skyNode = Create(sky); node.AddChild(skyNode); } WriteCommonAFrameNode(el, node); return(node); }
public void Visit(SceneElem el) { Node = factory.Create(el); }