コード例 #1
0
        /// <summary>
        /// Fills node Content property tree.
        /// </summary>
        private void loadContent(ObjectGraphNode thisNode)
        {
            var contentRoot = new ThisNode();

            thisNode.Content = contentRoot;

            // Object graph visualizer: collection support temp disabled (porting to new NRefactory).

            /*DebugType collectionType;
             * DebugType itemType;
             * if (thisNode.PermanentReference.Type.ResolveIListImplementation(out collectionType, out itemType))
             * {
             *      //AddRawViewNode(contentRoot, thisNode);
             *      // it is an IList
             *      LoadNodeCollectionContent(contentRoot, thisNode.Expression, collectionType);
             * } else if (thisNode.PermanentReference.Type.ResolveIEnumerableImplementation(out collectionType, out itemType)) {
             *      //AddRawViewNode(contentRoot, thisNode);
             *      // it is an IEnumerable
             *      DebugType debugListType;
             *      var debugListExpression = new GraphExpression(
             *              DebuggerHelpers.CreateDebugListExpression(thisNode.Expression.Expr, itemType, out debugListType),
             *              () => DebuggerHelpers.CreateListFromIEnumerable(thisNode.Expression.GetValue())
             *      );
             *      LoadNodeCollectionContent(contentRoot, debugListExpression, debugListType);
             * } else*/{
                // it is an object
                LoadNodeObjectContent(contentRoot, thisNode.Expression, thisNode.PermanentReference.Type);
            }
        }
コード例 #2
0
            public ThisNode AddChild(string name)
            {
                ThisNode child = new ThisNode(name);

                children.Add(child);
                return(this);
            }
コード例 #3
0
ファイル: Program.cs プロジェクト: wiwing/ROS.NET
        static void Main(string[] args)
        {
            IDictionary <string, string> remappings;

            RemappingHelper.GetRemappings(ref args, out remappings);
            Network.Init(remappings);
            Master.Init(remappings);
            ThisNode.Init("", remappings, InitOptions.AnonymousName | InitOptions.NoRousout);
            Param.Init(remappings);
            //ROS.Init(args, "");
            new Program(args).result();

            // Demo how to get/set parameters directly
            Param.Set("/test/string", "Hello");
            Param.Set("/test/number", 42);
            string result;

            if (Param.Get("/test/string", out result))
            {
                Console.WriteLine($"Got {result}");
            }
            else
            {
                Console.WriteLine("Haven't got any value for /test/string");
            }
        }
コード例 #4
0
        public override string ToString()
        {
            var sources = string.Join(", ", SourceNodes.Select(x => x.GetType().Name));
            var targets = string.Join(", ", TargetNodes.Select(x => x.GetType().Name));

            return($"{ThisNode.GetType().Name}, Builder='{Builder.Name}', Sources=[{sources}], Targets=[{targets}]");
        }
コード例 #5
0
        /// <summary>
        /// Fills node Content property tree.
        /// </summary>
        /// <param name="thisNode"></param>
        private void loadContent(ObjectGraphNode thisNode)
        {
            var contentRoot = new ThisNode();

            thisNode.Content = contentRoot;

            DebugType collectionType;
            DebugType itemType;

            if (thisNode.PermanentReference.Type.ResolveIListImplementation(out collectionType, out itemType))
            {
                //AddRawViewNode(contentRoot, thisNode);
                // it is an IList
                LoadNodeCollectionContent(contentRoot, thisNode.Expression, collectionType);
            }
            else if (thisNode.PermanentReference.Type.ResolveIEnumerableImplementation(out collectionType, out itemType))
            {
                //AddRawViewNode(contentRoot, thisNode);
                // it is an IEnumerable
                DebugType debugListType;
                var       debugListExpression = DebuggerHelpers.CreateDebugListExpression(thisNode.Expression, itemType, out debugListType);
                LoadNodeCollectionContent(contentRoot, debugListExpression, debugListType);
            }
            else
            {
                // it is an object
                LoadNodeObjectContent(contentRoot, thisNode.Expression, thisNode.PermanentReference.Type);
            }
        }
コード例 #6
0
ファイル: CodeGenerator.cs プロジェクト: tbyrresen/Deslang
 public object Visit(ThisNode n, object o)
 {
     if (n.Member is null)
     {
         Append("this");
     }
     else
     {
         Append("this.");
         n.Member.Accept(this, null);
     }
     return(null);
 }
