Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanded Convex Editor #2359

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
524 changes: 394 additions & 130 deletions Engine/source/T3D/convexShape.cpp

Large diffs are not rendered by default.

54 changes: 46 additions & 8 deletions Engine/source/T3D/convexShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,46 @@ class ConvexShape : public SceneObject
S32 id;
};

struct surfaceMaterial
{
// The name of the Material we will use for rendering
String materialName;

// The actual Material instance
BaseMatInstance* materialInst;

surfaceMaterial()
{
materialName = "";
materialInst = NULL;
}
};

struct surfaceUV
{
S32 matID;
Point2F offset;
Point2F scale;
float zRot;
bool horzFlip;
bool vertFlip;

surfaceUV() : matID(0), offset(Point2F(0.0f, 0.0f)), scale(Point2F(1.0f, 1.0f)), zRot(0.0f), horzFlip(false), vertFlip(false) {}
};

struct surfaceBuffers
{
// The GFX vertex and primitive buffers
GFXVertexBufferHandle< VertexType > mVertexBuffer;
GFXPrimitiveBufferHandle mPrimitiveBuffer;

U32 mVertCount;
U32 mPrimCount;
};

struct Geometry
{
void generate( const Vector< PlaneF > &planes, const Vector< Point3F > &tangents );
void generate(const Vector< PlaneF > &planes, const Vector< Point3F > &tangents, const Vector< surfaceMaterial > surfaceTextures, const Vector< Point2F > texOffset, const Vector< Point2F > texScale, const Vector< bool > horzFlip, const Vector< bool > vertFlip);

Vector< Point3F > points;
Vector< Face > faces;
Expand Down Expand Up @@ -215,6 +252,9 @@ class ConvexShape : public SceneObject
static S32 QSORT_CALLBACK _comparePlaneDist( const void *a, const void *b );

static bool protectedSetSurface( void *object, const char *index, const char *data );

static bool protectedSetSurfaceTexture( void *object, const char *index, const char *data );
static bool protectedSetSurfaceUV(void *object, const char *index, const char *data);

protected:

Expand All @@ -224,13 +264,6 @@ class ConvexShape : public SceneObject
// The actual Material instance
BaseMatInstance* mMaterialInst;

// The GFX vertex and primitive buffers
GFXVertexBufferHandle< VertexType > mVertexBuffer;
GFXPrimitiveBufferHandle mPrimitiveBuffer;

U32 mVertCount;
U32 mPrimCount;

Geometry mGeometry;

Vector< PlaneF > mPlanes;
Expand All @@ -239,6 +272,11 @@ class ConvexShape : public SceneObject

Vector< Point3F > mFaceCenters;

//this is mostly for storage purposes, so we can save the texture mods
Vector< surfaceMaterial > mSurfaceTextures;
Vector< surfaceUV > mSurfaceUVs;
Vector< surfaceBuffers > mSurfaceBuffers;

Convex *mConvexList;

PhysicsBody *mPhysicsRep;
Expand Down
Loading