public void CreateExpression_DateOutsideOfWindowAndIsMonday_BuildsExpression(int year, int month, int day, bool validates, int numberOfErrorMsg) { // Test: (DateTime d) => (d < floorDate | d > ceilingDate) & d.DayOfWeek == DayOfWeek.Monday var floorDate = new DateTime(2010, 2, 1); var ceilingDate = new DateTime(2010, 3, 1); var testDate = new DateTime(year, month, day); // build rule / rule node for "d.DayOfWeek == DayOfWeek.Monday var dateOneMondayRule = new CustomRule<CalendarEvent, DateTime>((c, d) => d.DayOfWeek == DayOfWeek.Monday); dateOneMondayRule.Message = "Date does not fall on a Monday."; var dateOneMondayRuleNode = new RuleNode(dateOneMondayRule); // build rules / rule nodes for "d < floorDate | d > ceilingDate" var rangeRuleNode = new RuleNode(new LessThan<CalendarEvent, DateTime>(floorDate)); rangeRuleNode.OrChild(new RuleNode(new GreaterThan<CalendarEvent, DateTime>(ceilingDate))); // put the rules / rule nodes together using a group to enforce the "or" precidence over the "and" var groupNode = new GroupNode(rangeRuleNode); groupNode.AndChild(dateOneMondayRuleNode); var tree = new RuleTree<CalendarEvent, DateTime>(groupNode); Assert.That(tree.LambdaExpression, Is.Not.Null); var context = BuildContextForCalendarEventStartDate(testDate); var notification = new ValidationNotification(); var isValid = tree.LambdaExpression(context, null, notification); Assert.That(isValid, Is.EqualTo(validates)); }
public bool Equals(GroupNode other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return base.Equals(other) && Equals(other.GroupMode, GroupMode) && Equals(other.NamedIdentifier, NamedIdentifier) && Equals(other.BalancingGroupIdentifier, BalancingGroupIdentifier); }
private void AddChild(GroupNode child) { _children.Add(child); }
private void ProcessPartnode(XmlElement partElement, GroupNode parent) { Debug.Assert(partElement.Attributes != null, "partNode.Attributes != null"); var group = new GroupNode(partElement.Attributes["id"].Value, parent); _groups.Add(group.ToString(), group); foreach (var elem in partElement.ChildNodes.OfType<XmlElement>()) if (elem.Name.Equals("part")) ProcessPartnode(elem, group); else ProcessTextnode(elem, group); }
private static void WriteText(XmlWriter writer, GroupNode group) { foreach (var text in group.Content) { writer.WriteStartElement("text"); writer.WriteAttributeString("key", text.Key); foreach (var language in text.Value) { writer.WriteStartElement("lang"); writer.WriteAttributeString("id", language.Key); writer.WriteRaw(language.Value); writer.WriteEndElement(); } writer.WriteEndElement(); } }
private static void ProcessTextnode(XmlElement textNode, GroupNode group) { var languages = textNode.ChildNodes.OfType<XmlElement>() .ToDictionary(langNode => langNode.Attributes["id"].Value, langNode => langNode.InnerXml); group.Content.Add(textNode.Attributes["key"].Value, languages); }
private GroupNode AddGroupNode(Group g) { GroupNode gn = (GroupNode)m_groups[g.GroupName]; if (gn == null) { gn = new GroupNode(g); m_groups.Add(g.GroupName, gn); this.Nodes.Add(gn); } return gn; }
internal AdjacencyNode(GroupNode to, E edge) { this.to = to; this.edge = edge; next = null; }
private void BuildGroupSQL(StringBuilder SQLQuery, GroupNode GroupNode) { if (_groupClauseStack.Count > 0 && SQLQuery.Length > 0 && !SQLQuery.ToString().EndsWith(GetStartGroup())) SQLQuery.AppendFormat(" {0} ", _groupClauseStack.Peek()); _groupClauseStack.Push(GetGroupOperator(GroupNode.NodeType)); // Start the group. SQLQuery.Append(GetStartGroup()); // Build sub-node information foreach (object subNode in GroupNode.SubNodes) { BuildSQL(SQLQuery, (DevExpress.XtraEditors.Filtering.Node)subNode); } _groupClauseStack.Pop(); SQLQuery.Append(GetEndGroup()); }
public UGUINode DrawLayer(GroupNode layer, UGUINode parent) { UGUINode node = PSDImportUtility.InstantiateItem(GroupType.SCROLLVIEW, layer.Name, parent); UnityEngine.UI.ScrollRect scrollRect = node.InitComponent <UnityEngine.UI.ScrollRect>(); UGUINode childNode = PSDImportUtility.InstantiateItem(GroupType.IMAGE, "Viewport", node); scrollRect.viewport = childNode.InitComponent <RectTransform>(); Color color; if (ColorUtility.TryParseHtmlString("#FFFFFF01", out color)) { childNode.InitComponent <UnityEngine.UI.Image>().color = color; } childNode.InitComponent <Mask>(); childNode.anchoType = AnchoType.XStretch | AnchoType.YStretch; bool havebg = false; for (int i = 0; i < layer.images.Count; i++) { ImgNode image = layer.images[i]; if (image.Name.ToLower().StartsWith("b_")) { havebg = true; UnityEngine.UI.Image graph = node.InitComponent <UnityEngine.UI.Image>(); PSDImportUtility.SetPictureOrLoadColor(image, graph); PSDImportUtility.SetRectTransform(image, scrollRect.GetComponent <RectTransform>()); } else { ctrl.DrawImage(image, node); } } if (!havebg) { PSDImportUtility.SetRectTransform(layer, scrollRect.GetComponent <RectTransform>()); } PSDImportUtility.SetRectTransform(layer, childNode.InitComponent <RectTransform>()); switch (layer.direction) { case Direction.Horizontal: scrollRect.vertical = true; scrollRect.horizontal = false; break; case Direction.Vertical: scrollRect.vertical = false; scrollRect.horizontal = true; break; case Direction.Horizontal | Direction.Vertical: scrollRect.vertical = true; scrollRect.horizontal = true; break; default: break; } if (layer.groups != null) { for (int i = 0; i < layer.groups.Count; i++) { GroupNode child = layer.groups[i]; string childLowerName = child.Name; UGUINode c_Node = ctrl.DrawLayer(child, childNode); if (childLowerName.StartsWith("c_")) { scrollRect.content = c_Node.InitComponent <RectTransform>(); } else if (childLowerName.StartsWith("vb_")) { scrollRect.verticalScrollbar = c_Node.InitComponent <Scrollbar>(); scrollRect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHide; } else if (childLowerName.StartsWith("hb_")) { scrollRect.horizontalScrollbar = c_Node.InitComponent <Scrollbar>(); scrollRect.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHide; } } } return(node); }
private SceneNodeBase GetTree() { var group = new GroupNode(); { var bmp = new Bitmap(@"Crate.bmp"); var texture = new Texture(TextureTarget.Texture2D, new TexImage2D(TexImage2D.Target.Texture2D, 0, (int)GL.GL_RGBA, bmp.Width, bmp.Height, 0, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, new ImageDataProvider(bmp))); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapS, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapT, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapR, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMinFilter, (int)GL.GL_LINEAR)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMagFilter, (int)GL.GL_LINEAR)); texture.Initialize(); bmp.Dispose(); var solidCube = TexturedCubeNode.Create(texture); group.Children.Add(solidCube); } { var blendingGroup = new BlendingGroupNode(BlendingSourceFactor.SourceAlpha, BlendingDestinationFactor.OneMinusSourceAlpha); group.Children.Add(blendingGroup); var list = new List <BlendingConfig>(); list.Add(new BlendingConfig(Color.Red, new vec3(1, 0, 1), 0.5f)); list.Add(new BlendingConfig(Color.Green, new vec3(0.6f, 0, 0.1f), 0.5f)); list.Add(new BlendingConfig(Color.Blue, new vec3(-0.1f, 0, -0.2f), 0.5f)); list.Add(new BlendingConfig(Color.Purple, new vec3(0.4f, 0, -0.7f), 0.5f)); list.Add(new BlendingConfig(Color.Orange, new vec3(0.8f, 0, 0.1f), 0.5f)); list.Add(new BlendingConfig(Color.Yellow, new vec3(0.8f, 0, 0.1f), 0.5f)); for (int i = 0; i < list.Count; i++) { const float distance = 2.0f; list[i].position = new vec3( distance * (float)Math.Cos((double)i / (double)list.Count * Math.PI * 2), 0, distance * (float)Math.Sin((double)i / (double)list.Count * Math.PI * 2) ); list[i].alpha = 0.3f; } foreach (var item in list) { var bmp = new Bitmap(1, 1); using (var g = Graphics.FromImage(bmp)) { g.Clear(item.color); } var texture = new Texture(TextureTarget.Texture2D, new TexImage2D(TexImage2D.Target.Texture2D, 0, (int)GL.GL_RGBA, bmp.Width, bmp.Height, 0, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, new ImageDataProvider(bmp))); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapS, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapT, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapR, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMinFilter, (int)GL.GL_LINEAR)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMagFilter, (int)GL.GL_LINEAR)); texture.Initialize(); bmp.Dispose(); var transparentCube = TexturedCubeNode.Create(texture); transparentCube.WorldPosition = item.position; transparentCube.Alpha = item.alpha; blendingGroup.Children.Add(transparentCube); } } return(group); }
public override void HeadGUI(Rect dirRect, GroupNode item) { base.HeadGUI(dirRect, item); item.direction = ((Direction)EditorGUI.EnumPopup(dirRect, item.direction)); }
private void FormMain_Load(object sender, EventArgs e) { var position = new vec3(-0.2f, 0, 1) * 14; var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); var camera = new Camera(position, center, up, CameraType.Perspective, this.winGLCanvas1.Width, this.winGLCanvas1.Height); this.scene = new Scene(camera); var rootNode = new GroupNode(); this.scene.RootNode = rootNode; Texture texBRDF = LoadBRDFTexture(); texBRDF.TextureUnitIndex = 2; Texture prefilterMap = LoadPrefilterMap(); prefilterMap.TextureUnitIndex = 1; Texture irradianceMap = LoadIrradianceMap(); irradianceMap.TextureUnitIndex = 0; Texture envCubemap = LoadEnvCubeMap(); Texture texHDR = LoadHDRTexture("newport_loft.hdr"); { var node = CubemapNode.Create(envCubemap, texHDR); rootNode.Children.Add(node); } { var node = IrradianceNode.Create(irradianceMap, envCubemap); rootNode.Children.Add(node); } { var node = BRDFNode.Create(texBRDF); rootNode.Children.Add(node); } { var sphere = new Sphere2();//(1, 40, 80); var filename = Path.Combine(System.Windows.Forms.Application.StartupPath, "sphere2.obj_"); sphere.DumpObjFile(filename, "sphere2"); var parser = new ObjVNFParser(false, true); ObjVNFResult result = parser.Parse(filename); if (result.Error != null) { Console.WriteLine("Error: {0}", result.Error); } else { ObjVNFMesh mesh = result.Mesh; var model = new ObjVNF(mesh); // render rows*column number of spheres with varying metallic/roughness values scaled by rows and columns respectively for (int row = 0; row < nrRows; ++row) { for (int col = 0; col < nrColumns; ++col) { var node = PBRNode.Create(model, model.GetSize(), ObjVNF.strPosition, ObjVNF.strTexCoord, ObjVNF.strNormal); node.IrradianceMap = irradianceMap; node.PrefilterMap = prefilterMap; node.texBRDF = texBRDF; node.Metallic = (float)row / (float)nrRows; // we clamp the roughness to 0.025 - 1.0 as perfectly smooth surfaces (roughness of 0.0) tend to look a bit off // on direct lighting. node.Roughness = glm.clamp((float)col / (float)nrColumns, 0.05f, 1.0f); node.WorldPosition = new vec3( (col - (nrColumns / 2)) * spacing, (row - (nrRows / 2)) * spacing, 0.0f); rootNode.Children.Add(node); } } } } { var backgroundNode = BackgroundNode.Create(envCubemap); rootNode.Children.Add(backgroundNode); } var list = new ActionList(); var transformAction = new TransformAction(scene); list.Add(transformAction); var renderAction = new RenderAction(scene); list.Add(renderAction); this.actionList = list; var manipulater = new FirstPerspectiveManipulater(); manipulater.Bind(camera, this.winGLCanvas1); }
public void ExperimentalGroupLayout(GraphModel model) { DagreInputGraph d = new DagreInputGraph(); d.VerticalLayout = VerticalLayout; updateNodesSizes(model); model.Nodes = model.Nodes.Where(z => z.LayerType != LayerType.Constant && (z.Childs.Any() || z.Parent != null || z.Parents.Any())).ToArray(); model.Groups.Clear(); var list1 = model.Nodes.ToList(); foreach (var rgrp in RequestedGroups) { var group1 = model.Nodes.Where(z => z.Name.StartsWith(rgrp.Prefix)).ToArray(); //replace group with big rectangle here? list1 = list1.Except(group1).ToList(); var gnode = new GroupNode() { Prefix = rgrp.Prefix, Name = "group" + (1 + RequestedGroups.IndexOf(rgrp)), DrawTag = new GraphNodeDrawInfo() { Width = 800, Height = 800 }, Nodes = group1.ToArray() }; model.Groups.Add(gnode); list1.Add(gnode); foreach (var gg in list1) { var tag = (gg.DrawTag as GraphNodeDrawInfo); d.AddNode(gg, tag.Rect.Width, tag.Rect.Height); } foreach (var gg in list1) { bool add = false; foreach (var item in gg.Childs) { if (group1.Contains(item)) { add = true; break; } } if (add) { gg.AttachChild(gnode); gg.Childs.RemoveAll(z => group1.Contains(z)); } } foreach (var gg in list1) { bool add = false; foreach (var item in gg.Parents) { if (group1.Contains(item)) { add = true; break; } } if (add) { gg.Parents.Add(gnode); gg.Parents.RemoveAll(z => group1.Contains(z)); } } foreach (var gg in group1) { foreach (var item in gg.Childs) { if (!group1.Contains(item)) { gnode.Childs.Add(item); } } } } foreach (var gg in list1) { foreach (var item in gg.Childs) { var nd1 = d.GetNode(gg); var nd2 = d.GetNode(item); var minlen = (item.Parents.Count == 0 || item.Childs.Count == 0 || gg.Parents.Count == 0 || gg.Childs.Count == 0) ? 3 : 1; d.AddEdge(nd1, nd2, minlen); } } d.Layout(); //back foreach (var n in model.Nodes.Union(model.Groups)) { var nd = d.GetNode(n); if (nd == null) { continue; } var tag = (n.DrawTag as GraphNodeDrawInfo); var xx = nd.X; var yy = nd.Y; tag.X = xx; tag.Y = yy; } List <EdgeNode> enodes = new List <EdgeNode>(); foreach (var item in d.Edges()) { var pnts = item.Points; List <PointF> rr = new List <PointF>(); foreach (var itemz in pnts) { rr.Add(new PointF(itemz.X, itemz.Y)); } enodes.Add(new EdgeNode(rr.ToArray())); } model.Edges = enodes.ToArray(); }
public override void PresentStep(int switchIndex, PresentationViewController presentationViewController) { switch (switchIndex) { case 0: // Set the slide's title and subtitle and add some text TextManager.SetTitle("Core Image"); TextManager.SetSubtitle("CI Filters"); TextManager.AddBulletAtLevel("Screen-space effects", 0); TextManager.AddBulletAtLevel("Applies to a node hierarchy", 0); TextManager.AddBulletAtLevel("Filter parameters are animatable", 0); TextManager.AddCode("#aNode.#Filters# = new CIFilter[] { filter1, filter2 };#"); break; case 1: SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1.0f; // Dim the text and move back a little TextManager.TextNode.Opacity = 0.0f; presentationViewController.CameraHandle.Position = presentationViewController.CameraNode.ConvertPositionToNode(new SCNVector3(0, 0, 5.0f), presentationViewController.CameraHandle.ParentNode); SCNTransaction.Commit(); // Reveal the grid GroupNode.Opacity = 1; break; case 2: SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; // Highlight an item HighlightContact(13, presentationViewController); SCNTransaction.Commit(); break; case 3: var index = 13; var subStep = 0; // Successively select items for (var i = 0; i < 5; ++i) { var popTime = new DispatchTime(DispatchTime.Now, (Int64)(i * 0.2 * Utils.NSEC_PER_SEC)); DispatchQueue.MainQueue.DispatchAfter(popTime, () => { SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0.2f; UnhighlightContact(index); if (subStep++ == 3) { index += ColumnCount; } else { index++; } HighlightContact(index, presentationViewController); SCNTransaction.Commit(); }); } break; case 4: // BLUR+DESATURATE in the background, GLOW in the foreground // Here we will change the node hierarchy in order to group all the nodes in the background under a single node. // This way we can use a single Core Image filter and apply it on the whole grid, and have another CI filter for the node in the foreground. var selectionParent = HeroNode.ParentNode; SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 0; // Stop the animations of the selected node HeroNode.Transform = HeroNode.PresentationNode.Transform; // set the current rotation to the current presentation value HeroNode.RemoveAllAnimations(); // Re-parent the node by preserving its world tranform var wantedWorldTransform = selectionParent.WorldTransform; GroupNode.ParentNode.AddChildNode(selectionParent); selectionParent.Transform = selectionParent.ParentNode.ConvertTransformFromNode(wantedWorldTransform, null); SCNTransaction.Commit(); // Add CIFilters SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 1; // A negative 'centerX' value means no scaling. //TODO HeroNode.Filters [0].SetValueForKey (new NSNumber (-1), new NSString ("centerX")); // Move the selection to the foreground selectionParent.Rotation = new SCNVector4(0, 1, 0, 0); HeroNode.Transform = ContentNode.ConvertTransformToNode(SCNMatrix4.CreateTranslation(0, Altitude, 29), selectionParent); HeroNode.Scale = new SCNVector3(1, 1, 1); HeroNode.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI / 4) * 0.25f); // Upon completion, rotate the selection forever SCNTransaction.SetCompletionBlock(() => { var animation = CABasicAnimation.FromKeyPath("rotation"); animation.Duration = 4.0f; animation.From = NSValue.FromVector(new SCNVector4(0, 1, 0, 0)); animation.To = NSValue.FromVector(new SCNVector4(0, 1, 0, NMath.PI * 2)); animation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut); animation.RepeatCount = float.MaxValue; HeroNode.ChildNodes [0].AddAnimation(animation, new NSString("heroNodeAnimation")); }); // Add the filters var blurFilter = CIFilter.FromName("CIGaussianBlur"); blurFilter.SetDefaults(); blurFilter.Name = "blur"; blurFilter.SetValueForKey(new NSNumber(0), CIFilterInputKey.Radius); var desaturateFilter = CIFilter.FromName("CIColorControls"); desaturateFilter.SetDefaults(); desaturateFilter.Name = "desaturate"; GroupNode.Filters = new CIFilter[] { blurFilter, desaturateFilter }; SCNTransaction.Commit(); // Increate the blur radius and desaturate progressively SCNTransaction.Begin(); SCNTransaction.AnimationDuration = 2; GroupNode.SetValueForKey(new NSNumber(10), new NSString("filters.blur.inputRadius")); GroupNode.SetValueForKey(new NSNumber(0.1), new NSString("filters.desaturate.inputSaturation")); SCNTransaction.Commit(); break; } }
public override Task <IQueryNode> VisitAsync(TermNode node, IQueryVisitorContext context) { IQueryNode result = node; // don't include terms without fields if (node.Field == null) { node.RemoveSelf(); return(Task.FromResult <IQueryNode>(null)); } // process special stack fields switch (node.Field?.ToLowerInvariant()) { case EventIndex.Alias.StackId: case "stack_id": node.Field = "id"; break; case "is_fixed": case StackIndex.Alias.IsFixed: bool isFixed = Boolean.TryParse(node.Term, out bool temp) && temp; node.Field = "status"; node.Term = "fixed"; node.IsNegated = !isFixed; break; case "is_regressed": case StackIndex.Alias.IsRegressed: bool isRegressed = Boolean.TryParse(node.Term, out bool regressed) && regressed; node.Field = "status"; node.Term = "regressed"; node.IsNegated = !isRegressed; break; case "is_hidden": case StackIndex.Alias.IsHidden: bool isHidden = Boolean.TryParse(node.Term, out bool hidden) && hidden; if (isHidden) { var isHiddenNode = new GroupNode { HasParens = true, IsNegated = true, Operator = GroupOperator.Or, Left = new TermNode { Field = "status", Term = "open" }, Right = new TermNode { Field = "status", Term = "regressed" } }; result = node.ReplaceSelf(isHiddenNode); break; } else { var notHiddenNode = new GroupNode { HasParens = true, Operator = GroupOperator.Or, Left = new TermNode { Field = "status", Term = "open" }, Right = new TermNode { Field = "status", Term = "regressed" } }; result = node.ReplaceSelf(notHiddenNode); break; } } if (result is TermNode termNode) { if (String.Equals(termNode.Field, "status", StringComparison.OrdinalIgnoreCase)) { context.SetValue(nameof(StackFilter.HasStatus), true); if (!termNode.IsNegated.GetValueOrDefault() && String.Equals(termNode.Term, "open", StringComparison.OrdinalIgnoreCase)) { context.SetValue(nameof(StackFilter.HasStatusOpen), true); } } if ((String.Equals(termNode.Field, EventIndex.Alias.StackId, StringComparison.OrdinalIgnoreCase) || String.Equals(termNode.Field, "stack_id", StringComparison.OrdinalIgnoreCase)) && !String.IsNullOrEmpty(termNode.Term)) { context.SetValue(nameof(StackFilter.HasStackIds), true); } } return(Task.FromResult <IQueryNode>(result)); }
/* * Constructor */ public DimmerSmartCIO(GroupNode specSnippet) : base(new Panel(), specSnippet) { if (_specSnippet.IsObject()) { // single state translation // this means that there is only a dimmer and no on or off switches _dimState = (ApplianceState)_objects[SINGLE_STATE]; _onCommand = null; _offCommand = null; } else { // multiple state translation _dimState = (ApplianceState)_objects[DIM_LABEL]; _onCommand = (ApplianceCommand)_objects[ON_LABEL]; _offCommand = (ApplianceCommand)_objects[OFF_LABEL]; } if (_dimState != null) { doNotRenderObject(_dimState); _dimmerControl = new HScrollBar(); _dimmerControl.Minimum = 0; _dimmerControl.SmallChange = 1; _dimmerControl.LargeChange = 10; _dimmerControl.Maximum = 109; GetControl().Controls.Add(_dimmerControl); _sentValues = new Hashtable(); _dimState.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(this.ValueChanged); _dimState.EnableChangedEvent += new PUC.ApplianceObject.EnableChangedHandler(this.EnableChanged); _dimmerControl.ValueChanged += new EventHandler(this._dimmerControl_ValueChanged); } System.Drawing.Font f = new System.Drawing.Font("Tahoma", 9, System.Drawing.FontStyle.Regular); if (_onCommand != null) { doNotRenderObject(_onCommand); _onButton = new Button(); _onButton.Text = "On"; _onButton.Font = f; GetControl().Controls.Add(_onButton); _onCommand.EnableChangedEvent += new PUC.ApplianceObject.EnableChangedHandler(this.EnableChanged); _onButton.Click += new EventHandler(_onButton_Click); } if (_offCommand != null) { doNotRenderObject(_offCommand); _offButton = new Button(); _offButton.Text = "Off"; _offButton.Font = f; GetControl().Controls.Add(_offButton); _offCommand.EnableChangedEvent += new PUC.ApplianceObject.EnableChangedHandler(this.EnableChanged); _offButton.Click += new EventHandler(_offButton_Click); } GetControl().Resize += new EventHandler(this.Resized); }
public override async Task VisitAsync(GroupNode node, IQueryVisitorContext context) { await base.VisitAsync(node, context).ConfigureAwait(false); // Only stop on scoped group nodes (parens). Gather all child queries (including scoped groups) and then combine them. // Combining only happens at the scoped group level though. // Merge all non-field terms together into a single match or multi-match query // Merge all nested queries for the same nested field together if (!(context is IElasticQueryVisitorContext elasticContext)) { throw new ArgumentException("Context must be of type IElasticQueryVisitorContext", nameof(context)); } QueryBase query = node.GetQuery(() => node.GetDefaultQuery(context)); QueryBase container = query; var nested = query as NestedQuery; if (nested != null && node.Parent != null) { container = null; } foreach (var child in node.Children.OfType <IFieldQueryNode>()) { var childQuery = child.GetQuery(() => child.GetDefaultQuery(context)); if (childQuery == null) { continue; } var op = node.GetOperator(elasticContext); if (child.IsExcluded()) { childQuery = !childQuery; } if (op == GroupOperator.Or && node.IsRequired()) { op = GroupOperator.And; } if (op == GroupOperator.And) { container &= childQuery; } else if (op == GroupOperator.Or) { container |= childQuery; } } if (nested != null) { nested.Query = container; node.SetQuery(nested); } else { node.SetQuery(container); } }
private SceneNodeBase GetTree(Scene scene) { var groupNode = new GroupNode(); { var children = new List<SceneNodeBase>(); const float alpha = 0.2f; var colors = new vec4[] { new vec4(1, 0, 0, alpha), new vec4(0, 1, 0, alpha), new vec4(0, 0, 1, alpha), new vec4(1, 1, 0, alpha), new vec4(0.5f, 0.5f, 0.5f, alpha), new vec4(1, 0, 1, alpha), new vec4(1, 0, 0, alpha), new vec4(0, 1, 0, alpha), new vec4(0, 0, 1, alpha), new vec4(1, 1, 0, alpha), new vec4(0.5f, 0.5f, 0.5f, alpha), new vec4(1, 0, 1, alpha), new vec4(1, 0, 0, alpha), new vec4(0, 1, 0, alpha), new vec4(0, 0, 1, alpha), new vec4(1, 0, 0, alpha), new vec4(0, 1, 0, alpha), new vec4(0, 0, 1, alpha), new vec4(1, 0, 0, alpha), new vec4(1, 0, 0, alpha), new vec4(1, 0, 0, alpha), new vec4(1, 1, 0, alpha), new vec4(1, 1, 0, alpha), new vec4(1, 1, 0, alpha), new vec4(1, 0, 0, alpha), new vec4(1, 0, 0, alpha), new vec4(1, 0, 0, alpha), }; int index = 0; var size = new vec3(5, 5, 5); for (int j = -1; j < 2; j++) { for (int i = -1; i < 2; i++) { vec3 worldPosition = new vec3(i * 2, j * 2, -2);// +new vec3(-2.375f, -1.75f, 0); //var cubeNode = CubeNode.Create(new CubeModel(), CubeModel.positions); //var cubeNode = CubeNode.Create(new RectangleModel(), RectangleModel.strPosition); var cubeNode = CubeNode.Create(new Sphere(0.5f), Sphere.strPosition); cubeNode.WorldPosition = worldPosition; cubeNode.Color = colors[index++]; children.Add(cubeNode); } } { var positionList = new List<vec3>(); positionList.Add(new vec3(0, 0, 0)); positionList.Add(new vec3(2, 0, 0)); positionList.Add(new vec3(0, 2, 2)); positionList.Add(new vec3(2, 2, 2)); for (int i = 0; i < positionList.Count; i++) { //var cubeNode = CubeNode.Create(new CubeModel(), CubeModel.positions); //var cubeNode = CubeNode.Create(new RectangleModel(), RectangleModel.strPosition); var cubeNode = i > 1 ? CubeNode.Create(new Sphere(0.5f), Sphere.strPosition) : CubeNode.Create(new RectangleModel(), RectangleModel.strPosition); cubeNode.WorldPosition = positionList[i]; cubeNode.Color = colors[index++]; children.Add(cubeNode); } } //{ // string folder = System.Windows.Forms.Application.StartupPath; // string objFilename = System.IO.Path.Combine(folder + @"\..\..\..\..\Infrastructure\CSharpGL.Models", "vnfHanoiTower.obj_"); // var parser = new ObjVNFParser(true); // ObjVNFResult result = parser.Parse(objFilename); // if (result.Error != null) // { // MessageBox.Show(result.Error.ToString()); // } // else // { // var model = new ObjVNF(result.Mesh); // var cubeNode = CubeNode.Create(model, ObjVNF.strPosition); // cubeNode.Color = Color.Red.ToVec4(); // size = model.GetSize(); // float max = size.max(); // size = new vec3(max, max, max); // children.Add(cubeNode); // } //} this.peelingNode = new PeelingNode(size, children.ToArray()); groupNode.Children.Add(this.peelingNode); } { this.raycastNode = RaycastNode.Create(this.peelingNode); groupNode.Children.Add(this.raycastNode); } return groupNode; }
/// <summary> /// 转换为组 /// </summary> /// <param name="layer"></param> /// <param name="group"></param> /// <param name="OnRetrive"></param> public static void RetriveLayerToSwitchModle(Vector2 rootSize, PsdLayer layer, GroupNode group, bool forceSprite = false) { if (!layer.IsGroup) { return; } else { float index = 0; foreach (var child in layer.Childs) { var progress = ++index / layer.Childs.Length; EditorUtility.DisplayProgressBar(layer.Name, "转换进度:" + progress, progress); if (child.IsGroup) { GroupNode childNode = new GroupNode(GetRectFromLayer(child), idSpan++, group.depth + 1); childNode.Analyzing(RuleObj, child.Name); group.AddChild(childNode); if (childNode != null) { RetriveLayerToSwitchModle(rootSize, child, childNode, forceSprite); } } else { ImgNode imgnode = AnalysisLayer(group.displayName, rootSize, child, forceSprite); if (imgnode != null) { group.images.Add(imgnode); } } } EditorUtility.ClearProgressBar(); } }
/// <summary> /// TODO: Documentation RemoveGroupNode /// </summary> /// <param name="groupNode"></param> private void RemoveGroupNode(GroupNode groupNode) { if (groupNode != null && groupNode.Nodes.Count == 0) { m_groups.Remove(groupNode.FullPath); GroupNode groupNodeParent = groupNode.Parent as GroupNode; groupNode.Remove(); this.RemoveGroupNode(groupNodeParent); } }
private void m_roster_OnRosterItem(object sender, jabber.protocol.iq.Item ri) { bool remove = (ri.Subscription == Subscription.remove); LinkedList nodelist = (LinkedList)m_items[ri.JID.ToString()]; if (nodelist == null) { // First time through. if (!remove) { nodelist = new LinkedList(); m_items.Add(ri.JID.ToString(), nodelist); } } else { // update to an existing item. remove all of them, and start over. foreach (ItemNode i in nodelist) { GroupNode gn = i.Parent as GroupNode; i.Remove(); if ((gn != null) && (gn.Nodes.Count == 0)) { m_groups.Remove(gn.GroupName); gn.Remove(); } } nodelist.Clear(); if (remove) { m_items.Remove(ri.JID.ToString()); } } if (remove) { return; } // add the new ones back Hashtable ghash = new Hashtable(); Group[] groups = ri.GetGroups(); for (int i = groups.Length - 1; i >= 0; i--) { if (groups[i].GroupName == "") { groups[i].GroupName = UNFILED; } } if (groups.Length == 0) { groups = new Group[] { new Group(ri.OwnerDocument) }; groups[0].GroupName = UNFILED; } foreach (Group g in groups) { GroupNode gn = AddGroupNode(g); // might have the same group twice. if (ghash.Contains(g.GroupName)) { continue; } ghash.Add(g.GroupName, g); ItemNode i = new ItemNode(ri); i.ChangePresence(m_pres[ri.JID]); nodelist.Add(i); gn.Nodes.Add(i); } }
private void BuildImageGrid() { // Create a root node for the grid GroupNode = SCNNode.Create(); // Retrieve the template node to replicate var scene = SCNScene.FromFile("Contacts/contact"); var templateNode = scene.RootNode.FindChildNode("people", true); for (int k = 0, j = 0; j < RowCount; j++) { for (var i = 0; i < ColumnCount; i++, k++) { // Hierarchy : __groupNode > container > node var container = SCNNode.Create(); var node = templateNode.Clone(); node.Name = "contact" + k; GroupNode.AddChildNode(container); container.AddChildNode(node); if (k == 28) { HeroNode = node; } // Curved layout var angle = 0.12f * ((ColumnCount - 1) / 2.0f - i); var x = NMath.Cos(angle + (float)(Math.PI / 2)) * 500.0f; var z = NMath.Sin(angle + (float)(Math.PI / 2)) * 500.0f; container.Position = new SCNVector3(x, j * 60, -z + 400); container.Rotation = new SCNVector4(0, 1, 0, angle); // We want a different image on each elemement and to do that we need to // unshare the geometry first and then unshare the material var geometryNode = node.ChildNodes [0]; geometryNode.Geometry = (SCNGeometry)geometryNode.Geometry.Copy(); var materialCopy = (SCNMaterial)geometryNode.Geometry.Materials [1].Copy(); materialCopy.Diffuse.Contents = new NSImage(NSBundle.MainBundle.PathForResource("Contacts/contact" + (k % ContactImageCount), "jpg")); geometryNode.Geometry.ReplaceMaterial(1, materialCopy); // Animate (rotate forever) var animation = CAKeyFrameAnimation.GetFromKeyPath("rotation"); animation.Duration = 4.0f; animation.KeyTimes = new NSNumber[] { 0.0f, 0.3f, 1.0f }; animation.Values = new NSObject[] { NSValue.FromVector(new SCNVector4(0, 1, 0, 0)), NSValue.FromVector(new SCNVector4(0, 1, 0, (float)(Math.PI * 2))), NSValue.FromVector(new SCNVector4(0, 1, 0, (float)(Math.PI * 2))) }; var tf = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut); animation.TimingFunctions = new CAMediaTimingFunction[] { tf, tf, tf }; animation.RepeatCount = float.MaxValue; animation.BeginTime = CAAnimation.CurrentMediaTime() + 1.0f + j * 0.1f + i * 0.05f; // desynchronize the animations node.AddAnimation(animation, new NSString("animation")); } } // Add the group to the scene GroupNode.Scale = new SCNVector3(0.03f, 0.03f, 0.03f); GroupNode.Position = new SCNVector3(0, Altitude - 2.8f, 18); GroupNode.Opacity = 0.0f; GroundNode.AddChildNode(GroupNode); }
static void Main(string[] args) { List<string> SceneNodeTypes = new List<string>(); SceneNodeTypes.Add("Cube"); SceneNodeTypes.Add("Sphere"); SceneNodeTypes.Add("Building"); SceneNodeTypes.Add("Terrain"); SceneNodeTypes.Add("Camera"); SceneNodeTypes.Add("Perspective"); SceneNodeTypes.Add("Rotate"); SceneNodeTypes.Add("Translate"); SceneNodeTypes.Add("IGroupNode"); SceneNodeTypes.Add("IStateNode"); List<string> DrawableTypes = new List<string>(); DrawableTypes.Add("Cube"); DrawableTypes.Add("Sphere"); DrawableTypes.Add("Building"); DrawableTypes.Add("Terrain"); List<string> TransformTypes = new List<string>(); TransformTypes.Add("Terrain"); TransformTypes.Add("Camera"); TransformTypes.Add("Perspective"); TransformTypes.Add("Rotate"); // init ISceneNode root; root = new GroupNode("Root"); IVisitor printGraph = new PrintVisitor(); root.Accept(printGraph); // read user input from Console string optionString = System.Console.ReadLine(); while (optionString != "Exit") { if (optionString == "Add") { bool _isLegalInput = true; string tmp = System.Console.ReadLine(); string[] token = tmp.Split(new char[] {' '}); string typeOfTheCurrentNode, nameOfTheCurrentNode, nameOfTheGroupNode; typeOfTheCurrentNode = token[0]; nameOfTheCurrentNode = token[1]; nameOfTheGroupNode = token[2]; if (!SceneNodeTypes.Contains(typeOfTheCurrentNode)) { _isLegalInput = false; throw new ArgumentOutOfRangeException("The type " + typeOfTheCurrentNode + " is not a recognized type of SceneNode."); } ISceneNode currentRoot = SearchVisitor.Find(nameOfTheGroupNode, root); if (currentRoot == null) { _isLegalInput = false; throw new ArgumentOutOfRangeException("The name of the Group " + nameOfTheGroupNode + " is not a recognized name of GroupNode."); } if (_isLegalInput) { ISceneGraphFactory nodeGenerator = new SceneGraphFactory(); if (DrawableTypes.Contains(typeOfTheCurrentNode)) { ISceneNode newNode = nodeGenerator.CreateDrawableNode(nameOfTheCurrentNode, typeOfTheCurrentNode, null); (currentRoot as GroupNode).AddChild(newNode); } else if (TransformTypes.Contains(typeOfTheCurrentNode)) { ISceneNode newNode = nodeGenerator.CreateTransformNode(nameOfTheCurrentNode, typeOfTheCurrentNode, null); (currentRoot as GroupNode).AddChild(newNode); } else if (typeOfTheCurrentNode == "IGroupNode") { ISceneNode newNode = nodeGenerator.CreateGroupNode(nameOfTheCurrentNode, typeOfTheCurrentNode, null); (currentRoot as GroupNode).AddChild(newNode); } else if (typeOfTheCurrentNode == "IStateNode") { ISceneNode newNode = nodeGenerator.CreateStateNode(nameOfTheCurrentNode, typeOfTheCurrentNode, null); (currentRoot as GroupNode).AddChild(newNode); } } } optionString = System.Console.ReadLine(); } // output log file System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Stream stream = File.Open(dialog.FileName, FileMode.Create); BinaryFormatter formatter = new BinaryFormatter(); using (stream) { formatter.Serialize(stream, root); } } // output sceneGraph to Console root.Accept(printGraph); // pause System.Console.ReadLine(); }
private static void WriteGroup(XmlWriter writer, GroupNode group) { writer.WriteStartElement("part"); writer.WriteAttributeString("id", group.Id); foreach (var subgroup in group.GetChildren()) WriteGroup(writer, subgroup); WriteText(writer, group); writer.WriteEndElement(); }
/* * Member Variables */ /* * Constructor */ /* * Process Rule Method */ public abstract PanelNode Process(GroupNode g, PanelNode p);
private GroupNode GetOrCreateGroupNode(Part part) { var partString = part.ToString(); if (_groups.ContainsKey(partString)) return _groups[partString]; var hierarchy = part.StackHierarchy(); GroupNode node = null; foreach (var hierarchyPart in hierarchy) { var hierarchyPartString = hierarchyPart.ToString(); if (_groups.ContainsKey(hierarchyPartString)) node = _groups[hierarchyPartString]; else { node = new GroupNode(hierarchyPart.Name, node); _groups.Add(hierarchyPartString, node); } } return node; }
public static AggregationBase GetDefaultAggregation(this GroupNode node, IQueryVisitorContext context) { var elasticContext = context as IElasticQueryVisitorContext; if (elasticContext == null) { throw new ArgumentException("Context must be of type IElasticQueryVisitorContext", nameof(context)); } if (!node.HasParens || String.IsNullOrEmpty(node.Field) || node.Left != null) { return(null); } string field = elasticContext.GetNonAnalyzedFieldName(node.Field); var mapping = elasticContext.GetPropertyMapping(field); switch (node.GetOperationType()) { case AggregationType.DateHistogram: return(GetDateHistogramAggregation("date_" + node.GetOriginalField(), field, node.Proximity, node.UnescapedBoost, context)); case AggregationType.Histogram: return(GetHistogramAggregation("histogram_" + node.GetOriginalField(), field, node.Proximity, node.UnescapedBoost, context)); case AggregationType.GeoHashGrid: var precision = GeoHashPrecision.Precision1; if (!String.IsNullOrEmpty(node.Proximity)) { Enum.TryParse(node.Proximity, out precision); } return(new GeoHashGridAggregation("geogrid_" + node.GetOriginalField()) { Field = field, Precision = precision, Aggregations = new AverageAggregation("avg_lat", null) { Script = new InlineScript($"doc['{node.Field}'].lat") } && new AverageAggregation("avg_lon", null) { Script = new InlineScript($"doc['{node.Field}'].lon") } }); case AggregationType.Terms: return(new TermsAggregation("terms_" + node.GetOriginalField()) { Field = field, Size = node.GetProximityAsInt32(), MinimumDocumentCount = node.GetBoostAsInt32(), Meta = new Dictionary <string, object> { { "@field_type", mapping?.Type?.ToString() } } }); case AggregationType.TopHits: return(new TopHitsAggregation("tophits") { Size = node.GetProximityAsInt32() }); } return(null); }
public GroupNode(String id, GroupNode parent) { Content = new Dictionary<String, Dictionary<String, String>>(); Id = id; Parent = parent; if (Parent != null) parent.AddChild(this); }
/* * Constructor */ public FullWidthRow(GroupNode g, PanelNode panel, ConcreteInteractionObject cio) : base(g, panel) { addCIO(cio); }
private void RemoveNode(GroupNode node) { lock(_children) _children.Remove(node); }
public static AggregationBase GetDefaultAggregation(this GroupNode node, IQueryVisitorContext context) { var elasticContext = context as IElasticQueryVisitorContext; if (elasticContext == null) { throw new ArgumentException("Context must be of type IElasticQueryVisitorContext", nameof(context)); } if (!node.HasParens || String.IsNullOrEmpty(node.Field) || node.Left != null) { return(null); } string field = elasticContext.MappingResolver.GetAggregationsFieldName(node.Field); var property = elasticContext.MappingResolver.GetMappingProperty(field, true); switch (node.GetOperationType()) { case AggregationType.DateHistogram: return(GetDateHistogramAggregation("date_" + node.GetOriginalField(), field, node.Proximity, node.UnescapedBoost ?? node.GetTimeZone(elasticContext.DefaultTimeZone), context)); case AggregationType.Histogram: return(GetHistogramAggregation("histogram_" + node.GetOriginalField(), field, node.Proximity, node.UnescapedBoost, context)); case AggregationType.GeoHashGrid: var precision = GeoHashPrecision.Precision1; if (!String.IsNullOrEmpty(node.Proximity)) { Enum.TryParse(node.Proximity, out precision); } return(new GeoHashGridAggregation("geogrid_" + node.GetOriginalField()) { Field = field, Precision = precision, Aggregations = new AverageAggregation("avg_lat", null) { Script = new InlineScript($"doc['{node.Field}'].lat") } && new AverageAggregation("avg_lon", null) { Script = new InlineScript($"doc['{node.Field}'].lon") } }); case AggregationType.Terms: var agg = new TermsAggregation("terms_" + node.GetOriginalField()) { Field = field, Size = node.GetProximityAsInt32(), MinimumDocumentCount = node.GetBoostAsInt32(), Meta = new Dictionary <string, object> { { "@field_type", property?.Type } } }; if (agg.Size.HasValue && (agg.Size * 1.5 + 10) > MAX_BUCKET_SIZE) { agg.ShardSize = Math.Max((int)agg.Size, MAX_BUCKET_SIZE); } return(agg); case AggregationType.TopHits: return(new TopHitsAggregation("tophits") { Size = node.GetProximityAsInt32() }); } return(null); }
public override Task VisitAsync(GroupNode node, IQueryVisitorContext context) { _builder.Append(node); return(Task.CompletedTask); }
private SceneNodeBase GetTree() { var group = new GroupNode(); { string folder = System.Windows.Forms.Application.StartupPath; var bmp = new Bitmap(System.IO.Path.Combine(folder, @"Crate.bmp")); TexStorageBase storage = new TexImageBitmap(bmp); var texture = new Texture(storage); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapS, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapT, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapR, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMinFilter, (int)GL.GL_LINEAR)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMagFilter, (int)GL.GL_LINEAR)); texture.Initialize(); bmp.Dispose(); var solidCube = TexturedCubeNode.Create(texture); group.Children.Add(solidCube); } { var blendingGroup = new BlendingGroupNode(BlendSrcFactor.SrcAlpha, BlendDestFactor.OneMinusSrcAlpha); group.Children.Add(blendingGroup); var list = new List <BlendingConfig>(); list.Add(new BlendingConfig(Color.Red, new vec3(1, 0, 1), 0.5f)); list.Add(new BlendingConfig(Color.Green, new vec3(0.6f, 0, 0.1f), 0.5f)); list.Add(new BlendingConfig(Color.Blue, new vec3(-0.1f, 0, -0.2f), 0.5f)); list.Add(new BlendingConfig(Color.Purple, new vec3(0.4f, 0, -0.7f), 0.5f)); list.Add(new BlendingConfig(Color.Orange, new vec3(0.8f, 0, 0.1f), 0.5f)); list.Add(new BlendingConfig(Color.Yellow, new vec3(0.8f, 0, 0.1f), 0.5f)); for (int i = 0; i < list.Count; i++) { const float distance = 2.0f; list[i].position = new vec3( distance * (float)Math.Cos((double)i / (double)list.Count * Math.PI * 2), 0, distance * (float)Math.Sin((double)i / (double)list.Count * Math.PI * 2) ); list[i].alpha = 0.3f; } foreach (var item in list) { var bmp = new Bitmap(1, 1); using (var g = Graphics.FromImage(bmp)) { g.Clear(item.color); } var texture = new Texture(new TexImageBitmap(bmp)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapS, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapT, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureWrapR, (int)GL.GL_CLAMP_TO_EDGE)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMinFilter, (int)GL.GL_LINEAR)); texture.BuiltInSampler.Add(new TexParameteri(TexParameter.PropertyName.TextureMagFilter, (int)GL.GL_LINEAR)); texture.Initialize(); bmp.Dispose(); var transparentCube = TexturedCubeNode.Create(texture); transparentCube.WorldPosition = item.position; transparentCube.Alpha = item.alpha; blendingGroup.Children.Add(transparentCube); } } return(group); }
// actual decoding stuff public override Level Read(Stream src, string name, bool metadata) { BinaryReader reader = new BinaryReader(src); if (ReadFourCC(reader) != "VOX ") { throw new NotSupportedException("Invalid header"); } if (reader.ReadInt32() != 150) { throw new NotSupportedException("Unsupported version number"); } Chunk main = ReadChunk(reader); if (main.FourCC != "MAIN") { throw new NotSupportedException("MAIN chunk expected"); } uint[] palette = new uint[256] { 0x00000000, 0xffffffff, 0xffccffff, 0xff99ffff, 0xff66ffff, 0xff33ffff, 0xff00ffff, 0xffffccff, 0xffccccff, 0xff99ccff, 0xff66ccff, 0xff33ccff, 0xff00ccff, 0xffff99ff, 0xffcc99ff, 0xff9999ff, 0xff6699ff, 0xff3399ff, 0xff0099ff, 0xffff66ff, 0xffcc66ff, 0xff9966ff, 0xff6666ff, 0xff3366ff, 0xff0066ff, 0xffff33ff, 0xffcc33ff, 0xff9933ff, 0xff6633ff, 0xff3333ff, 0xff0033ff, 0xffff00ff, 0xffcc00ff, 0xff9900ff, 0xff6600ff, 0xff3300ff, 0xff0000ff, 0xffffffcc, 0xffccffcc, 0xff99ffcc, 0xff66ffcc, 0xff33ffcc, 0xff00ffcc, 0xffffcccc, 0xffcccccc, 0xff99cccc, 0xff66cccc, 0xff33cccc, 0xff00cccc, 0xffff99cc, 0xffcc99cc, 0xff9999cc, 0xff6699cc, 0xff3399cc, 0xff0099cc, 0xffff66cc, 0xffcc66cc, 0xff9966cc, 0xff6666cc, 0xff3366cc, 0xff0066cc, 0xffff33cc, 0xffcc33cc, 0xff9933cc, 0xff6633cc, 0xff3333cc, 0xff0033cc, 0xffff00cc, 0xffcc00cc, 0xff9900cc, 0xff6600cc, 0xff3300cc, 0xff0000cc, 0xffffff99, 0xffccff99, 0xff99ff99, 0xff66ff99, 0xff33ff99, 0xff00ff99, 0xffffcc99, 0xffcccc99, 0xff99cc99, 0xff66cc99, 0xff33cc99, 0xff00cc99, 0xffff9999, 0xffcc9999, 0xff999999, 0xff669999, 0xff339999, 0xff009999, 0xffff6699, 0xffcc6699, 0xff996699, 0xff666699, 0xff336699, 0xff006699, 0xffff3399, 0xffcc3399, 0xff993399, 0xff663399, 0xff333399, 0xff003399, 0xffff0099, 0xffcc0099, 0xff990099, 0xff660099, 0xff330099, 0xff000099, 0xffffff66, 0xffccff66, 0xff99ff66, 0xff66ff66, 0xff33ff66, 0xff00ff66, 0xffffcc66, 0xffcccc66, 0xff99cc66, 0xff66cc66, 0xff33cc66, 0xff00cc66, 0xffff9966, 0xffcc9966, 0xff999966, 0xff669966, 0xff339966, 0xff009966, 0xffff6666, 0xffcc6666, 0xff996666, 0xff666666, 0xff336666, 0xff006666, 0xffff3366, 0xffcc3366, 0xff993366, 0xff663366, 0xff333366, 0xff003366, 0xffff0066, 0xffcc0066, 0xff990066, 0xff660066, 0xff330066, 0xff000066, 0xffffff33, 0xffccff33, 0xff99ff33, 0xff66ff33, 0xff33ff33, 0xff00ff33, 0xffffcc33, 0xffcccc33, 0xff99cc33, 0xff66cc33, 0xff33cc33, 0xff00cc33, 0xffff9933, 0xffcc9933, 0xff999933, 0xff669933, 0xff339933, 0xff009933, 0xffff6633, 0xffcc6633, 0xff996633, 0xff666633, 0xff336633, 0xff006633, 0xffff3333, 0xffcc3333, 0xff993333, 0xff663333, 0xff333333, 0xff003333, 0xffff0033, 0xffcc0033, 0xff990033, 0xff660033, 0xff330033, 0xff000033, 0xffffff00, 0xffccff00, 0xff99ff00, 0xff66ff00, 0xff33ff00, 0xff00ff00, 0xffffcc00, 0xffcccc00, 0xff99cc00, 0xff66cc00, 0xff33cc00, 0xff00cc00, 0xffff9900, 0xffcc9900, 0xff999900, 0xff669900, 0xff339900, 0xff009900, 0xffff6600, 0xffcc6600, 0xff996600, 0xff666600, 0xff336600, 0xff006600, 0xffff3300, 0xffcc3300, 0xff993300, 0xff663300, 0xff333300, 0xff003300, 0xffff0000, 0xffcc0000, 0xff990000, 0xff660000, 0xff330000, 0xff0000ee, 0xff0000dd, 0xff0000bb, 0xff0000aa, 0xff000088, 0xff000077, 0xff000055, 0xff000044, 0xff000022, 0xff000011, 0xff00ee00, 0xff00dd00, 0xff00bb00, 0xff00aa00, 0xff008800, 0xff007700, 0xff005500, 0xff004400, 0xff002200, 0xff001100, 0xffee0000, 0xffdd0000, 0xffbb0000, 0xffaa0000, 0xff880000, 0xff770000, 0xff550000, 0xff440000, 0xff220000, 0xff110000, 0xffeeeeee, 0xffdddddd, 0xffbbbbbb, 0xffaaaaaa, 0xff888888, 0xff777777, 0xff555555, 0xff444444, 0xff222222, 0xff111111, }; src.Seek(main.ChunkContentSize, SeekOrigin.Current); long end = src.Position + main.ChildChunkContentSize; Level lvl = null; List <Model> models = new List <Model>(); Dictionary <int, Node> nodes = new Dictionary <int, Node>(); while (src.Position < end) { Chunk chunk = ReadChunk(reader); if (chunk.FourCC == "RGBA") { if (chunk.ChunkContentSize != 4 * 256) { throw new NotSupportedException("RGBA chunk must be 1024 bytes"); } for (int i = 0; i <= 254; i++) { palette[i + 1] = reader.ReadUInt32(); } reader.ReadUInt32(); } else if (chunk.FourCC == "SIZE") { if (chunk.ChunkContentSize != 12) { throw new NotSupportedException("Size chunk must be 12 bytes"); } Model part = new Model(); part.SizeX = reader.ReadInt32(); part.SizeY = reader.ReadInt32(); part.SizeZ = reader.ReadInt32(); models.Add(part); } else if (chunk.FourCC == "XYZI") { int numVoxels = reader.ReadInt32(); Model part = models[models.Count - 1]; part.Voxels = new Voxel[numVoxels]; for (int i = 0; i < numVoxels; i++) { part.Voxels[i].X = reader.ReadByte(); part.Voxels[i].Y = reader.ReadByte(); part.Voxels[i].Z = reader.ReadByte(); part.Voxels[i].B = reader.ReadByte(); // index into palette } } else if (chunk.FourCC == "nTRN") { TransformNode node = new TransformNode(); node.Type = NodeType.Transform; ReadNode(reader, node); node.Children = new int[1]; node.Children[0] = reader.ReadInt32(); int reservedID = reader.ReadInt32(); int layerID = reader.ReadInt32(); int numFrames = reader.ReadInt32(); if (numFrames != 1) { throw new NotSupportedException("Transform node must only have one frame"); } node.FrameAttribs = ReadDict(reader); nodes[node.Id] = node; } else if (chunk.FourCC == "nGRP") { GroupNode node = new GroupNode(); node.Type = NodeType.Group; ReadNode(reader, node); node.Children = new int[reader.ReadInt32()]; for (int i = 0; i < node.Children.Length; i++) { node.Children[i] = reader.ReadInt32(); } nodes[node.Id] = node; } else if (chunk.FourCC == "nSHP") { ShapeNode node = new ShapeNode(); node.Type = NodeType.Shape; ReadNode(reader, node); node.Children = new int[0]; int numModels = reader.ReadInt32(); if (numModels != 1) { throw new NotSupportedException("Shape node must only have one model"); } int modelID = reader.ReadInt32(); node.Model = models[modelID]; node.ModelAttribs = ReadDict(reader); nodes[node.Id] = node; } else { src.Seek(chunk.ChunkContentSize, SeekOrigin.Current); } src.Seek(chunk.ChildChunkContentSize, SeekOrigin.Current); } // assume root node is 0 if (nodes.Count > 0) { Transform(0, Vec3S32.Zero, null, nodes); } Vec3S32 min = Vec3S32.Zero, max = Vec3S32.Zero; foreach (Model m in models) { min = Vec3S32.Min(min, m.Transform(0, 0, 0)); max = Vec3S32.Max(max, m.Transform(m.SizeX - 1, m.SizeY - 1, m.SizeZ - 1)); } // magicavox uses Z for vertical int width = (max.X - min.X) + 1, height = (max.Z - min.Z) + 1, length = (max.Y - min.Y) + 1; lvl = new Level(name, (ushort)width, (ushort)height, (ushort)length); ComposeParts(lvl, models, min.X, min.Y, min.Z); ComposePalette(lvl, palette); return(lvl); }
public ParquetFileWriter( OutputStream outputStream, GroupNode schema, WriterProperties writerProperties, IReadOnlyDictionary <string, string> keyValueMetadata = null) { _handle = CreateParquetFileWriter(outputStream, schema, writerProperties, keyValueMetadata); }
private void FormMain_Load(object sender, EventArgs e) { foreach (var item in Enum.GetNames(typeof(EnvironmentMappingNode.Ratio))) { this.cmbRatios.Items.Add(item); } var position = new vec3(8, 0, 4) * 3; var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); var camera = new Camera(position, center, up, CameraType.Perspecitive, this.winGLCanvas1.Width, this.winGLCanvas1.Height); string folder = System.Windows.Forms.Application.StartupPath; var totalBmp = new Bitmap(System.IO.Path.Combine(folder, @"cubemaps_skybox.png")); Bitmap[] bitmaps = GetBitmaps(totalBmp); this.skybox = SkyboxNode.Create(bitmaps); this.skybox.Scale *= 60; string objFilename = System.IO.Path.Combine(folder + @"\..\..\..\..\Infrastructure\CSharpGL.Models", "nanosuit.obj_"); var parser = new ObjVNFParser(false); ObjVNFResult result = parser.Parse(objFilename); if (result.Error != null) { MessageBox.Show(result.Error.ToString()); } else { var model = new ObjVNF(result.Mesh); var node = EnvironmentMappingNode.Create( this.skybox.SkyboxTexture, model, ObjVNF.strPosition, ObjVNF.strNormal); node.ModelSize = model.GetSize(); float max = node.ModelSize.max(); node.Scale *= 20.0f / max; node.Children.Add(new LegacyBoundingBoxNode(node.ModelSize)); this.environmentMappingNode = node; var group = new GroupNode(this.environmentMappingNode, this.skybox); this.scene = new Scene(camera) { RootNode = group, }; var list = new ActionList(); var transformAction = new TransformAction(scene.RootNode); list.Add(transformAction); var renderAction = new RenderAction(scene); list.Add(renderAction); this.actionList = list; var manipulater = new FirstPerspectiveManipulater(); manipulater.Bind(camera, this.winGLCanvas1); this.pickingAction = new Picking(scene); this.triangleTip = new LegacyTriangleNode(); this.quadTip = new LegacyQuadNode(); } }
/// <summary> /// This rule looks for InsufficientHeight layout problems, and attempts /// to fix them by splitting controls onto multiple tabbed panels. /// </summary> /// <param name="problem">the layout problem to fix</param> /// <param name="node">the root of the interface tree</param> /// <param name="ui">the UIGenerator object, which contains global variables to the layout process</param> public override InterfaceNode Process(LayoutProblem problem, InterfaceNode root, UIGenerator ui) { if (problem is InsufficientHeight) { InsufficientHeight prob = (InsufficientHeight)problem; // we will use tabs if the group associated with this panel // has only BranchGroupNodes as children, and each of those // groups has labels // Step #1: check if the above criteria are true if (prob.Panel.Group is BranchGroupNode) { BranchGroupNode bg = (BranchGroupNode)prob.Panel.Group; if (!bg.ContainsOnlyGroups()) { return(root); } while (bg.Count == 1) { bg = (BranchGroupNode)bg.Children[0]; if (!bg.ContainsOnlyGroups()) { return(root); } } IEnumerator e = bg.Children.GetEnumerator(); while (e.MoveNext()) { if (((GroupNode)e.Current).Labels == null) { return(root); } } // If we get here, all of the criteria have been met. // Now we insert our tabbed panel. TabbedOverlappingPanelsNode tabs = new TabbedOverlappingPanelsNode(bg); prob.Panel.Container.GetControl().Controls.Remove(prob.Panel.GetContainerCIO().GetControl()); if (prob.Panel.GetParent() != null) { prob.Panel.GetParent().AddPanel(tabs); prob.Panel.GetParent().RemovePanel(prob.Panel); } else { root = tabs; } // now we need to distribute the rows from the panel into the new tabbed panels IEnumerator row = prob.Panel.Rows.GetEnumerator(); while (row.MoveNext()) { Row r = (Row)row.Current; GroupNode g = r.Group; while (tabs[g] == null) { g = g.Parent; } ((PanelNode)tabs[g].GetChildNode()).AddRow(r); } // finally, add the components and the do the layout for the tabs tabs.SetLocation(prob.Panel.GetBounds().X, prob.Panel.GetBounds().Y); tabs.SetSize(prob.Panel.GetBounds().Width, prob.Panel.GetBounds().Height); tabs.AddComponents(prob.Panel.Container, ui.LayoutVars); tabs.DoLayout(ui.LayoutVars); } } return(root); }
internal AdjacencyNode(GroupNode to, E edge, AdjacencyNode prev) : this(to, edge) { prev.next = this; }
/* * Process Method */ public override void Process(GroupNode g, UIGenerator ui) { // look for MutualExclusionDecisions object o = g.Decorations[MutualExclusionDecision.DECISION_KEY]; if (o != null && o is MutualExclusionDecision) { MutualExclusionDecision d = (MutualExclusionDecision)o; if (!d.Handled) { // this will never occur on an ObjectGroupNode BranchGroupNode bg = (BranchGroupNode)g; // we need a pointer to the GroupNode that contains the state // variable that we are looking at (because tree manipulations // will need to use it) ObjectGroupNode stateGroup = null; IEnumerator e = bg.Children.GetEnumerator(); while (e.MoveNext()) { if (((GroupNode)e.Current).IsObject() && ((ObjectGroupNode)e.Current).Object == d.State) { stateGroup = (ObjectGroupNode)e.Current; break; } } // re-order the tree ArrayList childOrder = new ArrayList(); bg.Children.Remove(stateGroup); BranchGroupNode midG = new BranchGroupNode(); midG.Children = bg.Children; e = midG.Children.GetEnumerator(); while (e.MoveNext()) { ((GroupNode)e.Current).Parent = midG; } bg.Children = new ArrayList(); ArrayList dset = (ArrayList)d.ChildSets[0]; if (dset.Count > 0) { e = dset.GetEnumerator(); while (e.MoveNext()) { GroupNode c = (GroupNode)e.Current; c.Parent = bg; midG.Children.Remove(c); bg.Children.Add(c); } } bg.Children.Add(stateGroup); bg.Children.Add(midG); midG.Parent = bg; stateGroup.Parent = bg; for (int i = 1; i < d.ChildSets.Count; i++) { dset = (ArrayList)d.ChildSets[i]; if (dset.Count > 1) { BranchGroupNode newG = new BranchGroupNode(); newG.Parent = midG; e = dset.GetEnumerator(); while (e.MoveNext()) { GroupNode c = (GroupNode)e.Current; c.Parent = newG; midG.Children.Remove(c); newG.Children.Add(c); } childOrder.Insert(i - 1, newG); } else if (dset.Count == 0) { BranchGroupNode newG = new BranchGroupNode(); newG.Parent = midG; newG.Children = new ArrayList(); midG.Children.Add(newG); childOrder.Insert(i - 1, newG); } else { childOrder.Insert(i - 1, dset[0]); } } d.DependencySets.RemoveAt(0); OrganizationDecision newDecision = new ExternalOverlapOrgDecision(d, d.State, childOrder, d.DependencySets); midG.Decorations.Add(OrganizationDecision.DECISION_KEY, newDecision); d.Handled = true; } } }
private GroupNode AddGroupNode(Group g) { GroupNode gn = null; if (this.Client.SupportNestedGroups) { String[] groups = g.GroupName.Split(new String[] { this.Client.NestedGroupDelimiter }, StringSplitOptions.RemoveEmptyEntries); IEnumerable<String> nestedGroupList = this.ConstructNestedGroupList(groups); String parent = null; Int32 baseNameCounter = 0; foreach (String nestedGroup in nestedGroupList) { gn = m_groups[nestedGroup] as GroupNode; if (gn == null) { gn = new GroupNode(groups[baseNameCounter]); m_groups.Add(nestedGroup, gn); if (!String.IsNullOrEmpty(parent)) { TreeNode tn = this.FindTreeNode(this.Nodes, parent); tn.Nodes.Add(gn); } else this.Nodes.Add(gn); } parent = nestedGroup; baseNameCounter++; } } else { gn = m_groups[g.GroupName] as GroupNode; if (gn == null) { gn = new GroupNode(g.GroupName); m_groups.Add(g.GroupName, gn); this.Nodes.Add(gn); } } return gn; }
public LengthOperation(GroupNode node) { AddInput(node); }
public IGroupNode CreateGroupNode(string name, string groupType, object groupData) { IGroupNode newGroupNode = new GroupNode(name); return newGroupNode; }
private void FormMain_Load(object sender, EventArgs e) { var position = new vec3(9.3968f, -0.7408f, 2.9288f); var center = new vec3(-0.0710f, -2.2829f, 1.3023f); var up = new vec3(0, 1, 0); var camera = new Camera(position, center, up, CameraType.Perspective, this.winGLCanvas1.Width, this.winGLCanvas1.Height); this.scene = new Scene(camera); var rootNode = new GroupNode(); this.scene.RootNode = rootNode; Texture texBRDF = LoadBRDFTexture(); texBRDF.TextureUnitIndex = 2; Texture prefilterMap = LoadPrefilterMap(); prefilterMap.TextureUnitIndex = 1; Texture irradianceMap = LoadIrradianceMap(); irradianceMap.TextureUnitIndex = 0; Texture envCubemap = LoadEnvCubeMap(); Texture texHDR = LoadHDRTexture("environment.hdr"); { var node = CubemapNode.Create(envCubemap, texHDR); rootNode.Children.Add(node); } { var node = IrradianceNode.Create(irradianceMap, envCubemap); rootNode.Children.Add(node); } { var node = PrefilterNode.Create(prefilterMap, envCubemap); rootNode.Children.Add(node); } { var node = BRDFNode.Create(texBRDF); rootNode.Children.Add(node); } { var textureGroups = new string[] { "cerberus", "cerberus", "gold", "grass", "plastic", "rock", "rusted_iron", "wall", "wood" }; var models = new ObjVNF[textureGroups.Length]; { var filename = Path.Combine(System.Windows.Forms.Application.StartupPath, "cerberus.obj_"); var parser = new ObjVNFParser(false, false); ObjVNFResult result = parser.Parse(filename); if (result.Error != null) { MessageBox.Show(string.Format("Error: {0}", result.Error)); return; } ObjVNFMesh mesh = result.Mesh; // scale it to 0.1 percent. for (int i = 0; i < mesh.vertexes.Length; i++) { mesh.vertexes[i] = mesh.vertexes[i] / 10; } //// Dump texture coordinates' layout. //{ // vec2[] texCoords = mesh.texCoords; // int polygon = (mesh.faces[0] is ObjVNFTriangle) ? 3 : 4; // int index = 0; // var indices = new uint[polygon * mesh.faces.Length]; // foreach (var face in mesh.faces) { // foreach (var vertexIndex in face.VertexIndexes()) { // indices[index++] = vertexIndex; // } // } // var bmp = TexCoordAnalyzer.DumpLines(texCoords, indices, 1024); // bmp.Save("cerberus.texCoords.png"); //} var model = new ObjVNF(mesh); models[0] = model; } { var sphere = new Sphere2();//(1, 40, 80); var filename = Path.Combine(System.Windows.Forms.Application.StartupPath, "sphere2.obj_"); sphere.DumpObjFile(filename, "sphere2"); var parser = new ObjVNFParser(false, true); ObjVNFResult result = parser.Parse(filename); if (result.Error != null) { MessageBox.Show(string.Format("Error: {0}", result.Error)); return; } ObjVNFMesh mesh = result.Mesh; var model = new ObjVNF(mesh); for (int i = 1; i < textureGroups.Length; i++) { models[i] = model; } } for (int i = 0; i < textureGroups.Length; i++) { ObjVNF model = models[i]; string group = textureGroups[i]; var node = PBRNode.Create(model, model.GetSize(), ObjVNF.strPosition, ObjVNF.strTexCoord, ObjVNF.strNormal); node.IrradianceMap = irradianceMap; node.PrefilterMap = prefilterMap; node.texBRDF = texBRDF; Texture albedo = GetTexture(string.Format(@"Textures\{0}\albedo.png", group), 3); node.AlbedoMap = albedo; Texture ao = GetTexture(string.Format(@"Textures\{0}\ao.png", group), 4); node.AOMap = ao; Texture metallic = GetTexture(string.Format(@"Textures\{0}\metallic.png", group), 5); node.MetallicMap = metallic; Texture normal = GetTexture(string.Format(@"Textures\{0}\normal.png", group), 6); node.NormalMap = normal; Texture roughness = GetTexture(string.Format(@"Textures\{0}\roughness.png", group), 7); node.RoughnessMap = roughness; if (i == 0) { node.WorldPosition = new vec3(0, -5, 0); } else { node.WorldPosition = new vec3( 0.0f, 0.0f, ((textureGroups.Length / 2.0f) - i) * spacing); } rootNode.Children.Add(node); } } { var backgroundNode = BackgroundNode.Create(envCubemap); rootNode.Children.Add(backgroundNode); } var list = new ActionList(); var transformAction = new TransformAction(scene); list.Add(transformAction); var renderAction = new RenderAction(scene); list.Add(renderAction); this.actionList = list; var manipulater = new FirstPerspectiveManipulater(); manipulater.Bind(camera, this.winGLCanvas1); }
public static void DrawUI(int width, int height, ref ViewportOptions options, GroupNode rootNode) { ImGui.SetNextWindowPos(System.Numerics.Vector2.Zero); ImGui.SetNextWindowSize(new System.Numerics.Vector2(250, 350)); bool opened = true; ImGui.Begin("Model Loader Window", ref opened, ImGuiWindowFlags.MenuBar | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoCollapse); if (ImGui.BeginMenuBar()) { if (ImGui.BeginMenu("Load Model", !loading)) { if (ImGui.MenuItem("Open")) { LoadModel(rootNode, options.ShowEnvironmentMap); } ImGui.EndMenu(); } if (ImGui.BeginMenu("Options")) { ImGui.Checkbox("Dir Light Follow Camera", ref options.DirectionalLightFollowCamera); ImGui.SliderFloat("Dir Light Intensity", ref options.DirectionLightIntensity, 0, 1, "", ImGuiSliderFlags.AlwaysClamp); ImGui.SliderFloat("Ambient Light Intensity", ref options.AmbientLightIntensity, 0, 1, "", ImGuiSliderFlags.AlwaysClamp); ImGui.Separator(); ImGui.Checkbox("Show EnvironmentMap", ref options.ShowEnvironmentMap); ImGui.Checkbox("Enable SSAO", ref options.EnableSSAO); ImGui.Checkbox("Enable FXAA", ref options.EnableFXAA); ImGui.Checkbox("Enable Frustum", ref options.EnableFrustum); ImGui.Checkbox("Enable DpiScale", ref options.EnableDpiScale); if (ImGui.Checkbox("Show Wireframe", ref options.ShowWireframe)) { options.ShowWireframeChanged = true; } ImGui.Separator(); ImGui.ColorPicker3("Background Color", ref options.BackgroundColor); ImGui.EndMenu(); } if (!showImGuiDemo && ImGui.BeginMenu("ImGui Demo")) { if (ImGui.MenuItem("Show")) { showImGuiDemo = true; } ImGui.EndMenu(); } ImGui.EndMenuBar(); } if (ImGui.CollapsingHeader("Mouse Gestures", ImGuiTreeNodeFlags.DefaultOpen)) { ImGui.Text("Mouse Right: Rotate"); ImGui.Text("Mouse Middle: Pan"); ImGui.Separator(); if (!string.IsNullOrEmpty(SomeTextFromOutside)) { ImGui.Text(SomeTextFromOutside); } } ImGui.Separator(); ImGui.Text("FPS"); ImGui.PlotLines("", ref fps[0], fps.Length, 0, $"{fps[currFPSIndex]}", 30, 70, new System.Numerics.Vector2(200, 50)); ImGui.Text("Rendering Latency Ms"); ImGui.PlotLines("", ref latency[0], latency.Length, 0, $"{latency[currFPSIndex]}ms", 0, 5, new System.Numerics.Vector2(200, 50)); fps[currFPSIndex] = 1000f / (float)options.Viewport.RenderHost.RenderStatistics.LatencyStatistics.AverageValue; latency[currFPSIndex] = (float)options.Viewport.RenderHost.RenderStatistics.LatencyStatistics.AverageValue; frustumTest[currFPSIndex] = (float)options.Viewport.RenderHost.RenderStatistics.FrustumTestTime * 1000; ImGui.Text("Frustum Test Ms"); ImGui.PlotLines("", ref frustumTest[0], frustumTest.Length, 0, $"{frustumTest[currFPSIndex]}ms", 0, 5, new System.Numerics.Vector2(200, 50)); currFPSIndex = (currFPSIndex + 1) % frameDataLength; if (!loading && ImGui.CollapsingHeader("Scene Graph", ImGuiTreeNodeFlags.DefaultOpen)) { DrawSceneGraph(rootNode); } if (!loading && scene != null && scene.Animations != null) { DrawAnimations(ref options); } if (!loading && !string.IsNullOrEmpty(exception)) { ImGui.Separator(); ImGui.Text(exception); } if (loading) { ImGui.Text($"Loading: {modelName}"); var progress = ((float)(Stopwatch.GetTimestamp() - currentTime) / Stopwatch.Frequency) * 100 % 100; ImGui.ProgressBar(progress / 100, new System.Numerics.Vector2(width, 20), ""); } ImGui.End(); if (showImGuiDemo) { opened = false; ImGui.ShowDemoWindow(ref showImGuiDemo); } }
public UGUINode DrawLayer(GroupNode layer, UGUINode parent) { UGUINode node = layerImporterDic[layer.groupType].DrawLayer(layer, parent); return(node); }