Render() public method

Occurs before this object and all of its children's rendering. Occurs before this object and all of its children's rendering.
public Render ( RenderEventArgs arg ) : void
arg RenderEventArgs
return void
Esempio n. 1
0
 private void RenderObject(SceneObject sceneObject, RenderEventArgs arg)
 {
     sceneObject.Render(arg);
     SceneObject[] array = sceneObject.Children.ToArray();
     foreach (var child in array)
     {
         RenderObject(child, arg);
     }
 }
Esempio n. 2
0
        private void RenderPickableObject(SceneObject sceneObject, RenderEventArgs arg, ref uint renderedVertexCount, List <IColorCodedPicking> pickedRendererList)
        {
            if ((sceneObject == null) || (!sceneObject.Enabled))
            {
                return;
            }

            // global switches on.
            GLSwitch[] switchArray = sceneObject.GroupSwitchList.ToArray();
            for (int i = 0; i < switchArray.Length; i++)
            {
                switchArray[i].On();
            }
            // render self.
            var pickable = sceneObject.Renderer as IColorCodedPicking;

            if ((pickable != null) && (sceneObject.Renderer.Enabled))
            {
                pickable.PickingBaseId = renderedVertexCount;
                sceneObject.Render(arg);
                uint rendered = renderedVertexCount + pickable.GetVertexCount();
                if (renderedVertexCount <= rendered)
                {
                    renderedVertexCount = rendered;
                }
                else
                {
                    throw new Exception(string.Format(
                                            "Too many geometries({0} + {1} > {2}) for color coded picking.",
                                            renderedVertexCount, pickable.GetVertexCount(), uint.MaxValue));
                }

                pickedRendererList.Add(pickable);
            }
            // render children.
            {
                SceneObject[] array = sceneObject.Children.ToArray();
                foreach (SceneObject child in array)
                {
                    RenderPickableObject(child, arg, ref renderedVertexCount, pickedRendererList);
                }
            }
            // global switches off.
            for (int i = switchArray.Length - 1; i >= 0; i--)
            {
                switchArray[i].Off();
            }
        }
Esempio n. 3
0
 /// <summary>
 /// render object recursively.
 /// </summary>
 /// <param name="sceneObject"></param>
 /// <param name="arg"></param>
 private void RenderObject(SceneObject sceneObject, RenderEventArgs arg)
 {
     if (sceneObject.RenderingEnabled)
     {
         //sceneObject.DoBeforeRendering();
         GLState[] switchArray = sceneObject.GroupStateList.ToArray();
         for (int i = 0; i < switchArray.Length; i++)
         {
             switchArray[i].On();
         }
         sceneObject.Render(arg);
         ITreeNode[] array = sceneObject.Children.ToArray();
         foreach (ITreeNode child in array)
         {
             RenderObject(child as SceneObject, arg);
         }
         //sceneObject.DoAfterRendering();
         for (int i = switchArray.Length - 1; i >= 0; i--)
         {
             switchArray[i].Off();
         }
     }
 }