mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-06 05:37:48 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
/* Copyright 2003-2013 ROBLOX Corporation, All Rights Reserved */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SelectState.h"
|
||||
#include "Util/G3DCore.h"
|
||||
#include "V8DataModel/ModelInstance.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace G3D {
|
||||
class Rect2D;
|
||||
class CoordinateFrame;
|
||||
class Ray;
|
||||
class RenderDevice;
|
||||
class Color4;
|
||||
}
|
||||
|
||||
namespace RBX
|
||||
{
|
||||
|
||||
class Part;
|
||||
class Details;
|
||||
class Adorn;
|
||||
|
||||
class Draw {
|
||||
private:
|
||||
|
||||
// generic
|
||||
static void adornSurfaces(const Part& part, Adorn* adorn, const G3D::Color3& controllerColor);
|
||||
static void frameBox(const Part& part, Adorn* adorn, const Color4& color);
|
||||
static void constraint(const Part& part, Adorn* adorn, int face, const G3D::Color3& controllerColor);
|
||||
|
||||
static bool m_showHoverOver;
|
||||
static G3D::Color4 m_hoverOverColor;
|
||||
static G3D::Color4 m_selectColor;
|
||||
|
||||
public:
|
||||
static const G3D::Color4& selectColor() { return m_selectColor; }
|
||||
static void setSelectColor(const G3D::Color4& Color);
|
||||
|
||||
static const G3D::Color4& hoverOverColor() { return m_hoverOverColor; }
|
||||
static void setHoverOverColor(const G3D::Color4& color);
|
||||
|
||||
// DRAWING - assumes 2D mode
|
||||
static void selectionSquare(const G3D::Rect2D& rect, float thick);
|
||||
|
||||
static void partAdorn(
|
||||
const Part& part,
|
||||
Adorn* adorn,
|
||||
const G3D::Color3& controllerColor);
|
||||
|
||||
static void selectionBox(
|
||||
const Part& part,
|
||||
Adorn* adorn,
|
||||
const G3D::Color4& selectColor,
|
||||
float lineThickness = 0.15f);
|
||||
|
||||
static void selectionBox(
|
||||
ModelInstance& model,
|
||||
Adorn* adorn,
|
||||
const G3D::Color4& selectColor,
|
||||
float lineThickness = 0.15f);
|
||||
|
||||
static void selectionBox(
|
||||
const Part& part,
|
||||
Adorn* adorn,
|
||||
SelectState selectState,
|
||||
float lineThickness = 0.15f);
|
||||
|
||||
static void showHoverOver(bool Show) { m_showHoverOver = Show; }
|
||||
static bool isHoverOver() { return m_showHoverOver; }
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
/* Copyright 2003-2005 ROBLOX Corporation, All Rights Reserved */
|
||||
#pragma once
|
||||
|
||||
#include "SelectState.h"
|
||||
#include "appDraw/HandleType.h"
|
||||
#include "Util/G3DCore.h"
|
||||
#include "Util/NormalId.h"
|
||||
#include <vector>
|
||||
#include "V8World/Primitive.h"
|
||||
#include "V8DataModel/PartInstance.h"
|
||||
#include "Tool/DragTypes.h"
|
||||
|
||||
namespace RBX {
|
||||
|
||||
class Part;
|
||||
class Adorn;
|
||||
class Face;
|
||||
class Camera;
|
||||
|
||||
class DrawAdorn {
|
||||
private:
|
||||
static void surfaceBorder(
|
||||
Adorn* adorn,
|
||||
const Vector3& halfRealSize,
|
||||
float highlight,
|
||||
int surfaceId,
|
||||
const Color4& color);
|
||||
|
||||
public:
|
||||
static const Color3& resizeColor() {
|
||||
static Color3 c(0.1f, 0.6f, 1.0f);
|
||||
return c;
|
||||
}
|
||||
|
||||
static float scaleHandleRelativeToCamera(
|
||||
const Vector3& cameraPos,
|
||||
HandleType handleType,
|
||||
const Vector3& handlePos );
|
||||
|
||||
static Vector3 handlePosInObject(
|
||||
const Vector3& cameraPos,
|
||||
const Extents& localExtents,
|
||||
HandleType handleType,
|
||||
NormalId normalId );
|
||||
|
||||
static void cylinder(
|
||||
Adorn* adorn,
|
||||
const CoordinateFrame& worldC,
|
||||
int axis,
|
||||
float length,
|
||||
float radius,
|
||||
const Color4& color,
|
||||
bool cap = true);
|
||||
|
||||
static void faceInWorld(
|
||||
Adorn* adorn,
|
||||
const Face& face,
|
||||
float thickness,
|
||||
const Color4& color);
|
||||
|
||||
static void partSurface(
|
||||
const Part& part,
|
||||
int surfaceId,
|
||||
Adorn* adorn,
|
||||
const G3D::Color4& color = G3D::Color4(G3D::Color3::orange()),
|
||||
float thickness = 0.2f);
|
||||
|
||||
static void surfaceGridOnFace(
|
||||
const Primitive& prim,
|
||||
Adorn* adorn,
|
||||
int surfaceId,
|
||||
const G3D::Color4& color,
|
||||
int boxesPerStud );
|
||||
|
||||
static void zeroPlaneGrid(
|
||||
Adorn* adorn,
|
||||
const RBX::Camera& camera,
|
||||
const int studsPerBox,
|
||||
const int yLevel,
|
||||
const G3D::Color4& smallGridColor,
|
||||
const G3D::Color4& largeGridColor);
|
||||
|
||||
static void surfaceGridAtCoord(
|
||||
Adorn* adorn,
|
||||
CoordinateFrame& cF,
|
||||
const Vector4& bounds,
|
||||
const Vector3& gridXDir,
|
||||
const Vector3& gridYDir,
|
||||
const G3D::Color4& color,
|
||||
int boxesPerStud );
|
||||
|
||||
static void axisWidget(
|
||||
Adorn* adorn,
|
||||
const RBX::Camera& camera);
|
||||
|
||||
static void circularGridAtCoord(
|
||||
Adorn* adorn,
|
||||
const CoordinateFrame& coordFrame,
|
||||
const G3D::Vector3& size,
|
||||
const G3D::Vector3& cameraPos,
|
||||
NormalId normalId,
|
||||
const Color4& color,
|
||||
int boxesPerStud );
|
||||
|
||||
static void surfacePolygon(
|
||||
Adorn* adorn,
|
||||
PartInstance& partInst,
|
||||
int surfaceId,
|
||||
const G3D::Color3& color,
|
||||
float lineThickness );
|
||||
|
||||
static void polygonRelativeToCoord(
|
||||
Adorn* adorn,
|
||||
const CoordinateFrame& cF,
|
||||
std::vector<Vector3>& vertices,
|
||||
const G3D::Color4& color,
|
||||
float lineThickness );
|
||||
|
||||
static void lineSegmentRelativeToCoord(
|
||||
Adorn* adorn,
|
||||
const CoordinateFrame& cF,
|
||||
const Vector3& pt0,
|
||||
const Vector3& pt1,
|
||||
const G3D::Color3& color,
|
||||
float lineThickness );
|
||||
|
||||
static void verticalLineSegmentSplit(
|
||||
Adorn* adorn,
|
||||
const CoordinateFrame& cF,
|
||||
const Vector3& pt0,
|
||||
const Vector3& pt1,
|
||||
const float& delta,
|
||||
const float& magicParam,
|
||||
const short& level,
|
||||
const G3D::Color3& color,
|
||||
float lineThickness );
|
||||
|
||||
static void handles3d(
|
||||
const G3D::Vector3& size,
|
||||
const G3D::CoordinateFrame& position,
|
||||
Adorn* adorn,
|
||||
HandleType handleType,
|
||||
const G3D::Vector3& cameraPos,
|
||||
const G3D::Color4& color,
|
||||
bool useAxisColor = true,
|
||||
int normalIdMask = NORM_ALL_MASK,
|
||||
NormalId normalIdTohighlight = NORM_UNDEFINED,
|
||||
const G3D::Color4& highlightColor = cornflowerblue
|
||||
);
|
||||
|
||||
// Must be in 2d Mode
|
||||
static void handles2d(
|
||||
const G3D::Vector3& size,
|
||||
const G3D::CoordinateFrame& position,
|
||||
const RBX::Camera& camera,
|
||||
Adorn* adorn,
|
||||
HandleType handleType,
|
||||
const G3D::Color4& color,
|
||||
bool useAxisColor = true,
|
||||
int normalIdMask = NORM_ALL_MASK
|
||||
);
|
||||
|
||||
static void partInfoText2D(
|
||||
const G3D::Vector3& size,
|
||||
const G3D::CoordinateFrame& position,
|
||||
const RBX::Camera& camera,
|
||||
Adorn* adorn,
|
||||
const std::string& text,
|
||||
const G3D::Color4& color,
|
||||
float fontSize = 18.0f,
|
||||
int normalIdMask = NORM_ALL_MASK);
|
||||
|
||||
static void chatBubble2d(
|
||||
Adorn* adorn,
|
||||
const Rect2D& rect,
|
||||
const G3D::Vector2 pointer,
|
||||
float cornerradius,
|
||||
const float linewidth,
|
||||
const int quarterdivs,
|
||||
const Color4& color);
|
||||
|
||||
static void torus(
|
||||
Adorn* adorn,
|
||||
const CoordinateFrame& worldC,
|
||||
NormalId axis,
|
||||
float radius,
|
||||
float thicknessradius,
|
||||
const Color4& color);
|
||||
|
||||
/**
|
||||
* Draws a wire star made up of 3 line segments.
|
||||
*
|
||||
* @param adorn object used to generate the geometry
|
||||
* @param center world space center coordinates
|
||||
* @param size lines are -size to +size on the axis
|
||||
* @param colorX color of x axis line
|
||||
* @param colorY color of y axis line
|
||||
* @param colorZ color of z axis line
|
||||
*/
|
||||
static void star(
|
||||
Adorn* adorn,
|
||||
const Vector3& center,
|
||||
float size = 1.0f,
|
||||
const Color4& colorX = Color3::white(),
|
||||
const Color4& colorY = Color3::white(),
|
||||
const Color4& colorZ = Color3::white() );
|
||||
|
||||
/**
|
||||
* Draw an outline (wireframe) box in 3D.
|
||||
*
|
||||
* @param adorn adornment to use for drawing
|
||||
* @param box box to draw
|
||||
* @param color color of lines
|
||||
*/
|
||||
static void outlineBox(
|
||||
Adorn* adorn,
|
||||
const AABox& box,
|
||||
const Color4& color );
|
||||
|
||||
/**
|
||||
* Draw an outline (wireframe) box in 3D.
|
||||
*
|
||||
* @param adorn adornment to use for drawing
|
||||
* @param extents box dimensions
|
||||
* @param color color of lines
|
||||
*/
|
||||
static void outlineBox(
|
||||
Adorn* adorn,
|
||||
const Extents& extents,
|
||||
const Color4& color )
|
||||
{
|
||||
AABox aa_box(extents.min(),extents.max());
|
||||
outlineBox(adorn,aa_box,color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw select indicator around a box similar to 3DS.
|
||||
*
|
||||
* @param adorn adornment to use for drawing
|
||||
* @param box box to draw
|
||||
* @param color color of lines
|
||||
*/
|
||||
static void selectionBox(
|
||||
Adorn* adorn,
|
||||
const AABox& box,
|
||||
const Color4& color );
|
||||
|
||||
/**
|
||||
* Draw select indicator around a box similar to 3DS.
|
||||
*
|
||||
* @param adorn adornment to use for drawing
|
||||
* @param extents box dimensions
|
||||
* @param color color of lines
|
||||
*/
|
||||
static void selectionBox(
|
||||
Adorn* adorn,
|
||||
const Extents& extents,
|
||||
const Color4& color )
|
||||
{
|
||||
AABox aa_box(extents.min(),extents.max());
|
||||
selectionBox(adorn,aa_box,color);
|
||||
}
|
||||
|
||||
// common colors
|
||||
static const Color3 beige;
|
||||
static const Color3 darkblue;
|
||||
static const Color3 powderblue;
|
||||
static const Color3 skyblue;
|
||||
static const Color3 violet;
|
||||
static const Color3 slategray;
|
||||
static const Color3 aqua;
|
||||
static const Color3 tan;
|
||||
static const Color3 wheat;
|
||||
static const Color3 cornflowerblue;
|
||||
static const Color3 limegreen;
|
||||
static const Color3 magenta;
|
||||
static const Color3 pink;
|
||||
static const Color3 silver;
|
||||
|
||||
// Color values for each axis (x, y, z).
|
||||
static const Color3 axisColors[3];
|
||||
|
||||
private:
|
||||
|
||||
static float scaleRelativeToCamera(
|
||||
const Vector3& cameraPos,
|
||||
const Vector3& handlePos,
|
||||
float minAngle,
|
||||
float expectedRadius );
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/* Copyright 2003-2005 ROBLOX Corporation, All Rights Reserved */
|
||||
#pragma once
|
||||
|
||||
#include "Util/G3DCore.h"
|
||||
|
||||
namespace G3D {
|
||||
class RenderDevice;
|
||||
}
|
||||
|
||||
namespace RBX
|
||||
{
|
||||
class Rect;
|
||||
|
||||
class DrawPrimitives {
|
||||
public:
|
||||
static void rawBox(
|
||||
const AABox& box,
|
||||
G3D::RenderDevice* rd);
|
||||
|
||||
static void rawSphere(
|
||||
float radius,
|
||||
G3D::RenderDevice* rd);
|
||||
|
||||
static void rawCylinderAlongX(
|
||||
float radius,
|
||||
float axis,
|
||||
G3D::RenderDevice* rd,
|
||||
bool cap);
|
||||
|
||||
// generic 2d - must be in 2d mode
|
||||
static void rect2d(
|
||||
const RBX::Rect& rect,
|
||||
G3D::RenderDevice* rd,
|
||||
const G3D::Color4& color = G3D::Color3::white());
|
||||
|
||||
static void line2d(
|
||||
const G3D::Vector2& p0,
|
||||
const G3D::Vector2& p1,
|
||||
G3D::RenderDevice* rd,
|
||||
const G3D::Color4& color = G3D::Color3::white());
|
||||
|
||||
static void outlineRect2d(
|
||||
const RBX::Rect& rect,
|
||||
float thick,
|
||||
G3D::RenderDevice* rd,
|
||||
const G3D::Color4& color = G3D::Color3::blue());
|
||||
|
||||
};
|
||||
} // namespace
|
||||
@@ -0,0 +1,11 @@
|
||||
/* Copyright 2003-2005 ROBLOX Corporation, All Rights Reserved */
|
||||
#pragma once
|
||||
|
||||
namespace RBX {
|
||||
|
||||
enum HandleType { HANDLE_RESIZE = 0,
|
||||
HANDLE_MOVE,
|
||||
HANDLE_ROTATE,
|
||||
HANDLE_VELOCITY} ;
|
||||
|
||||
} // namespace
|
||||
@@ -0,0 +1,27 @@
|
||||
/* Copyright 2003-2005 ROBLOX Corporation, All Rights Reserved */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Util/G3DCore.h"
|
||||
|
||||
namespace RBX {
|
||||
|
||||
class Part;
|
||||
|
||||
class HitTest {
|
||||
private:
|
||||
// hitTests
|
||||
static bool hitTestBox(const Part& part, RbxRay& rayInPartCoords, Vector3& hitPointInPartCoords, float gridToReal);
|
||||
static bool hitTestBall(const Part& part, RbxRay& rayInPartCoords, Vector3& hitPointInPartCoords, float gridToReal);
|
||||
static bool hitTestCylinder(const Part& part, RbxRay& rayInPartCoords, Vector3& hitPointInPartCoords, float gridToReal);
|
||||
|
||||
public:
|
||||
static bool hitTest(
|
||||
const Part& part,
|
||||
RbxRay& rayInPartCoords,
|
||||
Vector3& hitPointInPartCoords,
|
||||
float gridToReal);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user