Ver código fonte

Javascript binding updates, added proper constructors, static method support, Polycode Services in global JavaScript scope, made default Texture filtering set to linear, added a simpler SceneLabel constructor

Ivan Safrin 9 anos atrás
pai
commit
88d4e141fa
100 arquivos alterados com 1021 adições e 369 exclusões
  1. 4 0
      bindings/javascript/Polycode/AABB.js
  2. 4 0
      bindings/javascript/Polycode/AttributeBinding.js
  3. 5 1
      bindings/javascript/Polycode/AudioMixer.js
  4. 5 1
      bindings/javascript/Polycode/AudioStreamingSource.js
  5. 11 7
      bindings/javascript/Polycode/BezierCurve.js
  6. 5 1
      bindings/javascript/Polycode/BezierPoint.js
  7. 5 1
      bindings/javascript/Polycode/BinaryObjectReader.js
  8. 7 3
      bindings/javascript/Polycode/BinaryObjectWriter.js
  9. 12 4
      bindings/javascript/Polycode/Bone.js
  10. 5 1
      bindings/javascript/Polycode/BoneTrack.js
  11. 19 11
      bindings/javascript/Polycode/Camera.js
  12. 26 6
      bindings/javascript/Polycode/Color.js
  13. 5 1
      bindings/javascript/Polycode/ColorRange.js
  14. 13 9
      bindings/javascript/Polycode/Config.js
  15. 4 0
      bindings/javascript/Polycode/ConfigEntry.js
  16. 29 20
      bindings/javascript/Polycode/Core.js
  17. 4 0
      bindings/javascript/Polycode/CoreFileExtension.js
  18. 26 12
      bindings/javascript/Polycode/CoreInput.js
  19. 8 0
      bindings/javascript/Polycode/CoreMotionEvent.js
  20. 27 2
      bindings/javascript/Polycode/CoreServices.js
  21. 5 1
      bindings/javascript/Polycode/Data.js
  22. 4 0
      bindings/javascript/Polycode/DebugBackTraceEntry.js
  23. 15 7
      bindings/javascript/Polycode/DummyCore.js
  24. 45 37
      bindings/javascript/Polycode/Entity.js
  25. 4 0
      bindings/javascript/Polycode/EntityProp.js
  26. 5 1
      bindings/javascript/Polycode/Event.js
  27. 16 8
      bindings/javascript/Polycode/EventDispatcher.js
  28. 4 0
      bindings/javascript/Polycode/EventHandler.js
  29. 9 1
      bindings/javascript/Polycode/Font.js
  30. 6 2
      bindings/javascript/Polycode/FontResourceLoader.js
  31. 4 0
      bindings/javascript/Polycode/GPUDrawBuffer.js
  32. 4 0
      bindings/javascript/Polycode/GPUDrawCall.js
  33. 4 0
      bindings/javascript/Polycode/GPUDrawOptions.js
  34. 4 0
      bindings/javascript/Polycode/GlyphData.js
  35. 23 13
      bindings/javascript/Polycode/Image.js
  36. 8 0
      bindings/javascript/Polycode/InputEvent.js
  37. 4 0
      bindings/javascript/Polycode/JoystickInfo.js
  38. 12 4
      bindings/javascript/Polycode/Label.js
  39. 4 0
      bindings/javascript/Polycode/LightInfo.js
  40. 4 0
      bindings/javascript/Polycode/LightInfoBinding.js
  41. 4 0
      bindings/javascript/Polycode/LightShadowInfoBinding.js
  42. 8 4
      bindings/javascript/Polycode/LocalShaderParam.js
  43. 14 6
      bindings/javascript/Polycode/Material.js
  44. 6 2
      bindings/javascript/Polycode/MaterialResourceLoader.js
  45. 14 6
      bindings/javascript/Polycode/Matrix4.js
  46. 17 3
      bindings/javascript/Polycode/Mesh.js
  47. 34 24
      bindings/javascript/Polycode/MeshGeometry.js
  48. 6 2
      bindings/javascript/Polycode/MeshResourceLoader.js
  49. 4 0
      bindings/javascript/Polycode/MouseEventResult.js
  50. 5 1
      bindings/javascript/Polycode/OSFileEntry.js
  51. 7 3
      bindings/javascript/Polycode/ObjectEntry.js
  52. 9 5
      bindings/javascript/Polycode/Perlin.js
  53. 4 0
      bindings/javascript/Polycode/PolycodeViewBase.js
  54. 4 0
      bindings/javascript/Polycode/ProgramAttribute.js
  55. 8 0
      bindings/javascript/Polycode/ProgramParam.js
  56. 6 2
      bindings/javascript/Polycode/ProgramResourceLoader.js
  57. 4 0
      bindings/javascript/Polycode/QuatTriple.js
  58. 23 7
      bindings/javascript/Polycode/Quaternion.js
  59. 7 3
      bindings/javascript/Polycode/QuaternionCurve.js
  60. 8 4
      bindings/javascript/Polycode/Ray.js
  61. 5 1
      bindings/javascript/Polycode/Rectangle.js
  62. 5 1
      bindings/javascript/Polycode/RenderBuffer.js
  63. 5 1
      bindings/javascript/Polycode/RenderDataArray.js
  64. 4 0
      bindings/javascript/Polycode/RenderFrame.js
  65. 4 0
      bindings/javascript/Polycode/RenderTargetBinding.js
  66. 9 5
      bindings/javascript/Polycode/RenderThread.js
  67. 4 0
      bindings/javascript/Polycode/RenderThreadDebugInfo.js
  68. 23 10
      bindings/javascript/Polycode/Renderer.js
  69. 4 0
      bindings/javascript/Polycode/RendererThreadJob.js
  70. 9 1
      bindings/javascript/Polycode/Resource.js
  71. 14 6
      bindings/javascript/Polycode/ResourceManager.js
  72. 17 9
      bindings/javascript/Polycode/ResourcePool.js
  73. 4 0
      bindings/javascript/Polycode/Rotation.js
  74. 18 10
      bindings/javascript/Polycode/Scene.js
  75. 16 2
      bindings/javascript/Polycode/SceneCurve.js
  76. 24 10
      bindings/javascript/Polycode/SceneEntityInstance.js
  77. 5 1
      bindings/javascript/Polycode/SceneEntityInstanceLayer.js
  78. 9 1
      bindings/javascript/Polycode/SceneEntityInstanceResourceEntry.js
  79. 12 4
      bindings/javascript/Polycode/SceneLabel.js
  80. 20 12
      bindings/javascript/Polycode/SceneLight.js
  81. 15 1
      bindings/javascript/Polycode/SceneLine.js
  82. 9 5
      bindings/javascript/Polycode/SceneManager.js
  83. 23 9
      bindings/javascript/Polycode/SceneMesh.js
  84. 4 0
      bindings/javascript/Polycode/SceneParticle.js
  85. 14 6
      bindings/javascript/Polycode/SceneParticleEmitter.js
  86. 12 4
      bindings/javascript/Polycode/ScenePrimitive.js
  87. 7 3
      bindings/javascript/Polycode/SceneRenderTexture.js
  88. 11 3
      bindings/javascript/Polycode/SceneSound.js
  89. 8 0
      bindings/javascript/Polycode/SceneSoundListener.js
  90. 16 8
      bindings/javascript/Polycode/SceneSprite.js
  91. 4 0
      bindings/javascript/Polycode/ScriptInstance.js
  92. 6 2
      bindings/javascript/Polycode/ScriptResourceLoader.js
  93. 5 0
      bindings/javascript/Polycode/Shader.js
  94. 20 16
      bindings/javascript/Polycode/ShaderBinding.js
  95. 10 0
      bindings/javascript/Polycode/ShaderPass.js
  96. 4 0
      bindings/javascript/Polycode/ShaderPlatformData.js
  97. 9 1
      bindings/javascript/Polycode/ShaderProgram.js
  98. 4 0
      bindings/javascript/Polycode/ShaderRenderTarget.js
  99. 23 9
      bindings/javascript/Polycode/Skeleton.js
  100. 6 2
      bindings/javascript/Polycode/SkeletonAnimation.js

+ 4 - 0
bindings/javascript/Polycode/AABB.js

@@ -1,9 +1,13 @@
 function AABB() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.AABB()
+	}
 	Object.defineProperties(this, {
 		'min': { enumerable: true, configurable: true, get: AABB.prototype.__get_min, set: AABB.prototype.__set_min},
 		'max': { enumerable: true, configurable: true, get: AABB.prototype.__get_max, set: AABB.prototype.__set_max}
 	})
 }
+
 AABB.prototype.__get_min = function() {
 	var retVal = new Vector3()
 	retVal.__ptr = 	Polycode.AABB__get_min(this.__ptr)

+ 4 - 0
bindings/javascript/Polycode/AttributeBinding.js

@@ -1,4 +1,7 @@
 function AttributeBinding() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.AttributeBinding()
+	}
 	Object.defineProperties(this, {
 		'name': { enumerable: true, configurable: true, get: AttributeBinding.prototype.__get_name, set: AttributeBinding.prototype.__set_name},
 		'vertexData': { enumerable: true, configurable: true, get: AttributeBinding.prototype.__get_vertexData, set: AttributeBinding.prototype.__set_vertexData},
@@ -6,6 +9,7 @@ function AttributeBinding() {
 		'enabled': { enumerable: true, configurable: true, get: AttributeBinding.prototype.__get_enabled, set: AttributeBinding.prototype.__set_enabled}
 	})
 }
+
 AttributeBinding.prototype.__get_name = function() {
 	return Polycode.AttributeBinding__get_name(this.__ptr)
 }

+ 5 - 1
bindings/javascript/Polycode/AudioMixer.js

@@ -1,4 +1,7 @@
 function AudioMixer() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.AudioMixer()
+	}
 	Object.defineProperties(this, {
 		'globalVolume': { enumerable: true, configurable: true, get: AudioMixer.prototype.__get_globalVolume, set: AudioMixer.prototype.__set_globalVolume},
 		'listenerPosition': { enumerable: true, configurable: true, get: AudioMixer.prototype.__get_listenerPosition, set: AudioMixer.prototype.__set_listenerPosition},
@@ -6,6 +9,7 @@ function AudioMixer() {
 		'mixerMutex': { enumerable: true, configurable: true, get: AudioMixer.prototype.__get_mixerMutex, set: AudioMixer.prototype.__set_mixerMutex}
 	})
 }
+
 AudioMixer.prototype.__get_globalVolume = function() {
 	return Polycode.AudioMixer__get_globalVolume(this.__ptr)
 }
@@ -52,5 +56,5 @@ Duktape.fin(AudioMixer.prototype, function (x) {
 })
 
 AudioMixer.prototype.mixIntoBuffer = function(buffer,numSamples) {
-	Polycode.AudioMixer_mixIntoBuffer(this.__ptr, buffer,numSamples)
+	Polycode.AudioMixer_mixIntoBuffer(this.__ptr, buffer.__ptr, numSamples)
 }

+ 5 - 1
bindings/javascript/Polycode/AudioStreamingSource.js

@@ -1,5 +1,9 @@
-function AudioStreamingSource() {
+function AudioStreamingSource(channels,freq) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.AudioStreamingSource(channels,freq)
+	}
 }
