|
@@ -12,14 +12,17 @@
|
|
|
|
|
|
|
|
namespace BansheeEngine
|
|
namespace BansheeEngine
|
|
|
{
|
|
{
|
|
|
|
|
+ /** @addtogroup Scene-Editor
|
|
|
|
|
+ * @{
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
class GizmoManagerCore;
|
|
class GizmoManagerCore;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Handles the rendering and picking of gizmo elements. Gizmos are icons and 3D objects
|
|
|
|
|
- * usually rendered in scene view for various visualization purposes (e.g. a Camera component
|
|
|
|
|
- * will have a gizmo that draws a Camera icon since otherwise it has no visual representation).
|
|
|
|
|
- * Aside from being rendered, gizmos can also be selected by the user as if they were normal
|
|
|
|
|
- * scene elements.
|
|
|
|
|
|
|
+ * Handles the rendering and picking of gizmo elements. Gizmos are icons and 3D objects usually rendered in scene view
|
|
|
|
|
+ * for various visualization purposes (e.g. a Camera component will have a gizmo that draws a Camera icon since
|
|
|
|
|
+ * otherwise it has no visual representation). Aside from being rendered, gizmos can also be selected by the user as if
|
|
|
|
|
+ * they were normal scene elements.
|
|
|
*/
|
|
*/
|
|
|
class BS_ED_EXPORT GizmoManager : public Module<GizmoManager>
|
|
class BS_ED_EXPORT GizmoManager : public Module<GizmoManager>
|
|
|
{
|
|
{
|
|
@@ -28,128 +31,116 @@ namespace BansheeEngine
|
|
|
~GizmoManager();
|
|
~GizmoManager();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Starts gizmo creation. All further call will be referencing this gizmo.
|
|
|
|
|
- * Must be followed by a matching "endGizmo".
|
|
|
|
|
|
|
+ * Starts gizmo creation. All further call will be referencing this gizmo. Must be followed by a matching
|
|
|
|
|
+ * endGizmo().
|
|
|
*
|
|
*
|
|
|
- * @note gizmoParent Scene object this gizmo is attached to. Selecting the gizmo will
|
|
|
|
|
- * select this scene object.
|
|
|
|
|
|
|
+ * @param gizmoParent Scene object this gizmo is attached to. Selecting the gizmo will select this scene object.
|
|
|
*/
|
|
*/
|
|
|
void startGizmo(const HSceneObject& gizmoParent);
|
|
void startGizmo(const HSceneObject& gizmoParent);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Ends gizmo creation. Must be called after a matching "startGizmo".
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Ends gizmo creation. Must be called after a matching startGizmo(). */
|
|
|
void endGizmo();
|
|
void endGizmo();
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Changes the color of any further gizmo draw calls.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Changes the color of any further gizmo draw calls. */
|
|
|
void setColor(const Color& color);
|
|
void setColor(const Color& color);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Changes the transform that will be applied to meshes of any further gizmo draw calls.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Changes the transform that will be applied to meshes of any further gizmo draw calls. */
|
|
|
void setTransform(const Matrix4& transform);
|
|
void setTransform(const Matrix4& transform);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief If pickable is set to true, gizmo can be selected by the user, otherwise it will be
|
|
|
|
|
- * drawn but cannot be interacted with.
|
|
|
|
|
|
|
+ * If pickable is set to true, gizmo can be selected by the user, otherwise it will be drawn but cannot be
|
|
|
|
|
+ * interacted with.
|
|
|
*
|
|
*
|
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
|
*/
|
|
*/
|
|
|
void setPickable(bool pickable) { mPickable = pickable; }
|
|
void setPickable(bool pickable) { mPickable = pickable; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns the currently set gizmo color.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Returns the currently set gizmo color. */
|
|
|
Color getColor() const { return mColor; }
|
|
Color getColor() const { return mColor; }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns the currently set gizmo transform.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Returns the currently set gizmo transform. */
|
|
|
Matrix4 getTransform() const { return mTransform; }
|
|
Matrix4 getTransform() const { return mTransform; }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Draws an axis aligned cuboid.
|
|
|
|
|
|
|
+ * Draws an axis aligned cuboid.
|
|
|
*
|
|
*
|
|
|
- * @param position Center of the cuboid.
|
|
|
|
|
- * @param extents Radius of the cuboid in each axis.
|
|
|
|
|
|
|
+ * @param[in] position Center of the cuboid.
|
|
|
|
|
+ * @param[in] extents Radius of the cuboid in each axis.
|
|
|
*
|
|
*
|
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
|
*/
|
|
*/
|
|
|
void drawCube(const Vector3& position, const Vector3& extents);
|
|
void drawCube(const Vector3& position, const Vector3& extents);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Draws a sphere.
|
|
|
|
|
|
|
+ * Draws a sphere.
|
|
|
*
|
|
*
|
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
|
*/
|
|
*/
|
|
|
void drawSphere(const Vector3& position, float radius);
|
|
void drawSphere(const Vector3& position, float radius);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Draws a wireframe axis aligned cuboid.
|
|
|
|
|
|
|
+ * Draws a wireframe axis aligned cuboid.
|
|
|
*
|
|
*
|
|
|
- * @param position Center of the cuboid.
|
|
|
|
|
- * @param extents Radius of the cuboid in each axis.
|
|
|
|
|
|
|
+ * @param[in] position Center of the cuboid.
|
|
|
|
|
+ * @param[in] extents Radius of the cuboid in each axis.
|
|
|
*
|
|
*
|
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
|
*/
|
|
*/
|
|
|
void drawWireCube(const Vector3& position, const Vector3& extents);
|
|
void drawWireCube(const Vector3& position, const Vector3& extents);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Draws a wireframe sphere represented by three discs.
|
|
|
|
|
|
|
+ * Draws a wireframe sphere represented by three discs.
|
|
|
*
|
|
*
|
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
|
*/
|
|
*/
|
|
|
void drawWireSphere(const Vector3& position, float radius);
|
|
void drawWireSphere(const Vector3& position, float radius);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Draws a line between two points.
|
|
|
|
|
|
|
+ * Draws a line between two points.
|
|
|
*
|
|
*
|
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
|
*/
|
|
*/
|
|
|
void drawLine(const Vector3& start, const Vector3& end);
|
|
void drawLine(const Vector3& start, const Vector3& end);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Draws a wireframe disc.
|
|
|
|
|
|
|
+ * Draws a wireframe disc.
|
|
|
*
|
|
*
|
|
|
- * @param position Center of the disc.
|
|
|
|
|
- * @param normal Orientation of the disc, pointing in the direction the disc is visible in.
|
|
|
|
|
- * @param radius Radius of the disc.
|
|
|
|
|
|
|
+ * @param[in] position Center of the disc.
|
|
|
|
|
+ * @param[in] normal Orientation of the disc, pointing in the direction the disc is visible in.
|
|
|
|
|
+ * @param[in] radius Radius of the disc.
|
|
|
*/
|
|
*/
|
|
|
void drawWireDisc(const Vector3& position, const Vector3& normal, float radius);
|
|
void drawWireDisc(const Vector3& position, const Vector3& normal, float radius);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Draws a wireframe arc.
|
|
|
|
|
|
|
+ * Draws a wireframe arc.
|
|
|
*
|
|
*
|
|
|
- * @param position Center of the arc.
|
|
|
|
|
- * @param normal Orientation of the arc, pointing in the direction the arc is visible in.
|
|
|
|
|
- * @param radius Radius of the arc.
|
|
|
|
|
- * @param startAngle Angle at which to start the arc.
|
|
|
|
|
- * @param amountAngle Length of the arc.
|
|
|
|
|
|
|
+ * @param[in] position Center of the arc.
|
|
|
|
|
+ * @param[in] normal Orientation of the arc, pointing in the direction the arc is visible in.
|
|
|
|
|
+ * @param[in] radius Radius of the arc.
|
|
|
|
|
+ * @param[in] startAngle Angle at which to start the arc.
|
|
|
|
|
+ * @param[in] amountAngle Length of the arc.
|
|
|
*/
|
|
*/
|
|
|
void drawWireArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle);
|
|
void drawWireArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Draws a wireframe frustum.
|
|
|
|
|
|
|
+ * Draws a wireframe frustum.
|
|
|
*
|
|
*
|
|
|
- * @param position Origin of the frustum, or the eye point.
|
|
|
|
|
- * @param aspect Ratio of frustum width over frustum height.
|
|
|
|
|
- * @param FOV Horizontal field of view in degrees.
|
|
|
|
|
- * @param near Distance to the near frustum plane.
|
|
|
|
|
- * @param far Distance to the far frustum plane.
|
|
|
|
|
|
|
+ * @param[in] position Origin of the frustum, or the eye point.
|
|
|
|
|
+ * @param[in] aspect Ratio of frustum width over frustum height.
|
|
|
|
|
+ * @param[in] FOV Horizontal field of view in degrees.
|
|
|
|
|
+ * @param[in] near Distance to the near frustum plane.
|
|
|
|
|
+ * @param[in] far Distance to the far frustum plane.
|
|
|
*
|
|
*
|
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
|
*/
|
|
*/
|
|
|
void drawFrustum(const Vector3& position, float aspect, Degree FOV, float near, float far);
|
|
void drawFrustum(const Vector3& position, float aspect, Degree FOV, float near, float far);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Draws an icon that always faces the camera.
|
|
|
|
|
|
|
+ * Draws an icon that always faces the camera.
|
|
|
*
|
|
*
|
|
|
- * @param position Position of the center of the icon.
|
|
|
|
|
- * @param image Sprite image for the icon to draw.
|
|
|
|
|
- * @param fixedScale If true then the icon will remain the same size
|
|
|
|
|
- * regardless of the distance from camera.
|
|
|
|
|
|
|
+ * @param[in] position Position of the center of the icon.
|
|
|
|
|
+ * @param[in] image Sprite image for the icon to draw.
|
|
|
|
|
+ * @param[in] fixedScale If true then the icon will remain the same size regardless of the distance from camera.
|
|
|
*
|
|
*
|
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
* @note Must be called between startGizmo/endGizmo calls.
|
|
|
*/
|
|
*/
|
|
@@ -166,7 +157,28 @@ namespace BansheeEngine
|
|
|
void drawText(const Vector3& position, const WString& text, const HFont& font, UINT32 fontSize = 16);
|
|
void drawText(const Vector3& position, const WString& text, const HFont& font, UINT32 fontSize = 16);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Updates all the gizmo meshes to reflect all draw calls submitted since "clearGizmos".
|
|
|
|
|
|
|
+ * Clears all gizmo data, but doesn't update the meshes or the render data. (Calling update would create empty
|
|
|
|
|
+ * meshes, but before calling update gizmos will still be drawn).
|
|
|
|
|
+ */
|
|
|
|
|
+ void clearGizmos();
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Clears gizmo render data like meshes, but doesn't clear the original gizmo data (Calling update would just
|
|
|
|
|
+ * recreate the render data).
|
|
|
|
|
+ */
|
|
|
|
|
+ void clearRenderData();
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Returns a scene object that was attached to a specific gizmo.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param[in] gizmoIdx Index of the gizmo to look for.
|
|
|
|
|
+ */
|
|
|
|
|
+ HSceneObject getSceneObject(UINT32 gizmoIdx);
|
|
|
|
|
+
|
|
|
|
|
+ /** @cond INTERNAL */
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Updates all the gizmo meshes to reflect all draw calls submitted since clearGizmos().
|
|
|
*
|
|
*
|
|
|
* @note Internal method.
|
|
* @note Internal method.
|
|
|
*/
|
|
*/
|
|
@@ -183,40 +195,18 @@ namespace BansheeEngine
|
|
|
*/
|
|
*/
|
|
|
void renderForPicking(const CameraPtr& camera, std::function<Color(UINT32)> idxToColorCallback);
|
|
void renderForPicking(const CameraPtr& camera, std::function<Color(UINT32)> idxToColorCallback);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Clears all gizmo data, but doesn't update the meshes
|
|
|
|
|
- * or the render data. (Calling update would create empty
|
|
|
|
|
- * meshes, but before calling update gizmos will still be drawn).
|
|
|
|
|
- */
|
|
|
|
|
- void clearGizmos();
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Clears gizmo render data like meshes, but doesn't clear the original gizmo data.
|
|
|
|
|
- * (Calling update would just recreate the render data).
|
|
|
|
|
- */
|
|
|
|
|
- void clearRenderData();
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Returns a scene object that was attached to a specific gizmo.
|
|
|
|
|
- *
|
|
|
|
|
- * @param gizmoIdx Index of the gizmo to look for.
|
|
|
|
|
- */
|
|
|
|
|
- HSceneObject getSceneObject(UINT32 gizmoIdx);
|
|
|
|
|
|
|
+ /** @endcond */
|
|
|
|
|
|
|
|
private:
|
|
private:
|
|
|
friend class GizmoManagerCore;
|
|
friend class GizmoManagerCore;
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Supported types of gizmo materials (i.e. shaders)
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Supported types of gizmo materials (i.e. shaders) */
|
|
|
enum class GizmoMaterial
|
|
enum class GizmoMaterial
|
|
|
{
|
|
{
|
|
|
Solid, Wire, Picking, PickingAlpha, Text
|
|
Solid, Wire, Picking, PickingAlpha, Text
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Common data shared by all gizmo types.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Common data shared by all gizmo types. */
|
|
|
struct CommonData
|
|
struct CommonData
|
|
|
{
|
|
{
|
|
|
UINT32 idx;
|
|
UINT32 idx;
|
|
@@ -226,36 +216,28 @@ namespace BansheeEngine
|
|
|
bool pickable;
|
|
bool pickable;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Data required for rendering a cuboid gizmo.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Data required for rendering a cuboid gizmo. */
|
|
|
struct CubeData : public CommonData
|
|
struct CubeData : public CommonData
|
|
|
{
|
|
{
|
|
|
Vector3 position;
|
|
Vector3 position;
|
|
|
Vector3 extents;
|
|
Vector3 extents;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Data required for rendering a sphere gizmo.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Data required for rendering a sphere gizmo. */
|
|
|
struct SphereData : public CommonData
|
|
struct SphereData : public CommonData
|
|
|
{
|
|
{
|
|
|
Vector3 position;
|
|
Vector3 position;
|
|
|
float radius;
|
|
float radius;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Data required for rendering a line gizmo.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Data required for rendering a line gizmo. */
|
|
|
struct LineData : public CommonData
|
|
struct LineData : public CommonData
|
|
|
{
|
|
{
|
|
|
Vector3 start;
|
|
Vector3 start;
|
|
|
Vector3 end;
|
|
Vector3 end;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Data required for rendering a wireframe disc gizmo.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Data required for rendering a wireframe disc gizmo. */
|
|
|
struct WireDiscData : public CommonData
|
|
struct WireDiscData : public CommonData
|
|
|
{
|
|
{
|
|
|
Vector3 position;
|
|
Vector3 position;
|
|
@@ -263,9 +245,7 @@ namespace BansheeEngine
|
|
|
float radius;
|
|
float radius;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Data required for rendering a wireframe arc gizmo.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Data required for rendering a wireframe arc gizmo. */
|
|
|
struct WireArcData : public CommonData
|
|
struct WireArcData : public CommonData
|
|
|
{
|
|
{
|
|
|
Vector3 position;
|
|
Vector3 position;
|
|
@@ -275,9 +255,7 @@ namespace BansheeEngine
|
|
|
Degree amountAngle;
|
|
Degree amountAngle;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Data required for rendering a frustum gizmo.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Data required for rendering a frustum gizmo. */
|
|
|
struct FrustumData : public CommonData
|
|
struct FrustumData : public CommonData
|
|
|
{
|
|
{
|
|
|
Vector3 position;
|
|
Vector3 position;
|
|
@@ -287,9 +265,7 @@ namespace BansheeEngine
|
|
|
float far;
|
|
float far;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Data required for rendering an icon gizmo.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Data required for rendering an icon gizmo. */
|
|
|
struct IconData : public CommonData
|
|
struct IconData : public CommonData
|
|
|
{
|
|
{
|
|
|
Vector3 position;
|
|
Vector3 position;
|
|
@@ -297,9 +273,7 @@ namespace BansheeEngine
|
|
|
HSpriteTexture texture;
|
|
HSpriteTexture texture;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Data required for rendering text.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Data required for rendering text. */
|
|
|
struct TextData : public CommonData
|
|
struct TextData : public CommonData
|
|
|
{
|
|
{
|
|
|
Vector3 position;
|
|
Vector3 position;
|
|
@@ -308,18 +282,14 @@ namespace BansheeEngine
|
|
|
UINT32 fontSize;
|
|
UINT32 fontSize;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Stores how many icons use a specific texture.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Stores how many icons use a specific texture. */
|
|
|
struct IconRenderData
|
|
struct IconRenderData
|
|
|
{
|
|
{
|
|
|
UINT32 count;
|
|
UINT32 count;
|
|
|
SPtr<TextureCore> texture;
|
|
SPtr<TextureCore> texture;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Data used for initializing the core thread equivalent of the gizmo manager.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Data used for initializing the core thread equivalent of the gizmo manager. */
|
|
|
struct CoreInitData
|
|
struct CoreInitData
|
|
|
{
|
|
{
|
|
|
SPtr<MaterialCore> solidMat;
|
|
SPtr<MaterialCore> solidMat;
|
|
@@ -334,44 +304,39 @@ namespace BansheeEngine
|
|
|
typedef std::shared_ptr<IconRenderDataVec> IconRenderDataVecPtr;
|
|
typedef std::shared_ptr<IconRenderDataVec> IconRenderDataVecPtr;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Builds a brand new mesh that can be used for rendering all icon gizmos.
|
|
|
|
|
|
|
+ * Builds a brand new mesh that can be used for rendering all icon gizmos.
|
|
|
*
|
|
*
|
|
|
- * @param camera Camera the mesh will be rendered to.
|
|
|
|
|
- * @param iconData A list of all icons and their properties.
|
|
|
|
|
- * @param forPicking Whether the icons will be rendered normally, or with a special material for picking.
|
|
|
|
|
- * @param renderData Output data that outlines the structure of the returned mesh. It tells us which portions of the
|
|
|
|
|
- * mesh use which icon texture.
|
|
|
|
|
|
|
+ * @param[in] camera Camera the mesh will be rendered to.
|
|
|
|
|
+ * @param[in] iconData A list of all icons and their properties.
|
|
|
|
|
+ * @param[in] forPicking Whether the icons will be rendered normally, or with a special material for picking.
|
|
|
|
|
+ * @param[in] renderData Output data that outlines the structure of the returned mesh. It tells us which portions
|
|
|
|
|
+ * of the mesh use which icon texture.
|
|
|
*
|
|
*
|
|
|
- * @returns A mesh containing all of the visible icons. Mesh is allocated using the icon mesh heap and should be deallocated manually.
|
|
|
|
|
|
|
+ * @return A mesh containing all of the visible icons. Mesh is allocated using the icon mesh heap
|
|
|
|
|
+ * and should be deallocated manually.
|
|
|
*/
|
|
*/
|
|
|
TransientMeshPtr buildIconMesh(const CameraPtr& camera, const Vector<IconData>& iconData, bool forPicking, IconRenderDataVecPtr& renderData);
|
|
TransientMeshPtr buildIconMesh(const CameraPtr& camera, const Vector<IconData>& iconData, bool forPicking, IconRenderDataVecPtr& renderData);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Resizes the icon width/height so it is always scaled to optimal size (with preserved aspect).
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Resizes the icon width/height so it is always scaled to optimal size (with preserved aspect). */
|
|
|
void limitIconSize(UINT32& width, UINT32& height);
|
|
void limitIconSize(UINT32& width, UINT32& height);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Calculates colors for an icon based on its position in the camera. e.g. icons too close to too far might be faded.
|
|
|
|
|
|
|
+ * Calculates colors for an icon based on its position in the camera. e.g. icons too close to too far might be faded.
|
|
|
*
|
|
*
|
|
|
- * @param tint Primary tint for the icon.
|
|
|
|
|
- * @param camera Camera in which the icon will be rendered in.
|
|
|
|
|
- * @param iconHeight Height of the icon in pixels.
|
|
|
|
|
- * @param fixedScale Whether the icon size changes depending on distance from the camera.
|
|
|
|
|
- * @param normalColor Normal color of the icon.
|
|
|
|
|
- * @param fadedColor Faded color to be used when icon is occluded by geometry.
|
|
|
|
|
|
|
+ * @param[in] tint Primary tint for the icon.
|
|
|
|
|
+ * @param[in] camera Camera in which the icon will be rendered in.
|
|
|
|
|
+ * @param[in] iconHeight Height of the icon in pixels.
|
|
|
|
|
+ * @param[in] fixedScale Whether the icon size changes depending on distance from the camera.
|
|
|
|
|
+ * @param[in] normalColor Normal color of the icon.
|
|
|
|
|
+ * @param[in] fadedColor Faded color to be used when icon is occluded by geometry.
|
|
|
*/
|
|
*/
|
|
|
void calculateIconColors(const Color& tint, const CameraPtr& camera, UINT32 iconHeight, bool fixedScale,
|
|
void calculateIconColors(const Color& tint, const CameraPtr& camera, UINT32 iconHeight, bool fixedScale,
|
|
|
Color& normalColor, Color& fadedColor);
|
|
Color& normalColor, Color& fadedColor);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Initializes the core thread version of the gizmo manager.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Initializes the core thread version of the gizmo manager. */
|
|
|
void initializeCore(const CoreInitData& initData);
|
|
void initializeCore(const CoreInitData& initData);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Destroys the core thread version of the gizmo manager.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Destroys the core thread version of the gizmo manager. */
|
|
|
void destroyCore(GizmoManagerCore* core);
|
|
void destroyCore(GizmoManagerCore* core);
|
|
|
|
|
|
|
|
static const UINT32 VERTEX_BUFFER_GROWTH;
|
|
static const UINT32 VERTEX_BUFFER_GROWTH;
|
|
@@ -426,17 +391,16 @@ namespace BansheeEngine
|
|
|
Vector<SortedIconData> mSortedIconData;
|
|
Vector<SortedIconData> mSortedIconData;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /** @cond INTERNAL */
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * @brief Core thread version of the gizmo manager that handles most of the rendering
|
|
|
|
|
- * of meshes provided by the gizmo manager.
|
|
|
|
|
|
|
+ * Core thread version of the gizmo manager that handles most of the rendering of meshes provided by the gizmo manager.
|
|
|
*/
|
|
*/
|
|
|
class GizmoManagerCore
|
|
class GizmoManagerCore
|
|
|
{
|
|
{
|
|
|
friend class GizmoManager;
|
|
friend class GizmoManager;
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Solid gizmo material and parameter handles.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Solid gizmo material and parameter handles. */
|
|
|
struct SolidMaterialData
|
|
struct SolidMaterialData
|
|
|
{
|
|
{
|
|
|
SPtr<MaterialCore> mat;
|
|
SPtr<MaterialCore> mat;
|
|
@@ -444,18 +408,14 @@ namespace BansheeEngine
|
|
|
GpuParamVec4Core mViewDir;
|
|
GpuParamVec4Core mViewDir;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Wire gizmo material and parameter handles.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Wire gizmo material and parameter handles. */
|
|
|
struct WireMaterialData
|
|
struct WireMaterialData
|
|
|
{
|
|
{
|
|
|
SPtr<MaterialCore> mat;
|
|
SPtr<MaterialCore> mat;
|
|
|
GpuParamMat4Core mViewProj;
|
|
GpuParamMat4Core mViewProj;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Icon gizmo material and parameter handles.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Icon gizmo material and parameter handles. */
|
|
|
struct IconMaterialData
|
|
struct IconMaterialData
|
|
|
{
|
|
{
|
|
|
SPtr<MaterialCore> mat;
|
|
SPtr<MaterialCore> mat;
|
|
@@ -464,9 +424,7 @@ namespace BansheeEngine
|
|
|
GpuParamTextureCore mTexture[2];
|
|
GpuParamTextureCore mTexture[2];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Text gizmo material and parameter handles.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Text gizmo material and parameter handles. */
|
|
|
struct TextMaterialData
|
|
struct TextMaterialData
|
|
|
{
|
|
{
|
|
|
SPtr<MaterialCore> mat;
|
|
SPtr<MaterialCore> mat;
|
|
@@ -474,9 +432,7 @@ namespace BansheeEngine
|
|
|
GpuParamTextureCore mTexture;
|
|
GpuParamTextureCore mTexture;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Gizmo material and parameter handles used for picking.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Gizmo material and parameter handles used for picking. */
|
|
|
struct PickingMaterialData
|
|
struct PickingMaterialData
|
|
|
{
|
|
{
|
|
|
SPtr<MaterialCore> mat;
|
|
SPtr<MaterialCore> mat;
|
|
@@ -484,8 +440,7 @@ namespace BansheeEngine
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Gizmo material and parameter handles used for picking, with
|
|
|
|
|
- * blending support (generally used for icon picking).
|
|
|
|
|
|
|
+ * Gizmo material and parameter handles used for picking, with blending support (generally used for icon picking).
|
|
|
*/
|
|
*/
|
|
|
struct AlphaPickingMaterialData
|
|
struct AlphaPickingMaterialData
|
|
|
{
|
|
{
|
|
@@ -520,47 +475,43 @@ namespace BansheeEngine
|
|
|
~GizmoManagerCore();
|
|
~GizmoManagerCore();
|
|
|
|
|
|
|
|
private:
|
|
private:
|
|
|
- /**
|
|
|
|
|
- * @brief Initializes the core gizmo manager. Must be called right after creation.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Initializes the core gizmo manager. Must be called right after creation. */
|
|
|
void initialize(const GizmoManager::CoreInitData& initData);
|
|
void initialize(const GizmoManager::CoreInitData& initData);
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @brief Renders all gizmos in the parent camera.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Renders all gizmos in the parent camera. */
|
|
|
void render();
|
|
void render();
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Renders a non-icon gizmo mesh using the provided parameters.
|
|
|
|
|
|
|
+ * Renders a non-icon gizmo mesh using the provided parameters.
|
|
|
*
|
|
*
|
|
|
- * @param viewMatrix View matrix of the camera we are rendering with.
|
|
|
|
|
- * @param projMatrix Projection matrix of the camera we are rendering with.
|
|
|
|
|
- * @param viewDir View direction of the camera we are rendering with.
|
|
|
|
|
- * @param mesh Mesh to render. This is normally the solid or wireframe gizmo mesh.
|
|
|
|
|
- * @param texture Texture to apply to the material, if the material supports a texture.
|
|
|
|
|
- * @param material Material to use for rendering. This is normally the solid, wireframe or picking material.
|
|
|
|
|
|
|
+ * @param[in] viewMatrix View matrix of the camera we are rendering with.
|
|
|
|
|
+ * @param[in] projMatrix Projection matrix of the camera we are rendering with.
|
|
|
|
|
+ * @param[in] viewDir View direction of the camera we are rendering with.
|
|
|
|
|
+ * @param[in] mesh Mesh to render. This is normally the solid or wireframe gizmo mesh.
|
|
|
|
|
+ * @param[in] texture Texture to apply to the material, if the material supports a texture.
|
|
|
|
|
+ * @param[in] material Material to use for rendering. This is normally the solid, wireframe or picking material.
|
|
|
*/
|
|
*/
|
|
|
void renderGizmos(const Matrix4& viewMatrix, const Matrix4& projMatrix, const Vector3& viewDir,
|
|
void renderGizmos(const Matrix4& viewMatrix, const Matrix4& projMatrix, const Vector3& viewDir,
|
|
|
const SPtr<MeshCoreBase>& mesh, const SPtr<TextureCore>& texture, GizmoManager::GizmoMaterial material);
|
|
const SPtr<MeshCoreBase>& mesh, const SPtr<TextureCore>& texture, GizmoManager::GizmoMaterial material);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Renders the icon gizmo mesh using the provided parameters.
|
|
|
|
|
|
|
+ * Renders the icon gizmo mesh using the provided parameters.
|
|
|
*
|
|
*
|
|
|
- * @param screenArea Area of the viewport to render the gizmos in, in pixels.
|
|
|
|
|
- * @param mesh Mesh containing the icons.
|
|
|
|
|
- * @param renderData Icon render data outlining which parts of the icon mesh use which textures.
|
|
|
|
|
- * @param usePickingMaterial Should the icons be rendered normally or for picking.
|
|
|
|
|
|
|
+ * @param[in] screenArea Area of the viewport to render the gizmos in, in pixels.
|
|
|
|
|
+ * @param[in] mesh Mesh containing the icons.
|
|
|
|
|
+ * @param[in] renderData Icon render data outlining which parts of the icon mesh use which textures.
|
|
|
|
|
+ * @param[in] usePickingMaterial Should the icons be rendered normally or for picking.
|
|
|
*/
|
|
*/
|
|
|
void renderIconGizmos(Rect2I screenArea, SPtr<MeshCoreBase> mesh, GizmoManager::IconRenderDataVecPtr renderData, bool usePickingMaterial);
|
|
void renderIconGizmos(Rect2I screenArea, SPtr<MeshCoreBase> mesh, GizmoManager::IconRenderDataVecPtr renderData, bool usePickingMaterial);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @brief Updates the internal data that is used for rendering. Normally you would call this after
|
|
|
|
|
- * updating the camera or meshes on the sim thread.
|
|
|
|
|
|
|
+ * Updates the internal data that is used for rendering. Normally you would call this after updating the camera or
|
|
|
|
|
+ * meshes on the sim thread.
|
|
|
*
|
|
*
|
|
|
- * @param camera Sets the camera all rendering will be performed to.
|
|
|
|
|
- * @param meshes Meshes to render.
|
|
|
|
|
- * @param iconMesh Mesh containing icon meshes.
|
|
|
|
|
- * @param iconRenderData Icon render data outlining which parts of the icon mesh use which textures.
|
|
|
|
|
|
|
+ * @param[in] camera Sets the camera all rendering will be performed to.
|
|
|
|
|
+ * @param[in] meshes Meshes to render.
|
|
|
|
|
+ * @param[in] iconMesh Mesh containing icon meshes.
|
|
|
|
|
+ * @param[in] iconRenderData Icon render data outlining which parts of the icon mesh use which textures.
|
|
|
*/
|
|
*/
|
|
|
void updateData(const SPtr<CameraCore>& camera, const Vector<MeshData>& meshes, const SPtr<MeshCoreBase>& iconMesh,
|
|
void updateData(const SPtr<CameraCore>& camera, const Vector<MeshData>& meshes, const SPtr<MeshCoreBase>& iconMesh,
|
|
|
const GizmoManager::IconRenderDataVecPtr& iconRenderData);
|
|
const GizmoManager::IconRenderDataVecPtr& iconRenderData);
|
|
@@ -582,4 +533,7 @@ namespace BansheeEngine
|
|
|
PickingMaterialData mPickingMaterial;
|
|
PickingMaterialData mPickingMaterial;
|
|
|
AlphaPickingMaterialData mAlphaPickingMaterial;
|
|
AlphaPickingMaterialData mAlphaPickingMaterial;
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+ /** @endcond */
|
|
|
|
|
+ /** @} */
|
|
|
}
|
|
}
|