void FLTree(OutModel mdl, ref int i) { var flags = TreeNodeFlags.OpenOnDoubleClick | TreeNodeFlags.DefaultOpen | TreeNodeFlags.OpenOnArrow; //if (obj == selected) flags |= TreeNodeFlags.Selected; var open = ImGui.TreeNodeEx(ImGuiExt.Pad(mdl.Name + "##" + i++), flags); //if (ImGuiNative.igIsItemClicked(0)) //selected = obj; //ColladaContextMenu(); Theme.RenderTreeIcon(mdl.Name, "fix", Color4.White); if (open) { if (ImGui.TreeNode("LODs")) { for (int j = 0; j < mdl.LODs.Count; j++) { ImGui.Selectable(string.Format("{0}: {1}", j, mdl.LODs[j].Name)); } ImGui.TreePop(); } foreach (var child in mdl.Children) { FLTree(child, ref i); } ImGui.TreePop(); } i += 500; }
void AutodetectTree(ColladaObject obj, List <OutModel> parent, Dictionary <string, ColladaObject[]> autodetect) { if (!obj.AutodetectInclude) { return; } var mdl = new OutModel(); mdl.Name = obj.Name; if (obj.Name.EndsWith("_lod0", StringComparison.InvariantCultureIgnoreCase)) { mdl.Name = obj.Name.Remove(obj.Name.Length - 5, 5); } var geometry = autodetect[mdl.Name]; foreach (var g in geometry) { if (g != null) { mdl.LODs.Add(g); } } foreach (var child in obj.Children) { AutodetectTree(child, mdl.Children, autodetect); } parent.Add(mdl); }
void FLTree(OutModel mdl, ref int i) { var flags = ImGuiTreeNodeFlags.OpenOnDoubleClick | ImGuiTreeNodeFlags.DefaultOpen | ImGuiTreeNodeFlags.OpenOnArrow; if (mdl == selected) { flags |= ImGuiTreeNodeFlags.Selected; } var open = Theme.IconTreeNode(Icons.Cube_LightPink, $"{mdl.Name}##{i++}", flags); if (ImGui.IsItemClicked(0)) { selected = mdl; } ImGui.SameLine(); if (open) { if (ImGui.TreeNode("LODs")) { for (int j = 0; j < mdl.LODs.Count; j++) { ImGui.Selectable(string.Format("{0}: {1}", j, mdl.LODs[j].Name)); } ImGui.TreePop(); } foreach (var child in mdl.Children) { FLTree(child, ref i); } ImGui.TreePop(); } i += 500; }
void AutodetectTree(ModelNode obj, List <OutModel> parent, Dictionary <string, ModelNode[]> autodetect) { var num = LodNumber(obj, out _); if (num != 0) { return; } var mdl = new OutModel(); mdl.Name = obj.Name; if (obj.Name.EndsWith("_lod0", StringComparison.InvariantCultureIgnoreCase)) { mdl.Name = obj.Name.Remove(obj.Name.Length - 5, 5); } var geometry = autodetect[mdl.Name]; foreach (var g in geometry) { if (g != null) { mdl.LODs.Add(g); } } foreach (var child in obj.Children) { AutodetectTree(child, mdl.Children, autodetect); } parent.Add(mdl); }
void FLTree(OutModel mdl, ref int i) { var flags = ImGuiTreeNodeFlags.OpenOnDoubleClick | ImGuiTreeNodeFlags.DefaultOpen | ImGuiTreeNodeFlags.OpenOnArrow; if (mdl == selected) flags |= ImGuiTreeNodeFlags.Selected; var open = ImGui.TreeNodeEx(ImGuiExt.Pad(mdl.Name + "##" + i++), flags); if(ImGui.IsItemClicked(0)) { selected = mdl; } ImGui.SameLine(); Theme.RenderTreeIcon(mdl.Name,"fix", Color4.LightPink); if(open) { if(ImGui.TreeNode("LODs")) { for (int j = 0; j < mdl.LODs.Count; j++) ImGui.Selectable(string.Format("{0}: {1}", j, mdl.LODs[j].Name)); ImGui.TreePop(); } foreach (var child in mdl.Children) FLTree(child, ref i); ImGui.TreePop(); } i += 500; }
void ApplyMatNames(OutModel model) { foreach(var mat in model.Materials) { mat.Geometry.Drawcalls[mat.Drawcall].Material.Name = mat.Name.GetText(); } foreach(var child in model.Children) { ApplyMatNames(child); } }
static void Export3DB(string mdlName, LUtfNode node3db, OutModel mdl, LUtfNode vmeshlibrary = null) { var vms = vmeshlibrary ?? new LUtfNode() { Name = "VMeshLibrary", Parent = node3db, Children = new List<LUtfNode>() }; for (int i = 0; i < mdl.LODs.Count; i++) { var n = new LUtfNode() { Name = string.Format("{0}-{1}.lod{2}.{3}.vms", mdlName, mdl.Name, i, (int)mdl.LODs[i].Geometry.FVF), Parent = vms }; n.Children = new List<LUtfNode>(); n.Children.Add(new LUtfNode() { Name = "VMeshData", Parent = n, Data = mdl.LODs[i].Geometry.VMeshData() }); vms.Children.Add(n); } if(vmeshlibrary == null) node3db.Children.Add(vms); if (mdl.LODs.Count > 1) { var multilevel = new LUtfNode() { Name = "MultiLevel", Parent = node3db }; multilevel.Children = new List<LUtfNode>(); var switch2 = new LUtfNode() { Name = "Switch2", Parent = multilevel }; multilevel.Children.Add(switch2); for (int i = 0; i < mdl.LODs.Count; i++) { var n = new LUtfNode() { Name = "Level" + i, Parent = multilevel }; n.Children = new List<LUtfNode>(); n.Children.Add(new LUtfNode() { Name = "VMeshPart", Parent = n, Children = new List<LUtfNode>() }); n.Children[0].Children.Add(new LUtfNode() { Name = "VMeshRef", Parent = n.Children[0], Data = mdl.LODs[i].Geometry.VMeshRef(string.Format("{0}-{1}.lod{2}.{3}.vms", mdlName, mdl.Name, i, (int)mdl.LODs[i].Geometry.FVF)) }); multilevel.Children.Add(n); } //Generate Switch2: TODO - Be more intelligent about this var mlfloats = new float[multilevel.Children.Count]; mlfloats[0] = 0; float cutOff = 2250; for (int i = 1; i < mlfloats.Length - 1; i++) { mlfloats[i] = cutOff; cutOff *= 2; } mlfloats[mlfloats.Length - 1] = 1000000; switch2.Data = UnsafeHelpers.CastArray(mlfloats); node3db.Children.Add(multilevel); } else { var part = new LUtfNode() { Name = "VMeshPart", Parent = node3db }; part.Children = new List<LUtfNode>(); part.Children.Add(new LUtfNode() { Name = "VMeshRef", Parent = part, Data = mdl.LODs[0].Geometry.VMeshRef(string.Format("{0}-{1}.lod0.{2}.vms", mdlName, mdl.Name, (int)mdl.LODs[0].Geometry.FVF)) }); node3db.Children.Add(part); } }
static void IterateMaterials(List<ColladaMaterial> materials, OutModel mdl) { foreach (var lod in mdl.LODs) foreach (var dc in lod.Geometry.Drawcalls) if (dc.Material != null && !HasMat(materials, dc.Material)) materials.Add(dc.Material); foreach (var child in mdl.Children) IterateMaterials(materials, child); }
void ExportModels(string mdlName, LUtfNode root, string suffix,LUtfNode vms, OutModel model) { var modelNode = new LUtfNode() { Parent = root, Name = model.Name + suffix }; modelNode.Children = new List<LUtfNode>(); root.Children.Add(modelNode); Export3DB(mdlName, modelNode, model, vms); foreach (var child in model.Children) ExportModels(mdlName, root, suffix, vms, child); }
void ProcessConstruct(string parentName, OutModel mdl, LUtfNode cmpnd, FixConstructor fix, string suffix, ref int index) { cmpnd.Children.Add(CmpndNode(cmpnd, "PART_" + mdl.Name, mdl.Name + suffix, mdl.Name, index++)); if(mdl.Transform == true) { fix.Add(parentName, mdl.Name, mdl.Def.Transform); } else { fix.Add(parentName, mdl.Name, Matrix4x4.Identity); } foreach (var child in mdl.Children) ProcessConstruct(mdl.Name, child, cmpnd, fix, suffix, ref index); }
public ActionResult DriveOut(OutModel model) { if (IsCarInPark(model.LicensePlate)) { SignOutOfCarPark(model.LicensePlate); RegisterNewVisitOut(model.LicensePlate); TempData["notification"] = "Erfolgreich hinausgefahren, beehren Sie uns bald wieder."; return(RedirectToAction("Index")); } else { TempData["notification"] = "Du kannst nicht noch mehr draußen sein!"; return(RedirectToAction("Index")); } }
static void IterateMaterials(List <Material> materials, OutModel mdl) { foreach (var lod in mdl.LODs) { foreach (var dc in lod.Geometry.Groups) { if (dc.Material != null && !HasMat(materials, dc.Material)) { materials.Add(dc.Material); } } } foreach (var child in mdl.Children) { IterateMaterials(materials, child); } }
static void IterateMaterials(List <string> materials, OutModel mdl) { foreach (var lod in mdl.LODs) { foreach (var dc in lod.Geometry.Drawcalls) { if (dc.Material != "NullMaterial" && !materials.Contains(dc.Material)) { materials.Add(dc.Material); } } } foreach (var child in mdl.Children) { IterateMaterials(materials, child); } }
void DoMats(OutModel mdl) { foreach(var lod in mdl.LODs) { for (int i = 0; i < lod.Geometry.Drawcalls.Length; i++) { var buf = new TextBuffer(256); buf.SetText(lod.Geometry.Drawcalls[i].Material.Name); mdl.Materials.Add(new MaterialName() { Geometry = lod.Geometry, Drawcall = i, Name = buf }); nameBuffers.Add(buf); } } foreach (var child in mdl.Children) DoMats(child); }
public ActionResult OutSubmit(OutModel model) { if (IsCarKnown(model.LicensePlate) && IsCarInPark(model.LicensePlate)) { if (!IsLongTermParker(model.LicensePlate)) { return(View("PayForShortTerm", model)); } else { return(View("PayForLongTerm", model)); } } else if (IsCarKnown(model.LicensePlate) && !IsCarInPark(model.LicensePlate)) { TempData["notification"] = "Du kannst nich noch mehr draußen sein!"; return(RedirectToAction("Index")); } else { TempData["notification"] = "Entschuldigung, kennen wir Sie?"; return(RedirectToAction("Index")); } }
public void SaveOut(OutModel outModel) { _context.Outs.Add(outModel); _context.SaveChanges(); }
public ViewResult Out() { var model = new OutModel(); return(View("Out", model)); }
static void Export3DB(LUtfNode node3db, OutModel mdl) { var vms = new LUtfNode() { Name = "VMeshLibrary", Parent = node3db }; vms.Children = new List <LUtfNode>(); for (int i = 0; i < mdl.LODs.Count; i++) { var n = new LUtfNode() { Name = string.Format("{0}.level{1}.vms", mdl.Name, i), Parent = vms }; n.Children = new List <LUtfNode>(); n.Children.Add(new LUtfNode() { Name = "VMeshData", Parent = n, Data = mdl.LODs[i].Geometry.VMeshData() }); vms.Children.Add(n); } node3db.Children.Add(vms); if (mdl.LODs.Count > 1) { var multilevel = new LUtfNode() { Name = "MultiLevel", Parent = node3db }; multilevel.Children = new List <LUtfNode>(); var switch2 = new LUtfNode() { Name = "Switch2", Parent = multilevel }; switch2.Data = UnsafeHelpers.CastArray(new float[] { 0, 4000 }); multilevel.Children.Add(switch2); for (int i = 0; i < mdl.LODs.Count; i++) { var n = new LUtfNode() { Name = "Level" + i, Parent = multilevel }; n.Children = new List <LUtfNode>(); n.Children.Add(new LUtfNode() { Name = "VMeshPart", Parent = n, Children = new List <LUtfNode>() }); n.Children[0].Children.Add(new LUtfNode() { Name = "VMeshRef", Parent = n.Children[0], Data = mdl.LODs[i].Geometry.VMeshRef(string.Format("{0}.level{1}.vms", mdl.Name, i)) }); multilevel.Children.Add(n); } node3db.Children.Add(multilevel); } else { var part = new LUtfNode() { Name = "VMeshPart", Parent = node3db }; part.Children = new List <LUtfNode>(); part.Children.Add(new LUtfNode() { Name = "VMeshRef", Parent = part, Data = mdl.LODs[0].Geometry.VMeshRef(string.Format("{0}.level0.vms", mdl.Name)) }); node3db.Children.Add(part); } }