コード例 #7
0
        private ThisExpressionNode ThisReference()
        {
            ThisExpressionNode itsAST;
            SourceCodePosition itsPos  = _currentToken.SourcePosition;
            ThisNode           itsThis = new ThisNode(itsPos);

            itsAST = new ThisExpressionNode(itsThis, itsPos);
            Accept(Token.TokenType.This);
            if (_currentToken.Type == Token.TokenType.Dot)
            {
                Accept(Token.TokenType.Dot);
                itsThis = new ThisNode(MemberReference(), itsPos);
                itsAST  = new ThisExpressionNode(itsThis, itsPos);
            }
            return(itsAST);
        }
コード例 #8
0
        internal virtual MethodInterfaceData CreateMethodInterfaceDataForNonAnalyzableMethod(MethodDescriptor methodDescriptor)
        {
            Contract.Assert(methodDescriptor != null);

            ReturnNode            retVar  = null;
            VariableNode          thisRef = null;
            IList <ParameterNode> parameters;

            var inputs  = new Dictionary <string, PropGraphNodeDescriptor>();
            var outputs = new Dictionary <string, PropGraphNodeDescriptor>();

            if (methodDescriptor.ReturnType != null && Utils.IsTypeForAnalysis(methodDescriptor.ReturnType))
            {
                retVar            = new ReturnNode(methodDescriptor.ReturnType);
                outputs["retVar"] = retVar;
            }
            if (!methodDescriptor.IsStatic)
            {
                thisRef = new ThisNode(methodDescriptor.ThisType);
            }
            parameters = new List <ParameterNode>();
            if (methodDescriptor.Parameters != null)
            {
                for (int i = 0; i < methodDescriptor.Parameters.Count(); i++)
                {
                    var parameterName = "P_" + i;
                    var parameterNode = new ParameterNode(parameterName, i, methodDescriptor.Parameters[i].Type);
                    parameters.Add(parameterNode);
                    //if (p.RefKind == RefKind.Ref || p.RefKind == RefKind.Out)
                    {
                        outputs[parameterName] = parameterNode;
                    }
                    inputs[parameterName] = parameterNode;
                }
            }

            var methodInterfaceData = new MethodInterfaceData()
            {
                ReturnVariable = retVar,
                ThisRef        = thisRef,
                Parameters     = parameters,
                InputData      = inputs,
                OutputData     = outputs
            };

            return(methodInterfaceData);
        }
コード例 #9
0
        /// <summary>
        /// Fills node Content property tree.
        /// </summary>
        /// <param name="thisNode"></param>
        private void loadContent(ObjectGraphNode thisNode)
        {
            thisNode.Content = new ThisNode();
            ThisNode contentRoot = thisNode.Content;

            DebugType iListType;
            DebugType listItemType;

            if (thisNode.PermanentReference.Type.ResolveIListImplementation(out iListType, out listItemType))
            {
                // it is a collection
                loadNodeCollectionContent(contentRoot, thisNode.Expression, iListType);
            }
            else
            {
                // it is an object
                loadNodeObjectContent(contentRoot, thisNode.Expression, thisNode.PermanentReference.Type);
            }
        }
コード例 #10
0
        /// <summary>
        /// Generates analysis values for the method signature
        /// In particular, the nodes for the propagation graph for parameters, retvalue y "this"
        /// </summary>
        /// <param name="symbol"></param>
        /// <returns></returns>
        internal virtual MethodInterfaceData CreateMethodInterfaceData(IMethodSymbol methodSymbol)
        {
            Contract.Assert(methodSymbol != null);

            ReturnNode            retVar  = null;
            VariableNode          thisRef = null;
            IList <ParameterNode> parameters;
            var inputs  = new Dictionary <string, PropGraphNodeDescriptor>();
            var outputs = new Dictionary <string, PropGraphNodeDescriptor>();

            if (!methodSymbol.ReturnsVoid && Utils.IsTypeForAnalysis(methodSymbol.ReturnType))
            {
                retVar            = new ReturnNode(Utils.CreateTypeDescriptor(methodSymbol.ReturnType));
                outputs["retVar"] = retVar;
            }
            if (!methodSymbol.IsStatic)
            {
                thisRef = new ThisNode(Utils.CreateTypeDescriptor(methodSymbol.ReceiverType));
            }
            parameters = new List <ParameterNode>();
            for (int i = 0; i < methodSymbol.Parameters.Count(); i++)
            {
                var p             = methodSymbol.Parameters[i];
                var parameterNode = new ParameterNode(methodSymbol.Parameters[i].Name, i, Utils.CreateTypeDescriptor(p.Type));
                parameters.Add(parameterNode);
                if (p.RefKind == RefKind.Ref || p.RefKind == RefKind.Out)
                {
                    outputs[p.Name] = parameterNode;
                }
                inputs[p.Name] = parameterNode;
            }

            var methodInterfaceData = new MethodInterfaceData()
            {
                ReturnVariable = retVar,
                ThisRef        = thisRef,
                Parameters     = parameters,
                InputData      = inputs,
                OutputData     = outputs
            };

            return(methodInterfaceData);
        }
