CustomGeometry.pkg 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. $#include "Graphics/CustomGeometry.h"
  2. struct CustomGeometryVertex
  3. {
  4. Vector3 position_ @ position;
  5. Vector3 normal_ @ normal;
  6. unsigned color_ @ color;
  7. Vector2 texCoord_ @ texCoord;
  8. Vector4 tangent_ @ tangent;
  9. };
  10. class CustomGeometry : public Drawable
  11. {
  12. void Clear();
  13. void SetNumGeometries(unsigned num);
  14. void SetDynamic(bool enable);
  15. void BeginGeometry(unsigned index, PrimitiveType type);
  16. void DefineVertex(const Vector3& position);
  17. void DefineNormal(const Vector3& normal);
  18. void DefineTangent(const Vector4& tangent);
  19. void DefineColor(const Color& color);
  20. void DefineTexCoord(const Vector2& texCoord);
  21. void DefineGeometry(unsigned index, PrimitiveType type, unsigned numVertices, bool hasNormals, bool hasColors, bool hasTexCoords, bool hasTangents);
  22. void Commit();
  23. void SetMaterial(Material* material);
  24. bool SetMaterial(unsigned index, Material* material);
  25. unsigned GetNumGeometries() const;
  26. unsigned GetNumVertices(unsigned index) const;
  27. bool IsDynamic() const;
  28. Material* GetMaterial(unsigned index = 0);
  29. CustomGeometryVertex* GetVertex(unsigned geometryIndex, unsigned vertexNum);
  30. tolua_property__get_set Material* material;
  31. tolua_property__get_set unsigned numGeometries;
  32. tolua_property__is_set bool dynamic;
  33. };