mirror of https://github.com/axmolengine/axmol.git
Merge pull request #11971 from joshuastray/physics
Physics3d js binding
This commit is contained in:
commit
698428e0a1
|
@ -821,7 +821,7 @@
|
|||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/physics $(SRCROOT)/../cocos/math/kazmath $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -845,7 +845,7 @@
|
|||
HEADER_SEARCH_PATHS = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/physics $(SRCROOT)/../cocos/math/kazmath $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
@ -43,6 +43,7 @@ set(JSBINDING_SRC
|
|||
auto/jsb_cocos2dx_3d_auto.cpp
|
||||
auto/jsb_cocos2dx_3d_extension_auto.cpp
|
||||
auto/jsb_cocos2dx_experimental.cpp
|
||||
auto/jsb_cocos2dx_physics3d_auto.cpp
|
||||
manual/ScriptingCore.cpp
|
||||
manual/cocos2d_specifics.cpp
|
||||
manual/js_manual_conversions.cpp
|
||||
|
@ -69,6 +70,7 @@ set(JSBINDING_SRC
|
|||
manual/ui/jsb_cocos2dx_ui_manual.cpp
|
||||
manual/3d/jsb_cocos2dx_3d_manual.cpp
|
||||
manual/experimental/jsb_cocos2dx_experimental_manual.cpp
|
||||
manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp
|
||||
${cocos_root}/cocos/storage/local-storage/LocalStorage.cpp
|
||||
)
|
||||
|
||||
|
@ -80,11 +82,13 @@ include_directories(
|
|||
${cocos_root}/external/spidermonkey/include/${PLATFORM_FOLDER}
|
||||
${cocos_root}/cocos/base
|
||||
${cocos_root}/cocos/2d
|
||||
${cocos_root}/cocos/3d
|
||||
${cocos_root}/cocos/ui
|
||||
${cocos_root}/cocos/audio/include
|
||||
${cocos_root}/cocos/storage
|
||||
${cocos_root}/cocos/network
|
||||
${cocos_root}/cocos/platform
|
||||
${cocos_root}/cocos/physics3d
|
||||
${cocos_root}/extensions
|
||||
${cocos_root}/external
|
||||
${cocos_root}/cocos/editor-support
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "jsb_cocos2dx_3d_manual.h"
|
||||
#include "cocos2d_specifics.hpp"
|
||||
#include "jsb_cocos2dx_3d_auto.hpp"
|
||||
#include "3d/CCBundle3D.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
|
@ -284,6 +285,60 @@ bool js_cocos2dx_Terrain_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
return false;
|
||||
}
|
||||
|
||||
jsval std_vector_vec3_to_jsval(JSContext* cx, const std::vector<cocos2d::Vec3>& triangles)
|
||||
{
|
||||
JS::RootedObject jsarr(cx, JS_NewArrayObject(cx, triangles.size()));
|
||||
|
||||
uint32_t i = 0;
|
||||
for(auto iter = triangles.begin(); iter != triangles.end(); ++iter)
|
||||
{
|
||||
JS::RootedValue element(cx, vector3_to_jsval(cx, *iter));
|
||||
JS_SetElement(cx, jsarr, i, element);
|
||||
++i;
|
||||
}
|
||||
|
||||
return OBJECT_TO_JSVAL(jsarr);
|
||||
}
|
||||
|
||||
bool js_cocos2dx_Bundle3D_getTrianglesList(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if(argc == 1)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
std::string path;
|
||||
bool ok = jsval_to_std_string(cx, args.get(0), &path);
|
||||
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
|
||||
|
||||
std::vector<cocos2d::Vec3> triangles = cocos2d::Bundle3D::getTrianglesList(path);
|
||||
|
||||
JS::RootedValue ret(cx, std_vector_vec3_to_jsval(cx, triangles));
|
||||
args.rval().set(ret);
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_Terrain_getHeightData(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if(argc == 0)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Terrain* cobj = (cocos2d::Terrain *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Terrain_getHeightData : Invalid Native Object");
|
||||
|
||||
auto data = cobj->getHeightData();
|
||||
|
||||
args.rval().set(std_vector_float_to_jsval(cx, data));
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
void register_all_cocos2dx_3d_manual(JSContext *cx, JS::HandleObject global)
|
||||
{
|
||||
JS::RootedValue tmpVal(cx);
|
||||
|
@ -299,9 +354,15 @@ void register_all_cocos2dx_3d_manual(JSContext *cx, JS::HandleObject global)
|
|||
tmpObj = tmpVal.toObjectOrNull();
|
||||
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_Terrain_create, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_GetProperty(cx, ccObj, "Bundle3D", &tmpVal);
|
||||
tmpObj = tmpVal.toObjectOrNull();
|
||||
JS_DefineFunction(cx, tmpObj, "getTrianglesList", js_cocos2dx_Bundle3D_getTrianglesList, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, JS::RootedObject(cx, jsb_cocos2d_Sprite3D_prototype), "getAABB", js_cocos2dx_Sprite3D_getAABB, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, JS::RootedObject(cx, jsb_cocos2d_Mesh_prototype), "getMeshVertexAttribute", js_cocos2dx_Mesh_getMeshVertexAttribute, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, JS::RootedObject(cx, jsb_cocos2d_TextureCube_prototype), "setTexParameters", js_cocos2dx_CCTextureCube_setTexParameters, 4, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, JS::RootedObject(cx, jsb_cocos2d_Terrain_prototype), "getHeightData", js_cocos2dx_Terrain_getHeightData, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
}
|
||||
|
|
|
@ -5339,6 +5339,89 @@ void get_or_create_js_obj(JSContext* cx, JS::HandleObject obj, const std::string
|
|||
}
|
||||
}
|
||||
|
||||
#if CC_ENABLE_BULLET_INTEGRATION && CC_USE_3D_PHYSICS
|
||||
|
||||
#include "physics3d/CCPhysics3D.h"
|
||||
|
||||
bool js_cocos2dx_Scene_setPhysics3DDebugCamera(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_setPhysics3DDebugCamera : Invalid Native Object");
|
||||
if (argc == 1)
|
||||
{
|
||||
cocos2d::Camera* arg0;
|
||||
do
|
||||
{
|
||||
if (!args.get(0).isObject()) { ok = false; break; }
|
||||
js_proxy_t *jsProxy;
|
||||
JSObject *tmpObj = args.get(0).toObjectOrNull();
|
||||
jsProxy = jsb_get_js_proxy(tmpObj);
|
||||
arg0 = (cocos2d::Camera*)(jsProxy ? jsProxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
||||
} while (0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setPhysics3DDebugCamera : Error processing arguments");
|
||||
cobj->setPhysics3DDebugCamera(arg0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Scene_setPhysics3DDebugCamera : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Scene_initWithPhysics(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_initWithPhysics : Invalid Native Object");
|
||||
if (argc == 0)
|
||||
{
|
||||
bool ret = cobj->initWithPhysics();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
jsret = BOOLEAN_TO_JSVAL(ret);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Scene_initWithPhysics : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
bool js_cocos2dx_Scene_getPhysics3DWorld(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_getPhysics3DWorld : Invalid Native Object");
|
||||
if (argc == 0)
|
||||
{
|
||||
cocos2d::Physics3DWorld* ret = cobj->getPhysics3DWorld();
|
||||
jsval jsret = JSVAL_NULL;
|
||||
do
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::Physics3DWorld>(cx, (cocos2d::Physics3DWorld*)ret);
|
||||
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
|
||||
} else
|
||||
{
|
||||
jsret = JSVAL_NULL;
|
||||
}
|
||||
} while (0);
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "js_cocos2dx_Scene_getPhysics3DWorld : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return false;
|
||||
}
|
||||
#endif //CC_ENABLE_BULLET_INTEGRATION && CC_USE_3D_PHYSICS
|
||||
|
||||
void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
|
||||
{
|
||||
JS::RootedObject ccObj(cx);
|
||||
|
@ -5633,4 +5716,11 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
|
|||
|
||||
get_or_create_js_obj(cx, global, "console", &tmpObj);
|
||||
JS_DefineFunction(cx, tmpObj, "log", js_console_log, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
#if CC_ENABLE_BULLET_INTEGRATION && CC_USE_3D_PHYSICS
|
||||
tmpObj.set(jsb_cocos2d_Scene_prototype);
|
||||
JS_DefineFunction(cx, tmpObj, "setPhysics3DDebugCamera", js_cocos2dx_Scene_setPhysics3DDebugCamera, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, tmpObj, "initWithPhysics", js_cocos2dx_Scene_initWithPhysics, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, tmpObj, "getPhysics3DWorld", js_cocos2dx_Scene_getPhysics3DWorld, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
#endif //CC_ENABLE_BULLET_INTEGRATION && CC_USE_3D_PHYSICS
|
||||
}
|
||||
|
|
|
@ -1337,7 +1337,7 @@ bool jsval_to_std_vector_string( JSContext *cx, JS::HandleValue vp, std::vector<
|
|||
|
||||
uint32_t len = 0;
|
||||
JS_GetArrayLength(cx, jsobj, &len);
|
||||
|
||||
ret->reserve(len);
|
||||
for (uint32_t i=0; i < len; i++)
|
||||
{
|
||||
JS::RootedValue value(cx);
|
||||
|
@ -1368,7 +1368,7 @@ bool jsval_to_std_vector_int( JSContext *cx, JS::HandleValue vp, std::vector<int
|
|||
|
||||
uint32_t len = 0;
|
||||
JS_GetArrayLength(cx, jsobj, &len);
|
||||
|
||||
ret->reserve(len);
|
||||
for (uint32_t i=0; i < len; i++)
|
||||
{
|
||||
JS::RootedValue value(cx);
|
||||
|
@ -1394,6 +1394,41 @@ bool jsval_to_std_vector_int( JSContext *cx, JS::HandleValue vp, std::vector<int
|
|||
return true;
|
||||
}
|
||||
|
||||
bool jsval_to_std_vector_float( JSContext *cx, JS::HandleValue vp, std::vector<float>* ret)
|
||||
{
|
||||
JS::RootedObject jsobj(cx);
|
||||
bool ok = vp.isObject() && JS_ValueToObject( cx, vp, &jsobj );
|
||||
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
|
||||
JSB_PRECONDITION3( jsobj && JS_IsArrayObject( cx, jsobj), cx, false, "Object must be an array");
|
||||
|
||||
uint32_t len = 0;
|
||||
JS_GetArrayLength(cx, jsobj, &len);
|
||||
ret->reserve(len);
|
||||
for (uint32_t i=0; i < len; i++)
|
||||
{
|
||||
JS::RootedValue value(cx);
|
||||
if (JS_GetElement(cx, jsobj, i, &value))
|
||||
{
|
||||
if (value.isNumber())
|
||||
{
|
||||
double number = 0.0;
|
||||
ok = JS::ToNumber(cx, value, &number);
|
||||
if (ok)
|
||||
{
|
||||
ret->push_back(number);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JS_ReportError(cx, "not supported type in array");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool jsval_to_matrix(JSContext *cx, JS::HandleValue vp, cocos2d::Mat4* ret)
|
||||
{
|
||||
JS::RootedObject jsobj(cx);
|
||||
|
@ -2458,7 +2493,7 @@ jsval ssize_to_jsval(JSContext *cx, ssize_t v)
|
|||
|
||||
jsval std_vector_string_to_jsval( JSContext *cx, const std::vector<std::string>& v)
|
||||
{
|
||||
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, 0));
|
||||
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, v.size()));
|
||||
|
||||
int i = 0;
|
||||
for (const std::string obj : v)
|
||||
|
@ -2476,7 +2511,7 @@ jsval std_vector_string_to_jsval( JSContext *cx, const std::vector<std::string>&
|
|||
|
||||
jsval std_vector_int_to_jsval( JSContext *cx, const std::vector<int>& v)
|
||||
{
|
||||
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, 0));
|
||||
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, v.size()));
|
||||
|
||||
int i = 0;
|
||||
for (const int obj : v)
|
||||
|
@ -2492,6 +2527,24 @@ jsval std_vector_int_to_jsval( JSContext *cx, const std::vector<int>& v)
|
|||
return OBJECT_TO_JSVAL(jsretArr);
|
||||
}
|
||||
|
||||
jsval std_vector_float_to_jsval( JSContext *cx, const std::vector<float>& v)
|
||||
{
|
||||
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, v.size()));
|
||||
|
||||
int i = 0;
|
||||
for (const float obj : v)
|
||||
{
|
||||
JS::RootedValue arrElement(cx);
|
||||
arrElement = DOUBLE_TO_JSVAL(obj);
|
||||
|
||||
if (!JS_SetElement(cx, jsretArr, i, arrElement)) {
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return OBJECT_TO_JSVAL(jsretArr);
|
||||
}
|
||||
|
||||
jsval matrix_to_jsval(JSContext *cx, const cocos2d::Mat4& v)
|
||||
{
|
||||
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, 16));
|
||||
|
|
|
@ -181,6 +181,7 @@ bool jsval_to_ccvaluevector(JSContext* cx, JS::HandleValue v, cocos2d::ValueVect
|
|||
bool jsval_to_ssize( JSContext *cx, JS::HandleValue vp, ssize_t* ret);
|
||||
bool jsval_to_std_vector_string( JSContext *cx, JS::HandleValue vp, std::vector<std::string>* ret);
|
||||
bool jsval_to_std_vector_int( JSContext *cx, JS::HandleValue vp, std::vector<int>* ret);
|
||||
bool jsval_to_std_vector_float( JSContext *cx, JS::HandleValue vp, std::vector<float>* ret);
|
||||
bool jsval_to_matrix(JSContext *cx, JS::HandleValue vp, cocos2d::Mat4* ret);
|
||||
bool jsval_to_vector2(JSContext *cx, JS::HandleValue vp, cocos2d::Vec2* ret);
|
||||
bool jsval_to_vector3(JSContext *cx, JS::HandleValue vp, cocos2d::Vec3* ret);
|
||||
|
@ -327,6 +328,7 @@ jsval ccvaluevector_to_jsval(JSContext* cx, const cocos2d::ValueVector& v);
|
|||
jsval ssize_to_jsval(JSContext *cx, ssize_t v);
|
||||
jsval std_vector_string_to_jsval( JSContext *cx, const std::vector<std::string>& v);
|
||||
jsval std_vector_int_to_jsval( JSContext *cx, const std::vector<int>& v);
|
||||
jsval std_vector_float_to_jsval( JSContext *cx, const std::vector<float>& v);
|
||||
jsval matrix_to_jsval(JSContext *cx, const cocos2d::Mat4& v);
|
||||
jsval vector2_to_jsval(JSContext *cx, const cocos2d::Vec2& v);
|
||||
jsval vector3_to_jsval(JSContext *cx, const cocos2d::Vec3& v);
|
||||
|
|
|
@ -0,0 +1,324 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "jsb_cocos2dx_physics3d_manual.h"
|
||||
|
||||
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
|
||||
|
||||
#include "jsb_cocos2dx_physics3d_auto.hpp"
|
||||
#include "cocos2d_specifics.hpp"
|
||||
#include "physics3d/CCPhysics3D.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
bool jsval_to_physics3DRigidBodyDes(JSContext* cx, JS::HandleValue v, Physics3DRigidBodyDes* des)
|
||||
{
|
||||
JS::RootedObject jsobj(cx, v.toObjectOrNull());
|
||||
JS::RootedValue tmp(cx);
|
||||
|
||||
if(JS_GetProperty(cx, jsobj, "mass", &tmp))
|
||||
{
|
||||
des->mass = tmp.toNumber();
|
||||
}
|
||||
if(JS_GetProperty(cx, jsobj, "shape", &tmp))
|
||||
{
|
||||
js_proxy_t* proxy = jsb_get_js_proxy(tmp.toObjectOrNull());
|
||||
des->shape = proxy ? (cocos2d::Physics3DShape*)proxy->ptr : nullptr;
|
||||
}
|
||||
if(JS_GetProperty(cx, jsobj, "localInertia", &tmp))
|
||||
{
|
||||
Vec3 v3;
|
||||
jsval_to_vector3(cx, tmp, &v3);
|
||||
des->localInertia = v3;
|
||||
}
|
||||
if(JS_GetProperty(cx, jsobj, "originalTransform", &tmp))
|
||||
{
|
||||
Mat4 m4;
|
||||
jsval_to_matrix(cx, tmp, &m4);
|
||||
des->originalTransform = m4;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_PhysicsSprite3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
if (argc == 2)
|
||||
{
|
||||
std::string arg0;
|
||||
cocos2d::Physics3DRigidBodyDes arg1;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
ok &= jsval_to_physics3DRigidBodyDes(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_PhysicsSprite3D_create : Error processing arguments");
|
||||
cocos2d::PhysicsSprite3D* ret = cocos2d::PhysicsSprite3D::create(arg0, &arg1);
|
||||
|
||||
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::PhysicsSprite3D>(cx, (cocos2d::PhysicsSprite3D*)ret);
|
||||
jsval jsret = jsProxy ? OBJECT_TO_JSVAL(jsProxy->obj) : JSVAL_VOID;
|
||||
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
if (argc == 3)
|
||||
{
|
||||
std::string arg0;
|
||||
cocos2d::Physics3DRigidBodyDes arg1;
|
||||
cocos2d::Vec3 arg2;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
ok &= jsval_to_physics3DRigidBodyDes(cx, args.get(1), &arg1);
|
||||
ok &= jsval_to_vector3(cx, args.get(2), &arg2);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_PhysicsSprite3D_create : Error processing arguments");
|
||||
cocos2d::PhysicsSprite3D* ret = cocos2d::PhysicsSprite3D::create(arg0, &arg1, arg2);
|
||||
|
||||
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::PhysicsSprite3D>(cx, (cocos2d::PhysicsSprite3D*)ret);
|
||||
jsval jsret = jsProxy ? OBJECT_TO_JSVAL(jsProxy->obj) : JSVAL_VOID;
|
||||
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
if (argc == 4)
|
||||
{
|
||||
std::string arg0;
|
||||
cocos2d::Physics3DRigidBodyDes arg1;
|
||||
cocos2d::Vec3 arg2;
|
||||
cocos2d::Quaternion arg3;
|
||||
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
||||
ok &= jsval_to_physics3DRigidBodyDes(cx, args.get(1), &arg1);
|
||||
ok &= jsval_to_vector3(cx, args.get(2), &arg2);
|
||||
ok &= jsval_to_quaternion(cx, args.get(3), &arg3);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_PhysicsSprite3D_create : Error processing arguments");
|
||||
cocos2d::PhysicsSprite3D* ret = cocos2d::PhysicsSprite3D::create(arg0, &arg1, arg2, arg3);
|
||||
|
||||
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::PhysicsSprite3D>(cx, (cocos2d::PhysicsSprite3D*)ret);
|
||||
jsval jsret = jsProxy ? OBJECT_TO_JSVAL(jsProxy->obj) : JSVAL_VOID;
|
||||
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "js_cocos2dx_physics3d_PhysicsSprite3D_create : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_physics3d_Physics3DRigidBody_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cocos2d::Physics3DRigidBodyDes arg0;
|
||||
ok &= jsval_to_physics3DRigidBodyDes(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DRigidBody_create : Error processing arguments");
|
||||
cocos2d::Physics3DRigidBody* ret = cocos2d::Physics3DRigidBody::create(&arg0);
|
||||
|
||||
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::Physics3DRigidBody>(cx, (cocos2d::Physics3DRigidBody*)ret);
|
||||
jsval jsret = OBJECT_TO_JSVAL(jsProxy->obj);
|
||||
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3DRigidBody_create : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<Vec3> jsval_to_std_vector_vec3(JSContext* cx, JS::HandleValue v)
|
||||
{
|
||||
std::vector<Vec3> ret;
|
||||
JS::RootedObject jsobj(cx, v.toObjectOrNull());
|
||||
uint32_t length;
|
||||
JS_GetArrayLength(cx, jsobj, &length);
|
||||
ret.reserve(length);
|
||||
|
||||
for(size_t i = 0; i < length; ++i)
|
||||
{
|
||||
JS::RootedValue element(cx);
|
||||
JS_GetElement(cx, jsobj, (uint32_t)i, &element);
|
||||
|
||||
Vec3 v3;
|
||||
jsval_to_vector3(cx, element, &v3);
|
||||
ret.push_back(v3);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_physics3d_Physics3dShape_createMesh(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if(argc == 2)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
std::vector<Vec3> arg0 = jsval_to_std_vector_vec3(cx, args.get(0));
|
||||
int arg1;
|
||||
|
||||
bool ok = jsval_to_int(cx, args.get(1), &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3dShape_createMesh : Error processing arguments");
|
||||
|
||||
Physics3DShape* ret = Physics3DShape::createMesh(&arg0[0], arg1);
|
||||
js_proxy_t* proxy = js_get_or_create_proxy<Physics3DShape>(cx, ret);
|
||||
jsval jsret = OBJECT_TO_JSVAL(proxy->obj);
|
||||
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3dShape_createMesh : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
jsval physics3d_collisionPoint_to_jsval(JSContext*cx, const Physics3DCollisionInfo::CollisionPoint& point)
|
||||
{
|
||||
JS::RootedObject tmp(cx, JS_NewObject(cx, NULL, JS::NullPtr(), JS::NullPtr()));
|
||||
|
||||
JS_DefineProperty(cx, tmp, "localPositionOnA", JS::RootedValue(cx, vector3_to_jsval(cx, point.localPositionOnA)), JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineProperty(cx, tmp, "localPositionOnB", JS::RootedValue(cx, vector3_to_jsval(cx, point.localPositionOnB)), JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineProperty(cx, tmp, "worldPositionOnA", JS::RootedValue(cx, vector3_to_jsval(cx, point.worldPositionOnA)), JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineProperty(cx, tmp, "worldPositionOnB", JS::RootedValue(cx, vector3_to_jsval(cx, point.worldPositionOnB)), JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
JS_DefineProperty(cx, tmp, "worldNormalOnB", JS::RootedValue(cx, vector3_to_jsval(cx, point.worldNormalOnB)), JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
return OBJECT_TO_JSVAL(tmp);
|
||||
}
|
||||
|
||||
jsval physics3d_collisioninfo_to_jsval(JSContext* cx, const Physics3DCollisionInfo& ci)
|
||||
{
|
||||
JS::RootedObject tmp(cx, JS_NewObject(cx, NULL, JS::NullPtr(), JS::NullPtr()));
|
||||
|
||||
js_proxy_t* proxy = js_get_or_create_proxy<Physics3DObject>(cx, ci.objA);
|
||||
JS_DefineProperty(cx, tmp, "objA", JS::RootedValue(cx, OBJECT_TO_JSVAL(proxy->obj)), JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
proxy = js_get_or_create_proxy<Physics3DObject>(cx, ci.objB);
|
||||
JS_DefineProperty(cx, tmp, "objB", JS::RootedValue(cx, OBJECT_TO_JSVAL(proxy->obj)), JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
JS::RootedObject jsarr(cx, JS_NewArrayObject(cx, ci.collisionPointList.size()));
|
||||
uint32_t i = 0;
|
||||
for(auto iter = ci.collisionPointList.begin(); iter != ci.collisionPointList.end(); ++iter)
|
||||
{
|
||||
JS::RootedValue element(cx, physics3d_collisionPoint_to_jsval(cx, *iter));
|
||||
JS_SetElement(cx, jsarr, i++, element);
|
||||
}
|
||||
JS_DefineProperty(cx, tmp, "collisionPointList", JS::RootedValue(cx, OBJECT_TO_JSVAL(jsarr)), JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
|
||||
return OBJECT_TO_JSVAL(tmp);
|
||||
}
|
||||
|
||||
bool jsb_cocos2d_Physics3DObject_setCollisionCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if(argc == 2)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Physics3DObject* cobj = (cocos2d::Physics3DObject *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "jsb_cocos2d_Physics3DObject_setCollisionCallback : Invalid Native Object");
|
||||
|
||||
std::function<void(const Physics3DCollisionInfo &)> arg0;
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, args.get(1).toObjectOrNull(), args.get(0)));
|
||||
auto lambda = [=](const Physics3DCollisionInfo &ci) -> void {
|
||||
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
||||
|
||||
jsval jsci = physics3d_collisioninfo_to_jsval(cx, ci);
|
||||
JS::RootedValue rval(cx);
|
||||
bool ok = func->invoke(1, &jsci, &rval);
|
||||
if (!ok && JS_IsExceptionPending(cx))
|
||||
{
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
};
|
||||
arg0 = lambda;
|
||||
cobj->setCollisionCallback(arg0);
|
||||
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3dShape_createMesh : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool js_cocos2dx_physics3d_Physics3dShape_createHeightfield(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if (argc == 8 || argc == 9)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
int arg0;
|
||||
int arg1;
|
||||
std::vector<float> arg2;
|
||||
double arg3;
|
||||
double arg4;
|
||||
double arg5;
|
||||
bool arg6;
|
||||
bool arg7;
|
||||
bool arg8;
|
||||
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
||||
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
||||
ok &= jsval_to_std_vector_float(cx, args.get(2), &arg2);
|
||||
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
|
||||
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4);
|
||||
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5);
|
||||
arg6 = JS::ToBoolean(args.get(6));
|
||||
arg7 = JS::ToBoolean(args.get(7));
|
||||
if(argc == 9)
|
||||
arg8 = JS::ToBoolean(args.get(8));
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DShape_createHeightfield : Error processing arguments");
|
||||
|
||||
cocos2d::Physics3DShape* ret = nullptr;
|
||||
if(argc == 8)
|
||||
ret = cocos2d::Physics3DShape::createHeightfield(arg0, arg1, &arg2[0], arg3, arg4, arg5, arg6, arg7);
|
||||
else if(argc == 9)
|
||||
ret = cocos2d::Physics3DShape::createHeightfield(arg0, arg1, &arg2[0], arg3, arg4, arg5, arg6, arg7, arg8);
|
||||
|
||||
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::Physics3DShape>(cx, ret);
|
||||
jsval jsret = OBJECT_TO_JSVAL(jsProxy->obj);
|
||||
|
||||
args.rval().set(jsret);
|
||||
return true;
|
||||
}
|
||||
JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3DShape_createHeightfield : wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
void register_all_cocos2dx_physics3d_manual(JSContext *cx, JS::HandleObject global)
|
||||
{
|
||||
JS::RootedObject ccObj(cx);
|
||||
get_or_create_js_obj(cx, global, "cc", &ccObj);
|
||||
|
||||
JS::RootedValue tmpVal(cx);
|
||||
JS_GetProperty(cx, ccObj, "PhysicsSprite3D", &tmpVal);
|
||||
JS::RootedObject tmpObj(cx, tmpVal.toObjectOrNull());
|
||||
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_PhysicsSprite3D_create, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_GetProperty(cx, ccObj, "Physics3DRigidBody", &tmpVal);
|
||||
tmpObj = tmpVal.toObjectOrNull();
|
||||
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_physics3d_Physics3DRigidBody_create, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_GetProperty(cx, ccObj, "Physics3DShape", &tmpVal);
|
||||
tmpObj = tmpVal.toObjectOrNull();
|
||||
JS_DefineFunction(cx, tmpObj, "createMesh", js_cocos2dx_physics3d_Physics3dShape_createMesh, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(cx, tmpObj, "createHeightfield", js_cocos2dx_physics3d_Physics3dShape_createHeightfield, 8, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
JS_DefineFunction(cx, JS::RootedObject(cx, jsb_cocos2d_Physics3DObject_prototype), "setCollisionCallback", jsb_cocos2d_Physics3DObject_setCollisionCallback, 2, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
}
|
||||
|
||||
#endif //CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
|
|
@ -0,0 +1,38 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#ifndef __jsb_cococs2dx_physics3d_manual_h__
|
||||
#define __jsb_cococs2dx_physics3d_manual_h__
|
||||
|
||||
#include "base/ccConfig.h"
|
||||
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
void register_all_cocos2dx_physics3d_manual(JSContext *cx, JS::HandleObject global);
|
||||
|
||||
#endif
|
||||
|
||||
#endif //__jsb_cococs2dx_physics3d_manual_h__
|
|
@ -44,6 +44,7 @@ LOCAL_SRC_FILES := ../auto/jsb_cocos2dx_3d_auto.cpp \
|
|||
../auto/jsb_cocos2dx_builder_auto.cpp \
|
||||
../auto/jsb_cocos2dx_ui_auto.cpp \
|
||||
../auto/jsb_cocos2dx_experimental.cpp \
|
||||
../auto/jsb_cocos2dx_physics3d_auto.cpp \
|
||||
../manual/ScriptingCore.cpp \ \
|
||||
../manual/cocos2d_specifics.cpp \
|
||||
../manual/js_manual_conversions.cpp \
|
||||
|
@ -69,8 +70,9 @@ LOCAL_SRC_FILES := ../auto/jsb_cocos2dx_3d_auto.cpp \
|
|||
../manual/network/XMLHTTPRequest.cpp \
|
||||
../manual/spine/jsb_cocos2dx_spine_manual.cpp \
|
||||
../manual/ui/jsb_cocos2dx_ui_manual.cpp \
|
||||
../manual/experimental/jsb_cocos2dx_experimental_manual.cpp
|
||||
|
||||
../manual/experimental/jsb_cocos2dx_experimental_manual.cpp \
|
||||
../manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp
|
||||
|
||||
|
||||
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
|
||||
|
||||
|
@ -81,6 +83,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual \
|
|||
$(LOCAL_PATH)/../manual/spine \
|
||||
$(LOCAL_PATH)/../auto \
|
||||
$(LOCAL_PATH)/../../../2d \
|
||||
$(LOCAL_PATH)/../../../3d \
|
||||
$(LOCAL_PATH)/../../../physics3d \
|
||||
$(LOCAL_PATH)/../../../base \
|
||||
$(LOCAL_PATH)/../../../ui \
|
||||
$(LOCAL_PATH)/../../../audio/include \
|
||||
|
@ -93,7 +97,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual \
|
|||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual \
|
||||
$(LOCAL_PATH)/../auto \
|
||||
$(LOCAL_PATH)/../../../audio/include
|
||||
$(LOCAL_PATH)/../../../audio/include
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_js_android_static
|
||||
|
||||
|
|
|
@ -146,6 +146,14 @@
|
|||
420BBCF81AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 420BBCF51AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp */; };
|
||||
420BBCF91AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 420BBCF61AA48EE900493976 /* jsb_cocos2dx_3d_manual.h */; };
|
||||
420BBCFA1AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 420BBCF61AA48EE900493976 /* jsb_cocos2dx_3d_manual.h */; };
|
||||
42638FFD1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42638FFB1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp */; };
|
||||
42638FFE1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42638FFB1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp */; };
|
||||
42638FFF1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 42638FFC1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp */; };
|
||||
426390001B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 42638FFC1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp */; };
|
||||
426390041B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 426390021B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp */; };
|
||||
426390051B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 426390021B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp */; };
|
||||
426390061B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 426390031B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h */; };
|
||||
426390071B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 426390031B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h */; };
|
||||
42AD256C1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */; };
|
||||
42AD256D1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */; };
|
||||
42AD256E1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */; };
|
||||
|
@ -263,6 +271,10 @@
|
|||
420BBCEF1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_3d_auto.hpp; sourceTree = "<group>"; };
|
||||
420BBCF51AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_3d_manual.cpp; sourceTree = "<group>"; };
|
||||
420BBCF61AA48EE900493976 /* jsb_cocos2dx_3d_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_3d_manual.h; sourceTree = "<group>"; };
|
||||
42638FFB1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_physics3d_auto.cpp; sourceTree = "<group>"; };
|
||||
42638FFC1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_physics3d_auto.hpp; sourceTree = "<group>"; };
|
||||
426390021B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_physics3d_manual.cpp; sourceTree = "<group>"; };
|
||||
426390031B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_physics3d_manual.h; sourceTree = "<group>"; };
|
||||
42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_experimental.cpp; sourceTree = "<group>"; };
|
||||
42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_experimental.hpp; sourceTree = "<group>"; };
|
||||
42AD25711AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_cocos2dx_experimental_manual.cpp; path = experimental/jsb_cocos2dx_experimental_manual.cpp; sourceTree = "<group>"; };
|
||||
|
@ -334,6 +346,8 @@
|
|||
1A119E2E18BDF19200352BAA /* auto */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
42638FFB1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp */,
|
||||
42638FFC1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp */,
|
||||
42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */,
|
||||
42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */,
|
||||
420BBCEE1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.cpp */,
|
||||
|
@ -362,6 +376,7 @@
|
|||
1A119E4118BDF19200352BAA /* manual */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
426390011B0EC1C6004C53A2 /* physics3d */,
|
||||
42AD25701AFF9DFC000176E2 /* experimental */,
|
||||
420BBCF41AA48EE900493976 /* 3d */,
|
||||
0541A74C1973876100E45470 /* ios */,
|
||||
|
@ -538,6 +553,15 @@
|
|||
path = 3d;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
426390011B0EC1C6004C53A2 /* physics3d */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
426390021B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp */,
|
||||
426390031B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h */,
|
||||
);
|
||||
path = physics3d;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
42AD25701AFF9DFC000176E2 /* experimental */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -603,7 +627,9 @@
|
|||
1AB5E63518D05BF30088DAA4 /* jsb_cocos2dx_ui_manual.h in Headers */,
|
||||
1A119EE318BDF19200352BAA /* jsb_opengl_functions.h in Headers */,
|
||||
42AD256E1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */,
|
||||
42638FFF1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp in Headers */,
|
||||
0541A74F1973876100E45470 /* JavaScriptObjCBridge.h in Headers */,
|
||||
426390061B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h in Headers */,
|
||||
1AB5E62D18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp in Headers */,
|
||||
420BBCF91AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */,
|
||||
1A119ED918BDF19200352BAA /* js_bindings_opengl.h in Headers */,
|
||||
|
@ -626,6 +652,7 @@
|
|||
files = (
|
||||
1A119EA418BDF19200352BAA /* jsb_cocos2dx_studio_auto.hpp in Headers */,
|
||||
1A119F0218BDF19200352BAA /* ScriptingCore.h in Headers */,
|
||||
426390071B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h in Headers */,
|
||||
1A119EBE18BDF19200352BAA /* cocos2d_specifics.hpp in Headers */,
|
||||
83A5661C18DA878400FC31A0 /* jsb_socketio.h in Headers */,
|
||||
1A1D3B7B18C44FD000922D3C /* jsb_event_dispatcher_manual.h in Headers */,
|
||||
|
@ -660,6 +687,7 @@
|
|||
1AB5E62E18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp in Headers */,
|
||||
1A119EDA18BDF19200352BAA /* js_bindings_opengl.h in Headers */,
|
||||
1A119EC818BDF19200352BAA /* jsb_cocos2dx_studio_manual.h in Headers */,
|
||||
426390001B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp in Headers */,
|
||||
420BBCFA1AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */,
|
||||
BA623E0C191A195F00761F37 /* jsb_pluginx_extension_registration.h in Headers */,
|
||||
1A119EAC18BDF19200352BAA /* js_bindings_chipmunk_auto_classes_registration.h in Headers */,
|
||||
|
@ -749,6 +777,7 @@
|
|||
1A119E8918BDF19200352BAA /* jsb_cocos2dx_builder_auto.cpp in Sources */,
|
||||
1A119EAD18BDF19200352BAA /* js_bindings_chipmunk_functions.cpp in Sources */,
|
||||
1A119EED18BDF19200352BAA /* js_bindings_system_functions.cpp in Sources */,
|
||||
426390041B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp in Sources */,
|
||||
0541A7501973876100E45470 /* JavaScriptObjCBridge.mm in Sources */,
|
||||
1A119EB318BDF19200352BAA /* js_bindings_chipmunk_manual.cpp in Sources */,
|
||||
1A119EE918BDF19200352BAA /* jsb_opengl_registration.cpp in Sources */,
|
||||
|
@ -779,6 +808,7 @@
|
|||
420BBCF01AA48EDE00493976 /* jsb_cocos2dx_3d_auto.cpp in Sources */,
|
||||
83A5661918DA878400FC31A0 /* jsb_socketio.cpp in Sources */,
|
||||
1A119EE118BDF19200352BAA /* jsb_opengl_functions.cpp in Sources */,
|
||||
42638FFD1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp in Sources */,
|
||||
1A119EA718BDF19200352BAA /* js_bindings_chipmunk_auto_classes.cpp in Sources */,
|
||||
1A119EFF18BDF19200352BAA /* ScriptingCore.cpp in Sources */,
|
||||
1A1D3B7818C44FD000922D3C /* jsb_event_dispatcher_manual.cpp in Sources */,
|
||||
|
@ -809,6 +839,8 @@
|
|||
1A119EF418BDF19200352BAA /* js_bindings_system_registration.cpp in Sources */,
|
||||
42AD256D1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */,
|
||||
1A119EBC18BDF19200352BAA /* cocos2d_specifics.cpp in Sources */,
|
||||
426390051B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp in Sources */,
|
||||
42638FFE1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp in Sources */,
|
||||
1A119EE618BDF19200352BAA /* jsb_opengl_manual.cpp in Sources */,
|
||||
1A119F0618BDF19200352BAA /* jsb_cocos2dx_spine_manual.cpp in Sources */,
|
||||
BA623E0F191A195F00761F37 /* jsb_pluginx_manual_protocols.cpp in Sources */,
|
||||
|
@ -873,7 +905,7 @@
|
|||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../../../cocos $(SRCROOT)/../../../../cocos/base $(SRCROOT)/../../../../cocos/2d $(SRCROOT)/../../../../cocos/physics $(SRCROOT)/../../../../cocos/math/kazmath $(SRCROOT)/../../../../cocos/platform $(SRCROOT)/../../../../cocos/audio/include $(SRCROOT)/../../../../cocos/editor-support $(SRCROOT)/../../../../cocos/editor-support/cocosbuilder $(SRCROOT)/../../../../cocos/editor-support/cocostudio $(SRCROOT)/../../../../cocos/editor-support/spine $(SRCROOT)/../../../../cocos/ui $(SRCROOT)/../../../../cocos/storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external $(SRCROOT)/../auto $(SRCROOT)/../manual";
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../../../cocos $(SRCROOT)/../../../../cocos/base $(SRCROOT)/../../../../cocos/3d $(SRCROOT)/../../../../cocos/2d $(SRCROOT)/../../../../cocos/physics3d $(SRCROOT)/../../../../cocos/platform $(SRCROOT)/../../../../cocos/audio/include $(SRCROOT)/../../../../cocos/editor-support $(SRCROOT)/../../../../cocos/editor-support/cocosbuilder $(SRCROOT)/../../../../cocos/editor-support/cocostudio $(SRCROOT)/../../../../cocos/editor-support/spine $(SRCROOT)/../../../../cocos/ui $(SRCROOT)/../../../../cocos/storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external $(SRCROOT)/../auto $(SRCROOT)/../manual";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -907,7 +939,7 @@
|
|||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../../../cocos $(SRCROOT)/../../../../cocos/base $(SRCROOT)/../../../../cocos/2d $(SRCROOT)/../../../../cocos/physics $(SRCROOT)/../../../../cocos/math/kazmath $(SRCROOT)/../../../../cocos/platform $(SRCROOT)/../../../../cocos/audio/include $(SRCROOT)/../../../../cocos/editor-support $(SRCROOT)/../../../../cocos/editor-support/cocosbuilder $(SRCROOT)/../../../../cocos/editor-support/cocostudio $(SRCROOT)/../../../../cocos/editor-support/spine $(SRCROOT)/../../../../cocos/ui $(SRCROOT)/../../../../cocos/storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external $(SRCROOT)/../auto $(SRCROOT)/../manual";
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../../../cocos $(SRCROOT)/../../../../cocos/base $(SRCROOT)/../../../../cocos/3d $(SRCROOT)/../../../../cocos/2d $(SRCROOT)/../../../../cocos/physics3d $(SRCROOT)/../../../../cocos/platform $(SRCROOT)/../../../../cocos/audio/include $(SRCROOT)/../../../../cocos/editor-support $(SRCROOT)/../../../../cocos/editor-support/cocosbuilder $(SRCROOT)/../../../../cocos/editor-support/cocostudio $(SRCROOT)/../../../../cocos/editor-support/spine $(SRCROOT)/../../../../cocos/ui $(SRCROOT)/../../../../cocos/storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external $(SRCROOT)/../auto $(SRCROOT)/../manual";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<ClCompile Include="..\auto\jsb_cocos2dx_builder_auto.cpp" />
|
||||
<ClCompile Include="..\auto\jsb_cocos2dx_experimental.cpp" />
|
||||
<ClCompile Include="..\auto\jsb_cocos2dx_extension_auto.cpp" />
|
||||
<ClCompile Include="..\auto\jsb_cocos2dx_physics3d_auto.cpp" />
|
||||
<ClCompile Include="..\auto\jsb_cocos2dx_spine_auto.cpp" />
|
||||
<ClCompile Include="..\auto\jsb_cocos2dx_studio_auto.cpp" />
|
||||
<ClCompile Include="..\auto\jsb_cocos2dx_ui_auto.cpp" />
|
||||
|
@ -43,6 +44,7 @@
|
|||
<ClCompile Include="..\manual\network\jsb_socketio.cpp" />
|
||||
<ClCompile Include="..\manual\network\jsb_websocket.cpp" />
|
||||
<ClCompile Include="..\manual\network\XMLHTTPRequest.cpp" />
|
||||
<ClCompile Include="..\manual\physics3d\jsb_cocos2dx_physics3d_manual.cpp" />
|
||||
<ClCompile Include="..\manual\ScriptingCore.cpp" />
|
||||
<ClCompile Include="..\manual\spine\jsb_cocos2dx_spine_manual.cpp" />
|
||||
<ClCompile Include="..\manual\ui\jsb_cocos2dx_ui_manual.cpp" />
|
||||
|
@ -54,6 +56,7 @@
|
|||
<ClInclude Include="..\auto\jsb_cocos2dx_builder_auto.hpp" />
|
||||
<ClInclude Include="..\auto\jsb_cocos2dx_experimental.hpp" />
|
||||
<ClInclude Include="..\auto\jsb_cocos2dx_extension_auto.hpp" />
|
||||
<ClInclude Include="..\auto\jsb_cocos2dx_physics3d_auto.hpp" />
|
||||
<ClInclude Include="..\auto\jsb_cocos2dx_spine_auto.hpp" />
|
||||
<ClInclude Include="..\auto\jsb_cocos2dx_studio_auto.hpp" />
|
||||
<ClInclude Include="..\auto\jsb_cocos2dx_ui_auto.hpp" />
|
||||
|
@ -86,6 +89,7 @@
|
|||
<ClInclude Include="..\manual\network\jsb_socketio.h" />
|
||||
<ClInclude Include="..\manual\network\jsb_websocket.h" />
|
||||
<ClInclude Include="..\manual\network\XMLHTTPRequest.h" />
|
||||
<ClInclude Include="..\manual\physics3d\jsb_cocos2dx_physics3d_manual.h" />
|
||||
<ClInclude Include="..\manual\ScriptingCore.h" />
|
||||
<ClInclude Include="..\manual\spidermonkey_specifics.h" />
|
||||
<ClInclude Include="..\manual\spine\jsb_cocos2dx_spine_manual.h" />
|
||||
|
@ -151,7 +155,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4068;4101;4800;4251;4244;4099;4083;4700;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
|
@ -177,7 +181,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\spidermonkey\prebuilt\win32\*.*"
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4068;4101;4800;4251;4244;4099;4083;4700;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
<Filter Include="manual\experimental">
|
||||
<UniqueIdentifier>{9f37ec66-1e00-4015-baa6-dabdf755f0ff}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="manual\physics3d">
|
||||
<UniqueIdentifier>{3aaaf02d-80d8-4339-b4cd-89d89ade5293}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\auto\jsb_cocos2dx_auto.cpp">
|
||||
|
@ -146,6 +149,12 @@
|
|||
<ClCompile Include="..\manual\experimental\jsb_cocos2dx_experimental_manual.cpp">
|
||||
<Filter>manual\experimental</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\auto\jsb_cocos2dx_physics3d_auto.cpp">
|
||||
<Filter>auto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\manual\physics3d\jsb_cocos2dx_physics3d_manual.cpp">
|
||||
<Filter>manual\physics3d</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\auto\jsb_cocos2dx_auto.hpp">
|
||||
|
@ -274,5 +283,11 @@
|
|||
<ClInclude Include="..\manual\experimental\jsb_cocos2dx_experimental_manual.h">
|
||||
<Filter>manual\experimental</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\auto\jsb_cocos2dx_physics3d_auto.hpp">
|
||||
<Filter>auto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\manual\physics3d\jsb_cocos2dx_physics3d_manual.h">
|
||||
<Filter>manual\physics3d</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -20,6 +20,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_builder_auto.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_experimental.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_extension_auto.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_physics3d_auto.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_spine_auto.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_studio_auto.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_ui_auto.hpp" />
|
||||
|
@ -52,6 +53,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\network\jsb_socketio.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\network\jsb_websocket.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\network\XMLHTTPRequest.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\physics3d\jsb_cocos2dx_physics3d_manual.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\ScriptingCore.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\spidermonkey_specifics.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\spine\jsb_cocos2dx_spine_manual.h" />
|
||||
|
@ -65,6 +67,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_builder_auto.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_experimental.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_extension_auto.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_physics3d_auto.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_spine_auto.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_studio_auto.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_ui_auto.cpp" />
|
||||
|
@ -91,6 +94,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\network\jsb_socketio.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\network\jsb_websocket.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\network\XMLHTTPRequest.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\physics3d\jsb_cocos2dx_physics3d_manual.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\ScriptingCore.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\spine\jsb_cocos2dx_spine_manual.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\ui\jsb_cocos2dx_ui_manual.cpp" />
|
||||
|
|
|
@ -128,6 +128,12 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\experimental\jsb_cocos2dx_experimental_manual.h">
|
||||
<Filter>manual\experimental</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_physics3d_auto.hpp">
|
||||
<Filter>auto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\physics3d\jsb_cocos2dx_physics3d_manual.h">
|
||||
<Filter>manual\physics3d</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_3d_auto.cpp">
|
||||
|
@ -235,6 +241,12 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\experimental\jsb_cocos2dx_experimental_manual.cpp">
|
||||
<Filter>manual\experimental</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_physics3d_auto.cpp">
|
||||
<Filter>auto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\physics3d\jsb_cocos2dx_physics3d_manual.cpp">
|
||||
<Filter>manual\physics3d</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="auto">
|
||||
|
@ -276,6 +288,9 @@
|
|||
<Filter Include="manual\experimental">
|
||||
<UniqueIdentifier>{ddd3651e-c6e7-4dea-80c1-a0a3dc51a740}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="manual\physics3d">
|
||||
<UniqueIdentifier>{511b128d-2604-48af-88e1-8cc0eba79e19}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\..\auto\api\jsb_cocos2dx_3d_auto_api.js">
|
||||
|
|
|
@ -126,10 +126,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -146,10 +146,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
|
@ -168,10 +168,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -188,10 +188,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
|
@ -210,10 +210,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -230,10 +230,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
|
|
|
@ -91,10 +91,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -111,10 +111,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
|
@ -133,10 +133,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -153,10 +153,10 @@
|
|||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<CompileAsWinRT>true</CompileAsWinRT>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
|
|
|
@ -135,5 +135,8 @@ if (jsb.Sprite3D){
|
|||
}
|
||||
|
||||
if (jsb.ParticleSystem3D) {
|
||||
require('script/3d/jsb_cocos2d_3d_ext.js');
|
||||
}
|
||||
require('script/3d/jsb_cocos2d_3d_ext.js');
|
||||
}
|
||||
|
||||
if(cc.Physics3DObject)
|
||||
require("script/physics3d/jsb_physics3d.js");
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2014 Chukong Technologies Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
cc.Physics3DRigidBodyDes = function(){
|
||||
this.mass = 0;
|
||||
this.localInertia = cc.math.vec3(0, 0, 0);
|
||||
this.shape = null;
|
||||
this.originalTransform = [1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0];
|
||||
this.disableSleep = false;
|
||||
};
|
||||
|
||||
cc.physics3DRigidBodyDes = function(){
|
||||
return new cc.Physics3DRigidBodyDes();
|
||||
};
|
||||
|
||||
cc.Physics3DComponent.PhysicsSyncFlag = {
|
||||
NONE : 0,
|
||||
NODE_TO_PHYSICS : 1, //align node transform to the physics
|
||||
PHYSICS_TO_NODE : 2, // align physics transform to the node
|
||||
NODE_AND_NODE : 1 | 2, //pre simulation, align the physics object to the node and align the node transform according to physics object after simulation
|
||||
};
|
|
@ -188,6 +188,7 @@
|
|||
|
||||
"src/SpritePolygonTest/SpritePolygonTest.js",
|
||||
"src/MaterialSystemTest/MaterialSystemTest.js",
|
||||
"src/TerrainTest/TerrainTest.js"
|
||||
"src/TerrainTest/TerrainTest.js",
|
||||
"src/Physics3DTest/Physics3DTest.js"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "jsb_cocos2dx_3d_auto.hpp"
|
||||
#include "jsb_cocos2dx_3d_extension_auto.hpp"
|
||||
#include "jsb_cocos2dx_experimental.hpp"
|
||||
#include "jsb_cocos2dx_physics3d_auto.hpp"
|
||||
#include "physics3d/jsb_cocos2dx_physics3d_manual.h"
|
||||
#include "experimental/jsb_cocos2dx_experimental_manual.h"
|
||||
#include "3d/jsb_cocos2dx_3d_manual.h"
|
||||
#include "extension/jsb_cocos2dx_extension_manual.h"
|
||||
|
@ -107,6 +109,9 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
|
||||
sc->addRegisterCallback(register_all_cocos2dx_experimental);
|
||||
sc->addRegisterCallback(register_all_cocos2dx_experimental_manual);
|
||||
|
||||
sc->addRegisterCallback(register_all_cocos2dx_physics3d);
|
||||
sc->addRegisterCallback(register_all_cocos2dx_physics3d_manual);
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
|
||||
|
|
|
@ -0,0 +1,649 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2008-2010 Ricardo Quesada
|
||||
Copyright (c) 2011-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
var Physics3DTestIdx = -1;
|
||||
|
||||
var physicsScene = null;
|
||||
|
||||
const START_POS_X = -0.5;
|
||||
const START_POS_Y = -2.5;
|
||||
const START_POS_Z = -0.5;
|
||||
|
||||
const ARRAY_SIZE_X = 4;
|
||||
const ARRAY_SIZE_Y = 3;
|
||||
const ARRAY_SIZE_Z = 4;
|
||||
|
||||
var Physics3DTestDemo = cc.Layer.extend({
|
||||
_title:"Physics3D Test",
|
||||
_subtitle:"",
|
||||
_camera:null,
|
||||
_angle:0.0,
|
||||
_needShootBox:false,
|
||||
|
||||
ctor:function () {
|
||||
this._super();
|
||||
|
||||
var size = cc.winSize;
|
||||
this._camera = cc.Camera.createPerspective(30.0, size.width / size.height, 1.0, 1000.0);
|
||||
this._camera.setPosition3D(cc.math.vec3(0, 50, 100));
|
||||
this._camera.lookAt(cc.math.vec3(0, 0, 0), cc.math.vec3(0, 1, 0));
|
||||
this._camera.setCameraFlag(cc.CameraFlag.USER1);
|
||||
this.addChild(this._camera);
|
||||
|
||||
cc.eventManager.addListener({
|
||||
event:cc.EventListener.TOUCH_ALL_AT_ONCE,
|
||||
onTouchesBegan:this.onTouchesBegan.bind(this),
|
||||
onTouchesMoved:this.onTouchesMoved.bind(this),
|
||||
onTouchesEnded:this.onTouchesEnded.bind(this)
|
||||
}, this);
|
||||
|
||||
var label = new cc.LabelTTF("DebugDraw OFF");
|
||||
var menuItem = new cc.MenuItemLabel(label, function(){
|
||||
if(physicsScene.getPhysics3DWorld().isDebugDrawEnabled()){
|
||||
physicsScene.getPhysics3DWorld().setDebugDrawEnable(false);
|
||||
label.setString("DebugDraw OFF");
|
||||
}else{
|
||||
physicsScene.getPhysics3DWorld().setDebugDrawEnable(true);
|
||||
label.setString("DebugDraw ON");
|
||||
}
|
||||
}, this);
|
||||
|
||||
var menu = new cc.Menu(menuItem);
|
||||
menu.setPosition(cc.p(0, 0));
|
||||
menuItem.setAnchorPoint(cc.p(0, 1));
|
||||
menuItem.setPosition(cc.p(cc.visibleRect.left.x, cc.visibleRect.top.y - 50));
|
||||
this.addChild(menu);
|
||||
},
|
||||
|
||||
onTouchesBegan:function(touches, event){
|
||||
this._needShootBox = true;
|
||||
},
|
||||
|
||||
onTouchesMoved:function(touches, event){
|
||||
if(touches.length > 0 && this._camera){
|
||||
var touch = touches[0];
|
||||
var delta = touch.getDelta();
|
||||
|
||||
this._angle -= cc.degreesToRadians(delta.x);
|
||||
this._camera.setPosition3D(cc.math.vec3(100*Math.sin(this._angle), 50, 100*Math.cos(this._angle)));
|
||||
this._camera.lookAt(cc.math.vec3(0, 0, 0), cc.math.vec3(0, 1, 0));
|
||||
|
||||
if(delta.x * delta.x + delta.y + delta.y > 16)
|
||||
this._needShootBox = false;
|
||||
}
|
||||
},
|
||||
|
||||
onTouchesEnded:function(touches, event){
|
||||
if(!this._needShootBox)
|
||||
return;
|
||||
if(touches.length > 0){
|
||||
var location = touches[0].getLocationInView();
|
||||
|
||||
var nearP = cc.math.vec3(location.x, location.y, -1);
|
||||
var farP = cc.math.vec3(location.x, location.y, 1);
|
||||
nearP = this._camera.unproject(nearP);
|
||||
farP = this._camera.unproject(farP);
|
||||
|
||||
var dir = cc.math.vec3Sub(farP, nearP);
|
||||
this.shootBox(cc.math.vec3Add(this._camera.getPosition3D(), cc.math.vec3(dir.x*10, dir.y*10, dir.z*10)));
|
||||
}
|
||||
},
|
||||
|
||||
shootBox:function(des){
|
||||
var rbDes = cc.physics3DRigidBodyDes();
|
||||
var linearVel = cc.math.vec3Sub(des, this._camera.getPosition3D());
|
||||
linearVel.normalize();
|
||||
linearVel.x *= 100;
|
||||
linearVel.y *= 100;
|
||||
linearVel.z *= 100;
|
||||
|
||||
rbDes.mass = 1;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(0.5, 0.5, 0.5));
|
||||
var v = this._camera.getPosition3D();
|
||||
rbDes.originalTransform[12] = v.x;
|
||||
rbDes.originalTransform[13] = v.y;
|
||||
rbDes.originalTransform[14] = v.z;
|
||||
var sprite = cc.PhysicsSprite3D.create("Sprite3DTest/box.c3t", rbDes);
|
||||
sprite.setTexture("Images/Icon.png");
|
||||
|
||||
var rigidBody = sprite.getPhysicsObj();
|
||||
rigidBody.setLinearFactor(cc.math.vec3(1, 1, 1));
|
||||
rigidBody.setLinearVelocity(linearVel);
|
||||
rigidBody.setAngularVelocity(cc.math.vec3(0, 0, 0));
|
||||
rigidBody.setCcdMotionThreshold(0.5);
|
||||
rigidBody.setCcdSweptSphereRadius(0.4);
|
||||
|
||||
this.addChild(sprite);
|
||||
sprite.setPosition3D(this._camera.getPosition3D());
|
||||
sprite.setScale(0.5);
|
||||
sprite.syncToNode();
|
||||
sprite.setSyncFlag(cc.Physics3DComponent.PhysicsSyncFlag.PHYSICS_TO_NODE);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
},
|
||||
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
onEnter:function () {
|
||||
this._super();
|
||||
|
||||
var label = new cc.LabelTTF(this._title, "Arial", 28);
|
||||
this.addChild(label, 100, BASE_TEST_TITLE_TAG);
|
||||
label.x = winSize.width / 2;
|
||||
label.y = winSize.height - 50;
|
||||
|
||||
var label2 = new cc.LabelTTF(this._subtitle, "Thonburi", 16);
|
||||
this.addChild(label2, 101, BASE_TEST_SUBTITLE_TAG);
|
||||
label2.x = winSize.width / 2;
|
||||
label2.y = winSize.height - 80;
|
||||
|
||||
var item1 = new cc.MenuItemImage(s_pathB1, s_pathB2, this.onBackCallback, this);
|
||||
var item2 = new cc.MenuItemImage(s_pathR1, s_pathR2, this.onRestartCallback, this);
|
||||
var item3 = new cc.MenuItemImage(s_pathF1, s_pathF2, this.onNextCallback, this);
|
||||
|
||||
item1.tag = BASE_TEST_MENUITEM_PREV_TAG;
|
||||
item2.tag = BASE_TEST_MENUITEM_RESET_TAG;
|
||||
item3.tag = BASE_TEST_MENUITEM_NEXT_TAG;
|
||||
|
||||
var menu = new cc.Menu(item1, item2, item3);
|
||||
|
||||
menu.x = 0;
|
||||
menu.y = 0;
|
||||
var width = item2.width, height = item2.height;
|
||||
item1.x = winSize.width/2 - width*2;
|
||||
item1.y = height/2 ;
|
||||
item2.x = winSize.width/2;
|
||||
item2.y = height/2 ;
|
||||
item3.x = winSize.width/2 + width*2;
|
||||
item3.y = height/2 ;
|
||||
|
||||
this.addChild(menu, 102, BASE_TEST_MENU_TAG);
|
||||
},
|
||||
|
||||
onRestartCallback:function (sender) {
|
||||
var s = new Physics3DTestScene();
|
||||
s.addChild(restartPhysics3DTest());
|
||||
director.runScene(s);
|
||||
},
|
||||
|
||||
onNextCallback:function (sender) {
|
||||
var s = new Physics3DTestScene();
|
||||
s.addChild(nextPhysics3DTest());
|
||||
director.runScene(s);
|
||||
},
|
||||
|
||||
onBackCallback:function (sender) {
|
||||
var s = new Physics3DTestScene();
|
||||
s.addChild(previousPhysics3DTest());
|
||||
director.runScene(s);
|
||||
}
|
||||
});
|
||||
|
||||
var Physics3DTestScene = cc.Scene.extend({
|
||||
ctor:function () {
|
||||
this._super();
|
||||
|
||||
var label = new cc.LabelTTF("Main Menu", "Arial", 20);
|
||||
var menuItem = new cc.MenuItemLabel(label, this.onMainMenuCallback, this);
|
||||
|
||||
var menu = new cc.Menu(menuItem);
|
||||
menu.x = 0;
|
||||
menu.y = 0;
|
||||
menuItem.x = winSize.width - 50;
|
||||
menuItem.y = 25;
|
||||
this.addChild(menu);
|
||||
|
||||
this.initWithPhysics();
|
||||
this.getPhysics3DWorld().setDebugDrawEnable(false);
|
||||
physicsScene = this;
|
||||
},
|
||||
onMainMenuCallback:function () {
|
||||
var scene = new cc.Scene();
|
||||
var layer = new TestController();
|
||||
scene.addChild(layer);
|
||||
director.runScene(scene);
|
||||
},
|
||||
runThisTest:function (num) {
|
||||
Physics3DTestIdx = (num || num == 0) ? (num - 1) : -1;
|
||||
var layer = nextPhysics3DTest();
|
||||
this.addChild(layer);
|
||||
|
||||
director.runScene(this);
|
||||
}
|
||||
});
|
||||
|
||||
var BasicPhysics3DDemo = Physics3DTestDemo.extend({
|
||||
_subtitle:"Basic Physics3D",
|
||||
|
||||
ctor:function(){
|
||||
this._super();
|
||||
|
||||
var rbDes = cc.physics3DRigidBodyDes();
|
||||
rbDes.mass = 0;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(60, 1, 60));
|
||||
|
||||
var floor = cc.PhysicsSprite3D.create("Sprite3DTest/box.c3t", rbDes);
|
||||
floor.setTexture("Sprite3DTest/plane.png");
|
||||
floor.setScaleX(60);
|
||||
floor.setScaleZ(60);
|
||||
this.addChild(floor);
|
||||
floor.setCameraMask(cc.CameraFlag.USER1);
|
||||
floor.syncToNode();
|
||||
//static object sync is not needed
|
||||
floor.setSyncFlag(cc.Physics3DComponent.PhysicsSyncFlag.NONE);
|
||||
|
||||
//create several boxes using PhysicsSprite3D
|
||||
rbDes.mass = 1;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(0.8, 0.8, 0.8));
|
||||
var start_x = START_POS_X - ARRAY_SIZE_X/2;
|
||||
var start_y = START_POS_Y;
|
||||
var start_z = START_POS_Z - ARRAY_SIZE_Z/2;
|
||||
|
||||
for(var k = 0; k < ARRAY_SIZE_Y; ++k){
|
||||
for(var i = 0; i < ARRAY_SIZE_X; ++i){
|
||||
for(var j = 0; j < ARRAY_SIZE_Z; ++j){
|
||||
var x = i + start_x,
|
||||
y = 5 + k + start_y,
|
||||
z = j + start_z;
|
||||
var sprite = cc.PhysicsSprite3D.create("Sprite3DTest/box.c3t", rbDes);
|
||||
sprite.setTexture("Images/CyanSquare.png");
|
||||
sprite.setPosition3D(cc.math.vec3(x, y, z));
|
||||
sprite.syncToNode();
|
||||
sprite.setSyncFlag(cc.Physics3DComponent.PhysicsSyncFlag.PHYSICS_TO_NODE);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
sprite.setScale(0.8);
|
||||
this.addChild(sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
physicsScene.setPhysics3DDebugCamera(this._camera);
|
||||
}
|
||||
});
|
||||
|
||||
var Physics3DConstraintDemo = Physics3DTestDemo.extend({
|
||||
_subtitle:"Physics3D Constraint",
|
||||
|
||||
ctor:function(){
|
||||
this._super();
|
||||
|
||||
//PhysicsSprite3d = Sprite3D + Physics3DComponent
|
||||
var rbDes = cc.physics3DRigidBodyDes();
|
||||
rbDes.disableSleep = true;
|
||||
rbDes.mass = 10;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(5, 5, 5));
|
||||
|
||||
var rigidBody = cc.Physics3DRigidBody.create(rbDes);
|
||||
var quat = cc.math.quaternion(cc.math.vec3(0, 1, 0), cc.degreesToRadians(180));
|
||||
var component = cc.Physics3DComponent.create(rigidBody, cc.math.vec3(0, -3, 0), quat);
|
||||
|
||||
var sprite = new jsb.Sprite3D("Sprite3DTest/orc.c3b");
|
||||
sprite.addComponent(component);
|
||||
this.addChild(sprite);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
sprite.setScale(0.4);
|
||||
sprite.setPosition3D(cc.math.vec3(-20, 5, 0));
|
||||
component.syncToNode();
|
||||
component.setSyncFlag(cc.Physics3DComponent.PhysicsSyncFlag.PHYSICS_TO_NODE);
|
||||
|
||||
physicsScene.setPhysics3DDebugCamera(this._camera);
|
||||
|
||||
//create point to point constraint
|
||||
var constraint = cc.Physics3DPointToPointConstraint.create(rigidBody, cc.math.vec3(2.5, 2.5, 2.5));
|
||||
physicsScene.getPhysics3DWorld().addPhysics3DConstraint(constraint);
|
||||
|
||||
//create hinge constraint
|
||||
rbDes.mass = 1;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(8, 8, 1));
|
||||
rigidBody = cc.Physics3DRigidBody.create(rbDes);
|
||||
component = cc.Physics3DComponent.create(rigidBody);
|
||||
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
|
||||
sprite.setTexture("Sprite3DTest/plane.png");
|
||||
sprite.setScaleX(8);
|
||||
sprite.setScaleZ(8);
|
||||
sprite.setPosition3D(cc.math.vec3(5, 0, 0));
|
||||
sprite.addComponent(component);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
this.addChild(sprite);
|
||||
component.syncToNode();
|
||||
rigidBody.setAngularVelocity(cc.math.vec3(0, 3, 0));
|
||||
constraint = cc.Physics3DHingeConstraint.create(rigidBody, cc.math.vec3(4, 4, 0.5), cc.math.vec3(0, 1, 0));
|
||||
physicsScene.getPhysics3DWorld().addPhysics3DConstraint(constraint);
|
||||
|
||||
//create slider constraint
|
||||
rbDes.mass = 1;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(3, 2, 3));
|
||||
rigidBody = cc.Physics3DRigidBody.create(rbDes);
|
||||
component = cc.Physics3DComponent.create(rigidBody);
|
||||
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
|
||||
sprite.setTexture("Sprite3DTest/plane.png");
|
||||
sprite.setScaleX(3);
|
||||
sprite.setScaleZ(3);
|
||||
sprite.setPosition3D(cc.math.vec3(30, 15, 0));
|
||||
sprite.addComponent(component);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
this.addChild(sprite);
|
||||
component.syncToNode();
|
||||
rigidBody.setLinearVelocity(cc.math.vec3(0, 3, 0));
|
||||
|
||||
rbDes.mass = 0;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(3, 3, 3));
|
||||
var rigidBodyB = cc.Physics3DRigidBody.create(rbDes);
|
||||
component = cc.Physics3DComponent.create(rigidBodyB);
|
||||
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
|
||||
sprite.setTexture("Sprite3DTest/plane.png");
|
||||
sprite.setScale(3);
|
||||
sprite.setPosition3D(cc.math.vec3(30, 5, 0));
|
||||
sprite.addComponent(component);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
this.addChild(sprite);
|
||||
component.syncToNode();
|
||||
|
||||
var frameInA = [-4.37114e-08, 1, 0, 0, -1, -4.37114e-08, 0, 0, 0, 0, 1, 0, 0, -5, 0, 1];
|
||||
var frameInB = [-4.37114e-08, 1, 0, 0, -1, -4.37114e-08, 0, 0, 0, 0, 1, 0, 0, 5, 0, 1];
|
||||
constraint = cc.Physics3DSliderConstraint.create(rigidBody, rigidBodyB, frameInA, frameInB, false);
|
||||
physicsScene.getPhysics3DWorld().addPhysics3DConstraint(constraint);
|
||||
constraint.setLowerLinLimit(-5);
|
||||
constraint.setUpperLinLimit(5);
|
||||
|
||||
//create ConeTwist constraint
|
||||
rbDes.mass = 1;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(3, 3, 3));
|
||||
rigidBody = cc.Physics3DRigidBody.create(rbDes);
|
||||
component = cc.Physics3DComponent.create(rigidBody);
|
||||
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
|
||||
sprite.setTexture("Sprite3DTest/plane.png");
|
||||
sprite.setScale(3);
|
||||
sprite.setPosition3D(cc.math.vec3(-10, 5, 5));
|
||||
sprite.addComponent(component);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
this.addChild(sprite);
|
||||
component.syncToNode();
|
||||
|
||||
frameInA = [-4.37114e-08, 1, 0, 0, -1, -4.37114e-08, 0, 0, 0, 0, 1, 0, 0, -10, 0, 1];
|
||||
constraint = cc.Physics3DConeTwistConstraint.create(rigidBody, frameInA);
|
||||
physicsScene.getPhysics3DWorld().addPhysics3DConstraint(constraint, true);
|
||||
constraint.setLimit(cc.degreesToRadians(10), cc.degreesToRadians(10), cc.degreesToRadians(40));
|
||||
|
||||
//create 6 dof constraint
|
||||
rbDes.mass = 1;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(3, 3, 3));
|
||||
rigidBody = cc.Physics3DRigidBody.create(rbDes);
|
||||
component = cc.Physics3DComponent.create(rigidBody);
|
||||
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
|
||||
sprite.setTexture("Sprite3DTest/plane.png");
|
||||
sprite.setScale(3);
|
||||
sprite.setPosition3D(cc.math.vec3(30, -5, 0));
|
||||
sprite.addComponent(component);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
this.addChild(sprite);
|
||||
component.syncToNode();
|
||||
|
||||
frameInA = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
||||
constraint = cc.Physics3D6DofConstraint.create(rigidBody, frameInA, false);
|
||||
physicsScene.getPhysics3DWorld().addPhysics3DConstraint(constraint);
|
||||
constraint.setAngularLowerLimit(cc.math.vec3(0, 0, 0));
|
||||
constraint.setAngularUpperLimit(cc.math.vec3(0, 0, 0));
|
||||
constraint.setLinearLowerLimit(cc.math.vec3(-10, 0, 0));
|
||||
constraint.setLinearUpperLimit(cc.math.vec3(10, 0, 0));
|
||||
}
|
||||
});
|
||||
|
||||
var Physics3DKinematicDemo = Physics3DTestDemo.extend({
|
||||
_subtitle:"Physics3D Kinematic",
|
||||
|
||||
ctor:function(){
|
||||
this._super();
|
||||
|
||||
var rbDes = cc.physics3DRigidBodyDes();
|
||||
rbDes.mass = 0;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(60, 1, 60));
|
||||
|
||||
var floor = cc.PhysicsSprite3D.create("Sprite3DTest/box.c3t", rbDes);
|
||||
floor.setTexture("Sprite3DTest/plane.png");
|
||||
floor.setScaleX(60);
|
||||
floor.setScaleZ(60);
|
||||
floor.setPosition3D(cc.math.vec3(0, -1, 0));
|
||||
this.addChild(floor);
|
||||
floor.setCameraMask(cc.CameraFlag.USER1);
|
||||
floor.syncToNode();
|
||||
//static object sync is not needed
|
||||
floor.setSyncFlag(cc.Physics3DComponent.PhysicsSyncFlag.NONE);
|
||||
|
||||
//create Kinematics
|
||||
for(let i = 0; i < 3; ++i){
|
||||
rbDes.mass = 0;
|
||||
rbDes.shape = cc.Physics3DShape.createBox(cc.math.vec3(2, 2, 2));
|
||||
|
||||
let sprite = cc.PhysicsSprite3D.create("Sprite3DTest/box.c3t", rbDes);
|
||||
sprite.setTexture("Images/CyanSquare.png");
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
let rigidBody = sprite.getPhysicsObj();
|
||||
rigidBody.setKinematic(true);
|
||||
|
||||
this.addChild(sprite);
|
||||
|
||||
sprite.setScale(2);
|
||||
sprite.setPosition3D(cc.math.vec3(-15, 0, 15-15*i));
|
||||
let moveby = cc.moveBy(2+i, cc.math.vec3(30, 0, 0));
|
||||
sprite.runAction(cc.sequence(moveby, moveby.reverse()).repeatForever());
|
||||
}
|
||||
|
||||
//create Dynamic
|
||||
rbDes.mass = 1;
|
||||
rbDes.shape = cc.Physics3DShape.createSphere(0.5);
|
||||
var start_x = START_POS_X - ARRAY_SIZE_X/2;
|
||||
var start_y = START_POS_Y + 5;
|
||||
var start_z = START_POS_Z - ARRAY_SIZE_Z/2;
|
||||
|
||||
for(var k = 0; k < ARRAY_SIZE_Y; ++k){
|
||||
for(var i = 0; i < ARRAY_SIZE_X; ++i){
|
||||
for(var j = 0; j < ARRAY_SIZE_Z; ++j){
|
||||
var x = i + start_x,
|
||||
y = 5 + k + start_y,
|
||||
z = j + start_z;
|
||||
|
||||
rbDes.originalTransform[12] = x;
|
||||
rbDes.originalTransform[13] = y;
|
||||
rbDes.originalTransform[14] = z;
|
||||
|
||||
var sprite = cc.PhysicsSprite3D.create("Sprite3DTest/sphere.c3b", rbDes);
|
||||
sprite.setTexture("Sprite3DTest/plane.png");
|
||||
sprite.setPosition3D(cc.math.vec3(x, y, z));
|
||||
sprite.syncToNode();
|
||||
sprite.setSyncFlag(cc.Physics3DComponent.PhysicsSyncFlag.PHYSICS_TO_NODE);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
sprite.setScale(1/sprite.getContentSize().width);
|
||||
this.addChild(sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
physicsScene.setPhysics3DDebugCamera(this._camera);
|
||||
}
|
||||
});
|
||||
|
||||
var Physics3DCollisionCallbackDemo = Physics3DTestDemo.extend({
|
||||
_subtitle:"Physics3D CollisionCallback",
|
||||
|
||||
ctor:function(){
|
||||
this._super();
|
||||
|
||||
var rbDes = cc.physics3DRigidBodyDes();
|
||||
|
||||
var scale = 2;
|
||||
var trianglesList = jsb.Bundle3D.getTrianglesList("Sprite3DTest/boss.c3b");
|
||||
|
||||
for(var i = 0; i < trianglesList.length; ++i){
|
||||
trianglesList[i].x *= scale;
|
||||
trianglesList[i].y *= scale;
|
||||
trianglesList[i].z *= scale;
|
||||
}
|
||||
|
||||
rbDes.mass = 0;
|
||||
rbDes.shape = cc.Physics3DShape.createMesh(trianglesList, trianglesList.length/3);
|
||||
|
||||
var rigidBody = cc.Physics3DRigidBody.create(rbDes);
|
||||
var component = cc.Physics3DComponent.create(rigidBody);
|
||||
var sprite = new jsb.Sprite3D("Sprite3DTest/boss.c3b");
|
||||
sprite.addComponent(component);
|
||||
sprite.setRotation3D(cc.math.vec3(-90, 0, 0));
|
||||
sprite.setScale(scale);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
this.addChild(sprite);
|
||||
|
||||
rigidBody.setCollisionCallback(function(collisionInfo){
|
||||
if(collisionInfo.collisionPointList.length > 0 && collisionInfo.objA.getMask() != 0){
|
||||
var ps = jsb.PUParticleSystem3D.create("Particle3D/scripts/mp_hit_04.pu");
|
||||
ps.setPosition3D(collisionInfo.collisionPointList[0].worldPositionOnB);
|
||||
ps.setScale(0.05);
|
||||
ps.startParticleSystem();
|
||||
ps.setCameraMask(2);
|
||||
this.addChild(ps);
|
||||
|
||||
ps.runAction(cc.sequence(cc.delayTime(1), cc.callFunc(function(){
|
||||
ps.removeFromParent();
|
||||
})));
|
||||
|
||||
collisionInfo.objA.setMask(0);
|
||||
}
|
||||
|
||||
}, this);
|
||||
|
||||
physicsScene.setPhysics3DDebugCamera(this._camera);
|
||||
}
|
||||
});
|
||||
|
||||
var Physics3DTerrainDemo = Physics3DTestDemo.extend({
|
||||
_subtitle:"Physics3D Terrain",
|
||||
|
||||
ctor:function(){
|
||||
this._super();
|
||||
|
||||
var r = jsb.Terrain.detailMap("TerrainTest/dirt.jpg"),
|
||||
g = jsb.Terrain.detailMap("TerrainTest/Grass2.jpg", 10),
|
||||
b = jsb.Terrain.detailMap("TerrainTest/road.jpg"),
|
||||
a = jsb.Terrain.detailMap("TerrainTest/GreenSkin.jpg", 20);
|
||||
var data = jsb.Terrain.terrainData(
|
||||
"TerrainTest/heightmap129.jpg",
|
||||
"TerrainTest/alphamap.png",
|
||||
[r, g, b, a],
|
||||
cc.size(32,32),
|
||||
20,
|
||||
1
|
||||
);
|
||||
|
||||
var terrain = jsb.Terrain.create(data, jsb.Terrain.CrackFixedType.SKIRT);
|
||||
terrain.setSkirtHeightRatio(3);
|
||||
terrain.setLODDistance(64, 128, 192);
|
||||
terrain.setMaxDetailMapAmount(4);
|
||||
terrain.setCameraMask(2);
|
||||
terrain.setDrawWire(false);
|
||||
|
||||
var rbDes = cc.physics3DRigidBodyDes();
|
||||
rbDes.mass = 0;
|
||||
|
||||
var heightData = terrain.getHeightData();
|
||||
var size = terrain.getTerrainSize();
|
||||
rbDes.shape = cc.Physics3DShape.createHeightfield(size.width, size.height, heightData, 1.0, terrain.getMinHeight(), terrain.getMaxHeight(), true, false, true);
|
||||
var rigidBody = cc.Physics3DRigidBody.create(rbDes);
|
||||
var component = cc.Physics3DComponent.create(rigidBody);
|
||||
terrain.addComponent(component);
|
||||
component.syncToNode();
|
||||
component.setSyncFlag(cc.Physics3DComponent.PhysicsSyncFlag.NONE);
|
||||
|
||||
this.addChild(terrain);
|
||||
|
||||
//create several spheres
|
||||
rbDes.mass = 1;
|
||||
rbDes.shape = cc.Physics3DShape.createSphere(0.5);
|
||||
var start_x = START_POS_X - ARRAY_SIZE_X/2 + 5;
|
||||
var start_y = START_POS_Y + 20;
|
||||
var start_z = START_POS_Z - ARRAY_SIZE_Z/2;
|
||||
|
||||
for(var k = 0; k < ARRAY_SIZE_Y; ++k){
|
||||
for(var i = 0; i < ARRAY_SIZE_X; ++i){
|
||||
for(var j = 0; j < ARRAY_SIZE_Z; ++j){
|
||||
var x = i + start_x,
|
||||
y = 5 + k + start_y,
|
||||
z = j + start_z;
|
||||
|
||||
var sprite = cc.PhysicsSprite3D.create("Sprite3DTest/sphere.c3b", rbDes);
|
||||
sprite.setTexture("Sprite3DTest/plane.png");
|
||||
sprite.setPosition3D(cc.math.vec3(x, y, z));
|
||||
sprite.syncToNode();
|
||||
sprite.setSyncFlag(cc.Physics3DComponent.PhysicsSyncFlag.PHYSICS_TO_NODE);
|
||||
sprite.setCameraMask(cc.CameraFlag.USER1);
|
||||
sprite.setScale(1/sprite.getContentSize().width);
|
||||
this.addChild(sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//create mesh
|
||||
var trianglesList = jsb.Bundle3D.getTrianglesList("Sprite3DTest/boss.c3b");
|
||||
rbDes.mass = 0;
|
||||
rbDes.shape = cc.Physics3DShape.createMesh(trianglesList, trianglesList.length/3);
|
||||
rigidBody = cc.Physics3DRigidBody.create(rbDes);
|
||||
component = cc.Physics3DComponent.create(rigidBody);
|
||||
var sprite = new jsb.Sprite3D("Sprite3DTest/boss.c3b");
|
||||
sprite.addComponent(component);
|
||||
sprite.setRotation3D(cc.math.vec3(-90, 0, 0));
|
||||
sprite.setPosition3D(cc.math.vec3(0, 15, 0));
|
||||
sprite.setCameraMask(2);
|
||||
this.addChild(sprite);
|
||||
|
||||
|
||||
physicsScene.setPhysics3DDebugCamera(this._camera);
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
// Flow control
|
||||
//
|
||||
var arrayOfPhysics3DTest = [
|
||||
BasicPhysics3DDemo,
|
||||
Physics3DConstraintDemo,
|
||||
Physics3DKinematicDemo,
|
||||
Physics3DCollisionCallbackDemo,
|
||||
Physics3DTerrainDemo
|
||||
];
|
||||
|
||||
var nextPhysics3DTest = function () {
|
||||
Physics3DTestIdx++;
|
||||
Physics3DTestIdx = Physics3DTestIdx % arrayOfPhysics3DTest.length;
|
||||
|
||||
return new arrayOfPhysics3DTest[Physics3DTestIdx ]();
|
||||
};
|
||||
var previousPhysics3DTest = function () {
|
||||
Physics3DTestIdx--;
|
||||
if (Physics3DTestIdx < 0)
|
||||
Physics3DTestIdx += arrayOfPhysics3DTest.length;
|
||||
|
||||
return new arrayOfPhysics3DTest[Physics3DTestIdx ]();
|
||||
};
|
||||
var restartPhysics3DTest = function () {
|
||||
return new arrayOfPhysics3DTest[Physics3DTestIdx ]();
|
||||
};
|
|
@ -530,6 +530,14 @@ var testNames = [
|
|||
return new PerformanceTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"Physics3D Test",
|
||||
platforms: PLATFORM_JSB,
|
||||
linksrc:"src/Physics3DTest/Physics3DTest.js",
|
||||
testScene:function () {
|
||||
return new Physics3DTestScene();
|
||||
}
|
||||
},
|
||||
{
|
||||
title:"ProgressActions Test",
|
||||
platforms: PLATFORM_ALL,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 5a75fd5df1fbafc81093700deb67fce8cd4861c1
|
||||
Subproject commit 0b64fbf99ef824bc33a56fe584ec78aedbdb464f
|
|
@ -22,11 +22,11 @@ cxxgenerator_headers =
|
|||
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
|
||||
|
||||
# what headers to parse
|
||||
headers = %(cocosdir)s/cocos/cocos2d.h
|
||||
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/3d/CCBundle3D.h
|
||||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
||||
classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard Sprite3DCache TextureCube Skybox Terrain
|
||||
classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard Sprite3DCache TextureCube Skybox Terrain Bundle3D
|
||||
|
||||
classes_need_extend = Sprite3D
|
||||
|
||||
|
@ -43,7 +43,8 @@ skip = Skeleton3D::[create],
|
|||
Sprite3DCache::[addSprite3DData getSpriteData],
|
||||
Animation3D::[getBoneCurves],
|
||||
TextureCube::[setTexParameters],
|
||||
Terrain::[getAABB getQuadTree create getHeightData]
|
||||
Terrain::[getAABB getQuadTree create getHeightData],
|
||||
Bundle3D::[getTrianglesList calculateAABB]
|
||||
|
||||
|
||||
rename_functions =
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
[cocos2dx_physics3d]
|
||||
# the prefix to be added to the generated functions. You might or might not use this in your own
|
||||
# templates
|
||||
prefix = cocos2dx_physics3d
|
||||
|
||||
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
|
||||
# all classes will be embedded in that namespace
|
||||
target_namespace = cc
|
||||
|
||||
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
|
||||
android_flags = -D_SIZE_T_DEFINED_
|
||||
|
||||
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
|
||||
clang_flags = -nostdinc -x c++ -std=c++11 -D CC_ENABLE_BULLET_INTEGRATION -D CC_USE_3D_PHYSICS
|
||||
|
||||
win32_clang_flags = -U __SSE__
|
||||
|
||||
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external
|
||||
|
||||
cocos_flags = -DANDROID
|
||||
|
||||
cxxgenerator_headers =
|
||||
|
||||
# extra arguments for clang
|
||||
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
|
||||
|
||||
# what headers to parse
|
||||
headers = %(cocosdir)s/cocos/physics3d/CCPhysics3D.h
|
||||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
||||
classes = Physics3DWorld Physics3DShape PhysicsSprite3D Physics3DObject Physics3DRigidBody Physics3DShapesk Physics3DComponent Physics3DConstraint Physics3DPointToPointConstraint Physics3DHingeConstraint Physics3DSliderConstraint Physics3DConeTwistConstraint Physics3D6DofConstraint
|
||||
|
||||
# what should we skip? in the format ClassName::[function function]
|
||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
|
||||
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
|
||||
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
|
||||
# functions from all classes.
|
||||
|
||||
skip = Physics3DShape::[createCompoundShape createMesh createHeightfield],
|
||||
Physics3DObject::[setCollisionCallback],
|
||||
Physics3DWorld::[getPhysicsObjects],
|
||||
Physics3DConeTwistConstraint::[setMotorTarget setMotorTargetInConstraintSpace],
|
||||
PhysicsSprite3D::[create],
|
||||
Physics3DRigidBody::[create]
|
||||
|
||||
rename_functions =
|
||||
|
||||
rename_classes =
|
||||
|
||||
# for all class names, should we remove something when registering in the target VM?
|
||||
remove_prefix =
|
||||
|
||||
# classes for which there will be no "parent" lookup
|
||||
classes_have_no_parents =
|
||||
|
||||
# base classes which will be skipped when their sub-classes found them.
|
||||
base_classes_to_skip = Ref
|
||||
|
||||
# classes that create no constructor
|
||||
# Set is special and we will use a hand-written constructor
|
||||
abstract_classes = Physics3DObject
|
||||
|
||||
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
|
||||
script_control_cpp = no
|
|
@ -142,7 +142,8 @@ def main():
|
|||
'cocos2dx_spine.ini' : ('cocos2dx_spine', 'jsb_cocos2dx_spine_auto'), \
|
||||
'cocos2dx_3d.ini' : ('cocos2dx_3d', 'jsb_cocos2dx_3d_auto'), \
|
||||
'cocos2dx_3d_ext.ini' : ('cocos2dx_3d_extension', 'jsb_cocos2dx_3d_extension_auto'), \
|
||||
'cocos2dx_experimental.ini' : ('cocos2dx_experimental', 'jsb_cocos2dx_experimental')
|
||||
'cocos2dx_experimental.ini' : ('cocos2dx_experimental', 'jsb_cocos2dx_experimental'), \
|
||||
'cocos2dx_physics3d.ini' : ('cocos2dx_physics3d', 'jsb_cocos2dx_physics3d_auto')
|
||||
}
|
||||
target = 'spidermonkey'
|
||||
generator_py = '%s/generator.py' % cxx_generator_root
|
||||
|
|
Loading…
Reference in New Issue