add Physics3DRigidBodyDes support new , add new file jsb_cocos2dx_3d_conversions.h and jsb_cocos2dx_3d_conversions.cpp

This commit is contained in:
jianglong0156 2015-07-27 18:19:10 +08:00
parent 9c6b5730d0
commit cb2b427eed
6 changed files with 26 additions and 12 deletions

View File

@ -21,6 +21,7 @@
<ClCompile Include="..\auto\jsb_cocos2dx_spine_auto.cpp" />
<ClCompile Include="..\auto\jsb_cocos2dx_studio_auto.cpp" />
<ClCompile Include="..\auto\jsb_cocos2dx_ui_auto.cpp" />
<ClCompile Include="..\manual\3d\jsb_cocos2dx_3d_conversions.cpp" />
<ClCompile Include="..\manual\3d\jsb_cocos2dx_3d_manual.cpp" />
<ClCompile Include="..\manual\chipmunk\js_bindings_chipmunk_auto_classes.cpp" />
<ClCompile Include="..\manual\chipmunk\js_bindings_chipmunk_functions.cpp" />
@ -61,6 +62,7 @@
<ClInclude Include="..\auto\jsb_cocos2dx_spine_auto.hpp" />
<ClInclude Include="..\auto\jsb_cocos2dx_studio_auto.hpp" />
<ClInclude Include="..\auto\jsb_cocos2dx_ui_auto.hpp" />
<ClInclude Include="..\manual\3d\jsb_cocos2dx_3d_conversions.h" />
<ClInclude Include="..\manual\3d\jsb_cocos2dx_3d_manual.h" />
<ClInclude Include="..\manual\chipmunk\js_bindings_chipmunk_auto_classes.h" />
<ClInclude Include="..\manual\chipmunk\js_bindings_chipmunk_auto_classes_registration.h" />
@ -204,4 +206,4 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\spidermonkey\prebuilt\win32\*.*"
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -161,6 +161,9 @@
<ClCompile Include="..\manual\navmesh\jsb_cocos2dx_navmesh_conversions.cpp">
<Filter>manual\navmesh</Filter>
</ClCompile>
<ClCompile Include="..\manual\3d\jsb_cocos2dx_3d_conversions.cpp">
<Filter>manual\3d</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\auto\jsb_cocos2dx_auto.hpp">
@ -298,5 +301,8 @@
<ClInclude Include="..\manual\navmesh\jsb_cocos2dx_navmesh_conversions.h">
<Filter>manual\navmesh</Filter>
</ClInclude>
<ClInclude Include="..\manual\3d\jsb_cocos2dx_3d_conversions.h">
<Filter>manual\3d</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -352,4 +352,8 @@ jsb.Physics3DPointToPointConstraint.prototype._ctor = function(first, second, th
{
throw new Error("error arguments");
}
}
jsb.Physics3DRigidBody.prototype._ctor = function(rigidBodyInfo){
this.init(rigidBodyInfo);
}

View File