+
 Duktape.fin(AudioStreamingSource.prototype, function (x) {
 	if (x === AudioStreamingSource.prototype) {
 		return;

+ 11 - 7
bindings/javascript/Polycode/BezierCurve.js

@@ -1,9 +1,13 @@
 function BezierCurve() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.BezierCurve()
+	}
 	Object.defineProperties(this, {
 		'insertPoint': { enumerable: true, configurable: true, get: BezierCurve.prototype.__get_insertPoint, set: BezierCurve.prototype.__set_insertPoint},
 		'evaluationAccuracy': { enumerable: true, configurable: true, get: BezierCurve.prototype.__get_evaluationAccuracy, set: BezierCurve.prototype.__set_evaluationAccuracy}
 	})
 }
+
 BezierCurve.prototype.__get_insertPoint = function() {
 	var retVal = new BezierPoint()
 	retVal.__ptr = 	Polycode.BezierCurve__get_insertPoint(this.__ptr)
@@ -40,23 +44,23 @@ BezierCurve.prototype.getNumControlPoints = function() {
 }
 
 BezierCurve.prototype.addControlPoint = function(p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z) {
-	Polycode.BezierCurve_addControlPoint(this.__ptr, p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z)
+	Polycode.BezierCurve_addControlPoint(this.__ptr, p1x, p1y, p1z, p2x, p2y, p2z, p3x, p3y, p3z)
 }
 
 BezierCurve.prototype.addControlPoint3dWithHandles = function(p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z) {
-	Polycode.BezierCurve_addControlPoint3dWithHandles(this.__ptr, p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z)
+	Polycode.BezierCurve_addControlPoint3dWithHandles(this.__ptr, p1x, p1y, p1z, p2x, p2y, p2z, p3x, p3y, p3z)
 }
 
 BezierCurve.prototype.addControlPoint3d = function(x,y,z) {
-	Polycode.BezierCurve_addControlPoint3d(this.__ptr, x,y,z)
+	Polycode.BezierCurve_addControlPoint3d(this.__ptr, x, y, z)
 }
 
 BezierCurve.prototype.addControlPoint2dWithHandles = function(p1x,p1y,p2x,p2y,p3x,p3y) {
-	Polycode.BezierCurve_addControlPoint2dWithHandles(this.__ptr, p1x,p1y,p2x,p2y,p3x,p3y)
+	Polycode.BezierCurve_addControlPoint2dWithHandles(this.__ptr, p1x, p1y, p2x, p2y, p3x, p3y)
 }
 
 BezierCurve.prototype.addControlPoint2d = function(x,y) {
-	Polycode.BezierCurve_addControlPoint2d(this.__ptr, x,y)
+	Polycode.BezierCurve_addControlPoint2d(this.__ptr, x, y)
 }
 
 BezierCurve.prototype.getPointAt = function(a) {
@@ -67,7 +71,7 @@ BezierCurve.prototype.getPointAt = function(a) {
 
 BezierCurve.prototype.getPointBetween = function(a,bp1,bp2) {
 	var retVal = new Vector3()
-	retVal.__ptr = Polycode.BezierCurve_getPointBetween(this.__ptr, a,bp1,bp2)
+	retVal.__ptr = Polycode.BezierCurve_getPointBetween(this.__ptr, a, bp1.__ptr, bp2.__ptr)
 	return retVal
 }
 
@@ -84,7 +88,7 @@ BezierCurve.prototype.getTValueAtX = function(x) {
 }
 
 BezierCurve.prototype.removePoint = function(point) {
-	Polycode.BezierCurve_removePoint(this.__ptr, point)
+	Polycode.BezierCurve_removePoint(this.__ptr, point.__ptr)
 }
 
 BezierCurve.prototype.setHeightCacheResolution = function(resolution) {

+ 5 - 1
bindings/javascript/Polycode/BezierPoint.js

@@ -1,10 +1,14 @@
-function BezierPoint() {
+function BezierPoint(p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.BezierPoint(p1x,p1y,p1z,p2x,p2y,p2z,p3x,p3y,p3z)
+	}
 	Object.defineProperties(this, {
 		'p1': { enumerable: true, configurable: true, get: BezierPoint.prototype.__get_p1, set: BezierPoint.prototype.__set_p1},
 		'p2': { enumerable: true, configurable: true, get: BezierPoint.prototype.__get_p2, set: BezierPoint.prototype.__set_p2},
 		'p3': { enumerable: true, configurable: true, get: BezierPoint.prototype.__get_p3, set: BezierPoint.prototype.__set_p3}
 	})
 }
+
 BezierPoint.prototype.__get_p1 = function() {
 	var retVal = new Vector3()
 	retVal.__ptr = 	Polycode.BezierPoint__get_p1(this.__ptr)

+ 5 - 1
bindings/javascript/Polycode/BinaryObjectReader.js

@@ -1,8 +1,12 @@
-function BinaryObjectReader() {
+function BinaryObjectReader(fileName,object) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.BinaryObjectReader(fileName,object)
+	}
 	Object.defineProperties(this, {
 		'success': { enumerable: true, configurable: true, get: BinaryObjectReader.prototype.__get_success, set: BinaryObjectReader.prototype.__set_success}
 	})
 }
+
 BinaryObjectReader.prototype.__get_success = function() {
 	return Polycode.BinaryObjectReader__get_success(this.__ptr)
 }

+ 7 - 3
bindings/javascript/Polycode/BinaryObjectWriter.js

@@ -1,5 +1,9 @@
-function BinaryObjectWriter() {
+function BinaryObjectWriter(object) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.BinaryObjectWriter(object)
+	}
 }
+
 Duktape.fin(BinaryObjectWriter.prototype, function (x) {
 	if (x === BinaryObjectWriter.prototype) {
 		return;
@@ -8,11 +12,11 @@ Duktape.fin(BinaryObjectWriter.prototype, function (x) {
 })
 
 BinaryObjectWriter.prototype.parseKeysFromObjectEntry = function(entry) {
-	Polycode.BinaryObjectWriter_parseKeysFromObjectEntry(this.__ptr, entry)
+	Polycode.BinaryObjectWriter_parseKeysFromObjectEntry(this.__ptr, entry.__ptr)
 }
 
 BinaryObjectWriter.prototype.writeEntryToFile = function(entry) {
-	Polycode.BinaryObjectWriter_writeEntryToFile(this.__ptr, entry)
+	Polycode.BinaryObjectWriter_writeEntryToFile(this.__ptr, entry.__ptr)
 }
 
 BinaryObjectWriter.prototype.addKey = function(key) {

+ 12 - 4
bindings/javascript/Polycode/Bone.js

@@ -1,4 +1,9 @@
-function Bone() {
+require('Polycode/Entity')
+
+function Bone(boneName) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Bone(boneName)
+	}
 	Object.defineProperties(this, {
 		'parentBoneId': { enumerable: true, configurable: true, get: Bone.prototype.__get_parentBoneId, set: Bone.prototype.__set_parentBoneId},
 		'boneMatrix': { enumerable: true, configurable: true, get: Bone.prototype.__get_boneMatrix, set: Bone.prototype.__set_boneMatrix},
@@ -11,6 +16,9 @@ function Bone() {
 		'disableAnimation': { enumerable: true, configurable: true, get: Bone.prototype.__get_disableAnimation, set: Bone.prototype.__set_disableAnimation}
 	})
 }
+
+Bone.prototype = Object.create(Entity.prototype);
+
 Bone.prototype.__get_parentBoneId = function() {
 	return Polycode.Bone__get_parentBoneId(this.__ptr)
 }
@@ -109,11 +117,11 @@ Bone.prototype.getName = function() {
 }
 
 Bone.prototype.setParentBone = function(bone) {
-	Polycode.Bone_setParentBone(this.__ptr, bone)
+	Polycode.Bone_setParentBone(this.__ptr, bone.__ptr)
 }
 
 Bone.prototype.addChildBone = function(bone) {
-	Polycode.Bone_addChildBone(this.__ptr, bone)
+	Polycode.Bone_addChildBone(this.__ptr, bone.__ptr)
 }
 
 Bone.prototype.getParentBone = function() {
@@ -197,5 +205,5 @@ Bone.prototype.buildFinalMatrix = function() {
 }
 
 Bone.prototype.intializeBone = function(basePosition,baseScale,baseRotation,restPosition,restScale,restRotation) {
-	Polycode.Bone_intializeBone(this.__ptr, basePosition,baseScale,baseRotation,restPosition,restScale,restRotation)
+	Polycode.Bone_intializeBone(this.__ptr, basePosition, baseScale, baseRotation, restPosition, restScale, restRotation)
 }

+ 5 - 1
bindings/javascript/Polycode/BoneTrack.js

@@ -1,4 +1,7 @@
-function BoneTrack() {
+function BoneTrack(bone,length) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.BoneTrack(bone,length)
+	}
 	Object.defineProperties(this, {
 		'scaleX': { enumerable: true, configurable: true, get: BoneTrack.prototype.__get_scaleX, set: BoneTrack.prototype.__set_scaleX},
 		'scaleY': { enumerable: true, configurable: true, get: BoneTrack.prototype.__get_scaleY, set: BoneTrack.prototype.__set_scaleY},
@@ -17,6 +20,7 @@ function BoneTrack() {
 		'weight': { enumerable: true, configurable: true, get: BoneTrack.prototype.__get_weight, set: BoneTrack.prototype.__set_weight}
 	})
 }
+
 BoneTrack.prototype.__get_scaleX = function() {
 	var retVal = new BezierCurve()
 	retVal.__ptr = 	Polycode.BoneTrack__get_scaleX(this.__ptr)

+ 19 - 11
bindings/javascript/Polycode/Camera.js

@@ -1,10 +1,18 @@
-function Camera() {
+require('Polycode/Entity')
+
+function Camera(parentScene) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Camera(parentScene)
+	}
 	Object.defineProperties(this, {
 		'frustumCulling': { enumerable: true, configurable: true, get: Camera.prototype.__get_frustumCulling, set: Camera.prototype.__set_frustumCulling},
 		'topLeftOrtho': { enumerable: true, configurable: true, get: Camera.prototype.__get_topLeftOrtho, set: Camera.prototype.__set_topLeftOrtho},
 		'cameraShift': { enumerable: true, configurable: true, get: Camera.prototype.__get_cameraShift, set: Camera.prototype.__set_cameraShift}
 	})
 }
+
+Camera.prototype = Object.create(Entity.prototype);
+
 Camera.prototype.__get_frustumCulling = function() {
 	return Polycode.Camera__get_frustumCulling(this.__ptr)
 }
@@ -37,7 +45,7 @@ Camera.prototype.buildFrustumPlanes = function() {
 }
 
 Camera.prototype.isSphereInFrustum = function(pos,fRadius) {
-	return Polycode.Camera_isSphereInFrustum(this.__ptr, pos,fRadius)
+	return Polycode.Camera_isSphereInFrustum(this.__ptr, pos, fRadius)
 }
 
 Camera.prototype.isAABBInFrustum = function(aabb) {
@@ -49,11 +57,11 @@ Camera.prototype.setOrthoMode = function(mode) {
 }
 
 Camera.prototype.setOrthoSize = function(orthoSizeX,orthoSizeY) {
-	Polycode.Camera_setOrthoSize(this.__ptr, orthoSizeX,orthoSizeY)
+	Polycode.Camera_setOrthoSize(this.__ptr, orthoSizeX, orthoSizeY)
 }
 
 Camera.prototype.setFrustumMode = function(left,right,bottom,top,front,back) {
-	Polycode.Camera_setFrustumMode(this.__ptr, left,right,bottom,top,front,back)
+	Polycode.Camera_setFrustumMode(this.__ptr, left, right, bottom, top, front, back)
 }
 
 Camera.prototype.getOrthoMode = function() {
@@ -77,7 +85,7 @@ Camera.prototype.getFOV = function() {
 }
 
 Camera.prototype.setClippingPlanes = function(nearClipPlane,farClipPlane) {
-	Polycode.Camera_setClippingPlanes(this.__ptr, nearClipPlane,farClipPlane)
+	Polycode.Camera_setClippingPlanes(this.__ptr, nearClipPlane, farClipPlane)
 }
 
 Camera.prototype.getNearClippingPlane = function() {
@@ -89,7 +97,7 @@ Camera.prototype.getFarClippingPlane = function() {
 }
 
 Camera.prototype.setParentScene = function(parentScene) {
-	Polycode.Camera_setParentScene(this.__ptr, parentScene)
+	Polycode.Camera_setParentScene(this.__ptr, parentScene.__ptr)
 }
 
 Camera.prototype.getParentScene = function() {
@@ -125,19 +133,19 @@ Camera.prototype.removePostFilter = function() {
 }
 
 Camera.prototype.getScreenShaderMaterial = function() {
-	var retVal = new shared_ptr<Material>()
+	var retVal = new Material()
 	retVal.__ptr = Polycode.Camera_getScreenShaderMaterial(this.__ptr)
 	return retVal
 }
 
 Camera.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.Camera_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.Camera_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 Camera.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.Camera_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.Camera_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }
 
 Camera.prototype.getProjectionMatrix = function() {
@@ -178,12 +186,12 @@ Camera.prototype.getProjectionMode = function() {
 
 Camera.prototype.projectRayFrom2DCoordinate = function(coordinate,viewport) {
 	var retVal = new Vector3()
-	retVal.__ptr = Polycode.Camera_projectRayFrom2DCoordinate(this.__ptr, coordinate,viewport)
+	retVal.__ptr = Polycode.Camera_projectRayFrom2DCoordinate(this.__ptr, coordinate, viewport)
 	return retVal
 }
 
 Camera.prototype.renderFullScreenQuad = function(drawBuffer,shaderPass) {
-	Polycode.Camera_renderFullScreenQuad(this.__ptr, drawBuffer,shaderPass)
+	Polycode.Camera_renderFullScreenQuad(this.__ptr, drawBuffer.__ptr, shaderPass)
 }
 
 Camera.prototype.getShaderPass = function(index) {

+ 26 - 6
bindings/javascript/Polycode/Color.js

@@ -1,4 +1,7 @@
-function Color() {
+function Color(r,g,b,a) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Color(r,g,b,a)
+	}
 	Object.defineProperties(this, {
 		'r': { enumerable: true, configurable: true, get: Color.prototype.__get_r, set: Color.prototype.__set_r},
 		'g': { enumerable: true, configurable: true, get: Color.prototype.__get_g, set: Color.prototype.__set_g},
@@ -6,6 +9,7 @@ function Color() {
 		'a': { enumerable: true, configurable: true, get: Color.prototype.__get_a, set: Color.prototype.__set_a}
 	})
 }
+
 Color.prototype.__get_r = function() {
 	return Polycode.Color__get_r(this.__ptr)
 }
@@ -45,6 +49,18 @@ Duktape.fin(Color.prototype, function (x) {
 	Polycode.Color__delete(x.__ptr)
 })
 
+Color.prototype.ColorWithInts = function(r,g,b,a) {
+	var retVal = new Color()
+	retVal.__ptr = Polycode.Color_ColorWithInts(r, g, b, a)
+	return retVal
+}
+
+Color.prototype.ColorWithHex = function(hex) {
+	var retVal = new Color()
+	retVal.__ptr = Polycode.Color_ColorWithHex(hex)
+	return retVal
+}
+
 Color.prototype.setColorHex = function(hex) {
 	Polycode.Color_setColorHex(this.__ptr, hex)
 }
@@ -62,24 +78,24 @@ Color.prototype.setColorHexRGBFromString = function(hex) {
 }
 
 Color.prototype.setColorHSV = function(h,s,v) {
-	Polycode.Color_setColorHSV(this.__ptr, h,s,v)
+	Polycode.Color_setColorHSV(this.__ptr, h, s, v)
 }
 
 Color.prototype.setColorRGBA = function(r,g,b,a) {
-	Polycode.Color_setColorRGBA(this.__ptr, r,g,b,a)
+	Polycode.Color_setColorRGBA(this.__ptr, r, g, b, a)
 }
 
 Color.prototype.setColorRGB = function(r,g,b) {
-	Polycode.Color_setColorRGB(this.__ptr, r,g,b)
+	Polycode.Color_setColorRGB(this.__ptr, r, g, b)
 }
 
 Color.prototype.setColor = function(r,g,b,a) {
-	Polycode.Color_setColor(this.__ptr, r,g,b,a)
+	Polycode.Color_setColor(this.__ptr, r, g, b, a)
 }
 
 Color.prototype.blendColor = function(c2,mode,amount,c3) {
 	var retVal = new Color()
-	retVal.__ptr = Polycode.Color_blendColor(this.__ptr, c2,mode,amount,c3)
+	retVal.__ptr = Polycode.Color_blendColor(this.__ptr, c2, mode, amount, c3)
 	return retVal
 }
 
@@ -91,6 +107,10 @@ Color.prototype.getBrightness = function() {
 	return Polycode.Color_getBrightness(this.__ptr)
 }
 
+Color.prototype.RGBtoHSV = function(r,g,b,h,s,v) {
+	Polycode.Color_RGBtoHSV(r, g, b, h, s, v)
+}
+
 Color.prototype.getHue = function() {
 	return Polycode.Color_getHue(this.__ptr)
 }

+ 5 - 1
bindings/javascript/Polycode/ColorRange.js

@@ -1,10 +1,14 @@
-function ColorRange() {
+function ColorRange(color,rangeStart,rangeEnd) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ColorRange(color,rangeStart,rangeEnd)
+	}
 	Object.defineProperties(this, {
 		'color': { enumerable: true, configurable: true, get: ColorRange.prototype.__get_color, set: ColorRange.prototype.__set_color},
 		'rangeStart': { enumerable: true, configurable: true, get: ColorRange.prototype.__get_rangeStart, set: ColorRange.prototype.__set_rangeStart},
 		'rangeEnd': { enumerable: true, configurable: true, get: ColorRange.prototype.__get_rangeEnd, set: ColorRange.prototype.__set_rangeEnd}
 	})
 }
+
 ColorRange.prototype.__get_color = function() {
 	var retVal = new Color()
 	retVal.__ptr = 	Polycode.ColorRange__get_color(this.__ptr)

+ 13 - 9
bindings/javascript/Polycode/Config.js

@@ -1,5 +1,9 @@
 function Config() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Config()
+	}
 }
+
 Duktape.fin(Config.prototype, function (x) {
 	if (x === Config.prototype) {
 		return;
@@ -8,39 +12,39 @@ Duktape.fin(Config.prototype, function (x) {
 })
 
 Config.prototype.loadConfig = function(configNamespace,fileName) {
-	Polycode.Config_loadConfig(this.__ptr, configNamespace,fileName)
+	Polycode.Config_loadConfig(this.__ptr, configNamespace, fileName)
 }
 
 Config.prototype.saveConfig = function(configNamespace,fileName) {
-	Polycode.Config_saveConfig(this.__ptr, configNamespace,fileName)
+	Polycode.Config_saveConfig(this.__ptr, configNamespace, fileName)
 }
 
 Config.prototype.getEntry = function(configNamespace,key) {
 	var retVal = new ConfigEntry()
-	retVal.__ptr = Polycode.Config_getEntry(this.__ptr, configNamespace,key)
+	retVal.__ptr = Polycode.Config_getEntry(this.__ptr, configNamespace, key)
 	return retVal
 }
 
 Config.prototype.setStringValue = function(configNamespace,key,value) {
-	Polycode.Config_setStringValue(this.__ptr, configNamespace,key,value)
+	Polycode.Config_setStringValue(this.__ptr, configNamespace, key, value)
 }
 
 Config.prototype.setNumericValue = function(configNamespace,key,value) {
-	Polycode.Config_setNumericValue(this.__ptr, configNamespace,key,value)
+	Polycode.Config_setNumericValue(this.__ptr, configNamespace, key, value)
 }
 
 Config.prototype.getNumericValue = function(configNamespace,key) {
-	return Polycode.Config_getNumericValue(this.__ptr, configNamespace,key)
+	return Polycode.Config_getNumericValue(this.__ptr, configNamespace, key)
 }
 
 Config.prototype.getStringValue = function(configNamespace,key) {
-	return Polycode.Config_getStringValue(this.__ptr, configNamespace,key)
+	return Polycode.Config_getStringValue(this.__ptr, configNamespace, key)
 }
 
 Config.prototype.setBoolValue = function(configNamespace,key,value) {
-	Polycode.Config_setBoolValue(this.__ptr, configNamespace,key,value)
+	Polycode.Config_setBoolValue(this.__ptr, configNamespace, key, value)
 }
 
 Config.prototype.getBoolValue = function(configNamespace,key) {
-	return Polycode.Config_getBoolValue(this.__ptr, configNamespace,key)
+	return Polycode.Config_getBoolValue(this.__ptr, configNamespace, key)
 }

+ 4 - 0
bindings/javascript/Polycode/ConfigEntry.js

@@ -1,4 +1,7 @@
 function ConfigEntry() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ConfigEntry()
+	}
 	Object.defineProperties(this, {
 		'key': { enumerable: true, configurable: true, get: ConfigEntry.prototype.__get_key, set: ConfigEntry.prototype.__set_key},
 		'configNamespace': { enumerable: true, configurable: true, get: ConfigEntry.prototype.__get_configNamespace, set: ConfigEntry.prototype.__set_configNamespace},
@@ -7,6 +10,7 @@ function ConfigEntry() {
 		'isString': { enumerable: true, configurable: true, get: ConfigEntry.prototype.__get_isString, set: ConfigEntry.prototype.__set_isString}
 	})
 }
+
 ConfigEntry.prototype.__get_key = function() {
 	return Polycode.ConfigEntry__get_key(this.__ptr)
 }

+ 29 - 20
bindings/javascript/Polycode/Core.js

@@ -1,3 +1,5 @@
+require('Polycode/EventDispatcher')
+
 function Core() {
 	Object.defineProperties(this, {
 		'eventMutex': { enumerable: true, configurable: true, get: Core.prototype.__get_eventMutex, set: Core.prototype.__set_eventMutex},
@@ -8,6 +10,9 @@ function Core() {
 		'deviceAttitude': { enumerable: true, configurable: true, get: Core.prototype.__get_deviceAttitude, set: Core.prototype.__set_deviceAttitude}
 	})
 }
+
+Core.prototype = Object.create(EventDispatcher.prototype);
+
 Core.prototype.__get_eventMutex = function() {
 	var retVal = new CoreMutex()
 	retVal.__ptr = 	Polycode.Core__get_eventMutex(this.__ptr)
@@ -100,7 +105,7 @@ Core.prototype.setCursor = function(cursorType) {
 }
 
 Core.prototype.warpCursor = function(x,y) {
-	Polycode.Core_warpCursor(this.__ptr, x,y)
+	Polycode.Core_warpCursor(this.__ptr, x, y)
 }
 
 Core.prototype.openOnScreenKeyboard = function(open) {
@@ -108,15 +113,15 @@ Core.prototype.openOnScreenKeyboard = function(open) {
 }
 
 Core.prototype.createThread = function(target) {
-	Polycode.Core_createThread(this.__ptr, target)
+	Polycode.Core_createThread(this.__ptr, target.__ptr)
 }
 
 Core.prototype.lockMutex = function(mutex) {
-	Polycode.Core_lockMutex(this.__ptr, mutex)
+	Polycode.Core_lockMutex(this.__ptr, mutex.__ptr)
 }
 
 Core.prototype.unlockMutex = function(mutex) {
-	Polycode.Core_unlockMutex(this.__ptr, mutex)
+	Polycode.Core_unlockMutex(this.__ptr, mutex.__ptr)
 }
 
 Core.prototype.createMutex = function() {
@@ -177,6 +182,10 @@ Core.prototype.getBackingYRes = function() {
 	return Polycode.Core_getBackingYRes(this.__ptr)
 }
 
+Core.prototype.getScreenInfo = function(width,height,hz) {
+	Polycode.Core_getScreenInfo(width.__ptr, height.__ptr, hz.__ptr)
+}
+
 Core.prototype.getScreenWidth = function() {
 	return Polycode.Core_getScreenWidth(this.__ptr)
 }
@@ -190,11 +199,11 @@ Core.prototype.createFolder = function(folderPath) {
 }
 
 Core.prototype.copyDiskItem = function(itemPath,destItemPath) {
-	Polycode.Core_copyDiskItem(this.__ptr, itemPath,destItemPath)
+	Polycode.Core_copyDiskItem(this.__ptr, itemPath, destItemPath)
 }
 
 Core.prototype.moveDiskItem = function(itemPath,destItemPath) {
-	Polycode.Core_moveDiskItem(this.__ptr, itemPath,destItemPath)
+	Polycode.Core_moveDiskItem(this.__ptr, itemPath, destItemPath)
 }
 
 Core.prototype.removeDiskItem = function(itemPath) {
@@ -206,11 +215,11 @@ Core.prototype.openFolderPicker = function() {
 }
 
 Core.prototype.setFramerate = function(frameRate,maxFixedCycles) {
-	Polycode.Core_setFramerate(this.__ptr, frameRate,maxFixedCycles)
+	Polycode.Core_setFramerate(this.__ptr, frameRate, maxFixedCycles)
 }
 
 Core.prototype.openFilePicker = function(extensions,allowMultiple) {
-	Polycode.Core_openFilePicker(this.__ptr, extensions,allowMultiple)
+	Polycode.Core_openFilePicker(this.__ptr, extensions, allowMultiple)
 }
 
 Core.prototype.saveFilePicker = function(extensions) {
@@ -218,7 +227,7 @@ Core.prototype.saveFilePicker = function(extensions) {
 }
 
 Core.prototype.handleVideoModeChange = function(modeInfo) {
-	Polycode.Core_handleVideoModeChange(this.__ptr, modeInfo)
+	Polycode.Core_handleVideoModeChange(this.__ptr, modeInfo.__ptr)
 }
 
 Core.prototype.flushRenderContext = function() {
@@ -235,28 +244,28 @@ Core.prototype.isWindowInitialized = function() {
 
 Core.prototype.openFile = function(fileName,opts) {
 	var retVal = new CoreFile()
-	retVal.__ptr = Polycode.Core_openFile(this.__ptr, fileName,opts)
+	retVal.__ptr = Polycode.Core_openFile(this.__ptr, fileName, opts)
 	return retVal
 }
 
 Core.prototype.closeFile = function(file) {
-	Polycode.Core_closeFile(this.__ptr, file)
+	Polycode.Core_closeFile(this.__ptr, file.__ptr)
 }
 
 Core.prototype.addFileSource = function(type,source) {
-	Polycode.Core_addFileSource(this.__ptr, type,source)
+	Polycode.Core_addFileSource(this.__ptr, type, source)
 }
 
 Core.prototype.removeFileSource = function(type,source) {
-	Polycode.Core_removeFileSource(this.__ptr, type,source)
+	Polycode.Core_removeFileSource(this.__ptr, type, source)
 }
 
 Core.prototype.parseFolder = function(pathString,showHidden) {
-	Polycode.Core_parseFolder(this.__ptr, pathString,showHidden)
+	Polycode.Core_parseFolder(this.__ptr, pathString, showHidden)
 }
 
 Core.prototype.systemParseFolder = function(pathString,showHidden,targetVector) {
-	return Polycode.Core_systemParseFolder(this.__ptr, pathString,showHidden,targetVector)
+	return Polycode.Core_systemParseFolder(this.__ptr, pathString, showHidden, targetVector)
 }
 
 Core.prototype.getResourcePathForFile = function(fileName) {
@@ -264,11 +273,11 @@ Core.prototype.getResourcePathForFile = function(fileName) {
 }
 
 Core.prototype.setVideoMode = function(xRes,yRes,fullScreen,vSync,aaLevel,anisotropyLevel,retinaSupport) {
-	Polycode.Core_setVideoMode(this.__ptr, xRes,yRes,fullScreen,vSync,aaLevel,anisotropyLevel,retinaSupport)
+	Polycode.Core_setVideoMode(this.__ptr, xRes, yRes, fullScreen, vSync, aaLevel, anisotropyLevel, retinaSupport)
 }
 
 Core.prototype.resizeTo = function(xRes,yRes) {
-	Polycode.Core_resizeTo(this.__ptr, xRes,yRes)
+	Polycode.Core_resizeTo(this.__ptr, xRes, yRes)
 }
 
 Core.prototype.doSleep = function() {
@@ -304,7 +313,7 @@ Core.prototype.getTicksFloat = function() {
 }
 
 Core.prototype.setUserPointer = function(ptr) {
-	Polycode.Core_setUserPointer(this.__ptr, ptr)
+	Polycode.Core_setUserPointer(this.__ptr, ptr.__ptr)
 }
 
 Core.prototype.getUserPointer = function() {
@@ -312,7 +321,7 @@ Core.prototype.getUserPointer = function() {
 }
 
 Core.prototype.executeExternalCommand = function(command,args,inDirectory) {
-	return Polycode.Core_executeExternalCommand(this.__ptr, command,args,inDirectory)
+	return Polycode.Core_executeExternalCommand(this.__ptr, command, args, inDirectory)
 }
 
 Core.prototype.getDefaultWorkingDirectory = function() {
@@ -334,5 +343,5 @@ Core.prototype.getEventMutex = function() {
 }
 
 Core.prototype.removeThread = function(thread) {
-	Polycode.Core_removeThread(this.__ptr, thread)
+	Polycode.Core_removeThread(this.__ptr, thread.__ptr)
 }

+ 4 - 0
bindings/javascript/Polycode/CoreFileExtension.js

@@ -1,9 +1,13 @@
 function CoreFileExtension() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.CoreFileExtension()
+	}
 	Object.defineProperties(this, {
 		'extension': { enumerable: true, configurable: true, get: CoreFileExtension.prototype.__get_extension, set: CoreFileExtension.prototype.__set_extension},
 		'description': { enumerable: true, configurable: true, get: CoreFileExtension.prototype.__get_description, set: CoreFileExtension.prototype.__set_description}
 	})
 }
+
 CoreFileExtension.prototype.__get_extension = function() {
 	return Polycode.CoreFileExtension__get_extension(this.__ptr)
 }

+ 26 - 12
bindings/javascript/Polycode/CoreInput.js

@@ -1,4 +1,9 @@
+require('Polycode/EventDispatcher')
+
 function CoreInput() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.CoreInput()
+	}
 	Object.defineProperties(this, {
 		'simulateTouchWithMouse': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_simulateTouchWithMouse, set: CoreInput.prototype.__set_simulateTouchWithMouse},
 		'simulateTouchAsPen': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_simulateTouchAsPen, set: CoreInput.prototype.__set_simulateTouchAsPen},
@@ -9,6 +14,9 @@ function CoreInput() {
 		'deltaMousePosition': { enumerable: true, configurable: true, get: CoreInput.prototype.__get_deltaMousePosition, set: CoreInput.prototype.__set_deltaMousePosition}
 	})
 }
+
+CoreInput.prototype = Object.create(EventDispatcher.prototype);
+
 CoreInput.prototype.__get_simulateTouchWithMouse = function() {
 	return Polycode.CoreInput__get_simulateTouchWithMouse(this.__ptr)
 }
@@ -87,11 +95,11 @@ CoreInput.prototype.getKeyState = function(keyCode) {
 }
 
 CoreInput.prototype.getJoystickButtonState = function(joystickIndex,button) {
-	return Polycode.CoreInput_getJoystickButtonState(this.__ptr, joystickIndex,button)
+	return Polycode.CoreInput_getJoystickButtonState(this.__ptr, joystickIndex, button)
 }
 
 CoreInput.prototype.getJoystickAxisValue = function(joystickIndex,axis) {
-	return Polycode.CoreInput_getJoystickAxisValue(this.__ptr, joystickIndex,axis)
+	return Polycode.CoreInput_getJoystickAxisValue(this.__ptr, joystickIndex, axis)
 }
 
 CoreInput.prototype.getMouseDelta = function() {
@@ -129,15 +137,15 @@ CoreInput.prototype.removeJoystick = function(deviceID) {
 }
 
 CoreInput.prototype.joystickAxisMoved = function(axisID,value,deviceID) {
-	Polycode.CoreInput_joystickAxisMoved(this.__ptr, axisID,value,deviceID)
+	Polycode.CoreInput_joystickAxisMoved(this.__ptr, axisID, value, deviceID)
 }
 
 CoreInput.prototype.joystickButtonDown = function(buttonID,deviceID) {
-	Polycode.CoreInput_joystickButtonDown(this.__ptr, buttonID,deviceID)
+	Polycode.CoreInput_joystickButtonDown(this.__ptr, buttonID, deviceID)
 }
 
 CoreInput.prototype.joystickButtonUp = function(buttonID,deviceID) {
-	Polycode.CoreInput_joystickButtonUp(this.__ptr, buttonID,deviceID)
+	Polycode.CoreInput_joystickButtonUp(this.__ptr, buttonID, deviceID)
 }
 
 CoreInput.prototype.mouseWheelUp = function(ticks) {
@@ -149,31 +157,37 @@ CoreInput.prototype.mouseWheelDown = function(ticks) {
 }
 
 CoreInput.prototype.setMouseButtonState = function(mouseButton,state,ticks) {
-	Polycode.CoreInput_setMouseButtonState(this.__ptr, mouseButton,state,ticks)
+	Polycode.CoreInput_setMouseButtonState(this.__ptr, mouseButton, state, ticks)
 }
 
 CoreInput.prototype.setMousePosition = function(x,y,ticks) {
-	Polycode.CoreInput_setMousePosition(this.__ptr, x,y,ticks)
+	Polycode.CoreInput_setMousePosition(this.__ptr, x, y, ticks)
 }
 
 CoreInput.prototype.setKeyState = function(keyCode,code,newState,ticks) {
-	Polycode.CoreInput_setKeyState(this.__ptr, keyCode,code,newState,ticks)
+	Polycode.CoreInput_setKeyState(this.__ptr, keyCode, code, newState, ticks)
 }
 
 CoreInput.prototype.setDeltaPosition = function(x,y) {
-	Polycode.CoreInput_setDeltaPosition(this.__ptr, x,y)
+	Polycode.CoreInput_setDeltaPosition(this.__ptr, x, y)
 }
 
 CoreInput.prototype.touchesBegan = function(touch,touches,ticks) {
-	Polycode.CoreInput_touchesBegan(this.__ptr, touch,touches,ticks)
+	Polycode.CoreInput_touchesBegan(this.__ptr, touch, touches, ticks)
 }
 
 CoreInput.prototype.touchesMoved = function(touch,touches,ticks) {
-	Polycode.CoreInput_touchesMoved(this.__ptr, touch,touches,ticks)
+	Polycode.CoreInput_touchesMoved(this.__ptr, touch, touches, ticks)
 }
 
 CoreInput.prototype.touchesEnded = function(touch,touches,ticks) {
-	Polycode.CoreInput_touchesEnded(this.__ptr, touch,touches,ticks)
+	Polycode.CoreInput_touchesEnded(this.__ptr, touch, touches, ticks)
+}
+
+CoreInput.prototype.createEvent = function(event) {
+	var retVal = new InputEvent()
+	retVal.__ptr = Polycode.CoreInput_createEvent(event.__ptr)
+	return retVal
 }
 
 CoreInput.prototype.clearInput = function() {

+ 8 - 0
bindings/javascript/Polycode/CoreMotionEvent.js

@@ -1,8 +1,16 @@
+require('Polycode/Event')
+
 function CoreMotionEvent() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.CoreMotionEvent()
+	}
 	Object.defineProperties(this, {
 		'amount': { enumerable: true, configurable: true, get: CoreMotionEvent.prototype.__get_amount, set: CoreMotionEvent.prototype.__set_amount}
 	})
 }
+
+CoreMotionEvent.prototype = Object.create(Event.prototype);
+
 CoreMotionEvent.prototype.__get_amount = function() {
 	var retVal = new Vector3()
 	retVal.__ptr = 	Polycode.CoreMotionEvent__get_amount(this.__ptr)

+ 27 - 2
bindings/javascript/Polycode/CoreServices.js

@@ -1,5 +1,10 @@
+require('Polycode/EventDispatcher')
+
 function CoreServices() {
 }
+
+CoreServices.prototype = Object.create(EventDispatcher.prototype);
+
 Duktape.fin(CoreServices.prototype, function (x) {
 	if (x === CoreServices.prototype) {
 		return;
@@ -7,8 +12,28 @@ Duktape.fin(CoreServices.prototype, function (x) {
 	Polycode.CoreServices__delete(x.__ptr)
 })
 
+CoreServices.prototype.getInstance = function() {
+	var retVal = new CoreServices()
+	retVal.__ptr = Polycode.CoreServices_getInstance()
+	return retVal
+}
+
+CoreServices.prototype.setInstance = function(_instance) {
+	Polycode.CoreServices_setInstance(_instance.__ptr)
+}
+
+CoreServices.prototype.getRenderMutex = function() {
+	var retVal = new CoreMutex()
+	retVal.__ptr = Polycode.CoreServices_getRenderMutex()
+	return retVal
+}
+
+CoreServices.prototype.createInstance = function() {
+	Polycode.CoreServices_createInstance()
+}
+
 CoreServices.prototype.setRenderer = function(renderer) {
-	Polycode.CoreServices_setRenderer(this.__ptr, renderer)
+	Polycode.CoreServices_setRenderer(this.__ptr, renderer.__ptr)
 }
 
 CoreServices.prototype.getRenderer = function() {
@@ -30,7 +55,7 @@ CoreServices.prototype.Render = function(viewport) {
 }
 
 CoreServices.prototype.setCore = function(core) {
-	Polycode.CoreServices_setCore(this.__ptr, core)
+	Polycode.CoreServices_setCore(this.__ptr, core.__ptr)
 }
 
 CoreServices.prototype.getCore = function() {

+ 5 - 1
bindings/javascript/Polycode/Data.js

@@ -1,5 +1,9 @@
 function Data() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Data()
+	}
 }
+
 Duktape.fin(Data.prototype, function (x) {
 	if (x === Data.prototype) {
 		return;
@@ -16,7 +20,7 @@ Data.prototype.getAsString = function(encoding) {
 }
 
 Data.prototype.setFromString = function(str,encoding) {
-	Polycode.Data_setFromString(this.__ptr, str,encoding)
+	Polycode.Data_setFromString(this.__ptr, str, encoding)
 }
 
 Data.prototype.saveToFile = function(fileName) {

+ 4 - 0
bindings/javascript/Polycode/DebugBackTraceEntry.js

@@ -1,9 +1,13 @@
 function DebugBackTraceEntry() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.DebugBackTraceEntry()
+	}
 	Object.defineProperties(this, {
 		'fileName': { enumerable: true, configurable: true, get: DebugBackTraceEntry.prototype.__get_fileName, set: DebugBackTraceEntry.prototype.__set_fileName},
 		'lineNumber': { enumerable: true, configurable: true, get: DebugBackTraceEntry.prototype.__get_lineNumber, set: DebugBackTraceEntry.prototype.__set_lineNumber}
 	})
 }
+
 DebugBackTraceEntry.prototype.__get_fileName = function() {
 	return Polycode.DebugBackTraceEntry__get_fileName(this.__ptr)
 }

+ 15 - 7
bindings/javascript/Polycode/DummyCore.js

@@ -1,5 +1,13 @@
+require('Polycode/Core')
+
 function DummyCore() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.DummyCore()
+	}
 }
+
+DummyCore.prototype = Object.create(Core.prototype);
+
 Duktape.fin(DummyCore.prototype, function (x) {
 	if (x === DummyCore.prototype) {
 		return;
@@ -20,7 +28,7 @@ DummyCore.prototype.setCursor = function(cursorType) {
 }
 
 DummyCore.prototype.createThread = function(target) {
-	Polycode.DummyCore_createThread(this.__ptr, target)
+	Polycode.DummyCore_createThread(this.__ptr, target.__ptr)
 }
 
 DummyCore.prototype.createMutex = function() {
@@ -42,11 +50,11 @@ DummyCore.prototype.createFolder = function(folderPath) {
 }
 
 DummyCore.prototype.copyDiskItem = function(itemPath,destItemPath) {
-	Polycode.DummyCore_copyDiskItem(this.__ptr, itemPath,destItemPath)
+	Polycode.DummyCore_copyDiskItem(this.__ptr, itemPath, destItemPath)
 }
 
 DummyCore.prototype.moveDiskItem = function(itemPath,destItemPath) {
-	Polycode.DummyCore_moveDiskItem(this.__ptr, itemPath,destItemPath)
+	Polycode.DummyCore_moveDiskItem(this.__ptr, itemPath, destItemPath)
 }
 
 DummyCore.prototype.removeDiskItem = function(itemPath) {
@@ -58,7 +66,7 @@ DummyCore.prototype.openFolderPicker = function() {
 }
 
 DummyCore.prototype.openFilePicker = function(extensions,allowMultiple) {
-	Polycode.DummyCore_openFilePicker(this.__ptr, extensions,allowMultiple)
+	Polycode.DummyCore_openFilePicker(this.__ptr, extensions, allowMultiple)
 }
 
 DummyCore.prototype.saveFilePicker = function(extensions) {
@@ -66,7 +74,7 @@ DummyCore.prototype.saveFilePicker = function(extensions) {
 }
 
 DummyCore.prototype.handleVideoModeChange = function(modeInfo) {
-	Polycode.DummyCore_handleVideoModeChange(this.__ptr, modeInfo)
+	Polycode.DummyCore_handleVideoModeChange(this.__ptr, modeInfo.__ptr)
 }
 
 DummyCore.prototype.flushRenderContext = function() {
@@ -82,9 +90,9 @@ DummyCore.prototype.getTicks = function() {
 }
 
 DummyCore.prototype.executeExternalCommand = function(command,args,inDirectory) {
-	return Polycode.DummyCore_executeExternalCommand(this.__ptr, command,args,inDirectory)
+	return Polycode.DummyCore_executeExternalCommand(this.__ptr, command, args, inDirectory)
 }
 
 DummyCore.prototype.systemParseFolder = function(pathString,showHidden,targetVector) {
-	return Polycode.DummyCore_systemParseFolder(this.__ptr, pathString,showHidden,targetVector)
+	return Polycode.DummyCore_systemParseFolder(this.__ptr, pathString, showHidden, targetVector)
 }

+ 45 - 37
bindings/javascript/Polycode/Entity.js

@@ -1,4 +1,9 @@
+require('Polycode/EventDispatcher')
+
 function Entity() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Entity()
+	}
 	Object.defineProperties(this, {
 		'ownsChildren': { enumerable: true, configurable: true, get: Entity.prototype.__get_ownsChildren, set: Entity.prototype.__set_ownsChildren},
 		'billboardMode': { enumerable: true, configurable: true, get: Entity.prototype.__get_billboardMode, set: Entity.prototype.__set_billboardMode},
@@ -23,6 +28,9 @@ function Entity() {
 		'layerID': { enumerable: true, configurable: true, get: Entity.prototype.__get_layerID, set: Entity.prototype.__set_layerID}
 	})
 }
+
+Entity.prototype = Object.create(EventDispatcher.prototype);
+
 Entity.prototype.__get_ownsChildren = function() {
 	return Polycode.Entity__get_ownsChildren(this.__ptr)
 }
@@ -205,7 +213,7 @@ Entity.prototype.initEntity = function() {
 }
 
 Entity.prototype.Render = function(buffer) {
-	Polycode.Entity_Render(this.__ptr, buffer)
+	Polycode.Entity_Render(this.__ptr, buffer.__ptr)
 }
 
 Entity.prototype.Update = function() {
@@ -217,21 +225,21 @@ Entity.prototype.fixedUpdate = function() {
 }
 
 Entity.prototype.transformAndRender = function(drawBuffer,parentScissorBox) {
-	Polycode.Entity_transformAndRender(this.__ptr, drawBuffer,parentScissorBox)
+	Polycode.Entity_transformAndRender(this.__ptr, drawBuffer.__ptr, parentScissorBox.__ptr)
 }
 
 Entity.prototype.renderChildren = function(buffer,parentScissorBox) {
-	Polycode.Entity_renderChildren(this.__ptr, buffer,parentScissorBox)
+	Polycode.Entity_renderChildren(this.__ptr, buffer.__ptr, parentScissorBox.__ptr)
 }
 
 Entity.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.Entity_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.Entity_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 Entity.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.Entity_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.Entity_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }
 
 Entity.prototype.dirtyMatrix = function(val) {
@@ -260,7 +268,7 @@ Entity.prototype.getConcatenatedMatrix = function() {
 
 Entity.prototype.getConcatenatedMatrixRelativeTo = function(relativeEntity) {
 	var retVal = new Matrix4()
-	retVal.__ptr = Polycode.Entity_getConcatenatedMatrixRelativeTo(this.__ptr, relativeEntity)
+	retVal.__ptr = Polycode.Entity_getConcatenatedMatrixRelativeTo(this.__ptr, relativeEntity.__ptr)
 	return retVal
 }
 
@@ -282,36 +290,36 @@ Entity.prototype.setTransformByMatrixPure = function(matrix) {
 
 Entity.prototype.getLookAtMatrix = function(loc,upVector) {
 	var retVal = new Matrix4()
-	retVal.__ptr = Polycode.Entity_getLookAtMatrix(this.__ptr, loc,upVector)
+	retVal.__ptr = Polycode.Entity_getLookAtMatrix(this.__ptr, loc, upVector)
 	return retVal
 }
 
 Entity.prototype.addChild = function(newChild) {
-	Polycode.Entity_addChild(this.__ptr, newChild)
+	Polycode.Entity_addChild(this.__ptr, newChild.__ptr)
 }
 
 Entity.prototype.removeChild = function(entityToRemove) {
-	Polycode.Entity_removeChild(this.__ptr, entityToRemove)
+	Polycode.Entity_removeChild(this.__ptr, entityToRemove.__ptr)
 }
 
 Entity.prototype.moveChildUp = function(child) {
-	Polycode.Entity_moveChildUp(this.__ptr, child)
+	Polycode.Entity_moveChildUp(this.__ptr, child.__ptr)
 }
 
 Entity.prototype.moveChildDown = function(child) {
-	Polycode.Entity_moveChildDown(this.__ptr, child)
+	Polycode.Entity_moveChildDown(this.__ptr, child.__ptr)
 }
 
 Entity.prototype.moveChildTop = function(child) {
-	Polycode.Entity_moveChildTop(this.__ptr, child)
+	Polycode.Entity_moveChildTop(this.__ptr, child.__ptr)
 }
 
 Entity.prototype.moveChildBottom = function(child) {
-	Polycode.Entity_moveChildBottom(this.__ptr, child)
+	Polycode.Entity_moveChildBottom(this.__ptr, child.__ptr)
 }
 
 Entity.prototype.setParentEntity = function(entity) {
-	Polycode.Entity_setParentEntity(this.__ptr, entity)
+	Polycode.Entity_setParentEntity(this.__ptr, entity.__ptr)
 }
 
 Entity.prototype.getParentEntity = function() {
@@ -353,7 +361,7 @@ Entity.prototype.getCombinedPosition = function() {
 }
 
 Entity.prototype.setPosition = function(x,y,z) {
-	Polycode.Entity_setPosition(this.__ptr, x,y,z)
+	Polycode.Entity_setPosition(this.__ptr, x, y, z)
 }
 
 Entity.prototype.setPositionX = function(x) {
@@ -365,7 +373,7 @@ Entity.prototype.setPositionY = function(y) {
 }
 
 Entity.prototype.Translate = function(x,y,z) {
-	Polycode.Entity_Translate(this.__ptr, x,y,z)
+	Polycode.Entity_Translate(this.__ptr, x, y, z)
 }
 
 Entity.prototype.setPositionZ = function(z) {
@@ -385,11 +393,11 @@ Entity.prototype.setScaleZ = function(z) {
 }
 
 Entity.prototype.Scale = function(x,y,z) {
-	Polycode.Entity_Scale(this.__ptr, x,y,z)
+	Polycode.Entity_Scale(this.__ptr, x, y, z)
 }
 
 Entity.prototype.setScale = function(x,y,z) {
-	Polycode.Entity_setScale(this.__ptr, x,y,z)
+	Polycode.Entity_setScale(this.__ptr, x, y, z)
 }
 
 Entity.prototype.getCompoundScale = function() {
@@ -491,7 +499,7 @@ Entity.prototype.setDepth = function(depth) {
 }
 
 Entity.prototype.setRotationQuat = function(w,x,y,z) {
-	Polycode.Entity_setRotationQuat(this.__ptr, w,x,y,z)
+	Polycode.Entity_setRotationQuat(this.__ptr, w, x, y, z)
 }
 
 Entity.prototype.setRotationByQuaternion = function(quaternion) {
@@ -511,11 +519,11 @@ Entity.prototype.getConcatenatedQuat = function() {
 }
 
 Entity.prototype.lookAt = function(loc,upVector) {
-	Polycode.Entity_lookAt(this.__ptr, loc,upVector)
+	Polycode.Entity_lookAt(this.__ptr, loc, upVector)
 }
 
 Entity.prototype.lookAtEntity = function(entity,upVector) {
-	Polycode.Entity_lookAtEntity(this.__ptr, entity,upVector)
+	Polycode.Entity_lookAtEntity(this.__ptr, entity.__ptr, upVector)
 }
 
 Entity.prototype.getCombinedColor = function() {
@@ -525,11 +533,11 @@ Entity.prototype.getCombinedColor = function() {
 }
 
 Entity.prototype.setColor = function(r,g,b,a) {
-	Polycode.Entity_setColor(this.__ptr, r,g,b,a)
+	Polycode.Entity_setColor(this.__ptr, r, g, b, a)
 }
 
 Entity.prototype.setColorInt = function(r,g,b,a) {
-	Polycode.Entity_setColorInt(this.__ptr, r,g,b,a)
+	Polycode.Entity_setColorInt(this.__ptr, r, g, b, a)
 }
 
 Entity.prototype.setAnchorPoint = function(anchorPoint) {
@@ -544,31 +552,31 @@ Entity.prototype.getAnchorPoint = function() {
 
 Entity.prototype.onMouseDown = function(ray,mouseButton,timestamp) {
 	var retVal = new MouseEventResult()
-	retVal.__ptr = Polycode.Entity_onMouseDown(this.__ptr, ray,mouseButton,timestamp)
+	retVal.__ptr = Polycode.Entity_onMouseDown(this.__ptr, ray, mouseButton, timestamp)
 	return retVal
 }
 
 Entity.prototype.onMouseUp = function(ray,mouseButton,timestamp) {
 	var retVal = new MouseEventResult()
-	retVal.__ptr = Polycode.Entity_onMouseUp(this.__ptr, ray,mouseButton,timestamp)
+	retVal.__ptr = Polycode.Entity_onMouseUp(this.__ptr, ray, mouseButton, timestamp)
 	return retVal
 }
 
 Entity.prototype.onMouseMove = function(ray,timestamp) {
 	var retVal = new MouseEventResult()
-	retVal.__ptr = Polycode.Entity_onMouseMove(this.__ptr, ray,timestamp)
+	retVal.__ptr = Polycode.Entity_onMouseMove(this.__ptr, ray, timestamp)
 	return retVal
 }
 
 Entity.prototype.onMouseWheelUp = function(ray,timestamp) {
 	var retVal = new MouseEventResult()
-	retVal.__ptr = Polycode.Entity_onMouseWheelUp(this.__ptr, ray,timestamp)
+	retVal.__ptr = Polycode.Entity_onMouseWheelUp(this.__ptr, ray, timestamp)
 	return retVal
 }
 
 Entity.prototype.onMouseWheelDown = function(ray,timestamp) {
 	var retVal = new MouseEventResult()
-	retVal.__ptr = Polycode.Entity_onMouseWheelDown(this.__ptr, ray,timestamp)
+	retVal.__ptr = Polycode.Entity_onMouseWheelDown(this.__ptr, ray, timestamp)
 	return retVal
 }
 
@@ -581,7 +589,7 @@ Entity.prototype.getDepthOnly = function() {
 }
 
 Entity.prototype.setUserData = function(userData) {
-	Polycode.Entity_setUserData(this.__ptr, userData)
+	Polycode.Entity_setUserData(this.__ptr, userData.__ptr)
 }
 
 Entity.prototype.getUserData = function() {
@@ -598,16 +606,16 @@ Entity.prototype.getBlendingMode = function() {
 
 Entity.prototype.getEntityById = function(id,recursive) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.Entity_getEntityById(this.__ptr, id,recursive)
+	retVal.__ptr = Polycode.Entity_getEntityById(this.__ptr, id, recursive)
 	return retVal
 }
 
 Entity.prototype.getEntitiesByTag = function(tag,recursive) {
-	Polycode.Entity_getEntitiesByTag(this.__ptr, tag,recursive)
+	Polycode.Entity_getEntitiesByTag(this.__ptr, tag, recursive)
 }
 
 Entity.prototype.getEntitiesByLayerID = function(layerID,recursive) {
-	Polycode.Entity_getEntitiesByLayerID(this.__ptr, layerID,recursive)
+	Polycode.Entity_getEntitiesByLayerID(this.__ptr, layerID, recursive)
 }
 
 Entity.prototype.getEntityProp = function(propName) {
@@ -615,7 +623,7 @@ Entity.prototype.getEntityProp = function(propName) {
 }
 
 Entity.prototype.setEntityProp = function(propName,propValue) {
-	Polycode.Entity_setEntityProp(this.__ptr, propName,propValue)
+	Polycode.Entity_setEntityProp(this.__ptr, propName, propValue)
 }
 
 Entity.prototype.setInverseY = function(val) {
@@ -641,7 +649,7 @@ Entity.prototype.buildPositionMatrix = function() {
 }
 
 Entity.prototype.setRenderer = function(renderer) {
-	Polycode.Entity_setRenderer(this.__ptr, renderer)
+	Polycode.Entity_setRenderer(this.__ptr, renderer.__ptr)
 }
 
 Entity.prototype.customHitDetection = function(ray) {
@@ -670,7 +678,7 @@ Entity.prototype.addTag = function(tag) {
 
 Entity.prototype.getScreenPosition = function(projectionMatrix,cameraMatrix,viewport) {
 	var retVal = new Vector2()
-	retVal.__ptr = Polycode.Entity_getScreenPosition(this.__ptr, projectionMatrix,cameraMatrix,viewport)
+	retVal.__ptr = Polycode.Entity_getScreenPosition(this.__ptr, projectionMatrix, cameraMatrix, viewport)
 	return retVal
 }
 
@@ -711,7 +719,7 @@ Entity.prototype.setLocalBoundingBoxZ = function(z) {
 }
 
 Entity.prototype.setContainerScene = function(scene) {
-	Polycode.Entity_setContainerScene(this.__ptr, scene)
+	Polycode.Entity_setContainerScene(this.__ptr, scene.__ptr)
 }
 
 Entity.prototype.getContainerScene = function() {
@@ -725,7 +733,7 @@ Entity.prototype.attachScript = function(script) {
 }
 
 Entity.prototype.detachScript = function(script) {
-	Polycode.Entity_detachScript(this.__ptr, script)
+	Polycode.Entity_detachScript(this.__ptr, script.__ptr)
 }
 
 Entity.prototype.getNumScripts = function() {

+ 4 - 0
bindings/javascript/Polycode/EntityProp.js

@@ -1,9 +1,13 @@
 function EntityProp() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.EntityProp()
+	}
 	Object.defineProperties(this, {
 		'propName': { enumerable: true, configurable: true, get: EntityProp.prototype.__get_propName, set: EntityProp.prototype.__set_propName},
 		'propValue': { enumerable: true, configurable: true, get: EntityProp.prototype.__get_propValue, set: EntityProp.prototype.__set_propValue}
 	})
 }
+
 EntityProp.prototype.__get_propName = function() {
 	return Polycode.EntityProp__get_propName(this.__ptr)
 }

+ 5 - 1
bindings/javascript/Polycode/Event.js

@@ -1,9 +1,13 @@
 function Event() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Event()
+	}
 	Object.defineProperties(this, {
 		'deleteOnDispatch': { enumerable: true, configurable: true, get: Event.prototype.__get_deleteOnDispatch, set: Event.prototype.__set_deleteOnDispatch},
 		'cancelEventFlag': { enumerable: true, configurable: true, get: Event.prototype.__get_cancelEventFlag, set: Event.prototype.__set_cancelEventFlag}
 	})
 }
+
 Event.prototype.__get_deleteOnDispatch = function() {
 	return Polycode.Event__get_deleteOnDispatch(this.__ptr)
 }
@@ -42,7 +46,7 @@ Event.prototype.setEventCode = function(eventCode) {
 }
 
 Event.prototype.setDispatcher = function(dispatcher) {
-	Polycode.Event_setDispatcher(this.__ptr, dispatcher)
+	Polycode.Event_setDispatcher(this.__ptr, dispatcher.__ptr)
 }
 
 Event.prototype.getEventType = function() {

+ 16 - 8
bindings/javascript/Polycode/EventDispatcher.js

@@ -1,5 +1,13 @@
+require('Polycode/EventHandler')
+
 function EventDispatcher() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.EventDispatcher()
+	}
 }
+
+EventDispatcher.prototype = Object.create(EventHandler.prototype);
+
 Duktape.fin(EventDispatcher.prototype, function (x) {
 	if (x === EventDispatcher.prototype) {
 		return;
@@ -12,33 +20,33 @@ EventDispatcher.prototype.removeAllHandlers = function() {
 }
 
 EventDispatcher.prototype.removeAllHandlersForListener = function(handler) {
-	Polycode.EventDispatcher_removeAllHandlersForListener(this.__ptr, handler)
+	Polycode.EventDispatcher_removeAllHandlersForListener(this.__ptr, handler.__ptr)
 }
 
 EventDispatcher.prototype.addEventListener = function(handler,eventCode) {
-	Polycode.EventDispatcher_addEventListener(this.__ptr, handler,eventCode)
+	Polycode.EventDispatcher_addEventListener(this.__ptr, handler.__ptr, eventCode)
 }
 
 EventDispatcher.prototype.addEventListenerUnique = function(handler,eventCode) {
-	Polycode.EventDispatcher_addEventListenerUnique(this.__ptr, handler,eventCode)
+	Polycode.EventDispatcher_addEventListenerUnique(this.__ptr, handler.__ptr, eventCode)
 }
 
 EventDispatcher.prototype.hasEventListener = function(handler,eventCode) {
-	return Polycode.EventDispatcher_hasEventListener(this.__ptr, handler,eventCode)
+	return Polycode.EventDispatcher_hasEventListener(this.__ptr, handler.__ptr, eventCode)
 }
 
 EventDispatcher.prototype.removeEventListener = function(handler,eventCode) {
-	Polycode.EventDispatcher_removeEventListener(this.__ptr, handler,eventCode)
+	Polycode.EventDispatcher_removeEventListener(this.__ptr, handler.__ptr, eventCode)
 }
 
 EventDispatcher.prototype.__dispatchEvent = function(event,eventCode) {
-	Polycode.EventDispatcher___dispatchEvent(this.__ptr, event,eventCode)
+	Polycode.EventDispatcher___dispatchEvent(this.__ptr, event.__ptr, eventCode)
 }
 
 EventDispatcher.prototype.dispatchEvent = function(event,eventCode) {
-	Polycode.EventDispatcher_dispatchEvent(this.__ptr, event,eventCode)
+	Polycode.EventDispatcher_dispatchEvent(this.__ptr, event.__ptr, eventCode)
 }
 
 EventDispatcher.prototype.dispatchEventNoDelete = function(event,eventCode) {
-	Polycode.EventDispatcher_dispatchEventNoDelete(this.__ptr, event,eventCode)
+	Polycode.EventDispatcher_dispatchEventNoDelete(this.__ptr, event.__ptr, eventCode)
 }

+ 4 - 0
bindings/javascript/Polycode/EventHandler.js

@@ -1,5 +1,9 @@
 function EventHandler() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.EventHandler()
+	}
 }
+
 Duktape.fin(EventHandler.prototype, function (x) {
 	if (x === EventHandler.prototype) {
 		return;

+ 9 - 1
bindings/javascript/Polycode/Font.js

@@ -1,8 +1,16 @@
-function Font() {
+require('Polycode/Resource')
+
+function Font(fileName,FTLibrary) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Font(fileName,FTLibrary)
+	}
 	Object.defineProperties(this, {
 		'loaded': { enumerable: true, configurable: true, get: Font.prototype.__get_loaded, set: Font.prototype.__set_loaded}
 	})
 }
+
+Font.prototype = Object.create(Resource.prototype);
+
 Font.prototype.__get_loaded = function() {
 	return Polycode.Font__get_loaded(this.__ptr)
 }

+ 6 - 2
bindings/javascript/Polycode/FontResourceLoader.js

@@ -1,5 +1,9 @@
 function FontResourceLoader() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.FontResourceLoader()
+	}
 }
+
 Duktape.fin(FontResourceLoader.prototype, function (x) {
 	if (x === FontResourceLoader.prototype) {
 		return;
@@ -8,7 +12,7 @@ Duktape.fin(FontResourceLoader.prototype, function (x) {
 })
 
 FontResourceLoader.prototype.loadResource = function(path,targetPool) {
-	var retVal = new shared_ptr<Resource>()
-	retVal.__ptr = Polycode.FontResourceLoader_loadResource(this.__ptr, path,targetPool)
+	var retVal = new Resource()
+	retVal.__ptr = Polycode.FontResourceLoader_loadResource(this.__ptr, path, targetPool.__ptr)
 	return retVal
 }

+ 4 - 0
bindings/javascript/Polycode/GPUDrawBuffer.js

@@ -1,4 +1,7 @@
 function GPUDrawBuffer() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.GPUDrawBuffer()
+	}
 	Object.defineProperties(this, {
 		'projectionMatrix': { enumerable: true, configurable: true, get: GPUDrawBuffer.prototype.__get_projectionMatrix, set: GPUDrawBuffer.prototype.__set_projectionMatrix},
 		'viewMatrix': { enumerable: true, configurable: true, get: GPUDrawBuffer.prototype.__get_viewMatrix, set: GPUDrawBuffer.prototype.__set_viewMatrix},
@@ -10,6 +13,7 @@ function GPUDrawBuffer() {
 		'viewport': { enumerable: true, configurable: true, get: GPUDrawBuffer.prototype.__get_viewport, set: GPUDrawBuffer.prototype.__set_viewport}
 	})
 }
+
 GPUDrawBuffer.prototype.__get_projectionMatrix = function() {
 	var retVal = new Matrix4()
 	retVal.__ptr = 	Polycode.GPUDrawBuffer__get_projectionMatrix(this.__ptr)

+ 4 - 0
bindings/javascript/Polycode/GPUDrawCall.js

@@ -1,9 +1,13 @@
 function GPUDrawCall() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.GPUDrawCall()
+	}
 	Object.defineProperties(this, {
 		'options': { enumerable: true, configurable: true, get: GPUDrawCall.prototype.__get_options, set: GPUDrawCall.prototype.__set_options},
 		'modelMatrix': { enumerable: true, configurable: true, get: GPUDrawCall.prototype.__get_modelMatrix, set: GPUDrawCall.prototype.__set_modelMatrix}
 	})
 }
+
 GPUDrawCall.prototype.__get_options = function() {
 	var retVal = new GPUDrawOptions()
 	retVal.__ptr = 	Polycode.GPUDrawCall__get_options(this.__ptr)

+ 4 - 0
bindings/javascript/Polycode/GPUDrawOptions.js

@@ -1,4 +1,7 @@
 function GPUDrawOptions() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.GPUDrawOptions()
+	}
 	Object.defineProperties(this, {
 		'depthTest': { enumerable: true, configurable: true, get: GPUDrawOptions.prototype.__get_depthTest, set: GPUDrawOptions.prototype.__set_depthTest},
 		'depthWrite': { enumerable: true, configurable: true, get: GPUDrawOptions.prototype.__get_depthWrite, set: GPUDrawOptions.prototype.__set_depthWrite},
@@ -13,6 +16,7 @@ function GPUDrawOptions() {
 		'drawColor': { enumerable: true, configurable: true, get: GPUDrawOptions.prototype.__get_drawColor, set: GPUDrawOptions.prototype.__set_drawColor}
 	})
 }
+
 GPUDrawOptions.prototype.__get_depthTest = function() {
 	return Polycode.GPUDrawOptions__get_depthTest(this.__ptr)
 }

+ 4 - 0
bindings/javascript/Polycode/GlyphData.js

@@ -1,4 +1,7 @@
 function GlyphData() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.GlyphData()
+	}
 	Object.defineProperties(this, {
 		'glyphs': { enumerable: true, configurable: true, get: GlyphData.prototype.__get_glyphs, set: GlyphData.prototype.__set_glyphs},
 		'positions': { enumerable: true, configurable: true, get: GlyphData.prototype.__get_positions, set: GlyphData.prototype.__set_positions},
@@ -6,6 +9,7 @@ function GlyphData() {
 		'trailingAdvance': { enumerable: true, configurable: true, get: GlyphData.prototype.__get_trailingAdvance, set: GlyphData.prototype.__set_trailingAdvance}
 	})
 }
+
 GlyphData.prototype.__get_glyphs = function() {
 	var retVal = new FT_Glyph()
 	retVal.__ptr = 	Polycode.GlyphData__get_glyphs(this.__ptr)

+ 23 - 13
bindings/javascript/Polycode/Image.js

@@ -1,4 +1,14 @@
-function Image() {
+function Image(fileName) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Image(fileName)
+	}
+}
+
+
+Image.prototype.BlankImage = function(width,height,type) {
+	var retVal = new Image()
+	retVal.__ptr = Polycode.Image_BlankImage(width, height, type)
+	return retVal
 }
 
 Image.prototype.loadImage = function(fileName) {
@@ -10,11 +20,11 @@ Image.prototype.saveImage = function(fileName) {
 }
 
 Image.prototype.pasteImage = function(image,x,y,blendingMode,blendAmount,blendColor) {
-	Polycode.Image_pasteImage(this.__ptr, image,x,y,blendingMode,blendAmount,blendColor)
+	Polycode.Image_pasteImage(this.__ptr, image.__ptr, x, y, blendingMode, blendAmount, blendColor)
 }
 
 Image.prototype.createEmpty = function(width,height,fillColor) {
-	Polycode.Image_createEmpty(this.__ptr, width,height,fillColor)
+	Polycode.Image_createEmpty(this.__ptr, width, height, fillColor)
 }
 
 Image.prototype.fill = function(color) {
@@ -22,41 +32,41 @@ Image.prototype.fill = function(color) {
 }
 
 Image.prototype.setPixel = function(x,y,r,g,b,a) {
-	Polycode.Image_setPixel(this.__ptr, x,y,r,g,b,a)
+	Polycode.Image_setPixel(this.__ptr, x, y, r, g, b, a)
 }
 
 Image.prototype.getPixel = function(x,y) {
 	var retVal = new Color()
-	retVal.__ptr = Polycode.Image_getPixel(this.__ptr, x,y)
+	retVal.__ptr = Polycode.Image_getPixel(this.__ptr, x, y)
 	return retVal
 }
 
 Image.prototype.swap = function(v1,v2) {
-	Polycode.Image_swap(this.__ptr, v1,v2)
+	Polycode.Image_swap(this.__ptr, v1.__ptr, v2.__ptr)
 }
 
 Image.prototype.drawLine = function(x0,y0,x1,y1,col) {
-	Polycode.Image_drawLine(this.__ptr, x0,y0,x1,y1,col)
+	Polycode.Image_drawLine(this.__ptr, x0, y0, x1, y1, col)
 }
 
 Image.prototype.moveBrushTo = function(x,y) {
-	Polycode.Image_moveBrushTo(this.__ptr, x,y)
+	Polycode.Image_moveBrushTo(this.__ptr, x, y)
 }
 
 Image.prototype.moveBrush = function(x,y) {
-	Polycode.Image_moveBrush(this.__ptr, x,y)
+	Polycode.Image_moveBrush(this.__ptr, x, y)
 }
 
 Image.prototype.drawLineTo = function(x,y,col) {
-	Polycode.Image_drawLineTo(this.__ptr, x,y,col)
+	Polycode.Image_drawLineTo(this.__ptr, x, y, col)
 }
 
 Image.prototype.fillRect = function(x,y,w,h,col) {
-	Polycode.Image_fillRect(this.__ptr, x,y,w,h,col)
+	Polycode.Image_fillRect(this.__ptr, x, y, w, h, col)
 }
 
 Image.prototype.perlinNoise = function(seed,alpha) {
-	Polycode.Image_perlinNoise(this.__ptr, seed,alpha)
+	Polycode.Image_perlinNoise(this.__ptr, seed, alpha)
 }
 
 Image.prototype.fastBlur = function(blurSize) {
@@ -73,7 +83,7 @@ Image.prototype.fastBlurHor = function(blurSize) {
 
 Image.prototype.getPixelsInRect = function(x,y,width,height) {
 	var retVal = new char()
-	retVal.__ptr = Polycode.Image_getPixelsInRect(this.__ptr, x,y,width,height)
+	retVal.__ptr = Polycode.Image_getPixelsInRect(this.__ptr, x, y, width, height)
 	return retVal
 }
 

+ 8 - 0
bindings/javascript/Polycode/InputEvent.js

@@ -1,4 +1,9 @@
+require('Polycode/Event')
+
 function InputEvent() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.InputEvent()
+	}
 	Object.defineProperties(this, {
 		'mouseButton': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_mouseButton, set: InputEvent.prototype.__set_mouseButton},
 		'mousePosition': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_mousePosition, set: InputEvent.prototype.__set_mousePosition},
@@ -15,6 +20,9 @@ function InputEvent() {
 		'hitDistance': { enumerable: true, configurable: true, get: InputEvent.prototype.__get_hitDistance, set: InputEvent.prototype.__set_hitDistance}
 	})
 }
+
+InputEvent.prototype = Object.create(Event.prototype);
+
 InputEvent.prototype.__get_mouseButton = function() {
 	return Polycode.InputEvent__get_mouseButton(this.__ptr)
 }

+ 4 - 0
bindings/javascript/Polycode/JoystickInfo.js

@@ -1,9 +1,13 @@
 function JoystickInfo() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.JoystickInfo()
+	}
 	Object.defineProperties(this, {
 		'deviceID': { enumerable: true, configurable: true, get: JoystickInfo.prototype.__get_deviceID, set: JoystickInfo.prototype.__set_deviceID},
 		'deviceIndex': { enumerable: true, configurable: true, get: JoystickInfo.prototype.__get_deviceIndex, set: JoystickInfo.prototype.__set_deviceIndex}
 	})
 }
+
 JoystickInfo.prototype.__get_deviceID = function() {
 	return Polycode.JoystickInfo__get_deviceID(this.__ptr)
 }

+ 12 - 4
bindings/javascript/Polycode/Label.js

@@ -1,5 +1,13 @@
-function Label() {
+require('Polycode/Image')
+
+function Label(font,text,size,antiAliasMode,premultiplyAlpha,backgroundColor,foregroundColor) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Label(font,text,size,antiAliasMode,premultiplyAlpha,backgroundColor,foregroundColor)
+	}
 }
+
+Label.prototype = Object.create(Image.prototype);
+
 Duktape.fin(Label.prototype, function (x) {
 	if (x === Label.prototype) {
 		return;
@@ -32,7 +40,7 @@ Label.prototype.getTextHeight = function() {
 }
 
 Label.prototype.setColorForRange = function(color,rangeStart,rangeEnd) {
-	Polycode.Label_setColorForRange(this.__ptr, color,rangeStart,rangeEnd)
+	Polycode.Label_setColorForRange(this.__ptr, color, rangeStart, rangeEnd)
 }
 
 Label.prototype.clearColors = function() {
@@ -58,7 +66,7 @@ Label.prototype.setFont = function(newFont) {
 }
 
 Label.prototype.getFont = function() {
-	var retVal = new shared_ptr<Font>()
+	var retVal = new Font()
 	retVal.__ptr = Polycode.Label_getFont(this.__ptr)
 	return retVal
 }
@@ -92,7 +100,7 @@ Label.prototype.setForegroundColor = function(color) {
 }
 
 Label.prototype.setColors = function(backgroundColor,foregroundColor) {
-	Polycode.Label_setColors(this.__ptr, backgroundColor,foregroundColor)
+	Polycode.Label_setColors(this.__ptr, backgroundColor, foregroundColor)
 }
 
 Label.prototype.getBackgroundColor = function() {

+ 4 - 0
bindings/javascript/Polycode/LightInfo.js

@@ -1,4 +1,7 @@
 function LightInfo() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.LightInfo()
+	}
 	Object.defineProperties(this, {
 		'importance': { enumerable: true, configurable: true, get: LightInfo.prototype.__get_importance, set: LightInfo.prototype.__set_importance},
 		'position': { enumerable: true, configurable: true, get: LightInfo.prototype.__get_position, set: LightInfo.prototype.__set_position},
@@ -16,6 +19,7 @@ function LightInfo() {
 		'lightViewMatrix': { enumerable: true, configurable: true, get: LightInfo.prototype.__get_lightViewMatrix, set: LightInfo.prototype.__set_lightViewMatrix}
 	})
 }
+
 LightInfo.prototype.__get_importance = function() {
 	return Polycode.LightInfo__get_importance(this.__ptr)
 }

+ 4 - 0
bindings/javascript/Polycode/LightInfoBinding.js

@@ -1,5 +1,9 @@
 function LightInfoBinding() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.LightInfoBinding()
+	}
 }
+
 Duktape.fin(LightInfoBinding.prototype, function (x) {
 	if (x === LightInfoBinding.prototype) {
 		return;

+ 4 - 0
bindings/javascript/Polycode/LightShadowInfoBinding.js

@@ -1,5 +1,9 @@
 function LightShadowInfoBinding() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.LightShadowInfoBinding()
+	}
 }
+
 Duktape.fin(LightShadowInfoBinding.prototype, function (x) {
 	if (x === LightShadowInfoBinding.prototype) {
 		return;

+ 8 - 4
bindings/javascript/Polycode/LocalShaderParam.js

@@ -1,4 +1,7 @@
 function LocalShaderParam() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.LocalShaderParam()
+	}
 	Object.defineProperties(this, {
 		'name': { enumerable: true, configurable: true, get: LocalShaderParam.prototype.__get_name, set: LocalShaderParam.prototype.__set_name},
 		'type': { enumerable: true, configurable: true, get: LocalShaderParam.prototype.__get_type, set: LocalShaderParam.prototype.__set_type},
@@ -7,6 +10,7 @@ function LocalShaderParam() {
 		'param': { enumerable: true, configurable: true, get: LocalShaderParam.prototype.__get_param, set: LocalShaderParam.prototype.__set_param}
 	})
 }
+
 LocalShaderParam.prototype.__get_name = function() {
 	return Polycode.LocalShaderParam__get_name(this.__ptr)
 }
@@ -57,7 +61,7 @@ Duktape.fin(LocalShaderParam.prototype, function (x) {
 })
 
 LocalShaderParam.prototype.Copy = function() {
-	var retVal = new shared_ptr<LocalShaderParam>()
+	var retVal = new LocalShaderParam()
 	retVal.__ptr = Polycode.LocalShaderParam_Copy(this.__ptr)
 	return retVal
 }
@@ -115,7 +119,7 @@ LocalShaderParam.prototype.setTexture = function(texture) {
 }
 
 LocalShaderParam.prototype.getTexture = function() {
-	var retVal = new shared_ptr<Texture>()
+	var retVal = new Texture()
 	retVal.__ptr = Polycode.LocalShaderParam_getTexture(this.__ptr)
 	return retVal
 }
@@ -125,11 +129,11 @@ LocalShaderParam.prototype.setCubemap = function(cubemap) {
 }
 
 LocalShaderParam.prototype.getCubemap = function() {
-	var retVal = new shared_ptr<Cubemap>()
+	var retVal = new Cubemap()
 	retVal.__ptr = Polycode.LocalShaderParam_getCubemap(this.__ptr)
 	return retVal
 }
 
 LocalShaderParam.prototype.setParamValueFromString = function(type,pvalue) {
-	Polycode.LocalShaderParam_setParamValueFromString(this.__ptr, type,pvalue)
+	Polycode.LocalShaderParam_setParamValueFromString(this.__ptr, type, pvalue)
 }

+ 14 - 6
bindings/javascript/Polycode/Material.js

@@ -1,10 +1,18 @@
-function Material() {
+require('Polycode/Resource')
+
+function Material(name) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Material(name)
+	}
 	Object.defineProperties(this, {
 		'fp16RenderTargets': { enumerable: true, configurable: true, get: Material.prototype.__get_fp16RenderTargets, set: Material.prototype.__set_fp16RenderTargets},
 		'blendingMode': { enumerable: true, configurable: true, get: Material.prototype.__get_blendingMode, set: Material.prototype.__set_blendingMode},
 		'screenMaterial': { enumerable: true, configurable: true, get: Material.prototype.__get_screenMaterial, set: Material.prototype.__set_screenMaterial}
 	})
 }
+
+Material.prototype = Object.create(Resource.prototype);
+
 Material.prototype.__get_fp16RenderTargets = function() {
 	return Polycode.Material__get_fp16RenderTargets(this.__ptr)
 }
@@ -35,7 +43,7 @@ Material.prototype.addShaderPass = function(pass) {
 }
 
 Material.prototype.addShaderPassAtIndex = function(pass,shaderIndex) {
-	Polycode.Material_addShaderPassAtIndex(this.__ptr, pass,shaderIndex)
+	Polycode.Material_addShaderPassAtIndex(this.__ptr, pass, shaderIndex)
 }
 
 Material.prototype.getNumShaderPasses = function() {
@@ -47,7 +55,7 @@ Material.prototype.removeShaderPass = function(shaderIndex) {
 }
 
 Material.prototype.addShaderRenderTarget = function(newTarget) {
-	Polycode.Material_addShaderRenderTarget(this.__ptr, newTarget)
+	Polycode.Material_addShaderRenderTarget(this.__ptr, newTarget.__ptr)
 }
 
 Material.prototype.getNumShaderRenderTargets = function() {
@@ -65,7 +73,7 @@ Material.prototype.removeShaderRenderTarget = function(index) {
 }
 
 Material.prototype.recreateRenderTarget = function(renderTarget) {
-	Polycode.Material_recreateRenderTarget(this.__ptr, renderTarget)
+	Polycode.Material_recreateRenderTarget(this.__ptr, renderTarget.__ptr)
 }
 
 Material.prototype.recreateRenderTargets = function() {
@@ -83,13 +91,13 @@ Material.prototype.getShaderPass = function(index) {
 }
 
 Material.prototype.getShaderBinding = function(index) {
-	var retVal = new shared_ptr<ShaderBinding>()
+	var retVal = new ShaderBinding()
 	retVal.__ptr = Polycode.Material_getShaderBinding(this.__ptr, index)
 	return retVal
 }
 
 Material.prototype.getShader = function(index) {
-	var retVal = new shared_ptr<Shader>()
+	var retVal = new Shader()
 	retVal.__ptr = Polycode.Material_getShader(this.__ptr, index)
 	return retVal
 }

+ 6 - 2
bindings/javascript/Polycode/MaterialResourceLoader.js

@@ -1,5 +1,9 @@
 function MaterialResourceLoader() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.MaterialResourceLoader()
+	}
 }
+
 Duktape.fin(MaterialResourceLoader.prototype, function (x) {
 	if (x === MaterialResourceLoader.prototype) {
 		return;
@@ -8,7 +12,7 @@ Duktape.fin(MaterialResourceLoader.prototype, function (x) {
 })
 
 MaterialResourceLoader.prototype.loadResource = function(path,targetPool) {
-	var retVal = new shared_ptr<Resource>()
-	retVal.__ptr = Polycode.MaterialResourceLoader_loadResource(this.__ptr, path,targetPool)
+	var retVal = new Resource()
+	retVal.__ptr = Polycode.MaterialResourceLoader_loadResource(this.__ptr, path, targetPool.__ptr)
 	return retVal
 }

+ 14 - 6
bindings/javascript/Polycode/Matrix4.js

@@ -1,5 +1,9 @@
 function Matrix4() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Matrix4()
+	}
 }
+
 Duktape.fin(Matrix4.prototype, function (x) {
 	if (x === Matrix4.prototype) {
 		return;
@@ -42,11 +46,11 @@ Matrix4.prototype.multVector4 = function(v2) {
 }
 
 Matrix4.prototype.Translate = function(x,y,z) {
-	Polycode.Matrix4_Translate(this.__ptr, x,y,z)
+	Polycode.Matrix4_Translate(this.__ptr, x, y, z)
 }
 
 Matrix4.prototype.setPosition = function(x,y,z) {
-	Polycode.Matrix4_setPosition(this.__ptr, x,y,z)
+	Polycode.Matrix4_setPosition(this.__ptr, x, y, z)
 }
 
 Matrix4.prototype.setScale = function(scale) {
@@ -54,7 +58,7 @@ Matrix4.prototype.setScale = function(scale) {
 }
 
 Matrix4.prototype.getEulerAngles = function(ax,ay,az) {
-	Polycode.Matrix4_getEulerAngles(this.__ptr, ax,ay,az)
+	Polycode.Matrix4_getEulerAngles(this.__ptr, ax.__ptr, ay.__ptr, az.__ptr)
 }
 
 Matrix4.prototype.transpose = function() {
@@ -79,14 +83,18 @@ Matrix4.prototype.determinant = function() {
 	return Polycode.Matrix4_determinant(this.__ptr)
 }
 
+Matrix4.prototype.generalDeterminant = function(a,n) {
+	return Polycode.Matrix4_generalDeterminant(a.__ptr, n)
+}
+
 Matrix4.prototype.setOrthoProjection = function(left,right,bottom,top,zNear,zFar) {
-	Polycode.Matrix4_setOrthoProjection(this.__ptr, left,right,bottom,top,zNear,zFar)
+	Polycode.Matrix4_setOrthoProjection(this.__ptr, left, right, bottom, top, zNear, zFar)
 }
 
 Matrix4.prototype.setProjectionFrustum = function(left,right,bottom,top,zNear,zFar) {
-	Polycode.Matrix4_setProjectionFrustum(this.__ptr, left,right,bottom,top,zNear,zFar)
+	Polycode.Matrix4_setProjectionFrustum(this.__ptr, left, right, bottom, top, zNear, zFar)
 }
 
 Matrix4.prototype.setProjection = function(fov,aspect,zNear,zFar) {
-	Polycode.Matrix4_setProjection(this.__ptr, fov,aspect,zNear,zFar)
+	Polycode.Matrix4_setProjection(this.__ptr, fov, aspect, zNear, zFar)
 }

+ 17 - 3
bindings/javascript/Polycode/Mesh.js

@@ -1,4 +1,18 @@
+require('Polycode/Resource')
+
 function Mesh() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Mesh()
+	}
+}
+
+Mesh.prototype = Object.create(Resource.prototype);
+
+
+Mesh.prototype.MeshFromFileName = function(fileName) {
+	var retVal = new Mesh()
+	retVal.__ptr = Polycode.Mesh_MeshFromFileName(fileName)
+	return retVal
 }
 
 Mesh.prototype.Copy = function() {
@@ -12,11 +26,11 @@ Mesh.prototype.loadMesh = function(fileName) {
 }
 
 Mesh.prototype.saveToFile = function(fileName,writeNormals,writeTangents,writeColors,writeBoneWeights,writeUVs,writeSecondaryUVs) {
-	Polycode.Mesh_saveToFile(this.__ptr, fileName,writeNormals,writeTangents,writeColors,writeBoneWeights,writeUVs,writeSecondaryUVs)
+	Polycode.Mesh_saveToFile(this.__ptr, fileName, writeNormals, writeTangents, writeColors, writeBoneWeights, writeUVs, writeSecondaryUVs)
 }
 
 Mesh.prototype.loadFromFile = function(inFile) {
-	Polycode.Mesh_loadFromFile(this.__ptr, inFile)
+	Polycode.Mesh_loadFromFile(this.__ptr, inFile.__ptr)
 }
 
 Mesh.prototype.addSubmesh = function(newSubmesh) {
@@ -38,7 +52,7 @@ Mesh.prototype.getSubmeshAtIndex = function(index) {
 }
 
 Mesh.prototype.getSubmeshPointer = function(index) {
-	var retVal = new shared_ptr<MeshGeometry>()
+	var retVal = new MeshGeometry()
 	retVal.__ptr = Polycode.Mesh_getSubmeshPointer(this.__ptr, index)
 	return retVal
 }

+ 34 - 24
bindings/javascript/Polycode/MeshGeometry.js

@@ -1,10 +1,14 @@
 function MeshGeometry() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.MeshGeometry()
+	}
 	Object.defineProperties(this, {
 		'meshType': { enumerable: true, configurable: true, get: MeshGeometry.prototype.__get_meshType, set: MeshGeometry.prototype.__set_meshType},
 		'dataChanged': { enumerable: true, configurable: true, get: MeshGeometry.prototype.__get_dataChanged, set: MeshGeometry.prototype.__set_dataChanged},
 		'indexedMesh': { enumerable: true, configurable: true, get: MeshGeometry.prototype.__get_indexedMesh, set: MeshGeometry.prototype.__set_indexedMesh}
 	})
 }
+
 MeshGeometry.prototype.__get_meshType = function() {
 	return Polycode.MeshGeometry__get_meshType(this.__ptr)
 }
@@ -45,47 +49,47 @@ MeshGeometry.prototype.getVertexCount = function() {
 }
 
 MeshGeometry.prototype.createPlane = function(w,h,tilingValue) {
-	Polycode.MeshGeometry_createPlane(this.__ptr, w,h,tilingValue)
+	Polycode.MeshGeometry_createPlane(this.__ptr, w, h, tilingValue)
 }
 
 MeshGeometry.prototype.createVPlane = function(w,h,tilingValue) {
-	Polycode.MeshGeometry_createVPlane(this.__ptr, w,h,tilingValue)
+	Polycode.MeshGeometry_createVPlane(this.__ptr, w, h, tilingValue)
 }
 
 MeshGeometry.prototype.createCircle = function(w,h,numSegments,tilingValue) {
-	Polycode.MeshGeometry_createCircle(this.__ptr, w,h,numSegments,tilingValue)
+	Polycode.MeshGeometry_createCircle(this.__ptr, w, h, numSegments, tilingValue)
 }
 
 MeshGeometry.prototype.createLineCircle = function(w,h,numSegments,tilingValue) {
-	Polycode.MeshGeometry_createLineCircle(this.__ptr, w,h,numSegments,tilingValue)
+	Polycode.MeshGeometry_createLineCircle(this.__ptr, w, h, numSegments, tilingValue)
 }
 
 MeshGeometry.prototype.createTorus = function(radius,tubeRadius,segmentsW,segmentsH,tilingValue) {
-	Polycode.MeshGeometry_createTorus(this.__ptr, radius,tubeRadius,segmentsW,segmentsH,tilingValue)
+	Polycode.MeshGeometry_createTorus(this.__ptr, radius, tubeRadius, segmentsW, segmentsH, tilingValue)
 }
 
 MeshGeometry.prototype.createBox = function(w,d,h,tilingValue) {
-	Polycode.MeshGeometry_createBox(this.__ptr, w,d,h,tilingValue)
+	Polycode.MeshGeometry_createBox(this.__ptr, w, d, h, tilingValue)
 }
 
 MeshGeometry.prototype.createSphere = function(radius,numRings,numSegments,tilingValue) {
-	Polycode.MeshGeometry_createSphere(this.__ptr, radius,numRings,numSegments,tilingValue)
+	Polycode.MeshGeometry_createSphere(this.__ptr, radius, numRings, numSegments, tilingValue)
 }
 
 MeshGeometry.prototype.createIcosphere = function(radius,subdivisions) {
-	Polycode.MeshGeometry_createIcosphere(this.__ptr, radius,subdivisions)
+	Polycode.MeshGeometry_createIcosphere(this.__ptr, radius, subdivisions)
 }
 
 MeshGeometry.prototype.createOctosphere = function(radius,subdivisions) {
-	Polycode.MeshGeometry_createOctosphere(this.__ptr, radius,subdivisions)
+	Polycode.MeshGeometry_createOctosphere(this.__ptr, radius, subdivisions)
 }
 
 MeshGeometry.prototype.createCylinder = function(height,radius,numSegments,capped,tilingValue) {
-	Polycode.MeshGeometry_createCylinder(this.__ptr, height,radius,numSegments,capped,tilingValue)
+	Polycode.MeshGeometry_createCylinder(this.__ptr, height, radius, numSegments, capped, tilingValue)
 }
 
 MeshGeometry.prototype.createCone = function(height,radius,numSegments,tilingValue) {
-	Polycode.MeshGeometry_createCone(this.__ptr, height,radius,numSegments,tilingValue)
+	Polycode.MeshGeometry_createCone(this.__ptr, height, radius, numSegments, tilingValue)
 }
 
 MeshGeometry.prototype.recenterMesh = function() {
@@ -95,43 +99,43 @@ MeshGeometry.prototype.recenterMesh = function() {
 }
 
 MeshGeometry.prototype.setVertexAtOffset = function(offset,x,y,z) {
-	Polycode.MeshGeometry_setVertexAtOffset(this.__ptr, offset,x,y,z)
+	Polycode.MeshGeometry_setVertexAtOffset(this.__ptr, offset, x, y, z)
 }
 
 MeshGeometry.prototype.addVertexWithUVAndNormal = function(x,y,z,u,v,nx,ny,nz) {
-	Polycode.MeshGeometry_addVertexWithUVAndNormal(this.__ptr, x,y,z,u,v,nx,ny,nz)
+	Polycode.MeshGeometry_addVertexWithUVAndNormal(this.__ptr, x, y, z, u, v, nx, ny, nz)
 }
 
 MeshGeometry.prototype.addTexCoord = function(u,v) {
-	Polycode.MeshGeometry_addTexCoord(this.__ptr, u,v)
+	Polycode.MeshGeometry_addTexCoord(this.__ptr, u, v)
 }
 
 MeshGeometry.prototype.addTexCoord2 = function(u,v) {
-	Polycode.MeshGeometry_addTexCoord2(this.__ptr, u,v)
+	Polycode.MeshGeometry_addTexCoord2(this.__ptr, u, v)
 }
 
 MeshGeometry.prototype.addTangent = function(x,y,z) {
-	Polycode.MeshGeometry_addTangent(this.__ptr, x,y,z)
+	Polycode.MeshGeometry_addTangent(this.__ptr, x, y, z)
 }
 
 MeshGeometry.prototype.addVertexWithUV = function(x,y,z,u,v) {
-	Polycode.MeshGeometry_addVertexWithUV(this.__ptr, x,y,z,u,v)
+	Polycode.MeshGeometry_addVertexWithUV(this.__ptr, x, y, z, u, v)
 }
 
 MeshGeometry.prototype.addVertex = function(x,y,z) {
-	Polycode.MeshGeometry_addVertex(this.__ptr, x,y,z)
+	Polycode.MeshGeometry_addVertex(this.__ptr, x, y, z)
 }
 
 MeshGeometry.prototype.addNormal = function(nx,ny,nz) {
-	Polycode.MeshGeometry_addNormal(this.__ptr, nx,ny,nz)
+	Polycode.MeshGeometry_addNormal(this.__ptr, nx, ny, nz)
 }
 
 MeshGeometry.prototype.addBoneAssignments = function(b1Weight,b1Index,b2Weight,b2Index,b3Weight,b3Index,b4Weight,b4Index) {
-	Polycode.MeshGeometry_addBoneAssignments(this.__ptr, b1Weight,b1Index,b2Weight,b2Index,b3Weight,b3Index,b4Weight,b4Index)
+	Polycode.MeshGeometry_addBoneAssignments(this.__ptr, b1Weight, b1Index, b2Weight, b2Index, b3Weight, b3Index, b4Weight, b4Index)
 }
 
 MeshGeometry.prototype.addColor = function(r,g,b,a) {
-	Polycode.MeshGeometry_addColor(this.__ptr, r,g,b,a)
+	Polycode.MeshGeometry_addColor(this.__ptr, r, g, b, a)
 }
 
 MeshGeometry.prototype.getVertexPosition = function(vertexOffset) {
@@ -195,7 +199,7 @@ MeshGeometry.prototype.calculateBBox = function() {
 }
 
 MeshGeometry.prototype.addIndexedFace = function(i1,i2) {
-	Polycode.MeshGeometry_addIndexedFace(this.__ptr, i1,i2)
+	Polycode.MeshGeometry_addIndexedFace(this.__ptr, i1, i2)
 }
 
 MeshGeometry.prototype.addIndex = function(index) {
@@ -203,7 +207,7 @@ MeshGeometry.prototype.addIndex = function(index) {
 }
 
 MeshGeometry.prototype.removeVertexRange = function(beginRemoveVertex,vertexRemovalCount) {
-	Polycode.MeshGeometry_removeVertexRange(this.__ptr, beginRemoveVertex,vertexRemovalCount)
+	Polycode.MeshGeometry_removeVertexRange(this.__ptr, beginRemoveVertex, vertexRemovalCount)
 }
 
 MeshGeometry.prototype.removeFace = function(faceIndex) {
@@ -219,7 +223,13 @@ MeshGeometry.prototype.getIndexCount = function() {
 }
 
 MeshGeometry.prototype.subdivideToRadius = function(radius,subdivisions) {
-	Polycode.MeshGeometry_subdivideToRadius(this.__ptr, radius,subdivisions)
+	Polycode.MeshGeometry_subdivideToRadius(this.__ptr, radius, subdivisions)
+}
+
+MeshGeometry.prototype.calculateFaceTangent = function(v1,v2,v3,texCoord1,texCoord2,texCoord3) {
+	var retVal = new Vector3()
+	retVal.__ptr = Polycode.MeshGeometry_calculateFaceTangent(v1, v2, v3, texCoord1, texCoord2, texCoord3)
+	return retVal
 }
 
 MeshGeometry.prototype.saveAsOBJ = function(fileName) {

+ 6 - 2
bindings/javascript/Polycode/MeshResourceLoader.js

@@ -1,5 +1,9 @@
 function MeshResourceLoader() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.MeshResourceLoader()
+	}
 }
+
 Duktape.fin(MeshResourceLoader.prototype, function (x) {
 	if (x === MeshResourceLoader.prototype) {
 		return;
@@ -8,7 +12,7 @@ Duktape.fin(MeshResourceLoader.prototype, function (x) {
 })
 
 MeshResourceLoader.prototype.loadResource = function(path,targetPool) {
-	var retVal = new shared_ptr<Resource>()
-	retVal.__ptr = Polycode.MeshResourceLoader_loadResource(this.__ptr, path,targetPool)
+	var retVal = new Resource()
+	retVal.__ptr = Polycode.MeshResourceLoader_loadResource(this.__ptr, path, targetPool.__ptr)
 	return retVal
 }

+ 4 - 0
bindings/javascript/Polycode/MouseEventResult.js

@@ -1,9 +1,13 @@
 function MouseEventResult() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.MouseEventResult()
+	}
 	Object.defineProperties(this, {
 		'hit': { enumerable: true, configurable: true, get: MouseEventResult.prototype.__get_hit, set: MouseEventResult.prototype.__set_hit},
 		'blocked': { enumerable: true, configurable: true, get: MouseEventResult.prototype.__get_blocked, set: MouseEventResult.prototype.__set_blocked}
 	})
 }
+
 MouseEventResult.prototype.__get_hit = function() {
 	return Polycode.MouseEventResult__get_hit(this.__ptr)
 }

+ 5 - 1
bindings/javascript/Polycode/OSFileEntry.js

@@ -1,4 +1,7 @@
 function OSFileEntry() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.OSFileEntry()
+	}
 	Object.defineProperties(this, {
 		'name': { enumerable: true, configurable: true, get: OSFileEntry.prototype.__get_name, set: OSFileEntry.prototype.__set_name},
 		'extension': { enumerable: true, configurable: true, get: OSFileEntry.prototype.__get_extension, set: OSFileEntry.prototype.__set_extension},
@@ -8,6 +11,7 @@ function OSFileEntry() {
 		'type': { enumerable: true, configurable: true, get: OSFileEntry.prototype.__get_type, set: OSFileEntry.prototype.__set_type}
 	})
 }
+
 OSFileEntry.prototype.__get_name = function() {
 	return Polycode.OSFileEntry__get_name(this.__ptr)
 }
@@ -64,5 +68,5 @@ Duktape.fin(OSFileEntry.prototype, function (x) {
 })
 
 OSFileEntry.prototype.init = function(path,name,type) {
-	Polycode.OSFileEntry_init(this.__ptr, path,name,type)
+	Polycode.OSFileEntry_init(this.__ptr, path, name, type)
 }

+ 7 - 3
bindings/javascript/Polycode/ObjectEntry.js

@@ -1,4 +1,7 @@
 function ObjectEntry() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ObjectEntry()
+	}
 	Object.defineProperties(this, {
 		'type': { enumerable: true, configurable: true, get: ObjectEntry.prototype.__get_type, set: ObjectEntry.prototype.__set_type},
 		'name': { enumerable: true, configurable: true, get: ObjectEntry.prototype.__get_name, set: ObjectEntry.prototype.__set_name},
@@ -9,6 +12,7 @@ function ObjectEntry() {
 		'length': { enumerable: true, configurable: true, get: ObjectEntry.prototype.__get_length, set: ObjectEntry.prototype.__set_length}
 	})
 }
+
 ObjectEntry.prototype.__get_type = function() {
 	return Polycode.ObjectEntry__get_type(this.__ptr)
 }
@@ -73,15 +77,15 @@ Duktape.fin(ObjectEntry.prototype, function (x) {
 })
 
 ObjectEntry.prototype.readNumber = function(key,out) {
-	return Polycode.ObjectEntry_readNumber(this.__ptr, key,out)
+	return Polycode.ObjectEntry_readNumber(this.__ptr, key, out.__ptr)
 }
 
 ObjectEntry.prototype.readString = function(key,out) {
-	return Polycode.ObjectEntry_readString(this.__ptr, key,out)
+	return Polycode.ObjectEntry_readString(this.__ptr, key, out.__ptr)
 }
 
 ObjectEntry.prototype.readBool = function(key,out) {
-	return Polycode.ObjectEntry_readBool(this.__ptr, key,out)
+	return Polycode.ObjectEntry_readBool(this.__ptr, key, out.__ptr)
 }
 
 ObjectEntry.prototype.addChild = function(name) {

+ 9 - 5
bindings/javascript/Polycode/Perlin.js

@@ -1,5 +1,9 @@
-function Perlin() {
+function Perlin(octaves,freq,amp,seed) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Perlin(octaves,freq,amp,seed)
+	}
 }
+
 Duktape.fin(Perlin.prototype, function (x) {
 	if (x === Perlin.prototype) {
 		return;
@@ -8,17 +12,17 @@ Duktape.fin(Perlin.prototype, function (x) {
 })
 
 Perlin.prototype.Get2DTiledX = function(x,y,t) {
-	return Polycode.Perlin_Get2DTiledX(this.__ptr, x,y,t)
+	return Polycode.Perlin_Get2DTiledX(this.__ptr, x, y, t)
 }
 
 Perlin.prototype.Get = function(x,y) {
-	return Polycode.Perlin_Get(this.__ptr, x,y)
+	return Polycode.Perlin_Get(this.__ptr, x, y)
 }
 
 Perlin.prototype.Get2D = function(x,y) {
-	return Polycode.Perlin_Get2D(this.__ptr, x,y)
+	return Polycode.Perlin_Get2D(this.__ptr, x, y)
 }
 
 Perlin.prototype.Get3D = function(x,y,z) {
-	return Polycode.Perlin_Get3D(this.__ptr, x,y,z)
+	return Polycode.Perlin_Get3D(this.__ptr, x, y, z)
 }

+ 4 - 0
bindings/javascript/Polycode/PolycodeViewBase.js

@@ -1,8 +1,12 @@
 function PolycodeViewBase() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.PolycodeViewBase()
+	}
 	Object.defineProperties(this, {
 		'resizable': { enumerable: true, configurable: true, get: PolycodeViewBase.prototype.__get_resizable, set: PolycodeViewBase.prototype.__set_resizable}
 	})
 }
+
 PolycodeViewBase.prototype.__get_resizable = function() {
 	return Polycode.PolycodeViewBase__get_resizable(this.__ptr)
 }

+ 4 - 0
bindings/javascript/Polycode/ProgramAttribute.js

@@ -1,10 +1,14 @@
 function ProgramAttribute() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ProgramAttribute()
+	}
 	Object.defineProperties(this, {
 		'size': { enumerable: true, configurable: true, get: ProgramAttribute.prototype.__get_size, set: ProgramAttribute.prototype.__set_size},
 		'name': { enumerable: true, configurable: true, get: ProgramAttribute.prototype.__get_name, set: ProgramAttribute.prototype.__set_name},
 		'arrayType': { enumerable: true, configurable: true, get: ProgramAttribute.prototype.__get_arrayType, set: ProgramAttribute.prototype.__set_arrayType}
 	})
 }
+
 ProgramAttribute.prototype.__get_size = function() {
 	return Polycode.ProgramAttribute__get_size(this.__ptr)
 }

+ 8 - 0
bindings/javascript/Polycode/ProgramParam.js

@@ -1,10 +1,14 @@
 function ProgramParam() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ProgramParam()
+	}
 	Object.defineProperties(this, {
 		'name': { enumerable: true, configurable: true, get: ProgramParam.prototype.__get_name, set: ProgramParam.prototype.__set_name},
 		'type': { enumerable: true, configurable: true, get: ProgramParam.prototype.__get_type, set: ProgramParam.prototype.__set_type},
 		'globalParam': { enumerable: true, configurable: true, get: ProgramParam.prototype.__get_globalParam, set: ProgramParam.prototype.__set_globalParam}
 	})
 }
+
 ProgramParam.prototype.__get_name = function() {
 	return Polycode.ProgramParam__get_name(this.__ptr)
 }
@@ -37,3 +41,7 @@ Duktape.fin(ProgramParam.prototype, function (x) {
 	}
 	Polycode.ProgramParam__delete(x.__ptr)
 })
+
+ProgramParam.prototype.createParamData = function(type) {
+	Polycode.ProgramParam_createParamData(type)
+}

+ 6 - 2
bindings/javascript/Polycode/ProgramResourceLoader.js

@@ -1,5 +1,9 @@
 function ProgramResourceLoader() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ProgramResourceLoader()
+	}
 }
+
 Duktape.fin(ProgramResourceLoader.prototype, function (x) {
 	if (x === ProgramResourceLoader.prototype) {
 		return;
@@ -8,7 +12,7 @@ Duktape.fin(ProgramResourceLoader.prototype, function (x) {
 })
 
 ProgramResourceLoader.prototype.loadResource = function(path,targetPool) {
-	var retVal = new shared_ptr<Resource>()
-	retVal.__ptr = Polycode.ProgramResourceLoader_loadResource(this.__ptr, path,targetPool)
+	var retVal = new Resource()
+	retVal.__ptr = Polycode.ProgramResourceLoader_loadResource(this.__ptr, path, targetPool.__ptr)
 	return retVal
 }

+ 4 - 0
bindings/javascript/Polycode/QuatTriple.js

@@ -1,4 +1,7 @@
 function QuatTriple() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.QuatTriple()
+	}
 	Object.defineProperties(this, {
 		'q1': { enumerable: true, configurable: true, get: QuatTriple.prototype.__get_q1, set: QuatTriple.prototype.__set_q1},
 		'q2': { enumerable: true, configurable: true, get: QuatTriple.prototype.__get_q2, set: QuatTriple.prototype.__set_q2},
@@ -6,6 +9,7 @@ function QuatTriple() {
 		'time': { enumerable: true, configurable: true, get: QuatTriple.prototype.__get_time, set: QuatTriple.prototype.__set_time}
 	})
 }
+
 QuatTriple.prototype.__get_q1 = function() {
 	var retVal = new Quaternion()
 	retVal.__ptr = 	Polycode.QuatTriple__get_q1(this.__ptr)

+ 23 - 7
bindings/javascript/Polycode/Quaternion.js

@@ -1,4 +1,7 @@
-function Quaternion() {
+function Quaternion(w,x,y,z) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Quaternion(w,x,y,z)
+	}
 	Object.defineProperties(this, {
 		'x': { enumerable: true, configurable: true, get: Quaternion.prototype.__get_x, set: Quaternion.prototype.__set_x},
 		'y': { enumerable: true, configurable: true, get: Quaternion.prototype.__get_y, set: Quaternion.prototype.__set_y},
@@ -6,6 +9,7 @@ function Quaternion() {
 		'w': { enumerable: true, configurable: true, get: Quaternion.prototype.__get_w, set: Quaternion.prototype.__set_w}
 	})
 }
+
 Quaternion.prototype.__get_x = function() {
 	return Polycode.Quaternion__get_x(this.__ptr)
 }
@@ -49,6 +53,12 @@ Quaternion.prototype.setFromMatrix = function(_mat) {
 	Polycode.Quaternion_setFromMatrix(this.__ptr, _mat)
 }
 
+Quaternion.prototype.Slerp = function(fT,rkP,rkQ,shortestPath) {
+	var retVal = new Quaternion()
+	retVal.__ptr = Polycode.Quaternion_Slerp(fT, rkP, rkQ, shortestPath)
+	return retVal
+}
+
 Quaternion.prototype.Dot = function(rkQ) {
 	return Polycode.Quaternion_Dot(this.__ptr, rkQ)
 }
@@ -74,13 +84,19 @@ Quaternion.prototype.Normalize = function() {
 }
 
 Quaternion.prototype.lookAt = function(D,upVector) {
-	Polycode.Quaternion_lookAt(this.__ptr, D,upVector)
+	Polycode.Quaternion_lookAt(this.__ptr, D, upVector)
 }
 
 Quaternion.prototype.createFromMatrix = function(matrix) {
 	Polycode.Quaternion_createFromMatrix(this.__ptr, matrix)
 }
 
+Quaternion.prototype.Squad = function(fT,rkP,rkA,rkB,rkQ,shortestPath) {
+	var retVal = new Quaternion()
+	retVal.__ptr = Polycode.Quaternion_Squad(fT, rkP, rkA, rkB, rkQ, shortestPath)
+	return retVal
+}
+
 Quaternion.prototype.Inverse = function() {
 	var retVal = new Quaternion()
 	retVal.__ptr = Polycode.Quaternion_Inverse(this.__ptr)
@@ -88,7 +104,7 @@ Quaternion.prototype.Inverse = function() {
 }
 
 Quaternion.prototype.set = function(w,x,y,z) {
-	Polycode.Quaternion_set(this.__ptr, w,x,y,z)
+	Polycode.Quaternion_set(this.__ptr, w, x, y, z)
 }
 
 Quaternion.prototype.InvSqrt = function(x) {
@@ -96,11 +112,11 @@ Quaternion.prototype.InvSqrt = function(x) {
 }
 
 Quaternion.prototype.fromAxes = function(az,ay,ax) {
-	Polycode.Quaternion_fromAxes(this.__ptr, az,ay,ax)
+	Polycode.Quaternion_fromAxes(this.__ptr, az, ay, ax)
 }
 
 Quaternion.prototype.fromAngleAxis = function(rfAngle,rkAxis) {
-	Polycode.Quaternion_fromAngleAxis(this.__ptr, rfAngle,rkAxis)
+	Polycode.Quaternion_fromAngleAxis(this.__ptr, rfAngle, rkAxis)
 }
 
 Quaternion.prototype.toEulerAngles = function() {
@@ -110,11 +126,11 @@ Quaternion.prototype.toEulerAngles = function() {
 }
 
 Quaternion.prototype.toAngleAxis = function(rfAngle,rkAxis) {
-	Polycode.Quaternion_toAngleAxis(this.__ptr, rfAngle,rkAxis)
+	Polycode.Quaternion_toAngleAxis(this.__ptr, rfAngle, rkAxis)
 }
 
 Quaternion.prototype.createFromAxisAngle = function(x,y,z,degrees) {
-	Polycode.Quaternion_createFromAxisAngle(this.__ptr, x,y,z,degrees)
+	Polycode.Quaternion_createFromAxisAngle(this.__ptr, x, y, z, degrees)
 }
 
 Quaternion.prototype.createMatrix = function() {

+ 7 - 3
bindings/javascript/Polycode/QuaternionCurve.js

@@ -1,5 +1,9 @@
-function QuaternionCurve() {
+function QuaternionCurve(wCurve,xCurve,yCurve,zCurve) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.QuaternionCurve(wCurve,xCurve,yCurve,zCurve)
+	}
 }
+
 Duktape.fin(QuaternionCurve.prototype, function (x) {
 	if (x === QuaternionCurve.prototype) {
 		return;
@@ -9,10 +13,10 @@ Duktape.fin(QuaternionCurve.prototype, function (x) {
 
 QuaternionCurve.prototype.interpolate = function(t,useShortestPath) {
 	var retVal = new Quaternion()
-	retVal.__ptr = Polycode.QuaternionCurve_interpolate(this.__ptr, t,useShortestPath)
+	retVal.__ptr = Polycode.QuaternionCurve_interpolate(this.__ptr, t, useShortestPath)
 	return retVal
 }
 
 QuaternionCurve.prototype.generatePointsFromCurves = function(wCurve,xCurve,yCurve,zCurve) {
-	Polycode.QuaternionCurve_generatePointsFromCurves(this.__ptr, wCurve,xCurve,yCurve,zCurve)
+	Polycode.QuaternionCurve_generatePointsFromCurves(this.__ptr, wCurve.__ptr, xCurve.__ptr, yCurve.__ptr, zCurve.__ptr)
 }

+ 8 - 4
bindings/javascript/Polycode/Ray.js

@@ -1,10 +1,14 @@
 function Ray() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Ray()
+	}
 	Object.defineProperties(this, {
 		'origin': { enumerable: true, configurable: true, get: Ray.prototype.__get_origin, set: Ray.prototype.__set_origin},
 		'direction': { enumerable: true, configurable: true, get: Ray.prototype.__get_direction, set: Ray.prototype.__set_direction},
 		'inv_direction': { enumerable: true, configurable: true, get: Ray.prototype.__get_inv_direction, set: Ray.prototype.__set_inv_direction}
 	})
 }
+
 Ray.prototype.__get_origin = function() {
 	var retVal = new Vector3()
 	retVal.__ptr = 	Polycode.Ray__get_origin(this.__ptr)
@@ -43,12 +47,12 @@ Duktape.fin(Ray.prototype, function (x) {
 })
 
 Ray.prototype.boxIntersect = function(box,transformMatrix,vnear,vfar) {
-	return Polycode.Ray_boxIntersect(this.__ptr, box,transformMatrix,vnear,vfar)
+	return Polycode.Ray_boxIntersect(this.__ptr, box, transformMatrix, vnear, vfar)
 }
 
 Ray.prototype.planeIntersectPoint = function(planeNormal,planeDistance) {
 	var retVal = new Vector3()
-	retVal.__ptr = Polycode.Ray_planeIntersectPoint(this.__ptr, planeNormal,planeDistance)
+	retVal.__ptr = Polycode.Ray_planeIntersectPoint(this.__ptr, planeNormal, planeDistance)
 	return retVal
 }
 
@@ -65,9 +69,9 @@ Ray.prototype.closestPointOnRay = function(point) {
 }
 
 Ray.prototype.closestPointsBetween = function(ray2,point1,point2) {
-	return Polycode.Ray_closestPointsBetween(this.__ptr, ray2,point1,point2)
+	return Polycode.Ray_closestPointsBetween(this.__ptr, ray2, point1.__ptr, point2.__ptr)
 }
 
 Ray.prototype.polygonIntersect = function(v1,v2,v3) {
-	return Polycode.Ray_polygonIntersect(this.__ptr, v1,v2,v3)
+	return Polycode.Ray_polygonIntersect(this.__ptr, v1, v2, v3)
 }

+ 5 - 1
bindings/javascript/Polycode/Rectangle.js

@@ -1,4 +1,7 @@
 function Rectangle() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Rectangle()
+	}
 	Object.defineProperties(this, {
 		'x': { enumerable: true, configurable: true, get: Rectangle.prototype.__get_x, set: Rectangle.prototype.__set_x},
 		'y': { enumerable: true, configurable: true, get: Rectangle.prototype.__get_y, set: Rectangle.prototype.__set_y},
@@ -6,6 +9,7 @@ function Rectangle() {
 		'h': { enumerable: true, configurable: true, get: Rectangle.prototype.__get_h, set: Rectangle.prototype.__set_h}
 	})
 }
+
 Rectangle.prototype.__get_x = function() {
 	return Polycode.Rectangle__get_x(this.__ptr)
 }
@@ -46,7 +50,7 @@ Duktape.fin(Rectangle.prototype, function (x) {
 })
 
 Rectangle.prototype.setRect = function(x,y,w,h) {
-	Polycode.Rectangle_setRect(this.__ptr, x,y,w,h)
+	Polycode.Rectangle_setRect(this.__ptr, x, y, w, h)
 }
 
 Rectangle.prototype.Clipped = function(rect) {

+ 5 - 1
bindings/javascript/Polycode/RenderBuffer.js

@@ -1,5 +1,9 @@
-function RenderBuffer() {
+function RenderBuffer(width,height,attachDepthBuffer,floatingPoint) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.RenderBuffer(width,height,attachDepthBuffer,floatingPoint)
+	}
 }
+
 Duktape.fin(RenderBuffer.prototype, function (x) {
 	if (x === RenderBuffer.prototype) {
 		return;

+ 5 - 1
bindings/javascript/Polycode/RenderDataArray.js

@@ -1,9 +1,13 @@
-function RenderDataArray() {
+function RenderDataArray(type) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.RenderDataArray(type)
+	}
 	Object.defineProperties(this, {
 		'type': { enumerable: true, configurable: true, get: RenderDataArray.prototype.__get_type, set: RenderDataArray.prototype.__set_type},
 		'customArrayName': { enumerable: true, configurable: true, get: RenderDataArray.prototype.__get_customArrayName, set: RenderDataArray.prototype.__set_customArrayName}
 	})
 }
+
 RenderDataArray.prototype.__get_type = function() {
 	return Polycode.RenderDataArray__get_type(this.__ptr)
 }

+ 4 - 0
bindings/javascript/Polycode/RenderFrame.js

@@ -1,5 +1,9 @@
 function RenderFrame() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.RenderFrame()
+	}
 }
+
 Duktape.fin(RenderFrame.prototype, function (x) {
 	if (x === RenderFrame.prototype) {
 		return;

+ 4 - 0
bindings/javascript/Polycode/RenderTargetBinding.js

@@ -1,10 +1,14 @@
 function RenderTargetBinding() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.RenderTargetBinding()
+	}
 	Object.defineProperties(this, {
 		'id': { enumerable: true, configurable: true, get: RenderTargetBinding.prototype.__get_id, set: RenderTargetBinding.prototype.__set_id},
 		'name': { enumerable: true, configurable: true, get: RenderTargetBinding.prototype.__get_name, set: RenderTargetBinding.prototype.__set_name},
 		'mode': { enumerable: true, configurable: true, get: RenderTargetBinding.prototype.__get_mode, set: RenderTargetBinding.prototype.__set_mode}
 	})
 }
+
 RenderTargetBinding.prototype.__get_id = function() {
 	return Polycode.RenderTargetBinding__get_id(this.__ptr)
 }

+ 9 - 5
bindings/javascript/Polycode/RenderThread.js

@@ -1,5 +1,9 @@
 function RenderThread() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.RenderThread()
+	}
 }
+
 Duktape.fin(RenderThread.prototype, function (x) {
 	if (x === RenderThread.prototype) {
 		return;
@@ -8,7 +12,7 @@ Duktape.fin(RenderThread.prototype, function (x) {
 })
 
 RenderThread.prototype.setGraphicsInterface = function(core,graphicsInterface) {
-	Polycode.RenderThread_setGraphicsInterface(this.__ptr, core,graphicsInterface)
+	Polycode.RenderThread_setGraphicsInterface(this.__ptr, core.__ptr, graphicsInterface.__ptr)
 }
 
 RenderThread.prototype.runThread = function() {
@@ -20,11 +24,11 @@ RenderThread.prototype.updateRenderThread = function() {
 }
 
 RenderThread.prototype.enqueueFrame = function(frame) {
-	Polycode.RenderThread_enqueueFrame(this.__ptr, frame)
+	Polycode.RenderThread_enqueueFrame(this.__ptr, frame.__ptr)
 }
 
 RenderThread.prototype.enqueueJob = function(jobType,data,data2) {
-	Polycode.RenderThread_enqueueJob(this.__ptr, jobType,data,data2)
+	Polycode.RenderThread_enqueueJob(this.__ptr, jobType, data.__ptr, data2.__ptr)
 }
 
 RenderThread.prototype.processJob = function(job) {
@@ -42,11 +46,11 @@ RenderThread.prototype.getShaderBinding = function() {
 }
 
 RenderThread.prototype.processDrawBufferLights = function(buffer) {
-	Polycode.RenderThread_processDrawBufferLights(this.__ptr, buffer)
+	Polycode.RenderThread_processDrawBufferLights(this.__ptr, buffer.__ptr)
 }
 
 RenderThread.prototype.processDrawBuffer = function(buffer) {
-	Polycode.RenderThread_processDrawBuffer(this.__ptr, buffer)
+	Polycode.RenderThread_processDrawBuffer(this.__ptr, buffer.__ptr)
 }
 
 RenderThread.prototype.getFrameInfo = function() {

+ 4 - 0
bindings/javascript/Polycode/RenderThreadDebugInfo.js

@@ -1,10 +1,14 @@
 function RenderThreadDebugInfo() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.RenderThreadDebugInfo()
+	}
 	Object.defineProperties(this, {
 		'buffersProcessed': { enumerable: true, configurable: true, get: RenderThreadDebugInfo.prototype.__get_buffersProcessed, set: RenderThreadDebugInfo.prototype.__set_buffersProcessed},
 		'drawCallsProcessed': { enumerable: true, configurable: true, get: RenderThreadDebugInfo.prototype.__get_drawCallsProcessed, set: RenderThreadDebugInfo.prototype.__set_drawCallsProcessed},
 		'timeTaken': { enumerable: true, configurable: true, get: RenderThreadDebugInfo.prototype.__get_timeTaken, set: RenderThreadDebugInfo.prototype.__set_timeTaken}
 	})
 }
+
 RenderThreadDebugInfo.prototype.__get_buffersProcessed = function() {
 	return Polycode.RenderThreadDebugInfo__get_buffersProcessed(this.__ptr)
 }

+ 23 - 10
bindings/javascript/Polycode/Renderer.js

@@ -1,5 +1,6 @@
 function Renderer() {
 }
+
 Duktape.fin(Renderer.prototype, function (x) {
 	if (x === Renderer.prototype) {
 		return;
@@ -8,7 +9,7 @@ Duktape.fin(Renderer.prototype, function (x) {
 })
 
 Renderer.prototype.setGraphicsInterface = function(core,graphicsInterface) {
-	Polycode.Renderer_setGraphicsInterface(this.__ptr, core,graphicsInterface)
+	Polycode.Renderer_setGraphicsInterface(this.__ptr, core.__ptr, graphicsInterface.__ptr)
 }
 
 Renderer.prototype.getRenderThread = function() {
@@ -18,11 +19,11 @@ Renderer.prototype.getRenderThread = function() {
 }
 
 Renderer.prototype.processDrawBuffer = function(buffer) {
-	Polycode.Renderer_processDrawBuffer(this.__ptr, buffer)
+	Polycode.Renderer_processDrawBuffer(this.__ptr, buffer.__ptr)
 }
 
 Renderer.prototype.setBackingResolutionScale = function(xScale,yScale) {
-	Polycode.Renderer_setBackingResolutionScale(this.__ptr, xScale,yScale)
+	Polycode.Renderer_setBackingResolutionScale(this.__ptr, xScale, yScale)
 }
 
 Renderer.prototype.getBackingResolutionScaleX = function() {
@@ -34,31 +35,31 @@ Renderer.prototype.getBackingResolutionScaleY = function() {
 }
 
 Renderer.prototype.enqueueFrameJob = function(jobType,data) {
-	Polycode.Renderer_enqueueFrameJob(this.__ptr, jobType,data)
+	Polycode.Renderer_enqueueFrameJob(this.__ptr, jobType, data.__ptr)
 }
 
 Renderer.prototype.destroyRenderBufferPlatformData = function(platformData) {
-	Polycode.Renderer_destroyRenderBufferPlatformData(this.__ptr, platformData)
+	Polycode.Renderer_destroyRenderBufferPlatformData(this.__ptr, platformData.__ptr)
 }
 
 Renderer.prototype.destroyTexturePlatformData = function(platformData) {
-	Polycode.Renderer_destroyTexturePlatformData(this.__ptr, platformData)
+	Polycode.Renderer_destroyTexturePlatformData(this.__ptr, platformData.__ptr)
 }
 
 Renderer.prototype.destroyProgramPlatformData = function(platformData) {
-	Polycode.Renderer_destroyProgramPlatformData(this.__ptr, platformData)
+	Polycode.Renderer_destroyProgramPlatformData(this.__ptr, platformData.__ptr)
 }
 
 Renderer.prototype.destroyShaderPlatformData = function(platformData) {
-	Polycode.Renderer_destroyShaderPlatformData(this.__ptr, platformData)
+	Polycode.Renderer_destroyShaderPlatformData(this.__ptr, platformData.__ptr)
 }
 
 Renderer.prototype.destroySubmeshPlatformData = function(platformData) {
-	Polycode.Renderer_destroySubmeshPlatformData(this.__ptr, platformData)
+	Polycode.Renderer_destroySubmeshPlatformData(this.__ptr, platformData.__ptr)
 }
 
 Renderer.prototype.setTextureParam = function(param,texture) {
-	Polycode.Renderer_setTextureParam(this.__ptr, param,texture)
+	Polycode.Renderer_setTextureParam(this.__ptr, param.__ptr, texture.__ptr)
 }
 
 Renderer.prototype.setAnisotropyAmount = function(amount) {
@@ -69,6 +70,18 @@ Renderer.prototype.getAnisotropyAmount = function() {
 	return Polycode.Renderer_getAnisotropyAmount(this.__ptr)
 }
 
+Renderer.prototype.unProject = function(position,modelMatrix,projectionMatrix,viewport) {
+	var retVal = new Vector3()
+	retVal.__ptr = Polycode.Renderer_unProject(position, modelMatrix, projectionMatrix, viewport)
+	return retVal
+}
+
+Renderer.prototype.project = function(position,modelMatrix,projectionMatrix,viewport) {
+	var retVal = new Vector3()
+	retVal.__ptr = Polycode.Renderer_project(position, modelMatrix, projectionMatrix, viewport)
+	return retVal
+}
+
 Renderer.prototype.beginFrame = function() {
 	Polycode.Renderer_beginFrame(this.__ptr)
 }

+ 4 - 0
bindings/javascript/Polycode/RendererThreadJob.js

@@ -1,8 +1,12 @@
 function RendererThreadJob() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.RendererThreadJob()
+	}
 	Object.defineProperties(this, {
 		'jobType': { enumerable: true, configurable: true, get: RendererThreadJob.prototype.__get_jobType, set: RendererThreadJob.prototype.__set_jobType}
 	})
 }
+
 RendererThreadJob.prototype.__get_jobType = function() {
 	return Polycode.RendererThreadJob__get_jobType(this.__ptr)
 }

+ 9 - 1
bindings/javascript/Polycode/Resource.js

@@ -1,9 +1,17 @@
-function Resource() {
+require('Polycode/EventDispatcher')
+
+function Resource(type) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Resource(type)
+	}
 	Object.defineProperties(this, {
 		'reloadOnFileModify': { enumerable: true, configurable: true, get: Resource.prototype.__get_reloadOnFileModify, set: Resource.prototype.__set_reloadOnFileModify},
 		'resourceFileTime': { enumerable: true, configurable: true, get: Resource.prototype.__get_resourceFileTime, set: Resource.prototype.__set_resourceFileTime}
 	})
 }
+
+Resource.prototype = Object.create(EventDispatcher.prototype);
+
 Resource.prototype.__get_reloadOnFileModify = function() {
 	return Polycode.Resource__get_reloadOnFileModify(this.__ptr)
 }

+ 14 - 6
bindings/javascript/Polycode/ResourceManager.js

@@ -1,5 +1,13 @@
+require('Polycode/EventDispatcher')
+
 function ResourceManager() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ResourceManager()
+	}
 }
+
+ResourceManager.prototype = Object.create(EventDispatcher.prototype);
+
 Duktape.fin(ResourceManager.prototype, function (x) {
 	if (x === ResourceManager.prototype) {
 		return;
@@ -20,7 +28,7 @@ ResourceManager.prototype.getResourcePoolByName = function(name) {
 }
 
 ResourceManager.prototype.addResourceLoader = function(loader) {
-	Polycode.ResourceManager_addResourceLoader(this.__ptr, loader)
+	Polycode.ResourceManager_addResourceLoader(this.__ptr, loader.__ptr)
 }
 
 ResourceManager.prototype.getResourceLoaderForExtension = function(extension) {
@@ -30,7 +38,7 @@ ResourceManager.prototype.getResourceLoaderForExtension = function(extension) {
 }
 
 ResourceManager.prototype.removeResourceLoader = function(loader) {
-	Polycode.ResourceManager_removeResourceLoader(this.__ptr, loader)
+	Polycode.ResourceManager_removeResourceLoader(this.__ptr, loader.__ptr)
 }
 
 ResourceManager.prototype.getNumResourceLoaders = function() {
@@ -44,11 +52,11 @@ ResourceManager.prototype.getResourceLoaderAtIndex = function(index) {
 }
 
 ResourceManager.prototype.addResourcePool = function(pool) {
-	Polycode.ResourceManager_addResourcePool(this.__ptr, pool)
+	Polycode.ResourceManager_addResourcePool(this.__ptr, pool.__ptr)
 }
 
 ResourceManager.prototype.removeResourcePool = function(pool) {
-	Polycode.ResourceManager_removeResourcePool(this.__ptr, pool)
+	Polycode.ResourceManager_removeResourcePool(this.__ptr, pool.__ptr)
 }
 
 ResourceManager.prototype.getResources = function(resourceType) {
@@ -60,11 +68,11 @@ ResourceManager.prototype.removeResource = function(resource) {
 }
 
 ResourceManager.prototype.subscribeToResourcePool = function(pool) {
-	Polycode.ResourceManager_subscribeToResourcePool(this.__ptr, pool)
+	Polycode.ResourceManager_subscribeToResourcePool(this.__ptr, pool.__ptr)
 }
 
 ResourceManager.prototype.unsubscibeFromResourcePool = function(pool) {
-	Polycode.ResourceManager_unsubscibeFromResourcePool(this.__ptr, pool)
+	Polycode.ResourceManager_unsubscibeFromResourcePool(this.__ptr, pool.__ptr)
 }
 
 ResourceManager.prototype.Update = function(elapsed) {

+ 17 - 9
bindings/javascript/Polycode/ResourcePool.js

@@ -1,4 +1,9 @@
-function ResourcePool() {
+require('Polycode/EventDispatcher')
+
+function ResourcePool(name,fallbackPool) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ResourcePool(name,fallbackPool)
+	}
 	Object.defineProperties(this, {
 		'reloadResourcesOnModify': { enumerable: true, configurable: true, get: ResourcePool.prototype.__get_reloadResourcesOnModify, set: ResourcePool.prototype.__set_reloadResourcesOnModify},
 		'dispatchChangeEvents': { enumerable: true, configurable: true, get: ResourcePool.prototype.__get_dispatchChangeEvents, set: ResourcePool.prototype.__set_dispatchChangeEvents},
@@ -6,6 +11,9 @@ function ResourcePool() {
 		'deleteOnUnsubscribe': { enumerable: true, configurable: true, get: ResourcePool.prototype.__get_deleteOnUnsubscribe, set: ResourcePool.prototype.__set_deleteOnUnsubscribe}
 	})
 }
+
+ResourcePool.prototype = Object.create(EventDispatcher.prototype);
+
 ResourcePool.prototype.__get_reloadResourcesOnModify = function() {
 	return Polycode.ResourcePool__get_reloadResourcesOnModify(this.__ptr)
 }
@@ -46,7 +54,7 @@ Duktape.fin(ResourcePool.prototype, function (x) {
 })
 
 ResourcePool.prototype.setFallbackPool = function(pool) {
-	Polycode.ResourcePool_setFallbackPool(this.__ptr, pool)
+	Polycode.ResourcePool_setFallbackPool(this.__ptr, pool.__ptr)
 }
 
 ResourcePool.prototype.addResource = function(resource) {
@@ -62,7 +70,7 @@ ResourcePool.prototype.hasResource = function(resource) {
 }
 
 ResourcePool.prototype.loadResourcesFromFolder = function(folder,recursive) {
-	Polycode.ResourcePool_loadResourcesFromFolder(this.__ptr, folder,recursive)
+	Polycode.ResourcePool_loadResourcesFromFolder(this.__ptr, folder, recursive)
 }
 
 ResourcePool.prototype.loadResourcesFromMaterialFile = function(path) {
@@ -70,20 +78,20 @@ ResourcePool.prototype.loadResourcesFromMaterialFile = function(path) {
 }
 
 ResourcePool.prototype.loadResource = function(path) {
-	var retVal = new shared_ptr<Resource>()
+	var retVal = new Resource()
 	retVal.__ptr = Polycode.ResourcePool_loadResource(this.__ptr, path)
 	return retVal
 }
 
 ResourcePool.prototype.loadResourceWithName = function(path,name) {
-	var retVal = new shared_ptr<Resource>()
-	retVal.__ptr = Polycode.ResourcePool_loadResourceWithName(this.__ptr, path,name)
+	var retVal = new Resource()
+	retVal.__ptr = Polycode.ResourcePool_loadResourceWithName(this.__ptr, path, name)
 	return retVal
 }
 
 ResourcePool.prototype.getResource = function(resourceType,resourceName) {
-	var retVal = new shared_ptr<Resource>()
-	retVal.__ptr = Polycode.ResourcePool_getResource(this.__ptr, resourceType,resourceName)
+	var retVal = new Resource()
+	retVal.__ptr = Polycode.ResourcePool_getResource(this.__ptr, resourceType, resourceName)
 	return retVal
 }
 
@@ -96,7 +104,7 @@ ResourcePool.prototype.setName = function(name) {
 }
 
 ResourcePool.prototype.getResourceByPath = function(resourcePath) {
-	var retVal = new shared_ptr<Resource>()
+	var retVal = new Resource()
 	retVal.__ptr = Polycode.ResourcePool_getResourceByPath(this.__ptr, resourcePath)
 	return retVal
 }

+ 4 - 0
bindings/javascript/Polycode/Rotation.js

@@ -1,10 +1,14 @@
 function Rotation() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Rotation()
+	}
 	Object.defineProperties(this, {
 		'pitch': { enumerable: true, configurable: true, get: Rotation.prototype.__get_pitch, set: Rotation.prototype.__set_pitch},
 		'yaw': { enumerable: true, configurable: true, get: Rotation.prototype.__get_yaw, set: Rotation.prototype.__set_yaw},
 		'roll': { enumerable: true, configurable: true, get: Rotation.prototype.__get_roll, set: Rotation.prototype.__set_roll}
 	})
 }
+
 Rotation.prototype.__get_pitch = function() {
 	return Polycode.Rotation__get_pitch(this.__ptr)
 }

+ 18 - 10
bindings/javascript/Polycode/Scene.js

@@ -1,4 +1,9 @@
-function Scene() {
+require('Polycode/EventDispatcher')
+
+function Scene(sceneType,virtualScene) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Scene(sceneType,virtualScene)
+	}
 	Object.defineProperties(this, {
 		'clearColor': { enumerable: true, configurable: true, get: Scene.prototype.__get_clearColor, set: Scene.prototype.__set_clearColor},
 		'useClearColor': { enumerable: true, configurable: true, get: Scene.prototype.__get_useClearColor, set: Scene.prototype.__set_useClearColor},
@@ -13,6 +18,9 @@ function Scene() {
 		'constrainPickingToViewport': { enumerable: true, configurable: true, get: Scene.prototype.__get_constrainPickingToViewport, set: Scene.prototype.__set_constrainPickingToViewport}
 	})
 }
+
+Scene.prototype = Object.create(EventDispatcher.prototype);
+
 Scene.prototype.__get_clearColor = function() {
 	var retVal = new Color()
 	retVal.__ptr = 	Polycode.Scene__get_clearColor(this.__ptr)
@@ -113,15 +121,15 @@ Scene.prototype.__set_constrainPickingToViewport = function(val) {
 
 
 Scene.prototype.addEntity = function(entity) {
-	Polycode.Scene_addEntity(this.__ptr, entity)
+	Polycode.Scene_addEntity(this.__ptr, entity.__ptr)
 }
 
 Scene.prototype.addChild = function(entity) {
-	Polycode.Scene_addChild(this.__ptr, entity)
+	Polycode.Scene_addChild(this.__ptr, entity.__ptr)
 }
 
 Scene.prototype.removeEntity = function(entity) {
-	Polycode.Scene_removeEntity(this.__ptr, entity)
+	Polycode.Scene_removeEntity(this.__ptr, entity.__ptr)
 }
 
 Scene.prototype.getDefaultCamera = function() {
@@ -137,7 +145,7 @@ Scene.prototype.getActiveCamera = function() {
 }
 
 Scene.prototype.setActiveCamera = function(camera) {
-	Polycode.Scene_setActiveCamera(this.__ptr, camera)
+	Polycode.Scene_setActiveCamera(this.__ptr, camera.__ptr)
 }
 
 Scene.prototype.enableFog = function(enable) {
@@ -145,7 +153,7 @@ Scene.prototype.enableFog = function(enable) {
 }
 
 Scene.prototype.setFogProperties = function(fogMode,color,density,startDepth,endDepth) {
-	Polycode.Scene_setFogProperties(this.__ptr, fogMode,color,density,startDepth,endDepth)
+	Polycode.Scene_setFogProperties(this.__ptr, fogMode, color, density, startDepth, endDepth)
 }
 
 Scene.prototype.setSceneType = function(newType) {
@@ -177,7 +185,7 @@ Scene.prototype.setEnabled = function(enabled) {
 }
 
 Scene.prototype.Render = function(targetCamera,targetFramebuffer,overrideMaterial,sendLights) {
-	Polycode.Scene_Render(this.__ptr, targetCamera,targetFramebuffer,overrideMaterial,sendLights)
+	Polycode.Scene_Render(this.__ptr, targetCamera.__ptr, targetFramebuffer, overrideMaterial, sendLights)
 }
 
 Scene.prototype.setOverrideMaterial = function(material) {
@@ -186,16 +194,16 @@ Scene.prototype.setOverrideMaterial = function(material) {
 
 Scene.prototype.projectRayFromCameraAndViewportCoordinate = function(camera,coordinate) {
 	var retVal = new Ray()
-	retVal.__ptr = Polycode.Scene_projectRayFromCameraAndViewportCoordinate(this.__ptr, camera,coordinate)
+	retVal.__ptr = Polycode.Scene_projectRayFromCameraAndViewportCoordinate(this.__ptr, camera.__ptr, coordinate)
 	return retVal
 }
 
 Scene.prototype.addLight = function(light) {
-	Polycode.Scene_addLight(this.__ptr, light)
+	Polycode.Scene_addLight(this.__ptr, light.__ptr)
 }
 
 Scene.prototype.removeLight = function(light) {
-	Polycode.Scene_removeLight(this.__ptr, light)
+	Polycode.Scene_removeLight(this.__ptr, light.__ptr)
 }
 
 Scene.prototype.getNumLights = function() {

+ 16 - 2
bindings/javascript/Polycode/SceneCurve.js

@@ -1,9 +1,17 @@
+require('Polycode/SceneMesh')
+
 function SceneCurve() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneCurve()
+	}
 	Object.defineProperties(this, {
 		'renderCurve': { enumerable: true, configurable: true, get: SceneCurve.prototype.__get_renderCurve, set: SceneCurve.prototype.__set_renderCurve},
 		'curveResolution': { enumerable: true, configurable: true, get: SceneCurve.prototype.__get_curveResolution, set: SceneCurve.prototype.__set_curveResolution}
 	})
 }
+
+SceneCurve.prototype = Object.create(SceneMesh.prototype);
+
 SceneCurve.prototype.__get_renderCurve = function() {
 	return Polycode.SceneCurve__get_renderCurve(this.__ptr)
 }
@@ -27,6 +35,12 @@ Duktape.fin(SceneCurve.prototype, function (x) {
 	Polycode.SceneCurve__delete(x.__ptr)
 })
 
+SceneCurve.prototype.SceneCurveWithCurve = function(curve) {
+	var retVal = new SceneCurve()
+	retVal.__ptr = Polycode.SceneCurve_SceneCurveWithCurve(curve.__ptr)
+	return retVal
+}
+
 SceneCurve.prototype.getWorldPointAt = function(t) {
 	var retVal = new Vector3()
 	retVal.__ptr = Polycode.SceneCurve_getWorldPointAt(this.__ptr, t)
@@ -39,12 +53,12 @@ SceneCurve.prototype.Update = function() {
 
 SceneCurve.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.SceneCurve_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.SceneCurve_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 SceneCurve.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.SceneCurve_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.SceneCurve_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }
 
 SceneCurve.prototype.getCurve = function() {

+ 24 - 10
bindings/javascript/Polycode/SceneEntityInstance.js

@@ -1,9 +1,17 @@
-function SceneEntityInstance() {
+require('Polycode/Entity')
+
+function SceneEntityInstance(parentScene,fileName) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneEntityInstance(parentScene,fileName)
+	}
 	Object.defineProperties(this, {
 		'cloneUsingReload': { enumerable: true, configurable: true, get: SceneEntityInstance.prototype.__get_cloneUsingReload, set: SceneEntityInstance.prototype.__set_cloneUsingReload},
 		'fileName': { enumerable: true, configurable: true, get: SceneEntityInstance.prototype.__get_fileName, set: SceneEntityInstance.prototype.__set_fileName}
 	})
 }
+
+SceneEntityInstance.prototype = Object.create(Entity.prototype);
+
 SceneEntityInstance.prototype.__get_cloneUsingReload = function() {
 	return Polycode.SceneEntityInstance__get_cloneUsingReload(this.__ptr)
 }
@@ -21,14 +29,20 @@ SceneEntityInstance.prototype.__set_fileName = function(val) {
 }
 
 
+SceneEntityInstance.prototype.BlankSceneEntityInstance = function(parentScene) {
+	var retVal = new SceneEntityInstance()
+	retVal.__ptr = Polycode.SceneEntityInstance_BlankSceneEntityInstance(parentScene.__ptr)
+	return retVal
+}
+
 SceneEntityInstance.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.SceneEntityInstance_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.SceneEntityInstance_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 SceneEntityInstance.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.SceneEntityInstance_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.SceneEntityInstance_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }
 
 SceneEntityInstance.prototype.reloadEntityInstance = function() {
@@ -40,12 +54,12 @@ SceneEntityInstance.prototype.clearInstance = function() {
 }
 
 SceneEntityInstance.prototype.parseObjectIntoCurve = function(entry,curve) {
-	Polycode.SceneEntityInstance_parseObjectIntoCurve(this.__ptr, entry,curve)
+	Polycode.SceneEntityInstance_parseObjectIntoCurve(this.__ptr, entry.__ptr, curve.__ptr)
 }
 
 SceneEntityInstance.prototype.loadObjectEntryIntoEntity = function(entry,targetEntity,entityFileVersion) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.SceneEntityInstance_loadObjectEntryIntoEntity(this.__ptr, entry,targetEntity,entityFileVersion)
+	retVal.__ptr = Polycode.SceneEntityInstance_loadObjectEntryIntoEntity(this.__ptr, entry.__ptr, targetEntity.__ptr, entityFileVersion)
 	return retVal
 }
 
@@ -54,11 +68,11 @@ SceneEntityInstance.prototype.loadFromFile = function(fileName) {
 }
 
 SceneEntityInstance.prototype.applySceneMesh = function(entry,sceneMesh) {
-	Polycode.SceneEntityInstance_applySceneMesh(this.__ptr, entry,sceneMesh)
+	Polycode.SceneEntityInstance_applySceneMesh(this.__ptr, entry.__ptr, sceneMesh.__ptr)
 }
 
 SceneEntityInstance.prototype.linkResourcePool = function(pool) {
-	Polycode.SceneEntityInstance_linkResourcePool(this.__ptr, pool)
+	Polycode.SceneEntityInstance_linkResourcePool(this.__ptr, pool.__ptr)
 }
 
 SceneEntityInstance.prototype.getNumLinkedResourePools = function() {
@@ -72,11 +86,11 @@ SceneEntityInstance.prototype.getLinkedResourcePoolAtIndex = function(index) {
 }
 
 SceneEntityInstance.prototype.unlinkResourcePool = function(pool) {
-	Polycode.SceneEntityInstance_unlinkResourcePool(this.__ptr, pool)
+	Polycode.SceneEntityInstance_unlinkResourcePool(this.__ptr, pool.__ptr)
 }
 
 SceneEntityInstance.prototype.getResourceEntry = function() {
-	var retVal = new shared_ptr<SceneEntityInstanceResourceEntry>()
+	var retVal = new SceneEntityInstanceResourceEntry()
 	retVal.__ptr = Polycode.SceneEntityInstance_getResourceEntry(this.__ptr)
 	return retVal
 }
@@ -102,7 +116,7 @@ SceneEntityInstance.prototype.getLayerAtIndex = function(index) {
 }
 
 SceneEntityInstance.prototype.removeLayer = function(layer) {
-	Polycode.SceneEntityInstance_removeLayer(this.__ptr, layer)
+	Polycode.SceneEntityInstance_removeLayer(this.__ptr, layer.__ptr)
 }
 
 SceneEntityInstance.prototype.createNewLayer = function(name) {

+ 5 - 1
bindings/javascript/Polycode/SceneEntityInstanceLayer.js

@@ -1,4 +1,7 @@
-function SceneEntityInstanceLayer() {
+function SceneEntityInstanceLayer(instance,name) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneEntityInstanceLayer(instance,name)
+	}
 	Object.defineProperties(this, {
 		'name': { enumerable: true, configurable: true, get: SceneEntityInstanceLayer.prototype.__get_name, set: SceneEntityInstanceLayer.prototype.__set_name},
 		'layerID': { enumerable: true, configurable: true, get: SceneEntityInstanceLayer.prototype.__get_layerID, set: SceneEntityInstanceLayer.prototype.__set_layerID},
@@ -6,6 +9,7 @@ function SceneEntityInstanceLayer() {
 		'instance': { enumerable: true, configurable: true, get: SceneEntityInstanceLayer.prototype.__get_instance, set: SceneEntityInstanceLayer.prototype.__set_instance}
 	})
 }
+
 SceneEntityInstanceLayer.prototype.__get_name = function() {
 	return Polycode.SceneEntityInstanceLayer__get_name(this.__ptr)
 }

+ 9 - 1
bindings/javascript/Polycode/SceneEntityInstanceResourceEntry.js

@@ -1,5 +1,13 @@
-function SceneEntityInstanceResourceEntry() {
+require('Polycode/Resource')
+
+function SceneEntityInstanceResourceEntry(instance) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneEntityInstanceResourceEntry(instance)
+	}
 }
+
+SceneEntityInstanceResourceEntry.prototype = Object.create(Resource.prototype);
+
 Duktape.fin(SceneEntityInstanceResourceEntry.prototype, function (x) {
 	if (x === SceneEntityInstanceResourceEntry.prototype) {
 		return;

+ 12 - 4
bindings/javascript/Polycode/SceneLabel.js

@@ -1,8 +1,16 @@
-function SceneLabel() {
+require('Polycode/ScenePrimitive')
+
+function SceneLabel(text,size,fontName,amode,actualHeight) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneLabel(text,size,fontName,amode,actualHeight)
+	}
 	Object.defineProperties(this, {
 		'positionAtBaseline': { enumerable: true, configurable: true, get: SceneLabel.prototype.__get_positionAtBaseline, set: SceneLabel.prototype.__set_positionAtBaseline}
 	})
 }
+
+SceneLabel.prototype = Object.create(ScenePrimitive.prototype);
+
 SceneLabel.prototype.__get_positionAtBaseline = function() {
 	return Polycode.SceneLabel__get_positionAtBaseline(this.__ptr)
 }
@@ -25,7 +33,7 @@ SceneLabel.prototype.getLabelActualHeight = function() {
 }
 
 SceneLabel.prototype.Render = function(buffer) {
-	Polycode.SceneLabel_Render(this.__ptr, buffer)
+	Polycode.SceneLabel_Render(this.__ptr, buffer.__ptr)
 }
 
 SceneLabel.prototype.getTextWidthForString = function(text) {
@@ -38,12 +46,12 @@ SceneLabel.prototype.setText = function(newText) {
 
 SceneLabel.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.SceneLabel_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.SceneLabel_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 SceneLabel.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.SceneLabel_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.SceneLabel_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }
 
 SceneLabel.prototype.updateFromLabel = function() {

+ 20 - 12
bindings/javascript/Polycode/SceneLight.js

@@ -1,6 +1,14 @@
-function SceneLight() {
+require('Polycode/Entity')
+
+function SceneLight(type,parentScene,intensity,constantAttenuation,linearAttenuation,quadraticAttenuation) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneLight(type,parentScene,intensity,constantAttenuation,linearAttenuation,quadraticAttenuation)
+	}
 }
 
+SceneLight.prototype = Object.create(Entity.prototype);
+
+
 SceneLight.prototype.getIntensity = function() {
 	return Polycode.SceneLight_getIntensity(this.__ptr)
 }
@@ -10,7 +18,7 @@ SceneLight.prototype.setIntensity = function(newIntensity) {
 }
 
 SceneLight.prototype.setAttenuation = function(constantAttenuation,linearAttenuation,quadraticAttenuation) {
-	Polycode.SceneLight_setAttenuation(this.__ptr, constantAttenuation,linearAttenuation,quadraticAttenuation)
+	Polycode.SceneLight_setAttenuation(this.__ptr, constantAttenuation, linearAttenuation, quadraticAttenuation)
 }
 
 SceneLight.prototype.getConstantAttenuation = function() {
@@ -30,29 +38,29 @@ SceneLight.prototype.getType = function() {
 }
 
 SceneLight.prototype.renderDepthMap = function(scene) {
-	Polycode.SceneLight_renderDepthMap(this.__ptr, scene)
+	Polycode.SceneLight_renderDepthMap(this.__ptr, scene.__ptr)
 }
 
 SceneLight.prototype.getZBufferTexture = function() {
-	var retVal = new shared_ptr<Texture>()
+	var retVal = new Texture()
 	retVal.__ptr = Polycode.SceneLight_getZBufferTexture(this.__ptr)
 	return retVal
 }
 
 SceneLight.prototype.setSpecularLightColor = function(r,g,b,a) {
-	Polycode.SceneLight_setSpecularLightColor(this.__ptr, r,g,b,a)
+	Polycode.SceneLight_setSpecularLightColor(this.__ptr, r, g, b, a)
 }
 
 SceneLight.prototype.setDiffuseLightColor = function(r,g,b,a) {
-	Polycode.SceneLight_setDiffuseLightColor(this.__ptr, r,g,b,a)
+	Polycode.SceneLight_setDiffuseLightColor(this.__ptr, r, g, b, a)
 }
 
 SceneLight.prototype.setLightColor = function(r,g,b,a) {
-	Polycode.SceneLight_setLightColor(this.__ptr, r,g,b,a)
+	Polycode.SceneLight_setLightColor(this.__ptr, r, g, b, a)
 }
 
 SceneLight.prototype.setSpotlightProperties = function(spotlightCutoff,spotlightExponent) {
-	Polycode.SceneLight_setSpotlightProperties(this.__ptr, spotlightCutoff,spotlightExponent)
+	Polycode.SceneLight_setSpotlightProperties(this.__ptr, spotlightCutoff, spotlightExponent)
 }
 
 SceneLight.prototype.getSpotlightCutoff = function() {
@@ -64,7 +72,7 @@ SceneLight.prototype.getSpotlightExponent = function() {
 }
 
 SceneLight.prototype.enableShadows = function(val,resolution) {
-	Polycode.SceneLight_enableShadows(this.__ptr, val,resolution)
+	Polycode.SceneLight_enableShadows(this.__ptr, val, resolution)
 }
 
 SceneLight.prototype.setShadowMapFOV = function(fov) {
@@ -101,12 +109,12 @@ SceneLight.prototype.setLightType = function(lightType) {
 
 SceneLight.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.SceneLight_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.SceneLight_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 SceneLight.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.SceneLight_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.SceneLight_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }
 
 SceneLight.prototype.getParentScene = function() {
@@ -116,7 +124,7 @@ SceneLight.prototype.getParentScene = function() {
 }
 
 SceneLight.prototype.setParentScene = function(scene) {
-	Polycode.SceneLight_setParentScene(this.__ptr, scene)
+	Polycode.SceneLight_setParentScene(this.__ptr, scene.__ptr)
 }
 
 SceneLight.prototype.getSpotlightCamera = function() {

+ 15 - 1
bindings/javascript/Polycode/SceneLine.js

@@ -1,4 +1,18 @@
-function SceneLine() {
+require('Polycode/SceneMesh')
+
+function SceneLine(ent1,ent2) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneLine(ent1,ent2)
+	}
+}
+
+SceneLine.prototype = Object.create(SceneMesh.prototype);
+
+
+SceneLine.prototype.SceneLineWithPositions = function(startp,endp) {
+	var retVal = new SceneLine()
+	retVal.__ptr = Polycode.SceneLine_SceneLineWithPositions(startp, endp)
+	return retVal
 }
 
 SceneLine.prototype.setStart = function(startp) {

+ 9 - 5
bindings/javascript/Polycode/SceneManager.js

@@ -1,5 +1,9 @@
 function SceneManager() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneManager()
+	}
 }
+
 Duktape.fin(SceneManager.prototype, function (x) {
 	if (x === SceneManager.prototype) {
 		return;
@@ -8,11 +12,11 @@ Duktape.fin(SceneManager.prototype, function (x) {
 })
 
 SceneManager.prototype.addScene = function(newScene) {
-	Polycode.SceneManager_addScene(this.__ptr, newScene)
+	Polycode.SceneManager_addScene(this.__ptr, newScene.__ptr)
 }
 
 SceneManager.prototype.removeScene = function(scene) {
-	Polycode.SceneManager_removeScene(this.__ptr, scene)
+	Polycode.SceneManager_removeScene(this.__ptr, scene.__ptr)
 }
 
 SceneManager.prototype.Update = function() {
@@ -32,13 +36,13 @@ SceneManager.prototype.renderVirtual = function() {
 }
 
 SceneManager.prototype.registerRenderTexture = function(renderTexture) {
-	Polycode.SceneManager_registerRenderTexture(this.__ptr, renderTexture)
+	Polycode.SceneManager_registerRenderTexture(this.__ptr, renderTexture.__ptr)
 }
 
 SceneManager.prototype.unregisterRenderTexture = function(renderTexture) {
-	Polycode.SceneManager_unregisterRenderTexture(this.__ptr, renderTexture)
+	Polycode.SceneManager_unregisterRenderTexture(this.__ptr, renderTexture.__ptr)
 }
 
 SceneManager.prototype.setRenderer = function(renderer) {
-	Polycode.SceneManager_setRenderer(this.__ptr, renderer)
+	Polycode.SceneManager_setRenderer(this.__ptr, renderer.__ptr)
 }

+ 23 - 9
bindings/javascript/Polycode/SceneMesh.js

@@ -1,4 +1,9 @@
-function SceneMesh() {
+require('Polycode/Entity')
+
+function SceneMesh(fileName) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneMesh(fileName)
+	}
 	Object.defineProperties(this, {
 		'lineWidth': { enumerable: true, configurable: true, get: SceneMesh.prototype.__get_lineWidth, set: SceneMesh.prototype.__set_lineWidth},
 		'lineSmooth': { enumerable: true, configurable: true, get: SceneMesh.prototype.__get_lineSmooth, set: SceneMesh.prototype.__set_lineSmooth},
@@ -9,6 +14,9 @@ function SceneMesh() {
 		'sendBoneMatricesToMaterial': { enumerable: true, configurable: true, get: SceneMesh.prototype.__get_sendBoneMatricesToMaterial, set: SceneMesh.prototype.__set_sendBoneMatricesToMaterial}
 	})
 }
+
+SceneMesh.prototype = Object.create(Entity.prototype);
+
 SceneMesh.prototype.__get_lineWidth = function() {
 	return Polycode.SceneMesh__get_lineWidth(this.__ptr)
 }
@@ -66,8 +74,14 @@ SceneMesh.prototype.__set_sendBoneMatricesToMaterial = function(val) {
 }
 
 
+SceneMesh.prototype.SceneMeshFromMesh = function(mesh) {
+	var retVal = new SceneMesh()
+	retVal.__ptr = Polycode.SceneMesh_SceneMeshFromMesh(mesh)
+	return retVal
+}
+
 SceneMesh.prototype.Render = function(buffer) {
-	Polycode.SceneMesh_Render(this.__ptr, buffer)
+	Polycode.SceneMesh_Render(this.__ptr, buffer.__ptr)
 }
 
 SceneMesh.prototype.getShaderPass = function(index) {
@@ -89,19 +103,19 @@ SceneMesh.prototype.removeShaderPass = function(shaderIndex) {
 }
 
 SceneMesh.prototype.getMesh = function() {
-	var retVal = new shared_ptr<Mesh>()
+	var retVal = new Mesh()
 	retVal.__ptr = Polycode.SceneMesh_getMesh(this.__ptr)
 	return retVal
 }
 
 SceneMesh.prototype.getMaterial = function() {
-	var retVal = new shared_ptr<Material>()
+	var retVal = new Material()
 	retVal.__ptr = Polycode.SceneMesh_getMaterial(this.__ptr)
 	return retVal
 }
 
 SceneMesh.prototype.loadSkeleton = function(fileName) {
-	var retVal = new shared_ptr<Skeleton>()
+	var retVal = new Skeleton()
 	retVal.__ptr = Polycode.SceneMesh_loadSkeleton(this.__ptr, fileName)
 	return retVal
 }
@@ -115,7 +129,7 @@ SceneMesh.prototype.setMaterial = function(material) {
 }
 
 SceneMesh.prototype.setMaterialByName = function(materialName,resourcePool) {
-	Polycode.SceneMesh_setMaterialByName(this.__ptr, materialName,resourcePool)
+	Polycode.SceneMesh_setMaterialByName(this.__ptr, materialName, resourcePool.__ptr)
 }
 
 SceneMesh.prototype.setMesh = function(mesh) {
@@ -127,7 +141,7 @@ SceneMesh.prototype.setSkeleton = function(skeleton) {
 }
 
 SceneMesh.prototype.getSkeleton = function() {
-	var retVal = new shared_ptr<Skeleton>()
+	var retVal = new Skeleton()
 	retVal.__ptr = Polycode.SceneMesh_getSkeleton(this.__ptr)
 	return retVal
 }
@@ -166,10 +180,10 @@ SceneMesh.prototype.getForceMaterial = function() {
 
 SceneMesh.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.SceneMesh_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.SceneMesh_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 SceneMesh.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.SceneMesh_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.SceneMesh_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }

+ 4 - 0
bindings/javascript/Polycode/SceneParticle.js

@@ -1,4 +1,7 @@
 function SceneParticle() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneParticle()
+	}
 	Object.defineProperties(this, {
 		'lifetime': { enumerable: true, configurable: true, get: SceneParticle.prototype.__get_lifetime, set: SceneParticle.prototype.__set_lifetime},
 		'position': { enumerable: true, configurable: true, get: SceneParticle.prototype.__get_position, set: SceneParticle.prototype.__set_position},
@@ -11,6 +14,7 @@ function SceneParticle() {
 		'varianceIndex': { enumerable: true, configurable: true, get: SceneParticle.prototype.__get_varianceIndex, set: SceneParticle.prototype.__set_varianceIndex}
 	})
 }
+
 SceneParticle.prototype.__get_lifetime = function() {
 	return Polycode.SceneParticle__get_lifetime(this.__ptr)
 }

+ 14 - 6
bindings/javascript/Polycode/SceneParticleEmitter.js

@@ -1,4 +1,9 @@
-function SceneParticleEmitter() {
+require('Polycode/SceneMesh')
+
+function SceneParticleEmitter(particleCount,lifetime,speed) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneParticleEmitter(particleCount,lifetime,speed)
+	}
 	Object.defineProperties(this, {
 		'useScaleCurve': { enumerable: true, configurable: true, get: SceneParticleEmitter.prototype.__get_useScaleCurve, set: SceneParticleEmitter.prototype.__set_useScaleCurve},
 		'scaleCurve': { enumerable: true, configurable: true, get: SceneParticleEmitter.prototype.__get_scaleCurve, set: SceneParticleEmitter.prototype.__set_scaleCurve},
@@ -10,6 +15,9 @@ function SceneParticleEmitter() {
 		'colorDeviation': { enumerable: true, configurable: true, get: SceneParticleEmitter.prototype.__get_colorDeviation, set: SceneParticleEmitter.prototype.__set_colorDeviation}
 	})
 }
+
+SceneParticleEmitter.prototype = Object.create(SceneMesh.prototype);
+
 SceneParticleEmitter.prototype.__get_useScaleCurve = function() {
 	return Polycode.SceneParticleEmitter__get_useScaleCurve(this.__ptr)
 }
@@ -138,7 +146,7 @@ SceneParticleEmitter.prototype.fixedUpdate = function() {
 }
 
 SceneParticleEmitter.prototype.Render = function(buffer) {
-	Polycode.SceneParticleEmitter_Render(this.__ptr, buffer)
+	Polycode.SceneParticleEmitter_Render(this.__ptr, buffer.__ptr)
 }
 
 SceneParticleEmitter.prototype.updateParticles = function() {
@@ -146,7 +154,7 @@ SceneParticleEmitter.prototype.updateParticles = function() {
 }
 
 SceneParticleEmitter.prototype.rebuildParticles = function(buffer) {
-	Polycode.SceneParticleEmitter_rebuildParticles(this.__ptr, buffer)
+	Polycode.SceneParticleEmitter_rebuildParticles(this.__ptr, buffer.__ptr)
 }
 
 SceneParticleEmitter.prototype.triggerParticles = function(allAtOnce) {
@@ -248,7 +256,7 @@ SceneParticleEmitter.prototype.getLoopParticles = function() {
 }
 
 SceneParticleEmitter.prototype.addSourceMesh = function(mesh) {
-	Polycode.SceneParticleEmitter_addSourceMesh(this.__ptr, mesh)
+	Polycode.SceneParticleEmitter_addSourceMesh(this.__ptr, mesh.__ptr)
 }
 
 SceneParticleEmitter.prototype.getNumSourceMeshes = function() {
@@ -271,10 +279,10 @@ SceneParticleEmitter.prototype.positionParticle = function(index) {
 
 SceneParticleEmitter.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.SceneParticleEmitter_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.SceneParticleEmitter_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 SceneParticleEmitter.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.SceneParticleEmitter_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.SceneParticleEmitter_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }

+ 12 - 4
bindings/javascript/Polycode/ScenePrimitive.js

@@ -1,8 +1,16 @@
-function ScenePrimitive() {
+require('Polycode/SceneMesh')
+
+function ScenePrimitive(type,v1,v2,v3,v4,v5) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ScenePrimitive(type,v1,v2,v3,v4,v5)
+	}
 }
 
+ScenePrimitive.prototype = Object.create(SceneMesh.prototype);
+
+
 ScenePrimitive.prototype.setPrimitiveOptions = function(type,v1,v2,v3,v4,v5) {
-	Polycode.ScenePrimitive_setPrimitiveOptions(this.__ptr, type,v1,v2,v3,v4,v5)
+	Polycode.ScenePrimitive_setPrimitiveOptions(this.__ptr, type, v1, v2, v3, v4, v5)
 }
 
 ScenePrimitive.prototype.recreatePrimitive = function() {
@@ -35,10 +43,10 @@ ScenePrimitive.prototype.getPrimitiveParameter5 = function() {
 
 ScenePrimitive.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.ScenePrimitive_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.ScenePrimitive_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 ScenePrimitive.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.ScenePrimitive_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.ScenePrimitive_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }

+ 7 - 3
bindings/javascript/Polycode/SceneRenderTexture.js

@@ -1,8 +1,12 @@
-function SceneRenderTexture() {
+function SceneRenderTexture(targetScene,targetCamera,renderWidth,renderHeight,floatingPoint) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneRenderTexture(targetScene,targetCamera,renderWidth,renderHeight,floatingPoint)
+	}
 	Object.defineProperties(this, {
 		'enabled': { enumerable: true, configurable: true, get: SceneRenderTexture.prototype.__get_enabled, set: SceneRenderTexture.prototype.__set_enabled}
 	})
 }
+
 SceneRenderTexture.prototype.__get_enabled = function() {
 	return Polycode.SceneRenderTexture__get_enabled(this.__ptr)
 }
@@ -19,7 +23,7 @@ Duktape.fin(SceneRenderTexture.prototype, function (x) {
 })
 
 SceneRenderTexture.prototype.getTargetTexture = function() {
-	var retVal = new shared_ptr<Texture>()
+	var retVal = new Texture()
 	retVal.__ptr = Polycode.SceneRenderTexture_getTargetTexture(this.__ptr)
 	return retVal
 }
@@ -35,7 +39,7 @@ SceneRenderTexture.prototype.saveToImage = function() {
 }
 
 SceneRenderTexture.prototype.resizeRenderTexture = function(newWidth,newHeight) {
-	Polycode.SceneRenderTexture_resizeRenderTexture(this.__ptr, newWidth,newHeight)
+	Polycode.SceneRenderTexture_resizeRenderTexture(this.__ptr, newWidth, newHeight)
 }
 
 SceneRenderTexture.prototype.getTargetScene = function() {

+ 11 - 3
bindings/javascript/Polycode/SceneSound.js

@@ -1,18 +1,26 @@
-function SceneSound() {
+require('Polycode/Entity')
+
+function SceneSound(fileName,referenceDistance,maxDistance,directionalSound) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneSound(fileName,referenceDistance,maxDistance,directionalSound)
+	}
 }
 
+SceneSound.prototype = Object.create(Entity.prototype);
+
+
 SceneSound.prototype.Update = function() {
 	Polycode.SceneSound_Update(this.__ptr)
 }
 
 SceneSound.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.SceneSound_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.SceneSound_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 SceneSound.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.SceneSound_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.SceneSound_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }
 
 SceneSound.prototype.isDirectionalSound = function() {

+ 8 - 0
bindings/javascript/Polycode/SceneSoundListener.js

@@ -1,5 +1,13 @@
+require('Polycode/Entity')
+
 function SceneSoundListener() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneSoundListener()
+	}
 }
+
+SceneSoundListener.prototype = Object.create(Entity.prototype);
+
 Duktape.fin(SceneSoundListener.prototype, function (x) {
 	if (x === SceneSoundListener.prototype) {
 		return;

+ 16 - 8
bindings/javascript/Polycode/SceneSprite.js

@@ -1,14 +1,22 @@
-function SceneSprite() {
+require('Polycode/SceneMesh')
+
+function SceneSprite(spriteSet) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SceneSprite(spriteSet)
+	}
 }
 
+SceneSprite.prototype = Object.create(SceneMesh.prototype);
+
+
 SceneSprite.prototype.Clone = function(deepClone,ignoreEditorOnly) {
 	var retVal = new Entity()
-	retVal.__ptr = Polycode.SceneSprite_Clone(this.__ptr, deepClone,ignoreEditorOnly)
+	retVal.__ptr = Polycode.SceneSprite_Clone(this.__ptr, deepClone, ignoreEditorOnly)
 	return retVal
 }
 
 SceneSprite.prototype.applyClone = function(clone,deepClone,ignoreEditorOnly) {
-	Polycode.SceneSprite_applyClone(this.__ptr, clone,deepClone,ignoreEditorOnly)
+	Polycode.SceneSprite_applyClone(this.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
 }
 
 SceneSprite.prototype.getSpriteSet = function() {
@@ -18,13 +26,13 @@ SceneSprite.prototype.getSpriteSet = function() {
 }
 
 SceneSprite.prototype.getCurrentSprite = function() {
-	var retVal = new shared_ptr<Sprite>()
+	var retVal = new Sprite()
 	retVal.__ptr = Polycode.SceneSprite_getCurrentSprite(this.__ptr)
 	return retVal
 }
 
 SceneSprite.prototype.setSpriteSet = function(spriteSet) {
-	Polycode.SceneSprite_setSpriteSet(this.__ptr, spriteSet)
+	Polycode.SceneSprite_setSpriteSet(this.__ptr, spriteSet.__ptr)
 }
 
 SceneSprite.prototype.setSpriteByName = function(spriteName) {
@@ -44,7 +52,7 @@ SceneSprite.prototype.Update = function() {
 }
 
 SceneSprite.prototype.Render = function(buffer) {
-	Polycode.SceneSprite_Render(this.__ptr, buffer)
+	Polycode.SceneSprite_Render(this.__ptr, buffer.__ptr)
 }
 
 SceneSprite.prototype.getSpriteBoundingBox = function() {
@@ -66,11 +74,11 @@ SceneSprite.prototype.setSprite = function(spriteEntry) {
 }
 
 SceneSprite.prototype.setSpriteState = function(spriteState,startingFrame,playOnce) {
-	Polycode.SceneSprite_setSpriteState(this.__ptr, spriteState,startingFrame,playOnce)
+	Polycode.SceneSprite_setSpriteState(this.__ptr, spriteState.__ptr, startingFrame, playOnce)
 }
 
 SceneSprite.prototype.setSpriteStateByName = function(name,startingFrame,playOnce) {
-	Polycode.SceneSprite_setSpriteStateByName(this.__ptr, name,startingFrame,playOnce)
+	Polycode.SceneSprite_setSpriteStateByName(this.__ptr, name, startingFrame, playOnce)
 }
 
 SceneSprite.prototype.getCurrentSpriteState = function() {

+ 4 - 0
bindings/javascript/Polycode/ScriptInstance.js

@@ -1,8 +1,12 @@
 function ScriptInstance() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ScriptInstance()
+	}
 	Object.defineProperties(this, {
 		'script': { enumerable: true, configurable: true, get: ScriptInstance.prototype.__get_script, set: ScriptInstance.prototype.__set_script}
 	})
 }
+
 ScriptInstance.prototype.__get_script = function() {
 	var retVal = new Script()
 	retVal.__ptr = 	Polycode.ScriptInstance__get_script(this.__ptr)

+ 6 - 2
bindings/javascript/Polycode/ScriptResourceLoader.js

@@ -1,5 +1,9 @@
 function ScriptResourceLoader() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ScriptResourceLoader()
+	}
 }
+
 Duktape.fin(ScriptResourceLoader.prototype, function (x) {
 	if (x === ScriptResourceLoader.prototype) {
 		return;
@@ -8,7 +12,7 @@ Duktape.fin(ScriptResourceLoader.prototype, function (x) {
 })
 
 ScriptResourceLoader.prototype.loadResource = function(path,targetPool) {
-	var retVal = new shared_ptr<Resource>()
-	retVal.__ptr = Polycode.ScriptResourceLoader_loadResource(this.__ptr, path,targetPool)
+	var retVal = new Resource()
+	retVal.__ptr = Polycode.ScriptResourceLoader_loadResource(this.__ptr, path, targetPool.__ptr)
 	return retVal
 }

+ 5 - 0
bindings/javascript/Polycode/Shader.js

@@ -1,3 +1,5 @@
+require('Polycode/Resource')
+
 function Shader() {
 	Object.defineProperties(this, {
 		'numSpotLights': { enumerable: true, configurable: true, get: Shader.prototype.__get_numSpotLights, set: Shader.prototype.__set_numSpotLights},
@@ -6,6 +8,9 @@ function Shader() {
 		'name': { enumerable: true, configurable: true, get: Shader.prototype.__get_name, set: Shader.prototype.__set_name}
 	})
 }
+
+Shader.prototype = Object.create(Resource.prototype);
+
 Shader.prototype.__get_numSpotLights = function() {
 	return Polycode.Shader__get_numSpotLights(this.__ptr)
 }

+ 20 - 16
bindings/javascript/Polycode/ShaderBinding.js

@@ -1,8 +1,12 @@
 function ShaderBinding() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ShaderBinding()
+	}
 	Object.defineProperties(this, {
 		'accessMutex': { enumerable: true, configurable: true, get: ShaderBinding.prototype.__get_accessMutex, set: ShaderBinding.prototype.__set_accessMutex}
 	})
 }
+
 ShaderBinding.prototype.__get_accessMutex = function() {
 	var retVal = new CoreMutex()
 	retVal.__ptr = 	Polycode.ShaderBinding__get_accessMutex(this.__ptr)
@@ -21,24 +25,24 @@ Duktape.fin(ShaderBinding.prototype, function (x) {
 })
 
 ShaderBinding.prototype.copyTo = function(targetBinding) {
-	Polycode.ShaderBinding_copyTo(this.__ptr, targetBinding)
+	Polycode.ShaderBinding_copyTo(this.__ptr, targetBinding.__ptr)
 }
 
 ShaderBinding.prototype.addParam = function(type,name) {
-	var retVal = new shared_ptr<LocalShaderParam>()
-	retVal.__ptr = Polycode.ShaderBinding_addParam(this.__ptr, type,name)
+	var retVal = new LocalShaderParam()
+	retVal.__ptr = Polycode.ShaderBinding_addParam(this.__ptr, type, name)
 	return retVal
 }
 
 ShaderBinding.prototype.addParamPointer = function(type,name,ptr) {
-	var retVal = new shared_ptr<LocalShaderParam>()
-	retVal.__ptr = Polycode.ShaderBinding_addParamPointer(this.__ptr, type,name,ptr)
+	var retVal = new LocalShaderParam()
+	retVal.__ptr = Polycode.ShaderBinding_addParamPointer(this.__ptr, type, name, ptr.__ptr)
 	return retVal
 }
 
 ShaderBinding.prototype.addParamFromData = function(name,data) {
-	var retVal = new shared_ptr<LocalShaderParam>()
-	retVal.__ptr = Polycode.ShaderBinding_addParamFromData(this.__ptr, name,data)
+	var retVal = new LocalShaderParam()
+	retVal.__ptr = Polycode.ShaderBinding_addParamFromData(this.__ptr, name, data)
 	return retVal
 }
 
@@ -47,13 +51,13 @@ ShaderBinding.prototype.getNumLocalParams = function() {
 }
 
 ShaderBinding.prototype.getLocalParam = function(index) {
-	var retVal = new shared_ptr<LocalShaderParam>()
+	var retVal = new LocalShaderParam()
 	retVal.__ptr = Polycode.ShaderBinding_getLocalParam(this.__ptr, index)
 	return retVal
 }
 
 ShaderBinding.prototype.getLocalParamByName = function(name) {
-	var retVal = new shared_ptr<LocalShaderParam>()
+	var retVal = new LocalShaderParam()
 	retVal.__ptr = Polycode.ShaderBinding_getLocalParamByName(this.__ptr, name)
 	return retVal
 }
@@ -63,17 +67,17 @@ ShaderBinding.prototype.removeParam = function(name) {
 }
 
 ShaderBinding.prototype.loadTextureForParam = function(paramName,fileName) {
-	var retVal = new shared_ptr<Texture>()
-	retVal.__ptr = Polycode.ShaderBinding_loadTextureForParam(this.__ptr, paramName,fileName)
+	var retVal = new Texture()
+	retVal.__ptr = Polycode.ShaderBinding_loadTextureForParam(this.__ptr, paramName, fileName)
 	return retVal
 }
 
 ShaderBinding.prototype.setTextureForParam = function(paramName,texture) {
-	Polycode.ShaderBinding_setTextureForParam(this.__ptr, paramName,texture)
+	Polycode.ShaderBinding_setTextureForParam(this.__ptr, paramName, texture)
 }
 
 ShaderBinding.prototype.setCubemapForParam = function(paramName,cubemap) {
-	Polycode.ShaderBinding_setCubemapForParam(this.__ptr, paramName,cubemap)
+	Polycode.ShaderBinding_setCubemapForParam(this.__ptr, paramName, cubemap)
 }
 
 ShaderBinding.prototype.getNumAttributeBindings = function() {
@@ -88,7 +92,7 @@ ShaderBinding.prototype.getAttributeBinding = function(index) {
 
 ShaderBinding.prototype.addAttributeBinding = function(name,dataArray) {
 	var retVal = new AttributeBinding()
-	retVal.__ptr = Polycode.ShaderBinding_addAttributeBinding(this.__ptr, name,dataArray)
+	retVal.__ptr = Polycode.ShaderBinding_addAttributeBinding(this.__ptr, name, dataArray.__ptr)
 	return retVal
 }
 
@@ -99,11 +103,11 @@ ShaderBinding.prototype.getAttributeBindingByName = function(name) {
 }
 
 ShaderBinding.prototype.addRenderTargetBinding = function(binding) {
-	Polycode.ShaderBinding_addRenderTargetBinding(this.__ptr, binding)
+	Polycode.ShaderBinding_addRenderTargetBinding(this.__ptr, binding.__ptr)
 }
 
 ShaderBinding.prototype.removeRenderTargetBinding = function(binding) {
-	Polycode.ShaderBinding_removeRenderTargetBinding(this.__ptr, binding)
+	Polycode.ShaderBinding_removeRenderTargetBinding(this.__ptr, binding.__ptr)
 }
 
 ShaderBinding.prototype.getNumRenderTargetBindings = function() {

+ 10 - 0
bindings/javascript/Polycode/ShaderPass.js

@@ -1,9 +1,13 @@
 function ShaderPass() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ShaderPass()
+	}
 	Object.defineProperties(this, {
 		'wireframe': { enumerable: true, configurable: true, get: ShaderPass.prototype.__get_wireframe, set: ShaderPass.prototype.__set_wireframe},
 		'blendingMode': { enumerable: true, configurable: true, get: ShaderPass.prototype.__get_blendingMode, set: ShaderPass.prototype.__set_blendingMode}
 	})
 }
+
 ShaderPass.prototype.__get_wireframe = function() {
 	return Polycode.ShaderPass__get_wireframe(this.__ptr)
 }
@@ -26,3 +30,9 @@ Duktape.fin(ShaderPass.prototype, function (x) {
 	}
 	Polycode.ShaderPass__delete(x.__ptr)
 })
+
+ShaderPass.prototype.getShaderBinding = function() {
+	var retVal = new ShaderBinding()
+	retVal.__ptr = Polycode.ShaderPass_getShaderBinding(this.__ptr)
+	return retVal
+}

+ 4 - 0
bindings/javascript/Polycode/ShaderPlatformData.js

@@ -1,10 +1,14 @@
 function ShaderPlatformData() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ShaderPlatformData()
+	}
 	Object.defineProperties(this, {
 		'shaderID': { enumerable: true, configurable: true, get: ShaderPlatformData.prototype.__get_shaderID, set: ShaderPlatformData.prototype.__set_shaderID},
 		'vertexProgramID': { enumerable: true, configurable: true, get: ShaderPlatformData.prototype.__get_vertexProgramID, set: ShaderPlatformData.prototype.__set_vertexProgramID},
 		'fragmentProgramID': { enumerable: true, configurable: true, get: ShaderPlatformData.prototype.__get_fragmentProgramID, set: ShaderPlatformData.prototype.__set_fragmentProgramID}
 	})
 }
+
 ShaderPlatformData.prototype.__get_shaderID = function() {
 	var retVal = new GLuint()
 	retVal.__ptr = 	Polycode.ShaderPlatformData__get_shaderID(this.__ptr)

+ 9 - 1
bindings/javascript/Polycode/ShaderProgram.js

@@ -1,8 +1,16 @@
-function ShaderProgram() {
+require('Polycode/Resource')
+
+function ShaderProgram(fileName) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ShaderProgram(fileName)
+	}
 	Object.defineProperties(this, {
 		'type': { enumerable: true, configurable: true, get: ShaderProgram.prototype.__get_type, set: ShaderProgram.prototype.__set_type}
 	})
 }
+
+ShaderProgram.prototype = Object.create(Resource.prototype);
+
 ShaderProgram.prototype.__get_type = function() {
 	return Polycode.ShaderProgram__get_type(this.__ptr)
 }

+ 4 - 0
bindings/javascript/Polycode/ShaderRenderTarget.js

@@ -1,4 +1,7 @@
 function ShaderRenderTarget() {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.ShaderRenderTarget()
+	}
 	Object.defineProperties(this, {
 		'id': { enumerable: true, configurable: true, get: ShaderRenderTarget.prototype.__get_id, set: ShaderRenderTarget.prototype.__set_id},
 		'width': { enumerable: true, configurable: true, get: ShaderRenderTarget.prototype.__get_width, set: ShaderRenderTarget.prototype.__set_width},
@@ -8,6 +11,7 @@ function ShaderRenderTarget() {
 		'normalizedHeight': { enumerable: true, configurable: true, get: ShaderRenderTarget.prototype.__get_normalizedHeight, set: ShaderRenderTarget.prototype.__set_normalizedHeight}
 	})
 }
+
 ShaderRenderTarget.prototype.__get_id = function() {
 	return Polycode.ShaderRenderTarget__get_id(this.__ptr)
 }

+ 23 - 9
bindings/javascript/Polycode/Skeleton.js

@@ -1,5 +1,13 @@
-function Skeleton() {
+require('Polycode/Entity')
+
+function Skeleton(fileName) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.Skeleton(fileName)
+	}
 }
+
+Skeleton.prototype = Object.create(Entity.prototype);
+
 Duktape.fin(Skeleton.prototype, function (x) {
 	if (x === Skeleton.prototype) {
 		return;
@@ -7,16 +15,22 @@ Duktape.fin(Skeleton.prototype, function (x) {
 	Polycode.Skeleton__delete(x.__ptr)
 })
 
+Skeleton.prototype.BlankSkeleton = function() {
+	var retVal = new Skeleton()
+	retVal.__ptr = Polycode.Skeleton_BlankSkeleton()
+	return retVal
+}
+
 Skeleton.prototype.loadSkeleton = function(fileName) {
 	Polycode.Skeleton_loadSkeleton(this.__ptr, fileName)
 }
 
 Skeleton.prototype.playAnimationByName = function(animName,weight,once,restartIfPlaying) {
-	Polycode.Skeleton_playAnimationByName(this.__ptr, animName,weight,once,restartIfPlaying)
+	Polycode.Skeleton_playAnimationByName(this.__ptr, animName, weight, once, restartIfPlaying)
 }
 
 Skeleton.prototype.playAnimation = function(animation,weight,once,restartIfPlaying) {
-	Polycode.Skeleton_playAnimation(this.__ptr, animation,weight,once,restartIfPlaying)
+	Polycode.Skeleton_playAnimation(this.__ptr, animation.__ptr, weight, once, restartIfPlaying)
 }
 
 Skeleton.prototype.setBaseAnimationByName = function(animName) {
@@ -24,7 +38,7 @@ Skeleton.prototype.setBaseAnimationByName = function(animName) {
 }
 
 Skeleton.prototype.setBaseAnimation = function(animation) {
-	Polycode.Skeleton_setBaseAnimation(this.__ptr, animation)
+	Polycode.Skeleton_setBaseAnimation(this.__ptr, animation.__ptr)
 }
 
 Skeleton.prototype.stopAllAnimations = function() {
@@ -38,7 +52,7 @@ Skeleton.prototype.getBaseAnimation = function() {
 }
 
 Skeleton.prototype.addAnimation = function(name,fileName) {
-	Polycode.Skeleton_addAnimation(this.__ptr, name,fileName)
+	Polycode.Skeleton_addAnimation(this.__ptr, name, fileName)
 }
 
 Skeleton.prototype.getAnimation = function(name) {
@@ -52,7 +66,7 @@ Skeleton.prototype.stopAnimationByName = function(name) {
 }
 
 Skeleton.prototype.stopAnimation = function(animation) {
-	Polycode.Skeleton_stopAnimation(this.__ptr, animation)
+	Polycode.Skeleton_stopAnimation(this.__ptr, animation.__ptr)
 }
 
 Skeleton.prototype.Update = function() {
@@ -80,13 +94,13 @@ Skeleton.prototype.getBone = function(index) {
 }
 
 Skeleton.prototype.addBone = function(bone) {
-	Polycode.Skeleton_addBone(this.__ptr, bone)
+	Polycode.Skeleton_addBone(this.__ptr, bone.__ptr)
 }
 
 Skeleton.prototype.removeBone = function(bone) {
-	Polycode.Skeleton_removeBone(this.__ptr, bone)
+	Polycode.Skeleton_removeBone(this.__ptr, bone.__ptr)
 }
 
 Skeleton.prototype.getBoneIndexByBone = function(bone) {
-	return Polycode.Skeleton_getBoneIndexByBone(this.__ptr, bone)
+	return Polycode.Skeleton_getBoneIndexByBone(this.__ptr, bone.__ptr)
 }

+ 6 - 2
bindings/javascript/Polycode/SkeletonAnimation.js

@@ -1,5 +1,9 @@
-function SkeletonAnimation() {
+function SkeletonAnimation(name,duration) {
+	if(arguments[0] != "__skip_ptr__") {
+		this.__ptr = Polycode.SkeletonAnimation(name,duration)
+	}
 }
+
 Duktape.fin(SkeletonAnimation.prototype, function (x) {
 	if (x === SkeletonAnimation.prototype) {
 		return;
@@ -8,7 +12,7 @@ Duktape.fin(SkeletonAnimation.prototype, function (x) {
 })
 
 SkeletonAnimation.prototype.addBoneTrack = function(boneTrack) {
-	Polycode.SkeletonAnimation_addBoneTrack(this.__ptr, boneTrack)
+	Polycode.SkeletonAnimation_addBoneTrack(this.__ptr, boneTrack.__ptr)
 }
 
 SkeletonAnimation.prototype.getName = function() {

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff