Sfoglia il codice sorgente

Expose CustomGeometry component to Lua. Closes #353.

Lasse Öörni 11 anni fa
parent
commit
24923bbc9c

+ 1 - 1
Source/Engine/Graphics/CustomGeometry.h

@@ -92,7 +92,7 @@ public:
     /// Return number of geometries.
     /// Return number of geometries.
     unsigned GetNumGeometries() const { return geometries_.Size(); }
     unsigned GetNumGeometries() const { return geometries_.Size(); }
     /// Return material by geometry index.
     /// Return material by geometry index.
-    Material* GetMaterial(unsigned index) const;
+    Material* GetMaterial(unsigned index = 0) const;
     
     
     /// Set geometry data attribute.
     /// Set geometry data attribute.
     void SetGeometryDataAttr(PODVector<unsigned char> value);
     void SetGeometryDataAttr(PODVector<unsigned char> value);

+ 21 - 0
Source/Engine/LuaScript/pkgs/Graphics/CustomGeometry.pkg

@@ -0,0 +1,21 @@
+$#include "CustomGeometry.h"
+
+class CustomGeometry : public Drawable
+{
+    void Clear();
+    void SetNumGeometries(unsigned num);
+    void BeginGeometry(unsigned index, PrimitiveType type);
+    void DefineVertex(const Vector3& position);
+    void DefineNormal(const Vector3& normal);
+    void DefineTangent(const Vector4& tangent);
+    void DefineColor(const Color& color);
+    void DefineTexCoord(const Vector2& texCoord);
+    void Commit();
+    void SetMaterial(Material* material);
+    bool SetMaterial(unsigned index, Material* material);
+    unsigned GetNumGeometries();
+    Material* GetMaterial(unsigned index = 0);
+
+    tolua_property__get_set Material* material;
+    tolua_property__get_set unsigned numGeometries;
+};

+ 0 - 6
Source/Engine/LuaScript/pkgs/Graphics/StaticModel.pkg

@@ -1,11 +1,5 @@
 $#include "StaticModel.h"
 $#include "StaticModel.h"
 
 
-struct StaticModelGeometryData
-{
-    Vector3 center_ @ center;
-    unsigned lodLevel_ @ lodLevel;
-};
-
 class StaticModel : public Drawable
 class StaticModel : public Drawable
 {
 {
     void SetModel(Model* model);
     void SetModel(Model* model);

+ 1 - 0
Source/Engine/LuaScript/pkgs/GraphicsLuaAPI.pkg

@@ -6,6 +6,7 @@ $pfile "Graphics/AnimationController.pkg"
 $pfile "Graphics/AnimationState.pkg"
 $pfile "Graphics/AnimationState.pkg"
 $pfile "Graphics/BillboardSet.pkg"
 $pfile "Graphics/BillboardSet.pkg"
 $pfile "Graphics/Camera.pkg"
 $pfile "Graphics/Camera.pkg"
+$pfile "Graphics/CustomGeometry.pkg"
 $pfile "Graphics/DebugRenderer.pkg"
 $pfile "Graphics/DebugRenderer.pkg"
 $pfile "Graphics/DecalSet.pkg"
 $pfile "Graphics/DecalSet.pkg"
 $pfile "Graphics/Graphics.pkg"
 $pfile "Graphics/Graphics.pkg"