mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2275 from dumganhar/rohankuruvilla-ccbreader
fixed #1936: Merging Pull Request #2273: Adding OpenGL Bindings to Javascript.
This commit is contained in:
commit
d052f6a752
|
@ -1 +1 @@
|
|||
Subproject commit 999fabb306cddffd0c043ee1cff6e8627ac0df24
|
||||
Subproject commit 975bbe4772eebe9c7d970ab9508312bb24cfab5d
|
|
@ -9,6 +9,7 @@
|
|||
#include "cocos2d_specifics.hpp"
|
||||
#include "js_bindings_chipmunk_registration.h"
|
||||
#include "js_bindings_system_registration.h"
|
||||
#include "jsb_opengl_registration.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace CocosDenshion;
|
||||
|
@ -40,6 +41,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
sc->addRegisterCallback(register_cocos2dx_js_extensions);
|
||||
sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
|
||||
sc->addRegisterCallback(jsb_register_chipmunk);
|
||||
sc->addRegisterCallback(JSB_register_opengl);
|
||||
sc->addRegisterCallback(jsb_register_system);
|
||||
|
||||
sc->start();
|
||||
|
|
|
@ -1 +1 @@
|
|||
e1f03e3925993f54e478def7760c0c849140f5d3
|
||||
1188862a29d02a39835ba2f3567c4213decf3038
|
|
@ -43,6 +43,7 @@
|
|||
<file name="LabelTest/LabelTest.js"/>
|
||||
<file name="LayerTest/LayerTest.js"/>
|
||||
<file name="MenuTest/MenuTest.js"/>
|
||||
<file name="OpenGLTest/OpenGLTest.js"/>
|
||||
<file name="ParallaxTest/ParallaxTest.js"/>
|
||||
<file name="ParticleTest/ParticleTest.js"/>
|
||||
<file name="PerformanceTest/PerformanceTest.js"/>
|
||||
|
|
|
@ -1 +1 @@
|
|||
0b29dbaef87c1e7f69eea235667a2e278bec0062
|
||||
fd1fb139a7505d087883dc9eff612594905edb6c
|
|
@ -19,6 +19,10 @@ LOCAL_SRC_FILES := ScriptingCore.cpp \
|
|||
js_bindings_system_registration.cpp \
|
||||
js_bindings_ccbreader.cpp \
|
||||
js_bindings_core.cpp \
|
||||
js_bindings_opengl.cpp \
|
||||
jsb_opengl_functions.cpp \
|
||||
jsb_opengl_manual.cpp \
|
||||
jsb_opengl_registration.cpp \
|
||||
generated/jsb_cocos2dx_auto.cpp \
|
||||
generated/jsb_cocos2dx_extension_auto.cpp
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
f90e21c07782c14bf38e748ec3e254e318d505ab
|
||||
158877faeea5c5d8bf8b8e51dc69aa902c382d32
|
|
@ -500,6 +500,7 @@ cc.Class.extend = function (prop) {
|
|||
};
|
||||
|
||||
cc.Node.prototype.ctor = function() {};
|
||||
cc.GLNode.extend = cc.Class.extend;
|
||||
cc.Node.extend = cc.Class.extend;
|
||||
cc.Layer.extend = cc.Class.extend;
|
||||
cc.LayerGradient.extend = cc.Class.extend;
|
||||
|
|
|
@ -1,24 +1,373 @@
|
|||
//
|
||||
// OpenGL defines
|
||||
//
|
||||
/*
|
||||
OpenGL ES 2.0 / WebGL helper functions
|
||||
*/
|
||||
|
||||
/*
|
||||
* According to the WebGL specification ( For further info see:s http://www.khronos.org/registry/webgl/specs/latest/webgl.idl ),
|
||||
* the API should work with objects like WebGLTexture, WebGLBuffer, WebGLRenderBuffer, WebGLFramebuffer, WebGLProgram, WebGLShader.
|
||||
* OpenGL ES 2.0 doesn't have "objects" concepts: Instead it uses ids (GLints). So, these objects are emulated in this thin wrapper.
|
||||
*/
|
||||
|
||||
|
||||
var gl = gl || {};
|
||||
|
||||
gl.NEAREST = 0x2600;
|
||||
gl.LINEAR = 0x2601;
|
||||
gl.REPEAT = 0x2901;
|
||||
gl.CLAMP_TO_EDGE = 0x812F;
|
||||
gl.CLAMP_TO_BORDER = 0x812D;
|
||||
gl.LINEAR_MIPMAP_NEAREST = 0x2701;
|
||||
gl.NEAREST_MIPMAP_NEAREST = 0x2700;
|
||||
gl.ZERO = 0;
|
||||
gl.ONE = 1;
|
||||
gl.SRC_COLOR = 0x0300;
|
||||
gl.ONE_MINUS_SRC_COLOR = 0x0301;
|
||||
gl.SRC_ALPHA = 0x0302;
|
||||
gl.ONE_MINUS_SRC_ALPHA = 0x0303;
|
||||
gl.DST_ALPHA = 0x0304;
|
||||
gl.ONE_MINUS_DST_ALPHA = 0x0305;
|
||||
gl.DST_COLOR = 0x0306;
|
||||
gl.ONE_MINUS_DST_COLOR = 0x0307;
|
||||
gl.SRC_ALPHA_SATURATE = 0x0308;
|
||||
//
|
||||
// Create functions
|
||||
//
|
||||
gl.createTexture = function() {
|
||||
// Returns a "WebGLTexture" object
|
||||
var ret = gl._createTexture();
|
||||
return { texture_id:ret };
|
||||
};
|
||||
|
||||
gl.createBuffer = function() {
|
||||
// Returns a "WebGLBuffer" object
|
||||
var ret = gl._createBuffer();
|
||||
return { buffer_id:ret };
|
||||
};
|
||||
|
||||
gl.createRenderbuffer = function() {
|
||||
// Returns a "WebGLRenderBuffer" object
|
||||
var ret = gl._createRenderuffer();
|
||||
return { renderbuffer_id:ret};
|
||||
};
|
||||
|
||||
gl.createFramebuffer = function() {
|
||||
// Returns a "WebGLFramebuffer" object
|
||||
var ret = gl._createFramebuffer();
|
||||
return {framebuffer_id:ret};
|
||||
};
|
||||
|
||||
gl.createProgram = function() {
|
||||
// Returns a "WebGLProgram" object
|
||||
var ret = gl._createProgram();
|
||||
return {program_id:ret};
|
||||
};
|
||||
|
||||
gl.createShader = function(shaderType) {
|
||||
// Returns a "WebGLShader" object
|
||||
var ret = gl._createShader(shaderType);
|
||||
return {shader_id:ret};
|
||||
};
|
||||
|
||||
//
|
||||
// Delete Functions
|
||||
//
|
||||
gl.deleteTexture = function(texture) {
|
||||
var texture_id = texture.texture_id;
|
||||
// Accept numbers too. eg: gl.deleteTexture(0)
|
||||
if( typeof texture === 'number' )
|
||||
texture_id = texture;
|
||||
|
||||
gl._deleteTexture(texture_id);
|
||||
};
|
||||
|
||||
gl.deleteBuffer = function(bufer) {
|
||||
var buffer_id = buffer.buffer_id;
|
||||
// Accept numbers too. eg: gl.deleteBuffer(0)
|
||||
if( typeof buffer === 'number' )
|
||||
buffer_id = buffer;
|
||||
|
||||
gl._deleteBuffer(buffer_id);
|
||||
};
|
||||
|
||||
gl.deleteRenderbuffer = function(bufer) {
|
||||
var buffer_id = buffer.renderbuffer_id;
|
||||
// Accept numbers too. eg: gl.deleteRenderbuffer(0)
|
||||
if( typeof buffer === 'number' )
|
||||
buffer_id = buffer;
|
||||
|
||||
gl._deleteRenderbuffer(renderbuffer_id);
|
||||
};
|
||||
|
||||
gl.deleteFramebuffer = function(bufer) {
|
||||
var buffer_id = buffer.framebuffer_id;
|
||||
// Accept numbers too. eg: gl.deleteFramebuffer(0)
|
||||
if( typeof buffer === 'number' )
|
||||
buffer_id = buffer;
|
||||
|
||||
gl._deleteFramebuffer(buffer_id);
|
||||
};
|
||||
|
||||
gl.deleteProgram = function(program) {
|
||||
var program_id = program.program_id;
|
||||
// Accept numbers too. eg: gl.deleteShader(0)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
|
||||
gl._deleteProgram(program_id);
|
||||
};
|
||||
|
||||
gl.deleteShader = function(shader) {
|
||||
var shader_id = shader.shader_id;
|
||||
// Accept numbers too. eg: gl.deleteShader(0)
|
||||
if( typeof shader === 'number' )
|
||||
shader_id = shader;
|
||||
|
||||
gl._deleteShader(shader_id);
|
||||
};
|
||||
|
||||
//
|
||||
// Bind Related
|
||||
//
|
||||
// void bindTexture(GLenum target, WebGLTexture? texture);
|
||||
gl.bindTexture = function(target, texture) {
|
||||
|
||||
var texture_id;
|
||||
// Accept numbers too. eg: gl.bindTexture(0)
|
||||
if( typeof texture === 'number' )
|
||||
texture_id = texture;
|
||||
else if( texture === null )
|
||||
texture_id = 0;
|
||||
else
|
||||
texture_id = texture.texture_id;
|
||||
|
||||
gl._bindTexture( target, texture_id );
|
||||
};
|
||||
|
||||
// void bindBuffer(GLenum target, WebGLBuffer? buffer);
|
||||
gl.bindBuffer = function(target, buffer) {
|
||||
var buffer_id;
|
||||
// Accept numbers too. eg: gl.bindBuffer(0)
|
||||
if( typeof buffer === 'number' )
|
||||
buffer_id = buffer;
|
||||
else if( buffer === null )
|
||||
buffer_id = 0;
|
||||
else
|
||||
buffer_id = buffer.buffer_id;
|
||||
|
||||
gl._bindBuffer(target, buffer_id);
|
||||
};
|
||||
|
||||
// void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
|
||||
gl.bindRenderBuffer = function(target, buffer) {
|
||||
var buffer_id;
|
||||
|
||||
// Accept numbers too. eg: gl.bindRenderbuffer(0)
|
||||
if( typeof buffer === 'number' )
|
||||
buffer_id = buffer;
|
||||
else if( buffer === null )
|
||||
buffer_id = 0;
|
||||
else
|
||||
buffer_id = buffer.buffer_id;
|
||||
|
||||
gl._bindRenderbuffer(target, buffer_id);
|
||||
};
|
||||
|
||||
// void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
|
||||
gl.bindFramebuffer = function(target, buffer) {
|
||||
var buffer_id;
|
||||
|
||||
// Accept numbers too. eg: gl.bindFramebuffer(0)
|
||||
if( typeof buffer === 'number' )
|
||||
buffer_id = buffer;
|
||||
else if( buffer === null )
|
||||
buffer_id = 0;
|
||||
else
|
||||
buffer_id = buffer.buffer_id;
|
||||
|
||||
gl._bindFramebuffer(target, buffer_id);
|
||||
};
|
||||
|
||||
//
|
||||
// Uniform related
|
||||
//
|
||||
// any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
|
||||
gl.getUniform = function(program, location) {
|
||||
var program_id;
|
||||
var location_id;
|
||||
|
||||
// Accept numbers too. eg: gl.bindFramebuffer(0)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
else
|
||||
program_id = program.program_id;
|
||||
|
||||
if( typeof location === 'number' )
|
||||
location_id = location;
|
||||
else
|
||||
location_id = location.location_id;
|
||||
|
||||
return gl._getUniform(program_id, location_id);
|
||||
};
|
||||
|
||||
// gl.uniformMatrix2fv = function(location, bool, matrix) {
|
||||
// gl._uniformMatrix2fv(program.program_id, bool, matrix);
|
||||
// };
|
||||
|
||||
// gl.uniformMatrix3fv = function(program, bool, matrix) {
|
||||
// gl._uniformMatrix3fv(program.program_id, bool, matrix);
|
||||
// };
|
||||
|
||||
// gl.uniformMatrix4fv = function(program, bool, matrix) {
|
||||
// gl._uniformMatrix4fv(program.program_id, bool, matrix);
|
||||
// };
|
||||
|
||||
|
||||
//
|
||||
// Shader related
|
||||
//
|
||||
// void compileShader(WebGLShader? shader);
|
||||
gl.compileShader = function(shader) {
|
||||
gl._compileShader( shader.shader_id);
|
||||
};
|
||||
|
||||
// void shaderSource(WebGLShader? shader, DOMString source);
|
||||
gl.shaderSource = function(shader, source) {
|
||||
gl._shaderSource(shader.shader_id, source);
|
||||
};
|
||||
|
||||
// any getShaderParameter(WebGLShader? shader, GLenum pname);
|
||||
gl.getShaderParameter = function(shader, e) {
|
||||
return gl._getShaderParameter(shader.shader_id,e);
|
||||
};
|
||||
|
||||
// DOMString? getShaderInfoLog(WebGLShader? shader);
|
||||
gl.getShaderInfoLog = function(shader) {
|
||||
return gl._getShaderInfoLog(shader.shader_id);
|
||||
};
|
||||
|
||||
//
|
||||
// program related
|
||||
//
|
||||
// void attachShader(WebGLProgram? program, WebGLShader? shader);
|
||||
gl.attachShader = function(program, shader) {
|
||||
var program_id = program.program_id;
|
||||
// Accept numbers too. eg: gl.attachShader(17)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
|
||||
gl._attachShader(program_id, shader.shader_id);
|
||||
};
|
||||
|
||||
// void linkProgram(WebGLProgram? program);
|
||||
gl.linkProgram = function(program) {
|
||||
var program_id = program.program_id;
|
||||
// Accept numbers too. eg: gl.linkProgram(17)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
|
||||
gl._linkProgram(program_id);
|
||||
};
|
||||
|
||||
|
||||
// any getProgramParameter(WebGLProgram? program, GLenum pname);
|
||||
gl.getProgramParameter = function(program, e) {
|
||||
var program_id = program.program_id;
|
||||
// Accept numbers too. eg: gl.getProgramParameter(17)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
|
||||
return gl._getProgramParameter(program_id, e);
|
||||
};
|
||||
|
||||
// void useProgram(WebGLProgram? program);
|
||||
gl.useProgram = function(program) {
|
||||
var program_id;
|
||||
// Accept numbers too. eg: gl.useProgram(17)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
else
|
||||
program_id = program.program_id;
|
||||
|
||||
gl._useProgram (program_id);
|
||||
};
|
||||
|
||||
|
||||
// [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram? program, DOMString name);
|
||||
gl.getAttribLocation = function(program, name) {
|
||||
var program_id = program.program_id;
|
||||
// Accept numbers too. eg: gl.getAttribLocation(17)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
|
||||
return gl._getAttribLocation(program_id, name);
|
||||
};
|
||||
|
||||
// WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name);
|
||||
gl.getUniformLocation = function(program, name) {
|
||||
var program_id = program.program_id;
|
||||
// Accept numbers too. eg: gl.getUniformLocation(17)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
|
||||
// XXX: it should return an object, not an integer
|
||||
return gl._getUniformLocation(program_id,name);
|
||||
};
|
||||
|
||||
|
||||
// WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, GLuint index);
|
||||
gl.getActiveAttrib = function(program, index) {
|
||||
var program_id = program.program_id;
|
||||
// Accept numbers too. eg: gl.getActiveAttrib(17)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
|
||||
return gl._getActiveAttrib(program_id, index);
|
||||
};
|
||||
|
||||
// WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index);
|
||||
gl.getActiveUniform = function(program, index) {
|
||||
var program_id = program.program_id;
|
||||
// Accept numbers too. eg: gl.getActiveUniform(17)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
|
||||
return gl._getActiveUniform(program_id, index);
|
||||
};
|
||||
|
||||
// sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
|
||||
gl.getAttachedShaders = function(program) {
|
||||
var program_id = program.program_id;
|
||||
// Accept numbers too. eg: gl.getAttachedShaders(17)
|
||||
if( typeof program === 'number' )
|
||||
program_id = program;
|
||||
|
||||
return gl._getAttachedShaders(program_id);
|
||||
};
|
||||
|
||||
//
|
||||
// Texture functions
|
||||
//
|
||||
|
||||
// XXX: Currently only the 1st one is supported
|
||||
// void texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, ArrayBufferView? pixels);
|
||||
// void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, ImageData? pixels);
|
||||
// void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException
|
||||
// void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException
|
||||
// void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
|
||||
gl.texImage2D = function() {
|
||||
if( arguments.length != 9)
|
||||
throw "texImage2D: Unsupported number of parameters:" + arguments.length;
|
||||
|
||||
gl._texImage2D.apply(this, arguments);
|
||||
};
|
||||
|
||||
// XXX: Currently only the 1st one is supported
|
||||
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView? pixels);
|
||||
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, ImageData? pixels);
|
||||
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException
|
||||
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException
|
||||
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
|
||||
gl.texSubImage2D = function() {
|
||||
if( arguments.length != 9)
|
||||
throw "texImage2D: Unsupported number of parameters";
|
||||
|
||||
gl._texSubImage2D.apply(this, arguments);
|
||||
};
|
||||
|
||||
//
|
||||
// Extensions
|
||||
//
|
||||
// From the WebGL spec:
|
||||
// Returns an object if, and only if, name is an ASCII case-insensitive match [HTML] for one of the names returned from getSupportedExtensions;
|
||||
// otherwise, returns null. The object returned from getExtension contains any constants or functions provided by the extension.
|
||||
// A returned object may have no constants or functions if the extension does not define any, but a unique object must still be returned.
|
||||
// That object is used to indicate that the extension has been enabled.
|
||||
// XXX: The returned object must return the functions and constants.
|
||||
gl.getExtension = function(extension) {
|
||||
var extensions = gl.getSupportedExtensions();
|
||||
if( extensions.indexOf(extension) > -1 )
|
||||
return {};
|
||||
return null;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* AUTOGENERATED FILE. DO NOT EDIT IT
|
||||
* Generated by "generate_jsb.py -c opengl_jsb.ini" on 2013-03-05
|
||||
* Generated by "generate_jsb.py -c opengl_jsb.ini" on 2013-03-18
|
||||
* Script version: v0.6
|
||||
*/
|
||||
|
||||
|
|
|
@ -161,4 +161,11 @@ JSAutoCompartment ac(cx, obj)
|
|||
#define JSB_INCLUDE_SYSTEM 1
|
||||
#endif // JSB_INCLUDE_SYSTEM
|
||||
|
||||
/** @def JSB_INCLUDE_OPENGL
|
||||
Whether or not it should include bindings for WebGL / OpenGL ES 2.0
|
||||
*/
|
||||
#ifndef JSB_INCLUDE_OPENGL
|
||||
#define JSB_INCLUDE_OPENGL 1
|
||||
#endif // JSB_INCLUDE_OPENGL
|
||||
|
||||
#endif // __JS_BINDINGS_CONFIG_H
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
#include "js_bindings_opengl.h"
|
||||
|
||||
void GLNode::draw() {
|
||||
js_proxy_t* proxy = NULL;
|
||||
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
|
||||
proxy = js_get_or_create_proxy<cocos2d::CCNode>(cx, this);
|
||||
|
||||
//JSB_CCNode *proxy = objc_getAssociatedObject(self, &JSB_association_proxy_key);
|
||||
if( proxy ) {
|
||||
JSObject *jsObj = proxy->obj;
|
||||
if (jsObj) {
|
||||
JSBool found;
|
||||
JSB_ENSURE_AUTOCOMPARTMENT(cx, jsObj);
|
||||
JS_HasProperty(cx, jsObj, "draw", &found);
|
||||
if (found == JS_TRUE) {
|
||||
jsval rval, fval;
|
||||
jsval *argv = NULL; unsigned argc=0;
|
||||
|
||||
JS_GetProperty(cx, jsObj, "draw", &fval);
|
||||
JS_CallFunctionValue(cx, jsObj, fval, argc, argv, &rval);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSClass *js_cocos2dx_GLNode_class;
|
||||
JSObject *js_cocos2dx_GLNode_prototype;
|
||||
|
||||
JSBool js_cocos2dx_GLNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
|
||||
if (argc == 0) {
|
||||
GLNode* cobj = new GLNode();
|
||||
#ifdef COCOS2D_JAVASCRIPT
|
||||
cocos2d::CCObject *_ccobj = dynamic_cast<cocos2d::CCObject *>(cobj);
|
||||
if (_ccobj) {
|
||||
_ccobj->autorelease();
|
||||
}
|
||||
#endif
|
||||
TypeTest<GLNode> t;
|
||||
js_type_class_t *typeClass;
|
||||
uint32_t typeId = t.s_id();
|
||||
HASH_FIND_INT(_js_global_type_ht, &typeId, typeClass);
|
||||
assert(typeClass);
|
||||
JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
|
||||
// link the native object with the javascript object
|
||||
js_proxy_t *p;
|
||||
JS_NEW_PROXY(p, cobj, obj);
|
||||
#ifdef COCOS2D_JAVASCRIPT
|
||||
JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::GLNode");
|
||||
#endif
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
void js_cocos2dx_GLNode_finalize(JSFreeOp *fop, JSObject *obj) {
|
||||
}
|
||||
|
||||
JSBool js_cocos2dx_GLNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
GLNode* ret = new GLNode();
|
||||
jsval jsret;
|
||||
do {
|
||||
if (ret) {
|
||||
js_proxy_t *proxy = js_get_or_create_proxy<GLNode>(cx, ret);
|
||||
jsret = OBJECT_TO_JSVAL(proxy->obj);
|
||||
} else {
|
||||
jsret = JSVAL_NULL;
|
||||
}
|
||||
} while (0);
|
||||
JS_SET_RVAL(cx, vp, jsret);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
extern JSObject* jsb_CCNode_prototype;
|
||||
|
||||
void js_register_cocos2dx_GLNode(JSContext *cx, JSObject *global) {
|
||||
js_cocos2dx_GLNode_class = (JSClass *)calloc(1, sizeof(JSClass));
|
||||
js_cocos2dx_GLNode_class->name = "GLNode";
|
||||
js_cocos2dx_GLNode_class->addProperty = JS_PropertyStub;
|
||||
js_cocos2dx_GLNode_class->delProperty = JS_PropertyStub;
|
||||
js_cocos2dx_GLNode_class->getProperty = JS_PropertyStub;
|
||||
js_cocos2dx_GLNode_class->setProperty = JS_StrictPropertyStub;
|
||||
js_cocos2dx_GLNode_class->enumerate = JS_EnumerateStub;
|
||||
js_cocos2dx_GLNode_class->resolve = JS_ResolveStub;
|
||||
js_cocos2dx_GLNode_class->convert = JS_ConvertStub;
|
||||
js_cocos2dx_GLNode_class->finalize = js_cocos2dx_GLNode_finalize;
|
||||
js_cocos2dx_GLNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
||||
|
||||
static JSPropertySpec properties[] = {
|
||||
{0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
static JSFunctionSpec st_funcs[] = {
|
||||
JS_FN("create", js_cocos2dx_GLNode_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
js_cocos2dx_GLNode_prototype = JS_InitClass(
|
||||
cx, global,
|
||||
jsb_CCNode_prototype,
|
||||
js_cocos2dx_GLNode_class,
|
||||
js_cocos2dx_GLNode_constructor, 0, // constructor
|
||||
properties,
|
||||
funcs,
|
||||
NULL, // no static properties
|
||||
st_funcs);
|
||||
// make the class enumerable in the registered namespace
|
||||
JSBool found;
|
||||
JS_SetPropertyAttributes(cx, global, "GLNode", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
|
||||
|
||||
// add the proto and JSClass to the type->js info hash table
|
||||
TypeTest<GLNode> t;
|
||||
js_type_class_t *p;
|
||||
uint32_t typeId = t.s_id();
|
||||
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
|
||||
if (!p) {
|
||||
p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
|
||||
p->type = typeId;
|
||||
p->jsclass = js_cocos2dx_GLNode_class;
|
||||
p->proto = js_cocos2dx_GLNode_prototype;
|
||||
p->parentProto = jsb_CCNode_prototype;
|
||||
HASH_ADD_INT(_js_global_type_ht, type, p);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#include "cocos2d.h"
|
||||
#include "ScriptingCore.h"
|
||||
#include "cocos2d_specifics.hpp"
|
||||
|
||||
class GLNode : public cocos2d::CCNode {
|
||||
public:
|
||||
void draw();
|
||||
};
|
||||
|
||||
void js_register_cocos2dx_GLNode(JSContext *cx, JSObject *global);
|
|
@ -148,6 +148,43 @@ JSBool jsval_to_uint( JSContext *cx, jsval vp, unsigned int *ret )
|
|||
return jsval_to_int32(cx, vp, (int32_t*)ret);
|
||||
}
|
||||
|
||||
|
||||
JSBool JSB_jsval_to_int32( JSContext *cx, jsval vp, int32_t *outval )
|
||||
{
|
||||
JSBool ret = JS_FALSE;
|
||||
double dp;
|
||||
if( (ret=JS_ValueToNumber(cx, vp, &dp)) ) {
|
||||
if( isnan(dp))
|
||||
return JS_FALSE;
|
||||
*outval = (int32_t)dp;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
JSBool JSB_jsval_to_uint32( JSContext *cx, jsval vp, uint32_t *outval )
|
||||
{
|
||||
JSBool ret = JS_FALSE;
|
||||
double dp;
|
||||
if( (ret=JS_ValueToNumber(cx, vp, &dp)) ) {
|
||||
if( isnan(dp))
|
||||
return JS_FALSE;
|
||||
*outval = (uint32_t)dp;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
JSBool JSB_jsval_to_uint16( JSContext *cx, jsval vp, uint16_t *outval )
|
||||
{
|
||||
JSBool ret = JS_FALSE;
|
||||
double dp;
|
||||
if( (ret=JS_ValueToNumber(cx, vp, &dp)) ) {
|
||||
if( isnan(dp))
|
||||
return JS_FALSE;
|
||||
*outval = (uint16_t)dp;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
jsval int_to_jsval( JSContext *cx, int number )
|
||||
{
|
||||
return INT_TO_JSVAL(number);
|
||||
|
@ -217,3 +254,96 @@ jsval charptr_to_jsval( JSContext *cx, const char *str)
|
|||
return STRING_TO_JSVAL(ret_obj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
JSBool JSB_jsval_typedarray_to_dataptr( JSContext *cx, jsval vp, GLsizei *count, void **data, JSArrayBufferViewType t)
|
||||
{
|
||||
JSObject *jsobj;
|
||||
JSBool ok = JS_ValueToObject( cx, vp, &jsobj );
|
||||
JSB_PRECONDITION2( ok && jsobj, cx, JS_FALSE, "Error converting value to object");
|
||||
|
||||
// WebGL supports TypedArray and sequences for some of its APIs. So when converting a TypedArray, we should
|
||||
// also check for a possible non-Typed Array JS object, like a JS Array.
|
||||
|
||||
if( JS_IsTypedArrayObject( jsobj ) ) {
|
||||
|
||||
*count = JS_GetTypedArrayLength(jsobj);
|
||||
JSArrayBufferViewType type = JS_GetArrayBufferViewType(jsobj);
|
||||
JSB_PRECONDITION2(t==type, cx, JS_FALSE, "TypedArray type different than expected type");
|
||||
|
||||
switch (t) {
|
||||
case js::ArrayBufferView::TYPE_INT8:
|
||||
case js::ArrayBufferView::TYPE_UINT8:
|
||||
*data = JS_GetUint8ArrayData(jsobj);
|
||||
break;
|
||||
|
||||
case js::ArrayBufferView::TYPE_INT16:
|
||||
case js::ArrayBufferView::TYPE_UINT16:
|
||||
*data = JS_GetUint16ArrayData(jsobj);
|
||||
break;
|
||||
|
||||
case js::ArrayBufferView::TYPE_INT32:
|
||||
case js::ArrayBufferView::TYPE_UINT32:
|
||||
*data = JS_GetUint32ArrayData(jsobj);
|
||||
break;
|
||||
|
||||
case js::ArrayBufferView::TYPE_FLOAT32:
|
||||
*data = JS_GetFloat32ArrayData(jsobj);
|
||||
break;
|
||||
|
||||
default:
|
||||
JSB_PRECONDITION2(false, cx, JS_FALSE, "Unsupported typedarray type");
|
||||
break;
|
||||
}
|
||||
} else if( JS_IsArrayObject(cx, jsobj)) {
|
||||
// Slow... avoid it. Use TypedArray instead, but the spec says that it can receive
|
||||
// Sequence<> as well.
|
||||
uint32_t length;
|
||||
JS_GetArrayLength(cx, jsobj, &length);
|
||||
|
||||
for( uint32_t i=0; i<length;i++ ) {
|
||||
|
||||
jsval valarg;
|
||||
JS_GetElement(cx, jsobj, i, &valarg);
|
||||
|
||||
switch(t) {
|
||||
case js::ArrayBufferView::TYPE_INT32:
|
||||
case js::ArrayBufferView::TYPE_UINT32:
|
||||
{
|
||||
uint32_t e = JSVAL_TO_INT(valarg);
|
||||
((uint32_t*)data)[i] = e;
|
||||
break;
|
||||
}
|
||||
case js::ArrayBufferView::TYPE_FLOAT32:
|
||||
{
|
||||
double e = JSVAL_TO_DOUBLE(valarg);
|
||||
((GLfloat*)data)[i] = (GLfloat)e;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
JSB_PRECONDITION2(false, cx, JS_FALSE, "Unsupported typedarray type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
JSB_PRECONDITION2(false, cx, JS_FALSE, "Object shall be a TypedArray or Sequence");
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_get_arraybufferview_dataptr( JSContext *cx, jsval vp, GLsizei *count, GLvoid **data )
|
||||
{
|
||||
JSObject *jsobj;
|
||||
JSBool ok = JS_ValueToObject( cx, vp, &jsobj );
|
||||
JSB_PRECONDITION2( ok && jsobj, cx, JS_FALSE, "Error converting value to object");
|
||||
JSB_PRECONDITION2( JS_IsArrayBufferViewObject(jsobj), cx, JS_FALSE, "Not an ArrayBufferView object");
|
||||
|
||||
*data = JS_GetArrayBufferViewData(jsobj);
|
||||
*count = JS_GetArrayBufferViewByteLength(jsobj);
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -24,10 +24,17 @@ extern jsval int_to_jsval( JSContext *cx, int number );
|
|||
extern jsval uint_to_jsval( JSContext *cx, unsigned int number );
|
||||
extern jsval long_to_jsval( JSContext *cx, long number );
|
||||
extern jsval longlong_to_jsval( JSContext *cx, long long number );
|
||||
/** converts a jsval (JS string) into a char */
|
||||
/** converts a jsval (JS string) into a char */
|
||||
extern JSBool jsval_to_charptr( JSContext *cx, jsval vp, const char **out);
|
||||
/* Converts a char ptr into a jsval (using JS string) */
|
||||
/* Converts a char ptr into a jsval (using JS string) */
|
||||
extern jsval charptr_to_jsval( JSContext *cx, const char *str);
|
||||
|
||||
extern JSBool JSB_jsval_to_int32( JSContext *cx, jsval vp, int32_t *outval );
|
||||
extern JSBool JSB_jsval_to_uint32( JSContext *cx, jsval vp, uint32_t *outval);
|
||||
extern JSBool JSB_jsval_typedarray_to_dataptr( JSContext *cx, jsval vp, GLsizei *count, void **data, JSArrayBufferViewType t);
|
||||
extern JSBool JSB_get_arraybufferview_dataptr( JSContext *cx, jsval vp, GLsizei *count, GLvoid **data );
|
||||
extern JSBool JSB_jsval_to_uint16( JSContext *cx, jsval vp, uint16_t *outval );
|
||||
|
||||
//#ifdef __cplusplus
|
||||
//}
|
||||
//#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* AUTOGENERATED FILE. DO NOT EDIT IT
|
||||
* Generated by "generate_jsb.py -c opengl_jsb.ini" on 2013-03-05
|
||||
* Script version: v0.6
|
||||
*/
|
||||
#include "js_bindings_config.h"
|
||||
#ifdef JSB_INCLUDE_OPENGL
|
||||
|
||||
#include "jsb_opengl_manual.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
JSBool JSB_glActiveTexture(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glAttachShader(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBindAttribLocation(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBindBuffer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBindFramebuffer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBindRenderbuffer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBindTexture(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBlendColor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBlendEquation(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBlendEquationSeparate(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBlendFuncSeparate(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBufferData(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glBufferSubData(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glCheckFramebufferStatus(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glClear(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glClearColor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glClearDepthf(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glClearStencil(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glColorMask(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glCompileShader(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glCompressedTexImage2D(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glCompressedTexSubImage2D(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glCopyTexImage2D(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glCopyTexSubImage2D(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glCreateProgram(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glCreateShader(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glCullFace(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDeleteBuffers(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDeleteFramebuffers(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDeleteProgram(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDeleteRenderbuffers(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDeleteShader(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDeleteTextures(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDepthFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDepthMask(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDepthRangef(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDetachShader(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDisable(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDisableVertexAttribArray(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDrawArrays(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glDrawElements(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glEnable(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glEnableVertexAttribArray(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glFinish(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glFlush(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glFramebufferRenderbuffer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glFramebufferTexture2D(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glFrontFace(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGenBuffers(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGenFramebuffers(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGenRenderbuffers(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGenTextures(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGenerateMipmap(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetActiveAttrib(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetActiveUniform(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetAttachedShaders(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetAttribLocation(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetError(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetProgramInfoLog(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetProgramiv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetShaderInfoLog(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetShaderSource(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetShaderiv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetTexParameterfv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetUniformLocation(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glGetUniformfv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glHint(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glIsBuffer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glIsEnabled(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glIsFramebuffer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glIsProgram(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glIsRenderbuffer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glIsShader(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glIsTexture(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glLineWidth(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glLinkProgram(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glPixelStorei(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glPolygonOffset(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glReadPixels(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glReleaseShaderCompiler(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glRenderbufferStorage(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glSampleCoverage(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glScissor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glShaderSource(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glStencilFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glStencilFuncSeparate(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glStencilMask(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glStencilMaskSeparate(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glStencilOp(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glStencilOpSeparate(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glTexImage2D(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glTexParameterf(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glTexParameteri(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glTexSubImage2D(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform1f(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform1fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform1i(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform1iv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform2f(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform2fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform2i(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform2iv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform3f(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform3fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform3i(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform3iv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform4f(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform4fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform4i(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniform4iv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniformMatrix2fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniformMatrix3fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUniformMatrix4fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glUseProgram(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glValidateProgram(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glVertexAttrib1f(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glVertexAttrib1fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glVertexAttrib2f(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glVertexAttrib2fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glVertexAttrib3f(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glVertexAttrib3fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glVertexAttrib4f(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glVertexAttrib4fv(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glVertexAttribPointer(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool JSB_glViewport(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // JSB_INCLUDE_OPENGL
|
|
@ -0,0 +1,526 @@
|
|||
/*
|
||||
* JS Bindings: https://github.com/zynga/jsbindings
|
||||
*
|
||||
* Copyright (c) 2013 Zynga Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "js_bindings_config.h"
|
||||
#ifdef JSB_INCLUDE_OPENGL
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#include "jsb_opengl_manual.h"
|
||||
#include "js_manual_conversions.h"
|
||||
#include "cocosjs_manual_conversions.h"
|
||||
#include "js_bindings_core.h"
|
||||
#include "jsb_opengl_functions.h"
|
||||
|
||||
|
||||
// Helper functions that link "glGenXXXs" (OpenGL ES 2.0 spec), with "gl.createXXX" (WebGL spec)
|
||||
JSBool JSB_glGenTextures(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 0, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
|
||||
GLuint texture;
|
||||
glGenTextures(1, &texture);
|
||||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(texture));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glGenBuffers(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 0, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
|
||||
GLuint buffer;
|
||||
glGenBuffers(1, &buffer);
|
||||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(buffer));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glGenRenderbuffers(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 0, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
|
||||
GLuint renderbuffers;
|
||||
glGenRenderbuffers(1, &renderbuffers);
|
||||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(renderbuffers));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glGenFramebuffers(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 0, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
|
||||
GLuint framebuffers;
|
||||
glGenFramebuffers(1, &framebuffers);
|
||||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(framebuffers));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glDeleteTextures(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 1, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
glDeleteTextures(1, &arg0);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glDeleteBuffers(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 1, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
glDeleteBuffers(1, &arg0);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glDeleteRenderbuffers(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 1, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
glDeleteRenderbuffers(1, &arg0);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glDeleteFramebuffers(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 1, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
glDeleteFramebuffers(1, &arg0);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glShaderSource(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 2, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0; const char *arg1;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
ok &= jsval_to_charptr(cx, *argvp++, &arg1);
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
glShaderSource(arg0, 1, &arg1, NULL);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glGetShaderiv(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 2, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0, arg1;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
GLint ret;
|
||||
glGetShaderiv(arg0, arg1, &ret);
|
||||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(ret));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glGetProgramiv(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 2, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0, arg1;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
GLint ret;
|
||||
glGetProgramiv(arg0, arg1, &ret);
|
||||
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(ret));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool JSB_glGetProgramInfoLog(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 1, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
GLsizei length;
|
||||
glGetProgramiv(arg0, GL_INFO_LOG_LENGTH, &length);
|
||||
GLchar* src = new GLchar[length];
|
||||
glGetProgramInfoLog(arg0, length, NULL, src);
|
||||
|
||||
JS_SET_RVAL(cx, vp, charptr_to_jsval(cx, src));
|
||||
CC_SAFE_DELETE_ARRAY(src);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
// DOMString? getShaderInfoLog(WebGLShader? shader);
|
||||
JSBool JSB_glGetShaderInfoLog(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 1, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
GLsizei length;
|
||||
glGetShaderiv(arg0, GL_INFO_LOG_LENGTH, &length);
|
||||
GLchar* src = new GLchar[length];
|
||||
glGetShaderInfoLog(arg0, length, NULL, src);
|
||||
|
||||
JS_SET_RVAL(cx, vp, charptr_to_jsval(cx, src));
|
||||
CC_SAFE_DELETE_ARRAY(src);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
// DOMString? getShaderSource(WebGLShader? shader);
|
||||
JSBool JSB_glGetShaderSource(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 1, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
GLsizei length;
|
||||
glGetShaderiv(arg0, GL_SHADER_SOURCE_LENGTH, &length);
|
||||
GLchar* src = new GLchar[length];
|
||||
glGetShaderSource(arg0, length, NULL, src);
|
||||
|
||||
JS_SET_RVAL(cx, vp, charptr_to_jsval(cx, src));
|
||||
CC_SAFE_DELETE_ARRAY(src);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
// interface WebGLActiveInfo {
|
||||
// readonly attribute GLint size;
|
||||
// readonly attribute GLenum type;
|
||||
// readonly attribute DOMString name;
|
||||
// WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, GLuint index);
|
||||
JSBool JSB_glGetActiveAttrib(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 2, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0, arg1;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
GLsizei length;
|
||||
glGetProgramiv(arg0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &length);
|
||||
GLchar* buffer = new GLchar[length];
|
||||
GLint size = -1;
|
||||
GLenum type = -1;
|
||||
|
||||
glGetActiveAttrib(arg0, arg1, length, NULL, &size, &type, buffer);
|
||||
|
||||
jsval retval = JSVAL_VOID;
|
||||
|
||||
JSObject *object = JS_NewObject(cx, NULL, NULL, NULL );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error creating JS Object");
|
||||
|
||||
if (!JS_DefineProperty(cx, object, "size", INT_TO_JSVAL(size), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ||
|
||||
!JS_DefineProperty(cx, object, "type", INT_TO_JSVAL(type), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ||
|
||||
!JS_DefineProperty(cx, object, "name", charptr_to_jsval(cx, buffer), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) )
|
||||
return JS_FALSE;
|
||||
|
||||
retval = OBJECT_TO_JSVAL(object);
|
||||
|
||||
JS_SET_RVAL(cx, vp, retval);
|
||||
CC_SAFE_DELETE_ARRAY(buffer);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
// interface WebGLActiveInfo {
|
||||
// readonly attribute GLint size;
|
||||
// readonly attribute GLenum type;
|
||||
// readonly attribute DOMString name;
|
||||
// };
|
||||
// WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index);
|
||||
JSBool JSB_glGetActiveUniform(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 2, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0, arg1;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
GLsizei length;
|
||||
glGetProgramiv(arg0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &length);
|
||||
GLchar* buffer = new GLchar[length];
|
||||
GLint size = -1;
|
||||
GLenum type = -1;
|
||||
|
||||
glGetActiveUniform(arg0, arg1, length, NULL, &size, &type, buffer);
|
||||
|
||||
jsval retval = JSVAL_VOID;
|
||||
|
||||
|
||||
JSObject *object = JS_NewObject(cx, NULL, NULL, NULL );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error creating JS Object");
|
||||
|
||||
if (!JS_DefineProperty(cx, object, "size", INT_TO_JSVAL(size), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ||
|
||||
!JS_DefineProperty(cx, object, "type", INT_TO_JSVAL(type), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ||
|
||||
!JS_DefineProperty(cx, object, "name", charptr_to_jsval(cx, buffer), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) )
|
||||
return JS_FALSE;
|
||||
|
||||
retval = OBJECT_TO_JSVAL(object);
|
||||
|
||||
JS_SET_RVAL(cx, vp, retval);
|
||||
CC_SAFE_DELETE_ARRAY(buffer);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
// sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
|
||||
JSBool JSB_glGetAttachedShaders(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 1, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
|
||||
GLsizei length;
|
||||
glGetProgramiv(arg0, GL_ATTACHED_SHADERS, &length);
|
||||
GLuint* buffer = new GLuint[length];
|
||||
memset(buffer, 0, length * sizeof(GLuint));
|
||||
glGetAttachedShaders(arg0, length, NULL, buffer);
|
||||
|
||||
JSObject *jsobj = JS_NewArrayObject(cx, length, NULL);
|
||||
JSB_PRECONDITION2(jsobj, cx, JS_FALSE, "Error creating JS Object");
|
||||
|
||||
for( int i=0; i<length; i++) {
|
||||
jsval e = INT_TO_JSVAL(buffer[i]);
|
||||
JS_SetElement(cx, jsobj, i, &e );
|
||||
}
|
||||
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsobj));
|
||||
CC_SAFE_DELETE_ARRAY(buffer);
|
||||
return JS_TRUE;
|
||||
|
||||
}
|
||||
|
||||
// sequence<DOMString>? getSupportedExtensions();
|
||||
JSBool JSB_glGetSupportedExtensions(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 0, cx, JS_FALSE, "Invalid number of arguments" );
|
||||
|
||||
const GLubyte *extensions = glGetString(GL_EXTENSIONS);
|
||||
|
||||
JSObject *jsobj = JS_NewArrayObject(cx, 0, NULL);
|
||||
JSB_PRECONDITION2(jsobj, cx, JS_FALSE, "Error creating JS Object");
|
||||
|
||||
// copy, to be able to add '\0'
|
||||
size_t len = strlen((char*)extensions);
|
||||
GLubyte* copy = new GLubyte[len+1];
|
||||
strncpy((char*)copy, (const char*)extensions, len );
|
||||
|
||||
int start_extension=0;
|
||||
int element=0;
|
||||
for( int i=0; i<len+1; i++) {
|
||||
if( copy[i]==' ' || copy[i]==',' || i==len ) {
|
||||
copy[i] = 0;
|
||||
|
||||
jsval str = charptr_to_jsval(cx, (const char*)©[start_extension]);
|
||||
JS_SetElement(cx, jsobj, element++, &str );
|
||||
|
||||
start_extension = i+1;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsobj));
|
||||
CC_SAFE_DELETE_ARRAY(copy);
|
||||
return JS_TRUE;
|
||||
|
||||
}
|
||||
|
||||
// any getTexParameter(GLenum target, GLenum pname);
|
||||
JSBool JSB_glGetTexParameterfv(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 2, cx, JS_FALSE, "JSB_glGetTexParameterfv: Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0, arg1;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
|
||||
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "JSB_glGetTexParameterfv: Error processing arguments");
|
||||
|
||||
GLfloat param;
|
||||
glGetTexParameterfv(arg0, arg1, ¶m);
|
||||
|
||||
JS_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(param));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
// any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
|
||||
JSBool JSB_glGetUniformfv(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2( argc == 2, cx, JS_FALSE, "JSB_glGetUniformfv: Invalid number of arguments" );
|
||||
jsval *argvp = JS_ARGV(cx,vp);
|
||||
JSBool ok = JS_TRUE;
|
||||
uint32_t arg0, arg1;
|
||||
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
|
||||
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
|
||||
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "JSB_glGetUniformfv: Error processing arguments");
|
||||
|
||||
GLsizei length;
|
||||
glGetProgramiv(arg0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &length);
|
||||
GLchar* namebuffer = new GLchar[length];
|
||||
GLint size = -1;
|
||||
GLenum type = -1;
|
||||
|
||||
glGetActiveUniform(arg0, arg1, length, NULL, &size, &type, namebuffer);
|
||||
CC_SAFE_DELETE_ARRAY(namebuffer);
|
||||
|
||||
int usize = 0;
|
||||
int utype = 0;
|
||||
switch(type) {
|
||||
|
||||
// float
|
||||
case GL_FLOAT:
|
||||
usize = 1;
|
||||
utype = GL_FLOAT;
|
||||
break;
|
||||
case GL_FLOAT_MAT2:
|
||||
usize = 2 * 2;
|
||||
utype = GL_FLOAT;
|
||||
break;
|
||||
case GL_FLOAT_MAT3:
|
||||
usize = 3 * 3;
|
||||
utype = GL_FLOAT;
|
||||
break;
|
||||
case GL_FLOAT_MAT4:
|
||||
usize = 4 * 4;
|
||||
utype = GL_FLOAT;
|
||||
break;
|
||||
case GL_FLOAT_VEC2:
|
||||
usize = 2;
|
||||
utype = GL_FLOAT;
|
||||
break;
|
||||
case GL_FLOAT_VEC3:
|
||||
usize = 3;
|
||||
utype = GL_FLOAT;
|
||||
break;
|
||||
case GL_FLOAT_VEC4:
|
||||
usize = 4;
|
||||
utype = GL_FLOAT;
|
||||
break;
|
||||
|
||||
// int
|
||||
case GL_INT:
|
||||
usize = 1;
|
||||
utype = GL_INT;
|
||||
break;
|
||||
case GL_INT_VEC2:
|
||||
usize = 1;
|
||||
utype = GL_INT;
|
||||
break;
|
||||
case GL_INT_VEC3:
|
||||
usize = 1;
|
||||
utype = GL_INT;
|
||||
break;
|
||||
case GL_INT_VEC4:
|
||||
usize = 1;
|
||||
utype = GL_INT;
|
||||
break;
|
||||
|
||||
default:
|
||||
JSB_PRECONDITION2(false, cx, JS_FALSE, "JSB_glGetUniformfv: Uniform Type not supported");
|
||||
}
|
||||
|
||||
JSObject *typedArray = NULL;
|
||||
if( utype == GL_FLOAT) {
|
||||
GLfloat* param = new GLfloat[usize];
|
||||
glGetUniformfv(arg0, arg1, param);
|
||||
|
||||
typedArray = JS_NewFloat32Array(cx, usize);
|
||||
float *buffer = (float*)JS_GetArrayBufferViewData(typedArray);
|
||||
memcpy( buffer, param, sizeof(float) * usize);
|
||||
CC_SAFE_DELETE_ARRAY(param);
|
||||
} else if( utype == GL_INT ) {
|
||||
GLint* param = new GLint[usize];
|
||||
glGetUniformiv(arg0, arg1, param);
|
||||
|
||||
typedArray = JS_NewInt32Array(cx, usize);
|
||||
GLint *buffer = (GLint*)JS_GetArrayBufferViewData(typedArray);
|
||||
memcpy( buffer, param, sizeof(GLint) * usize);
|
||||
CC_SAFE_DELETE_ARRAY(param);
|
||||
}
|
||||
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(typedArray));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
#endif // JSB_INCLUDE_OPENGL
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* JS Bindings: https://github.com/zynga/jsbindings
|
||||
*
|
||||
* Copyright (c) 2012 Zynga Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __jsb_opengl_manual
|
||||
#define __jsb_opengl_manual
|
||||
|
||||
#include "js_bindings_config.h"
|
||||
#ifdef JSB_INCLUDE_OPENGL
|
||||
|
||||
//#include <Availability.h>
|
||||
#include "jsapi.h"
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
|
||||
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
|
||||
|
||||
// compatible with iOS
|
||||
#define glClearDepthf glClearDepth
|
||||
#define glDepthRangef glDepthRange
|
||||
#define glReleaseShaderCompiler()
|
||||
|
||||
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED
|
||||
|
||||
// forward declaration of new functions
|
||||
JSBool JSB_glGetSupportedExtensions(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
|
||||
#endif // JSB_INCLUDE_OPENGL
|
||||
|
||||
#endif // __jsb_opengl_manual
|
|
@ -0,0 +1,188 @@
|
|||
/*
|
||||
* JS Bindings: https://github.com/zynga/jsbindings
|
||||
*
|
||||
* Copyright (c) 2012 Zynga Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "js_bindings_config.h"
|
||||
#include "js_bindings_core.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "jsb_opengl_manual.h"
|
||||
#include "js_bindings_opengl.h"
|
||||
|
||||
//#include "jsb_opengl_functions_registration.h"
|
||||
|
||||
// system
|
||||
#include "jsb_opengl_functions.h"
|
||||
|
||||
void JSB_register_opengl(JSContext *_cx, JSObject *object)
|
||||
{
|
||||
//
|
||||
// gl
|
||||
//
|
||||
JSObject *opengl = JS_NewObject(_cx, NULL, NULL, NULL);
|
||||
jsval openglVal = OBJECT_TO_JSVAL(opengl);
|
||||
JS_SetProperty(_cx, object, "gl", &openglVal);
|
||||
|
||||
jsval nsval;
|
||||
JSObject *ccns;
|
||||
JS_GetProperty(_cx, object, "cc", &nsval);
|
||||
if (nsval == JSVAL_VOID) {
|
||||
ccns = JS_NewObject(_cx, NULL, NULL, NULL);
|
||||
nsval = OBJECT_TO_JSVAL(ccns);
|
||||
JS_SetProperty(_cx, object, "cc", &nsval);
|
||||
} else {
|
||||
JS_ValueToObject(_cx, nsval, &ccns);
|
||||
}
|
||||
|
||||
js_register_cocos2dx_GLNode(_cx, ccns);
|
||||
|
||||
// New WebGL functions, not present on OpenGL ES 2.0
|
||||
JS_DefineFunction(_cx, opengl, "getSupportedExtensions", JSB_glGetSupportedExtensions, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "activeTexture", JSB_glActiveTexture, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_attachShader", JSB_glAttachShader, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_bindAttribLocation", JSB_glBindAttribLocation, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_bindBuffer", JSB_glBindBuffer, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_bindFramebuffer", JSB_glBindFramebuffer, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_bindRenderbuffer", JSB_glBindRenderbuffer, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_bindTexture", JSB_glBindTexture, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "blendColor", JSB_glBlendColor, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "blendEquation", JSB_glBlendEquation, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "blendEquationSeparate", JSB_glBlendEquationSeparate, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "blendFunc", JSB_glBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "blendFuncSeparate", JSB_glBlendFuncSeparate, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "bufferData", JSB_glBufferData, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "bufferSubData", JSB_glBufferSubData, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "checkFramebufferStatus", JSB_glCheckFramebufferStatus, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "clear", JSB_glClear, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "clearColor", JSB_glClearColor, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "clearDepthf", JSB_glClearDepthf, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "clearStencil", JSB_glClearStencil, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "colorMask", JSB_glColorMask, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_compileShader", JSB_glCompileShader, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "compressedTexImage2D", JSB_glCompressedTexImage2D, 8, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "compressedTexSubImage2D", JSB_glCompressedTexSubImage2D, 9, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "copyTexImage2D", JSB_glCopyTexImage2D, 8, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "copyTexSubImage2D", JSB_glCopyTexSubImage2D, 8, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_createProgram", JSB_glCreateProgram, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_createShader", JSB_glCreateShader, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "cullFace", JSB_glCullFace, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_deleteBuffer", JSB_glDeleteBuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_deleteFramebuffer", JSB_glDeleteFramebuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_deleteProgram", JSB_glDeleteProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_deleteRenderbuffer", JSB_glDeleteRenderbuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_deleteShader", JSB_glDeleteShader, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_deleteTexture", JSB_glDeleteTextures, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "depthFunc", JSB_glDepthFunc, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "depthMask", JSB_glDepthMask, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "depthRangef", JSB_glDepthRangef, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "detachShader", JSB_glDetachShader, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "disable", JSB_glDisable, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "disableVertexAttribArray", JSB_glDisableVertexAttribArray, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "drawArrays", JSB_glDrawArrays, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "drawElements", JSB_glDrawElements, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "enable", JSB_glEnable, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "enableVertexAttribArray", JSB_glEnableVertexAttribArray, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "finish", JSB_glFinish, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "flush", JSB_glFlush, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "framebufferRenderbuffer", JSB_glFramebufferRenderbuffer, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "framebufferTexture2D", JSB_glFramebufferTexture2D, 5, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "frontFace", JSB_glFrontFace, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_createBuffer", JSB_glGenBuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_createFramebuffer", JSB_glGenFramebuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_createRenderbuffer", JSB_glGenRenderbuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_createTexture", JSB_glGenTextures, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "generateMipmap", JSB_glGenerateMipmap, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getActiveAttrib", JSB_glGetActiveAttrib, 7, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getActiveUniform", JSB_glGetActiveUniform, 7, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getAttachedShaders", JSB_glGetAttachedShaders, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getAttribLocation", JSB_glGetAttribLocation, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "getError", JSB_glGetError, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getProgramInfoLog", JSB_glGetProgramInfoLog, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getProgramParameter", JSB_glGetProgramiv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getShaderInfoLog", JSB_glGetShaderInfoLog, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getShaderSource", JSB_glGetShaderSource, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getShaderParameter", JSB_glGetShaderiv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "getTexParameter", JSB_glGetTexParameterfv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getUniformLocation", JSB_glGetUniformLocation, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_getUniform", JSB_glGetUniformfv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "hint", JSB_glHint, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "isBuffer", JSB_glIsBuffer, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "isEnabled", JSB_glIsEnabled, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "isFramebuffer", JSB_glIsFramebuffer, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "isProgram", JSB_glIsProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "isRenderbuffer", JSB_glIsRenderbuffer, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "isShader", JSB_glIsShader, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "isTexture", JSB_glIsTexture, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "lineWidth", JSB_glLineWidth, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_linkProgram", JSB_glLinkProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "pixelStorei", JSB_glPixelStorei, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "polygonOffset", JSB_glPolygonOffset, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "readPixels", JSB_glReadPixels, 7, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "releaseShaderCompiler", JSB_glReleaseShaderCompiler, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "renderbufferStorage", JSB_glRenderbufferStorage, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "sampleCoverage", JSB_glSampleCoverage, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "scissor", JSB_glScissor, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_shaderSource", JSB_glShaderSource, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "stencilFunc", JSB_glStencilFunc, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "stencilFuncSeparate", JSB_glStencilFuncSeparate, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "stencilMask", JSB_glStencilMask, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "stencilMaskSeparate", JSB_glStencilMaskSeparate, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "stencilOp", JSB_glStencilOp, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "stencilOpSeparate", JSB_glStencilOpSeparate, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_texImage2D", JSB_glTexImage2D, 9, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "texParameterf", JSB_glTexParameterf, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "texParameteri", JSB_glTexParameteri, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_texSubImage2D", JSB_glTexSubImage2D, 9, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform1f", JSB_glUniform1f, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform1fv", JSB_glUniform1fv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform1i", JSB_glUniform1i, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform1iv", JSB_glUniform1iv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform2f", JSB_glUniform2f, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform2fv", JSB_glUniform2fv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform2i", JSB_glUniform2i, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform2iv", JSB_glUniform2iv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform3f", JSB_glUniform3f, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform3fv", JSB_glUniform3fv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform3i", JSB_glUniform3i, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform3iv", JSB_glUniform3iv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform4f", JSB_glUniform4f, 5, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform4fv", JSB_glUniform4fv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform4i", JSB_glUniform4i, 5, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniform4iv", JSB_glUniform4iv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniformMatrix2fv", JSB_glUniformMatrix2fv, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniformMatrix3fv", JSB_glUniformMatrix3fv, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "uniformMatrix4fv", JSB_glUniformMatrix4fv, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_useProgram", JSB_glUseProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "_validateProgram", JSB_glValidateProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "vertexAttrib1f", JSB_glVertexAttrib1f, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "vertexAttrib1fv", JSB_glVertexAttrib1fv, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "vertexAttrib2f", JSB_glVertexAttrib2f, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "vertexAttrib2fv", JSB_glVertexAttrib2fv, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "vertexAttrib3f", JSB_glVertexAttrib3f, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "vertexAttrib3fv", JSB_glVertexAttrib3fv, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "vertexAttrib4f", JSB_glVertexAttrib4f, 5, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "vertexAttrib4fv", JSB_glVertexAttrib4fv, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "vertexAttribPointer", JSB_glVertexAttribPointer, 6, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
JS_DefineFunction(_cx, opengl, "viewport", JSB_glViewport, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* JS Bindings: https://github.com/zynga/jsbindings
|
||||
*
|
||||
* Copyright (c) 2012 Zynga Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __JSB_OPENGL_REGISTRATION
|
||||
#define __JSB_OPENGL_REGISTRATION
|
||||
#include "jsb_opengl_functions.h"
|
||||
|
||||
void JSB_register_opengl( JSContext *globalC, JSObject *globalO);
|
||||
|
||||
#endif // __JSB_OPENGL_REGISTRATION
|
|
@ -1 +1 @@
|
|||
f92eb40bc776570519509464d3f3ba6e9d93d3a9
|
||||
6ddddf80e821ca5ff218502a76a75d5eba5bb254
|
|
@ -16,12 +16,16 @@
|
|||
<ClCompile Include="..\generated\jsb_cocos2dx_auto.cpp" />
|
||||
<ClCompile Include="..\generated\jsb_cocos2dx_extension_auto.cpp" />
|
||||
<ClCompile Include="..\jsb_cocos2dx_extension_manual.cpp" />
|
||||
<ClCompile Include="..\jsb_opengl_functions.cpp" />
|
||||
<ClCompile Include="..\jsb_opengl_manual.cpp" />
|
||||
<ClCompile Include="..\jsb_opengl_registration.cpp" />
|
||||
<ClCompile Include="..\js_bindings_ccbreader.cpp" />
|
||||
<ClCompile Include="..\js_bindings_chipmunk_auto_classes.cpp" />
|
||||
<ClCompile Include="..\js_bindings_chipmunk_functions.cpp" />
|
||||
<ClCompile Include="..\js_bindings_chipmunk_manual.cpp" />
|
||||
<ClCompile Include="..\js_bindings_chipmunk_registration.cpp" />
|
||||
<ClCompile Include="..\js_bindings_core.cpp" />
|
||||
<ClCompile Include="..\js_bindings_opengl.cpp" />
|
||||
<ClCompile Include="..\js_bindings_system_functions.cpp" />
|
||||
<ClCompile Include="..\js_bindings_system_registration.cpp" />
|
||||
<ClCompile Include="..\js_manual_conversions.cpp" />
|
||||
|
@ -33,6 +37,9 @@
|
|||
<ClInclude Include="..\generated\jsb_cocos2dx_auto.hpp" />
|
||||
<ClInclude Include="..\generated\jsb_cocos2dx_extension_auto.hpp" />
|
||||
<ClInclude Include="..\jsb_cocos2dx_extension_manual.h" />
|
||||
<ClInclude Include="..\jsb_opengl_functions.h" />
|
||||
<ClInclude Include="..\jsb_opengl_manual.h" />
|
||||
<ClInclude Include="..\jsb_opengl_registration.h" />
|
||||
<ClInclude Include="..\js_bindings_ccbreader.h" />
|
||||
<ClInclude Include="..\js_bindings_chipmunk_auto_classes.h" />
|
||||
<ClInclude Include="..\js_bindings_chipmunk_auto_classes_registration.h" />
|
||||
|
@ -42,6 +49,7 @@
|
|||
<ClInclude Include="..\js_bindings_chipmunk_registration.h" />
|
||||
<ClInclude Include="..\js_bindings_config.h" />
|
||||
<ClInclude Include="..\js_bindings_core.h" />
|
||||
<ClInclude Include="..\js_bindings_opengl.h" />
|
||||
<ClInclude Include="..\js_bindings_system_functions.h" />
|
||||
<ClInclude Include="..\js_bindings_system_functions_registration.h" />
|
||||
<ClInclude Include="..\js_bindings_system_registration.h" />
|
||||
|
|
|
@ -59,6 +59,18 @@
|
|||
<ClCompile Include="..\jsb_cocos2dx_extension_manual.cpp">
|
||||
<Filter>manual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\js_bindings_opengl.cpp">
|
||||
<Filter>manual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\jsb_opengl_registration.cpp">
|
||||
<Filter>manual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\jsb_opengl_manual.cpp">
|
||||
<Filter>manual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\jsb_opengl_functions.cpp">
|
||||
<Filter>manual</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\cocos2d_specifics.hpp">
|
||||
|
@ -121,6 +133,18 @@
|
|||
<ClInclude Include="..\jsb_cocos2dx_extension_manual.h">
|
||||
<Filter>manual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\js_bindings_opengl.h">
|
||||
<Filter>manual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\jsb_opengl_functions.h">
|
||||
<Filter>manual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\jsb_opengl_manual.h">
|
||||
<Filter>manual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\jsb_opengl_registration.h">
|
||||
<Filter>manual</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\generated\jsb_cocos2dx_extension_auto_api.js">
|
||||
|
|
|
@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos2dx/include/cocos2d.h %(cocosdir)s/CocosDenshion/inc
|
|||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^CCMenu*$".
|
||||
classes = CCSprite.* CCScene CCNode.* CCDirector CCLayer.* CCMenu.* CCTouch CC.*Action.* CCMove.* CCRotate.* CCBlink.* CCTint.* CCSequence CCRepeat.* CCFade.* CCEase.* CCScale.* CCTransition.* CCSpawn CCAnimat.* CCFlip.* CCDelay.* CCSkew.* CCJump.* CCPlace.* CCShow.* CCProgress.* CCPointArray CCToggleVisibility.* CCHide CCParticle.* CCLabel.* CCAtlas.* CCTextureCache.* CCTexture2D CCCardinal.* CCCatmullRom.* CCParallaxNode CCTileMap.* CCTMX.* CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCGridBase$ CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit.* CCFollow.* CCBezier.* CCCardinalSpline.* CCCamera.* CCDrawNode CC.*3D$ CCLiquid$ CCWaves$ CCShuffleTiles$ CCTurnOffTiles$ CCSplit.* CCTwirl$ CCFileUtils$
|
||||
classes = CCSprite.* CCScene CCNode.* CCDirector CCLayer.* CCMenu.* CCTouch CC.*Action.* CCMove.* CCRotate.* CCBlink.* CCTint.* CCSequence CCRepeat.* CCFade.* CCEase.* CCScale.* CCTransition.* CCSpawn CCAnimat.* CCFlip.* CCDelay.* CCSkew.* CCJump.* CCPlace.* CCShow.* CCProgress.* CCPointArray CCToggleVisibility.* CCHide CCParticle.* CCLabel.* CCAtlas.* CCTextureCache.* CCTexture2D CCCardinal.* CCCatmullRom.* CCParallaxNode CCTileMap.* CCTMX.* CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCGridBase$ CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit.* CCFollow.* CCBezier.* CCCardinalSpline.* CCCamera.* CCDrawNode CC.*3D$ CCLiquid$ CCWaves$ CCShuffleTiles$ CCTurnOffTiles$ CCSplit.* CCTwirl$ CCFileUtils$ CCGLProgram CCShaderCache
|
||||
|
||||
# what should we skip? in the format ClassName::[function function]
|
||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||
|
@ -35,7 +35,7 @@ classes = CCSprite.* CCScene CCNode.* CCDirector CCLayer.* CCMenu.* CCTouch CC.*
|
|||
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
|
||||
# functions from all classes.
|
||||
|
||||
skip = CCNode::[.*Transform convertToWindowSpace ^setPosition$ getGrid setGLServerState description getShaderProgram getUserObject .*UserData getGLServerState .*schedule],
|
||||
skip = CCNode::[.*Transform convertToWindowSpace ^setPosition$ getGrid setGLServerState description getUserObject .*UserData getGLServerState .*schedule],
|
||||
CCSprite::[getQuad displayFrame getBlendFunc ^setPosition$ setBlendFunc setSpriteBatchNode getSpriteBatchNode],
|
||||
CCSpriteBatchNode::[getBlendFunc setBlendFunc],
|
||||
CCMotionStreak::[getBlendFunc setBlendFunc],
|
||||
|
@ -83,6 +83,7 @@ skip = CCNode::[.*Transform convertToWindowSpace ^setPosition$ getGrid setGLServ
|
|||
CCSequence::[create],
|
||||
CCSpawn::[create],
|
||||
CCAnimation::[create],
|
||||
CCGLProgram::[getProgram setUniformLocationWith2f.* setUniformLocationWith1f.* setUniformLocationWith3f.* setUniformLocationWith4f.*],
|
||||
CCGrid3DAction::[create actionWith.*],
|
||||
CCTiledGrid3DAction::[create actionWith.*],
|
||||
CCTMXMapInfo::[startElement endElement textHandler],
|
||||
|
@ -107,6 +108,7 @@ rename_functions = CCDirector::[sharedDirector=getInstance],
|
|||
CCAnimationCache::[sharedAnimationCache=getInstance addAnimationsWithFile=addAnimations animationByName=getAnimation removeAnimationByName=removeAnimation],
|
||||
CCLayerGradient::[initWithColor=init],
|
||||
CCLayerColor::[initWithColor=init],
|
||||
CCGLProgram::[fragmentShaderLog=getFragmentShaderLog initWithVertexShaderByteArray=initWithString initWithVertexShaderFilename=init programLog=getProgramLog setUniformLocationWith1i=setUniformLocationI32 vertexShaderLog=getVertexShaderLog],
|
||||
CCNode::[boundingBox=getBoundingBox removeFromParentAndCleanup=removeFromParent removeAllChildrenWithCleanup=removeAllChildren],
|
||||
CCLabelAtlas::[create=_create],
|
||||
CCTMXLayer::[tileAt=getTileAt tileGIDAt=getTileGIDAt propertyNamed=getProperty],
|
||||
|
@ -118,6 +120,7 @@ rename_functions = CCDirector::[sharedDirector=getInstance],
|
|||
CCCamera::[setUpXYZ=setUp getUpXYZ=getUp setEyeXYZ=setEye getEyeXYZ=getEye setCenterXYZ=setCenter getCenterXYZ=getCenter],
|
||||
CCTMXTiledMap::[layerNamed=getLayer objectGroupNamed=getObjectGroup propertyNamed=getProperty],
|
||||
CCTexture2D::[defaultAlphaPixelFormat=getDefaultAlphaPixelFormat],
|
||||
CCShaderCache::[programForKey=getProgram sharedShaderCache=getInstance],
|
||||
CCFileUtils::[sharedFileUtils=getInstance loadFilenameLookupDictionaryFromFile=loadFilenameLookup]
|
||||
|
||||
rename_classes = CCParticleSystemQuad::CCParticleSystem,
|
||||
|
|
Loading…
Reference in New Issue