#ifndef GeometryOverrideExample2_h
#define GeometryOverrideExample2_h
#include <maya/MPxGeometryOverride.h>
#include <maya/MPxSurfaceShape.h>
#include <maya/MHWGeometry.h>
#include <maya/MHWGeometryUtilities.h>
#include <maya/MDagMessage.h>
#include <vector>
{
public:
struct Float2
{
Float2() {}
Float2(float x, float y)
: x(x), y(y) {}
float x;
float y;
};
struct Float3
{
Float3() {}
Float3(float x, float y, float z)
: x(x), y(y), z(z) {}
float x;
float y;
float z;
};
typedef std::vector<Float3> Float3Array;
typedef std::vector<Float2> Float2Array;
typedef std::vector<unsigned int> IndexList;
public:
static void * creator()
{
return new GeometryOverrideExample2_shape();
}
static MStatus initialize() {
return MS::kSuccess; }
~GeometryOverrideExample2_shape() override;
bool isBounded()
const override {
return true; }
const Float3Array& getPositions() const { return fPositions; }
const Float3Array& getNormals() const { return fNormals; }
const Float3Array& getTangents() const { return fTangents; }
const Float3Array& getBiTangents() const { return fBiTangents; }
const Float2Array & getTexCoords() const { return fTextureCoords; }
const IndexList& getShadedIndices() const { return fShadedIndices; }
const IndexList& getWireFrameIndices() const { return fWireFrameIndices; }
public:
private:
GeometryOverrideExample2_shape();
Float3Array fPositions;
Float3Array fNormals;
Float3Array fTangents;
Float3Array fBiTangents;
Float2Array fTextureCoords;
IndexList fShadedIndices;
IndexList fWireFrameIndices;
MCallbackId mInstanceAddedCallbackId = 0;
};
{
public:
{
return new GeometryOverrideExample2(obj);
}
~GeometryOverrideExample2() override;
private:
GeometryOverrideExample2(
const MObject& obj);
void updateWireframeItems(const char* renderItemName, MGeometry::DrawMode mode, unsigned int depthPriority,
private:
static const char* sActiveWireframeRenderItemName;
static const char* sDormantWireframeRenderItemName;
static const char* sShadedRenderItemName;
GeometryOverrideExample2_shape* fMesh = nullptr;
};
#endif // GeometryOverrideExample2_h