initial
This commit is contained in:
commit
8682feb9e9
|
@ -0,0 +1,12 @@
|
|||
.idea
|
||||
.cproject,.project
|
||||
.cproject
|
||||
.project
|
||||
.lock-wscript
|
||||
build*
|
||||
.DS_Store
|
||||
Debug
|
||||
node_modules
|
||||
package-lock.json
|
||||
bin_*
|
||||
*.log
|
|
@ -0,0 +1,12 @@
|
|||
.idea
|
||||
.cproject,.project
|
||||
.cproject
|
||||
.project
|
||||
.lock-wscript
|
||||
build*
|
||||
.DS_Store
|
||||
Debug
|
||||
node_modules
|
||||
package-lock.json
|
||||
bin_*
|
||||
*.log
|
|
@ -0,0 +1,59 @@
|
|||
This document lists all the licenses used in this node-webgl repository:
|
||||
|
||||
- Part I - node-webgl distributed under BSD license
|
||||
- Part II - LightGL.js from Evan Wallace under MIT license
|
||||
|
||||
No specific license found for:
|
||||
- Some tests adapted from LearningWebGL.com lessons, themselves adapted from NeHe lessons.
|
||||
- Travelling wavefront demo adapted from https://github.com/webos-commons/com.creationix.minimason webOS demo, itself adapted from the minimason nko2 demo.
|
||||
|
||||
node-webgl depends on node-glfw, also under BSD license.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Part I - node-webgl distributed under BSD license
|
||||
|
||||
Copyright (c) 2011-2012, Mikael Bourges-Sevenier
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Part II - LightGL.js from Evan Wallace under MIT license
|
||||
|
||||
Copyright (C) 2011 by Evan Wallace
|
||||
|
||||
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.
|
|
@ -0,0 +1,2 @@
|
|||
# node-addon-tools
|
||||
A set of extra macros for node addons, shipped as C++ header file.
|
|
@ -0,0 +1,107 @@
|
|||
#ifndef _COMMON_HPP_
|
||||
#define _COMMON_HPP_
|
||||
|
||||
|
||||
#include <node.h>
|
||||
#include <nan.h>
|
||||
#include <v8.h>
|
||||
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#define JS_STR(...) Nan::New<String>(__VA_ARGS__).ToLocalChecked()
|
||||
#define JS_INT(val) Nan::New<v8::Integer>(val)
|
||||
#define JS_NUM(val) Nan::New<v8::Number>(val)
|
||||
#define JS_BOOL(val) (val) ? Nan::True() : Nan::False()
|
||||
#define JS_RETHROW(tc) v8::Local<v8::Value>::New(tc.Exception());
|
||||
|
||||
#define REQ_ARGS(N) \
|
||||
if (info.Length() < (N)) \
|
||||
Nan::ThrowTypeError("Expected at least " #N " arguments");
|
||||
|
||||
#define REQ_STR_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsString()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be a string"); \
|
||||
String::Utf8Value _v8_##VAR(info[I]->ToString()); \
|
||||
std::string _std_##VAR = std::string(*_v8_##VAR); \
|
||||
const char *VAR = _std_##VAR.c_str();
|
||||
|
||||
#define REQ_UTF8_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsString()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be a string"); \
|
||||
String::Utf8Value VAR(info[I]);
|
||||
|
||||
#define REQ_INT32_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsInt32()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be an int32"); \
|
||||
int VAR = info[I]->Int32Value();
|
||||
|
||||
#define LET_INT32_ARG(I, VAR) \
|
||||
if ( ! (info[I]->IsNull() || info[I]->IsInt32()) ) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be an int32 or null");\
|
||||
int VAR = info[I]->IsNull() ? 0 : info[I]->Int32Value();
|
||||
|
||||
#define REQ_BOOL_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsBoolean()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be a bool"); \
|
||||
int VAR = info[I]->BooleanValue();
|
||||
|
||||
#define REQ_UINT32_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsUint32()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be a uint32"); \
|
||||
unsigned int VAR = info[I]->Uint32Value();
|
||||
|
||||
#define USE_UINT32_ARG(I, VAR, DEF) \
|
||||
if ( ! (info[I]->IsNull() || info[I]->IsUint32()) ) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be an uint32 or null");\
|
||||
unsigned int VAR = info[I]->IsNull() ? (DEF) : info[I]->Uint32Value();
|
||||
|
||||
#define LET_UINT32_ARG(I, VAR) \
|
||||
USE_UINT32_ARG(I, VAR, 0)
|
||||
|
||||
#define REQ_INT_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsNumber()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be a int"); \
|
||||
size_t VAR = static_cast<size_t>(info[I]->IntegerValue());
|
||||
|
||||
#define REQ_DOUBLE_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsNumber()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be a int"); \
|
||||
double VAR = static_cast<size_t>(info[I]->NumberValue());
|
||||
|
||||
#define REQ_FLOAT_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsNumber()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be a int"); \
|
||||
float VAR = static_cast<float>(info[I]->NumberValue());
|
||||
|
||||
#define REQ_EXT_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsExternal()) \
|
||||
Nan::ThrowTypeError("Argument " #I " invalid"); \
|
||||
Local<External> VAR = Local<External>::Cast(info[I]);
|
||||
|
||||
#define REQ_FUN_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsFunction()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be a function"); \
|
||||
Local<Function> VAR = Local<Function>::Cast(info[I]);
|
||||
|
||||
#define REQ_OBJ_ARG(I, VAR) \
|
||||
if (info.Length() <= (I) || ! info[I]->IsObject()) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be an object"); \
|
||||
Local<Object> VAR = Local<Object>::Cast(info[I]);
|
||||
|
||||
#define REQ_ARRV_ARG(I, VAR) \
|
||||
REQ_OBJ_ARG(I, _obj_##VAR); \
|
||||
if( ! _obj_##VAR->IsArrayBufferView() ) \
|
||||
Nan::ThrowTypeError("Argument " #I " must be an array buffer"); \
|
||||
Local<ArrayBufferView> VAR = Local<ArrayBufferView>::Cast(_obj_##VAR);
|
||||
|
||||
#define REQ_ERROR_THROW(error) \
|
||||
if (ret == error) \
|
||||
Nan::ThrowError(String::New(#error));
|
||||
|
||||
#define NAN_HS Nan::HandleScope scope;
|
||||
|
||||
#define RET_VALUE(VAL) info.GetReturnValue().Set(VAL);
|
||||
#define RET_UNDEFINED info.GetReturnValue().Set(Nan::Undefined());
|
||||
|
||||
#endif // _COMMON_HPP_
|
|
@ -0,0 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
module.exports = {
|
||||
root : __dirname,
|
||||
};
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "node-addon-tools",
|
||||
"author": "Luis Blanco <raubtierxxx@gmail.com>",
|
||||
"description": "WebGL for nodejs",
|
||||
"version": "0.0.1",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
"node",
|
||||
"addon",
|
||||
"header",
|
||||
"include"
|
||||
],
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Luis Blanco",
|
||||
"email": "raubtierxxx@gmail.com",
|
||||
"skype": "rauber666"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/raub/node-addon-tools.git"
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue