Browse Source

Changed setMaterial to setMaterialIndex in CustomGeometry. Added TypeScript declaration.

rsredsq 10 years ago
parent
commit
9b8be0f2b8
2 changed files with 12 additions and 5 deletions
  1. 9 1
      Script/Packages/Atomic/Atomic3D.json
  2. 3 4
      Source/AtomicJS/Javascript/JSAtomic3D.cpp

+ 9 - 1
Script/Packages/Atomic/Atomic3D.json

@@ -15,19 +15,27 @@
 		},
 		"AnimationState" : {
 			"AnimationState" : ["AnimatedModel", "Animation"]
+		},
+		"CustomGeometry" : {
+			"SetMaterial" : ["Material"]
 		}
 
 	},
 	"typescript_decl" : {
-
 		"StaticModel" : [
 			"setMaterialIndex(index:number, material:Material);"
+		],
+		"CustomGeometry" : [
+			"setMaterialIndex(index:number, material:Material);"
 		]
 	},
 
 	"haxe_decl" : {
 		"StaticModel" : [
 			"function setMaterialIndex(index:UInt, material:Material):Void;"
+		],
+		"CustomGeometry" : [
+			"function setMaterialIndex(index:UInt, material:Material):Void;"
 		]
 	}
 

+ 3 - 4
Source/AtomicJS/Javascript/JSAtomic3D.cpp

@@ -25,7 +25,7 @@ static int StaticModel_SetMaterialIndex(duk_context* ctx) {
     return 0;
 }
 
-static int CustomGeometry_SetMaterial(duk_context* ctx) {
+static int CustomGeometry_SetMaterialIndex(duk_context* ctx) {
 
     unsigned index = (unsigned)duk_require_number(ctx, 0);
     Material* material = js_to_class_instance<Material>(ctx, 1, 0);
@@ -38,7 +38,6 @@ static int CustomGeometry_SetMaterial(duk_context* ctx) {
 
     geometry->SetMaterial(index, material);
 
-
     return 0;
 }
 
@@ -52,8 +51,8 @@ void jsapi_init_atomic3d(JSVM* vm)
     duk_pop(ctx); // pop AObject prototype
 
     js_class_get_prototype(ctx, "Atomic", "CustomGeometry");
-    duk_push_c_function(ctx, CustomGeometry_SetMaterial, 2);
-    duk_put_prop_string(ctx, -2, "setMaterial");
+    duk_push_c_function(ctx, CustomGeometry_SetMaterialIndex, 2);
+    duk_put_prop_string(ctx, -2, "setMaterialIndex");
     duk_pop(ctx); // pop AObject prototype
 }