Optional physics

This commit is contained in:
Lubos Lenco 2016-01-11 13:50:54 +01:00
parent 3b0862afe5
commit fc3b002c70
6 changed files with 14 additions and 7 deletions

View file

@ -1,6 +1,8 @@
package cycles.trait;
#if WITH_PHYSICS
import haxebullet.Bullet;
#end
import lue.trait.Trait;
import lue.sys.Time;
import lue.math.Vec3;
@ -17,7 +19,7 @@ class ContactPair {
class PhysicsWorld extends Trait {
#if (!js && !cpp)
#if (!WITH_PHYSICS)
public function new() { super(); }
#else

View file

@ -1,6 +1,8 @@
package cycles.trait;
#if WITH_PHYSICS
import haxebullet.Bullet;
#end
import lue.trait.Trait;
import lue.sys.Time;
import lue.math.Vec3;
@ -10,7 +12,7 @@ import cycles.Root;
class RigidBody extends Trait {
#if (!js && !cpp)
#if (!WITH_PHYSICS)
public function new() { super(); }
#else

View file

@ -21,7 +21,7 @@ def defaultSettings():
wrd['CGProjectHeight'] = 640
wrd['CGTargetScene'] = bpy.data.scenes[0].name
wrd['CGAA'] = 1
wrd['CGPhysics'] = 1
wrd['CGPhysics'] = 0
wrd['CGMinimize'] = (True)
# Make sure we are using cycles
if bpy.data.scenes[0].render.engine == 'BLENDER_RENDER':

View file

@ -20,7 +20,11 @@ project.addAssets('Libraries/cyclesgame/Assets/**');
f.write("project.addShaders('Libraries/cyclesgame/compiled/Shaders/" + ref + ".frag.glsl');\n")
f.write("project.addShaders('Libraries/cyclesgame/compiled/Shaders/" + ref + ".vert.glsl');\n")
f.write("\nreturn project;")
if bpy.data.worlds[0]['CGPhysics'] != 0:
f.write("\nproject.addDefine('WITH_PHYSICS')\n")
f.write("project.addLibrary('haxebullet')\n")
f.write("\nreturn project;\n")
# Write Main.hx
def write_main():
@ -37,7 +41,7 @@ class Main {
lue.sys.CompileTime.importPackage('lue.trait');
lue.sys.CompileTime.importPackage('cycles.trait');
lue.sys.CompileTime.importPackage('""" + bpy.data.worlds[0]['CGProjectPackage'] + """');
#if js
#if (js && WITH_PHYSICS)
untyped __js__("
function loadScript(url, callback) {
var head = document.getElementsByTagName('head')[0];

View file

@ -10,7 +10,6 @@
"contributors": ["Lubos"],
"dependencies": {
"kha": "",
"lue": "",
"haxebullet": ""
"lue": ""
}
}