@ -76,7 +76,7 @@ var NavMeshBaseTestDemo = NavMeshTestScene.extend({
var rbDes = jsb.physics3DRigidBodyDes();
rbDes.mass = 0;
rbDes.shape = jsb.Physics3DShape.createMesh(trianglesList, trianglesList.length/3);
var rigidBody = jsb.Physics3DRigidBody.create(rbDes);
var rigidBody = new jsb.Physics3DRigidBody(rbDes);
var component = new jsb.Physics3DComponent(rigidBody);
var sprite = jsb.Sprite3D.create("NavMesh/scene.obj");
sprite.addComponent(component);

View File

@ -302,7 +302,7 @@ var Physics3DConstraintDemo = Physics3DTestDemo.extend({
rbDes.mass = 10;
rbDes.shape = jsb.Physics3DShape.createBox(cc.math.vec3(5, 5, 5));
var rigidBody = jsb.Physics3DRigidBody.create(rbDes);
var rigidBody = new jsb.Physics3DRigidBody(rbDes);
var quat = cc.math.quaternion(cc.math.vec3(0, 1, 0), cc.degreesToRadians(180));
var component = new jsb.Physics3DComponent(rigidBody, cc.math.vec3(0, -3, 0), quat);
@ -325,7 +325,7 @@ var Physics3DConstraintDemo = Physics3DTestDemo.extend({
//create hinge constraint
rbDes.mass = 1;
rbDes.shape = jsb.Physics3DShape.createBox(cc.math.vec3(8, 8, 1));
rigidBody = jsb.Physics3DRigidBody.create(rbDes);
rigidBody = new jsb.Physics3DRigidBody(rbDes);
component = new jsb.Physics3DComponent(rigidBody);
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
sprite.setTexture("Sprite3DTest/plane.png");
@ -343,7 +343,7 @@ var Physics3DConstraintDemo = Physics3DTestDemo.extend({
//create slider constraint
rbDes.mass = 1;
rbDes.shape = jsb.Physics3DShape.createBox(cc.math.vec3(3, 2, 3));
rigidBody = jsb.Physics3DRigidBody.create(rbDes);
rigidBody = new jsb.Physics3DRigidBody(rbDes);
component = new jsb.Physics3DComponent(rigidBody);
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
sprite.setTexture("Sprite3DTest/plane.png");
@ -358,7 +358,7 @@ var Physics3DConstraintDemo = Physics3DTestDemo.extend({
rbDes.mass = 0;
rbDes.shape = jsb.Physics3DShape.createBox(cc.math.vec3(3, 3, 3));
var rigidBodyB = jsb.Physics3DRigidBody.create(rbDes);
var rigidBodyB = new jsb.Physics3DRigidBody(rbDes);
component = new jsb.Physics3DComponent(rigidBodyB);
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
sprite.setTexture("Sprite3DTest/plane.png");
@ -379,7 +379,7 @@ var Physics3DConstraintDemo = Physics3DTestDemo.extend({
//create ConeTwist constraint
rbDes.mass = 1;
rbDes.shape = jsb.Physics3DShape.createBox(cc.math.vec3(3, 3, 3));
rigidBody = jsb.Physics3DRigidBody.create(rbDes);
rigidBody = new jsb.Physics3DRigidBody(rbDes);
component = new jsb.Physics3DComponent(rigidBody);
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
sprite.setTexture("Sprite3DTest/plane.png");
@ -398,7 +398,7 @@ var Physics3DConstraintDemo = Physics3DTestDemo.extend({
//create 6 dof constraint
rbDes.mass = 1;
rbDes.shape = jsb.Physics3DShape.createBox(cc.math.vec3(3, 3, 3));
rigidBody = jsb.Physics3DRigidBody.create(rbDes);
rigidBody = new jsb.Physics3DRigidBody(rbDes);
component = new jsb.Physics3DComponent(rigidBody);
sprite = new jsb.Sprite3D("Sprite3DTest/box.c3t");
sprite.setTexture("Sprite3DTest/plane.png");
@ -570,7 +570,7 @@ var Physics3DCollisionCallbackDemo = Physics3DTestDemo.extend({
rbDes.mass = 0;
rbDes.shape = jsb.Physics3DShape.createMesh(trianglesList, trianglesList.length/3);
var rigidBody = jsb.Physics3DRigidBody.create(rbDes);
var rigidBody = new jsb.Physics3DRigidBody(rbDes);
var component = new jsb.Physics3DComponent(rigidBody);
var sprite = new jsb.Sprite3D("Sprite3DTest/boss.c3b");
sprite.addComponent(component);
@ -633,7 +633,7 @@ var Physics3DTerrainDemo = Physics3DTestDemo.extend({
var heightData = terrain.getHeightData();
var size = terrain.getTerrainSize();
rbDes.shape = jsb.Physics3DShape.createHeightfield(size.width, size.height, heightData, 1.0, terrain.getMinHeight(), terrain.getMaxHeight(), true, false, true);
var rigidBody = jsb.Physics3DRigidBody.create(rbDes);
var rigidBody = new jsb.Physics3DRigidBody(rbDes);
var component = new jsb.Physics3DComponent(rigidBody);
terrain.addComponent(component);
component.syncNodeToPhysics();
@ -671,7 +671,7 @@ var Physics3DTerrainDemo = Physics3DTestDemo.extend({
var trianglesList = jsb.Bundle3D.getTrianglesList("Sprite3DTest/boss.c3b");
rbDes.mass = 0;
rbDes.shape = jsb.Physics3DShape.createMesh(trianglesList, trianglesList.length/3);
rigidBody = jsb.Physics3DRigidBody.create(rbDes);
rigidBody = new jsb.Physics3DRigidBody(rbDes);
component = new jsb.Physics3DComponent(rigidBody);
var sprite = new jsb.Sprite3D("Sprite3DTest/boss.c3b");
sprite.addComponent(component);

View File

@ -17,7 +17,7 @@ clang_flags = -nostdinc -x c++ -std=c++11 -D CC_ENABLE_BULLET_INTEGRATION -D CC_
win32_clang_flags = -U __SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external
cocos_flags = -DANDROID
@ -29,6 +29,8 @@ extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s
# what headers to parse
headers = %(cocosdir)s/cocos/physics3d/CCPhysics3D.h
cpp_headers = 3d/jsb_cocos2dx_3d_conversions.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