67 lines
3.4 KiB
C++
67 lines
3.4 KiB
C++
/* -----------------------------------------------------------------------------
|
|
GSFramework
|
|
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
|
----------------------------------------------------------------------------- */
|
|
|
|
|
|
#ifndef __NRENDERER_TOOLBOX__
|
|
#define __NRENDERER_TOOLBOX__
|
|
|
|
|
|
#include "core/renderer.h"
|
|
|
|
|
|
namespace GS {
|
|
namespace RendererToolbox {
|
|
using Core::Material;
|
|
using Render::Renderer;
|
|
|
|
/// Wrapper to display a cross in 3D.
|
|
void DrawCross(Renderer &, const Vector4 &, float size = Units::Mtr(1), const Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display an axis aligned square in 3D.
|
|
void DrawSquare(Renderer &, const Vector4 &, float size = Units::Mtr(1), Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display an OOBB using the line function of a derived renderer.
|
|
void DrawOBB(Renderer &, const OBB &, const Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display an OOBB using the triangle function of a derived renderer.
|
|
void DrawFilledOBB(Renderer &, const OBB &, const Color *, Material::BlendOperator = Material::Blend_None, Material::RenderWord = Material::Render_None);
|
|
/// Wrapper to display an AABB in 3D.
|
|
void DrawAABB(Renderer &, const MinMax &, const Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display a cube in 3D.
|
|
void DrawCube(Renderer &, const Vector4 &, float size = Units::Mtr(1), const Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display a sphere in 3D.
|
|
void DrawSphere(Renderer &, const Vector4 &, float radius = Units::Mtr(1), const Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display a ball in 3D.
|
|
void DrawBall(Renderer &, const nMatrix4 &, float radius = Units::Mtr(1), Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display a circle in 3D.
|
|
void DrawCircle(Renderer &, const Vector4 &, float radius = Units::Mtr(1), const Matrix3 * = 0, const Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display a cylinder in 3D.
|
|
void DrawCylinder(Renderer &, const Vector4 &, float radius = Units::Mtr(1), float length = Units::Mtr(1), const Matrix3 * = 0, const Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display a capsule in 3D.
|
|
void DrawCapsule(Renderer &, const Vector4 &, float radius = Units::Mtr(1.f), float length = Units::Mtr(1), const Matrix3 * = 0, const Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
/// Wrapper to display a cone in 3D.
|
|
void DrawCone(Renderer &, const Vector4 &, float radius = Units::Mtr(1.f), float length = Units::Mtr(1), const Matrix3 * = 0, const Color * = 0, Material::BlendOperator = Material::Blend_None);
|
|
|
|
/// Wrapper to line 3D.
|
|
void Line3D(Renderer &, const Vector4 &, const Vector4 &, const Color * = 0, Material::BlendOperator = Material::Blend_None, Material::RenderWord = Material::Render_None);
|
|
/// Draw triangle.
|
|
void Triangle3D(Renderer &, const Vector4 [3], const Color [3] = 0, const Vector2 [3] = 0, const Render::Texture * = 0, Material::BlendOperator = Material::Blend_None, Material::RenderWord = Material::Render_None);
|
|
|
|
/// Return nearest but highest power of two from a given value.
|
|
template <class T> T GetPow2(T v, bool no_shrink = false)
|
|
{
|
|
T h = 1;
|
|
if (no_shrink)
|
|
while (h < v)
|
|
h *= 2;
|
|
else
|
|
while ((h + h / 2) < v)
|
|
h *= 2;
|
|
return h;
|
|
}
|
|
|
|
} // RendererToolbox
|
|
} // GS
|
|
|
|
|
|
#endif // __NRENDERER_TOOLBOX__
|