コード例 #11
0
 public object Visit(ThisNode n, object o)
 {
     return(null);
 }
コード例 #12
0
		/// <summary>
		/// Fills node Content property tree.
		/// </summary>
		private void loadContent(ObjectGraphNode thisNode)
		{
			var contentRoot = new ThisNode();
			thisNode.Content = contentRoot;
			
			// Object graph visualizer: collection support temp disabled (porting to new NRefactory).
			/*DebugType collectionType;
			DebugType itemType;
			if (thisNode.PermanentReference.Type.ResolveIListImplementation(out collectionType, out itemType))
			{
				//AddRawViewNode(contentRoot, thisNode);
				// it is an IList
				LoadNodeCollectionContent(contentRoot, thisNode.Expression, collectionType);
			} else if (thisNode.PermanentReference.Type.ResolveIEnumerableImplementation(out collectionType, out itemType)) {
				//AddRawViewNode(contentRoot, thisNode);
				// it is an IEnumerable
				DebugType debugListType;
				var debugListExpression = new GraphExpression(
					DebuggerHelpers.CreateDebugListExpression(thisNode.Expression.Expr, itemType, out debugListType),
					() => DebuggerHelpers.CreateListFromIEnumerable(thisNode.Expression.GetValue())
				);
				LoadNodeCollectionContent(contentRoot, debugListExpression, debugListType);
			} else*/ {
				// it is an object
				LoadNodeObjectContent(contentRoot, thisNode.Expression, thisNode.PermanentReference.Type);
			}
		}
コード例 #13
0
 public ThisExpressionNode(ThisNode thisNode, SourceCodePosition pos)
     : base(thisNode, pos)
 {
     This = thisNode;
 }
コード例 #14
0
		/// <summary>
		/// Fills node Content property tree.
		/// </summary>
		/// <param name="thisNode"></param>
		private void loadContent(ObjectGraphNode thisNode)
		{
			var contentRoot = new ThisNode();
			thisNode.Content = contentRoot;
			
			DebugType collectionType;
			DebugType itemType;
			if (thisNode.PermanentReference.Type.ResolveIListImplementation(out collectionType, out itemType))
			{
				//AddRawViewNode(contentRoot, thisNode);
				// it is an IList
				LoadNodeCollectionContent(contentRoot, thisNode.Expression, collectionType);
			} else if (thisNode.PermanentReference.Type.ResolveIEnumerableImplementation(out collectionType, out itemType)) {
				//AddRawViewNode(contentRoot, thisNode);
				// it is an IEnumerable
				DebugType debugListType;
				var debugListExpression = DebuggerHelpers.CreateDebugListExpression(thisNode.Expression, itemType, out debugListType);
				LoadNodeCollectionContent(contentRoot, debugListExpression, debugListType);
			} else {
				// it is an object
				LoadNodeObjectContent(contentRoot, thisNode.Expression, thisNode.PermanentReference.Type);
			}
		}
