Esempio n. 1
0
 /// <summary>
 /// Render this bounding box.
 /// </summary>
 /// <param name="boundingBox"></param>
 /// <param name="color"></param>
 /// <param name="arg"></param>
 public static void Render(this IBoundingBox boundingBox, Color color, RenderEventArgs arg)
 {
     if (renderer == null)
     {
         var lengths = new vec3(1, 1, 1);
         renderer = BoundingBoxRenderer.Create(lengths);
         renderer.Initialize();
     }
     renderer.WorldPosition    = boundingBox.MaxPosition / 2 + boundingBox.MinPosition / 2;
     renderer.Scale            = boundingBox.MaxPosition - boundingBox.MinPosition;
     renderer.BoundingBoxColor = color;
     renderer.Render(arg);
 }
Esempio n. 2
0
 /// <summary>
 /// Render this bounding box.
 /// </summary>
 /// <param name="boundingBox"></param>
 /// <param name="color"></param>
 /// <param name="arg"></param>
 public static void Render(this IBoundingBox boundingBox, Color color, RenderEventArgs arg)
 {
     if (renderer == null)
     {
         var lengths = new vec3(1, 1, 1);
         renderer = BoundingBoxRenderer.Create(lengths);
         renderer.Initialize();
     }
     renderer.WorldPosition = boundingBox.MaxPosition / 2 + boundingBox.MinPosition / 2;
     renderer.Scale = boundingBox.MaxPosition - boundingBox.MinPosition;
     renderer.BoundingBoxColor = color;
     renderer.Render(arg);
 }
Esempio n. 3
0
        /// <summary>
        /// Render this bounding box.
        /// </summary>
        /// <param name="boundingBox"></param>
        /// <param name="color"></param>
        /// <param name="arg"></param>
        public static void Render(this IBoundingBox boundingBox, Color color, RenderEventArgs arg)
        {
            if (renderer == null)
            {
                var lengths = new vec3(1, 1, 1);
                renderer = BoundingBoxRenderer.Create(lengths);
                renderer.Initialize();
            }
            mat4 model = glm.translate(mat4.identity(), boundingBox.MaxPosition / 2 + boundingBox.MinPosition / 2);

            model = glm.scale(model, boundingBox.MaxPosition - boundingBox.MinPosition);
            renderer.ModelMatrix      = model;
            renderer.BoundingBoxColor = color;
            renderer.Render(arg);
        }