コード例 #15
0
        private void Render(object sender, PaintEventArgs e)
        {
            if (!ReadyToRender)
            {
                return;
            }

            glViewport.MakeCurrent();

            GL.LoadIdentity();
            GL.Viewport(glViewport.ClientRectangle);

            // Push all attributes so we don't have to clean up later
            GL.PushAttrib(AttribMask.AllAttribBits);
            // clear the gf buffer
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);

            // use fixed function pipeline for drawing background and floor grid
            GL.UseProgram(0);

            if (MeshList.treeView1.SelectedNode != null)
            {
                if (MeshList.treeView1.SelectedNode is BCH_Texture)
                {
                    GL.PopAttrib();
                    BCH_Texture tex = ((BCH_Texture)MeshList.treeView1.SelectedNode);
                    RenderTools.DrawTexturedQuad(tex.display, tex.Width, tex.Height, true, true, true, true, false, true);
                    glViewport.SwapBuffers();
                    return;
                }
                if (MeshList.treeView1.SelectedNode is NUT_Texture)
                {
                    GL.PopAttrib();
                    NUT_Texture tex = ((NUT_Texture)MeshList.treeView1.SelectedNode);
                    RenderTools.DrawTexturedQuad(((NUT)tex.Parent).draw[tex.HASHID], tex.Width, tex.Height, true, true, true, true, false, true);
                    glViewport.SwapBuffers();
                    return;
                }
            }

            if (Runtime.renderBackGround)
            {
                // background uses different matrices
                GL.MatrixMode(MatrixMode.Modelview);
                GL.LoadIdentity();
                GL.MatrixMode(MatrixMode.Projection);
                GL.LoadIdentity();

                RenderTools.RenderBackground();
            }

            // Camera Update
            // -------------------------------------------------------------
            GL.MatrixMode(MatrixMode.Projection);
            if (glViewport.ClientRectangle.Contains(glViewport.PointToClient(Cursor.Position)) &&
                glViewport.Focused &&
                CurrentMode == Mode.Normal &&
                !TransformTool.hit)
            {
                Camera.Update();
                //if (cameraPosForm != null && !cameraPosForm.IsDisposed)
                //    cameraPosForm.updatePosition();
            }
            try
            {
                if (OpenTK.Input.Mouse.GetState() != null)
                {
                    Camera.mouseSLast = OpenTK.Input.Mouse.GetState().WheelPrecise;
                }
            } catch
            {
            }

            Matrix4 matrix = Camera.getMVPMatrix();

            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadMatrix(ref matrix);

            // Floor
            // -------------------------------------------------------------
            if (Runtime.renderFloor)
            {
                RenderTools.drawFloor();
            }

            // Shadows
            // -------------------------------------------------------------
            if (Runtime.drawModelShadow)
            {
                CalculateLightSource();
                // update light matrix and setup shadowmap rendering
                GL.MatrixMode(MatrixMode.Modelview);
                GL.LoadMatrix(ref lightMatrix);
                GL.Enable(EnableCap.DepthTest);
                GL.Viewport(0, 0, sw, sh);
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, sfb);

                foreach (ModelContainer m in draw)
                {
                    m.RenderShadow(Camera, 0, Matrix4.Zero, Camera.getMVPMatrix());
                }

                // reset matrices and viewport for model rendering again
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
                GL.LoadMatrix(ref matrix);
                GL.Viewport(glViewport.ClientRectangle);
            }

            // render models into hdr buffer
            // -------------------------------------------------------------
            if (Runtime.useDepthTest)
            {
                GL.Enable(EnableCap.DepthTest);
                GL.DepthFunc(DepthFunction.Lequal);
            }

            else
            {
                GL.Disable(EnableCap.DepthTest);
            }

            GL.Enable(EnableCap.DepthTest);

            // Models
            // -------------------------------------------------------------
            //frameTime.Start();
            if (Runtime.renderModel || Runtime.renderModelWireframe)
            {
                foreach (TreeNode m in draw)
                {
                    if (m is ModelContainer)
                    {
                        ((ModelContainer)m).Render(Camera, 0, Matrix4.Zero, Camera.getMVPMatrix());
                    }
                }
            }

            if (ViewComboBox.SelectedIndex == 1)
            {
                foreach (TreeNode m in draw)
                {
                    if (m is ModelContainer)
                    {
                        ((ModelContainer)m).RenderPoints(Camera);
                    }
                }
            }


            //GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);

            /*// render gaussian blur stuff
             * if (Runtime.drawQuadBlur)
             *  DrawQuadBlur();
             *
             * // render full screen quad for post processing
             * if (Runtime.drawQuadFinalOutput)
             *  DrawQuadFinalOutput();*/

            // use fixed function pipeline again for area lights, lvd, bones, hitboxes, etc
            SetupFixedFunctionRendering();

            /*// draw path.bin
             * if (Runtime.renderPath)
             *  DrawPathDisplay();
             *
             * // area light bounding boxes should intersect stage geometry and not render on top
             * if (Runtime.drawAreaLightBoundingBoxes)
             *  DrawAreaLightBoundingBoxes();*/

            // clear depth buffer so stuff will render on top of the models
            GL.Clear(ClearBufferMask.DepthBufferBit);

            if (Runtime.renderLVD)
            {
                _lvd.Render();
            }

            if (Runtime.renderBones)
            {
                foreach (ModelContainer m in draw)
                {
                    m.RenderBones();
                }
            }


            // ACMD
            if (ParamManager != null && Runtime.renderHurtboxes && draw.Count > 0 && (draw[0] is ModelContainer))
            {
                ParamManager.RenderHurtboxes(Frame, scriptId, ACMDScript, ((ModelContainer)draw[0]).GetVBN());
            }

            if (ACMDScript != null && draw.Count > 0 && (draw[0] is ModelContainer))
            {
                ACMDScript.Render(((ModelContainer)draw[0]).GetVBN());
            }
            //Debug.WriteLine(frameTime.getAverageRenderTime());



            // Bone Transform Tool
            if (ViewComboBox.SelectedIndex == 2)
            {
                if (modeBone.Checked)
                {
                    TransformTool.Render(Camera, new Ray(Camera, glViewport));
                    if (TransformTool.state == 1)
                    {
                        CurrentMode = Mode.Selection;
                    }
                    else
                    {
                        CurrentMode = Mode.Normal;
                    }
                }

                if (TransformTool.HasChanged())
                {
                    if (Animation != null && TransformTool.b != null)
                    {
                        // get the node group for the current bone in animation
                        Animation.KeyNode ThisNode = null;
                        foreach (Animation.KeyNode node in Animation.Bones)
                        {
                            if (node.Text.Equals(TransformTool.b.Text))
                            {
                                // found
                                ThisNode = node;
                                break;
                            }
                        }
                        if (ThisNode == null)
                        {
                            ThisNode = new Animation.KeyNode(TransformTool.b.Text);
                            Animation.Bones.Add(ThisNode);
                        }

                        // update or add the key frame
                        ThisNode.SetKeyFromBone((float)currentFrame.Value, TransformTool.b);
                    }
                }
            }


            // Mouse selection
            // -------------------------------------------------------------
            if (ViewComboBox.SelectedIndex == 1)
            {
                try
                {
                    if (CurrentMode == Mode.Normal && OpenTK.Input.Mouse.GetState().IsButtonDown(OpenTK.Input.MouseButton.Right))
                    {
                        CurrentMode = Mode.Selection;
                        Vector2 m = GetMouseOnViewport();
                        sx1 = m.X;
                        sy1 = m.Y;
                    }
                }
                catch
                {
                }
                if (CurrentMode == Mode.Selection)
                {
                    if (!OpenTK.Input.Mouse.GetState().IsButtonDown(OpenTK.Input.MouseButton.Right))
                    {
                        checkSelect();
                        CurrentMode = Mode.Normal;
                    }

                    GL.MatrixMode(MatrixMode.Modelview);
                    GL.PushMatrix();
                    GL.LoadIdentity();

                    Vector2 m = GetMouseOnViewport();
                    GL.Color3(Color.Black);
                    GL.LineWidth(2f);
                    GL.Begin(PrimitiveType.LineLoop);
                    GL.Vertex2(sx1, sy1);
                    GL.Vertex2(m.X, sy1);
                    GL.Vertex2(m.X, m.Y);
                    GL.Vertex2(sx1, m.Y);
                    GL.End();

                    GL.Color3(Color.White);
                    GL.LineWidth(1f);
                    GL.Begin(PrimitiveType.LineLoop);
                    GL.Vertex2(sx1, sy1);
                    GL.Vertex2(m.X, sy1);
                    GL.Vertex2(m.X, m.Y);
                    GL.Vertex2(sx1, m.Y);
                    GL.End();
                    GL.PopMatrix();
                }
            }

            /*if (CurrentMode == Mode.Photoshoot)
             * {
             *  freezeCamera = false;
             *  if (Keyboard.GetState().IsKeyDown(Key.W) && Mouse.GetState().IsButtonDown(MouseButton.Left))
             *  {
             *      shootX = this.PointToClient(Cursor.Position).X;
             *      shootY = this.PointToClient(Cursor.Position).Y;
             *      freezeCamera = true;
             *  }
             *  // Hold on to your pants, boys
             *  RenderTools.DrawPhotoshoot(glViewport, shootX, shootY, shootWidth, shootHeight);
             * }*/

            GL.PopAttrib();
            glViewport.SwapBuffers();
        }