Code Monkey home page Code Monkey logo

grimoirejs's Introduction

Grimoire.js

Slack Status Circle CI LICENSE Dependency Status devDependency Status Greenkeeper badge

Overview

Grimoire.js provide a bridge between Web engineers and CG engineers

There were big gap between the development flows used for each.

Web engineers have typically used event driven javascript programs for daily works. And they mutate DOM APIs to make Web pages dynamic.

However, CG engineers has typically used loop based programs for daily works. These are mostly build with a programming language with strong type like C++ or C#. And recently CG engineers more like to use strongly structured engines like Unity.

This is why these 2 engineers have so much different flow for workings. This is why it is hard to learn CG stuff by Web engineers. And CG engineers are also hard to make suitable APIs for Web engineers working with.

Grimoire.js is a javascript(Typescript) framework to solve this problem with strong architecture

Features

You can see several feature of Grimoire.js providing in this section.

We strongly recommend to see our top page to learn these features. Most of written things are same as this README.md. But our samples on the top pages are working!!.

HTML like markup

We provides a syntax like XML to compose WebGL canvas. This is kind of HTML for Web engineers. You can create 360 degree image viewer on browser only by writing the code below.(See official page to see working example)

<goml>
  <scene>
    <camera></camera>
    <mesh geometry="sphere" cull="front" texture="360.jpg">
      <mesh.components>
        <Rotate speed="0.1" />
      </mesh.components>
    </mesh>
  </scene>
</goml>

DOM operation API

Web engineers typically write javascript to mutate DOM structures or attributes. All that kinds things are same at Grimoire. Web engineers can use query-based operation API to changing attributes, modifying structures of DOM or registering event handlers.

These are codes to co-work WebGL canvas and Web UIs that made with ordinal web development way. (You can see working example on our official top page)

<goml>
  <scene>
    <camera></camera>
    <mesh texture="logo.png" geometry="cube">
      <mesh.components>
        <Rotate speed="0,0.1,0" />
      </mesh.components>
    </mesh>
  </scene>
</goml>
gr(function() {
  var mesh = gr('#simple .canvas')('mesh')
  $('#simple .red').on('click', function () {
    mesh.setAttribute('color', 'red')
  })
  $('#simple .blue').on('click', function () {
    mesh.setAttribute('color', 'blue')
  })
  mesh.on('mouseenter', function () {
    mesh.setAttribute('scale', '2.0')
    $("#simple .bigger").addClass("bold-label");
    $("#simple .smaller").removeClass("bold-label");
  })
  mesh.on('mouseleave', function () {
    mesh.setAttribute('scale', '1.0')
    $("#simple .smaller").addClass("bold-label");
    $("#simple .bigger").removeClass("bold-label");
  })
})

Simple and powerful architecture, Typescript ready

If you really want to make WebGL stuff on your page, it is hard to make only by Web engineers if that contents requires highly customized representation. In this situation, Web engineers and CG engineers need to co-work.

CG engineers can write a component. And these are reusable.

And these are able to be written by Typescript. Safe and effective environment for development.

This is a sample to make objects waving movement. (You can see full comprehensive this sample at our top page)

import Component from "grimoirejs/ref/Node/Component";
import ISceneUpdateArgument from "grimoirejs-fundamental/ref/SceneRenderer/ISceneUpdateArgument";
import TransformComponent from "grimoirejs-fundamental/ref/Components/TransformComponent";
import Vector3 from "grimoirejs-math/ref/Vector3";
import gr from "grimoirejs";
class Wave extends Component{
  public static attributes = {
    amp:{
      default:1.0,
      converter:"Number"
    },
    speed:{
      default:1.0,
      converter:"Number"
    }
  };

  public amp:number;

  public speed:number;

  private transform: TransformComponent;

  public $mount():void{
    this.transform = this.node.getComponent(TransformComponent);
    this.__bindAttributes(); // bind component attributes to fields
  }
  public $update(t:ISceneUpdateArgument):void{
    this.transfrom.position = new Vector3(this.transform.position.X,Math.sin(this.speed * t.timer.timeInSecound) * this.amp,this.transform.position.Z);
  }
}
gr.registerComponent("Wave",Wave);

Download

Please see official site and Download page.

Useful Links

API Reference

See here.

This document is automatically generated.

Make sure the API reference is only containing core stuff(Mutating goml stuff, operating attributes, methods being available on Component instance and so on).

If you want to see WebGL related feature of API, you should see renderer plugin page.

LICENSE

MIT License

(See the LICENSE file for more detail.)

grimoirejs's People

Contributors

59naga avatar greenkeeper[bot] avatar kyasbal avatar m2wasabi avatar moajo avatar pnlybubbles avatar yokurin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grimoirejs's Issues

Too many errors in chrome

GL ERROR :GL_INVALID_OPERATION : glUniform3fv: wrong uniform function for type
RENDER WARNING: there is no texture bound to the unit 0

9j3.js:18874 WebGL: drawElements: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'. Or the texture is Float or Half Float type with linear filtering while OES_float_linear or OES_half_float_linear extension is not enabled.

remove bower

  • bowerとwebpackの親和性が良くない
  • 利用しているbowerのパッケージがnpmに存在するため、npmとbowerを共存させる必要性が無い

これらの理由からbowerの削除を検討します

Cube geometry gl error

[.WebGLRenderingContext-0x7fb574b6c750]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1

以下の環境でエラーが発生します:
mac os x 10.10.4
Intel Iris 1536 MB
Google Chrome 46.0.2461.0 canary (64-bit)

typedoc build task is not passing

gulp doc

Running task above, error below is occurred.

Using TypeScript 1.4.1 from /Users/pnlybubbles/Devs/jThree/node_modules/typescript/bin
Error: /Users/pnlybubbles/Devs/jThree/jThree/src/Core/CanvasManager.ts(97)
 Property 'webkitRequestFullScreen' does not exist on type 'HTMLCanvasElement'.

Wrap all webgl methods

  • sequence? getSupportedExtensions();
  • object? getExtension(DOMString name);
  • void activeTexture(GLenum texture);
  • void attachShader(WebGLProgram? program, WebGLShader? shader);
  • void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
  • void bindBuffer(GLenum target, WebGLBuffer? buffer);
  • void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
  • void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
  • void bindTexture(GLenum target, WebGLTexture? texture);
  • void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  • void blendEquation(GLenum mode);
  • void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
  • void blendFunc(GLenum sfactor, GLenum dfactor);
  • void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
  • void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
  • void bufferData(GLenum target, BufferDataSource? data, GLenum usage);
  • void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data);
  • [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
  • void clear(GLbitfield mask);
  • void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  • void clearDepth(GLclampf depth);
  • void clearStencil(GLint s);
  • void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
  • void compileShader(WebGLShader? shader);
  • void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,GLsizei width, GLsizei height, GLint border,ArrayBufferView data);
  • void compressedTexSubImage2D(GLenum target, GLint level,GLint xoffset, GLint yoffset,GLsizei width, GLsizei height, GLenum format,ArrayBufferView data);
  • void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
  • void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,GLint x, GLint y, GLsizei width, GLsizei height);
  • WebGLBuffer? createBuffer();
  • WebGLFramebuffer? createFramebuffer();
  • WebGLProgram? createProgram();
  • WebGLRenderbuffer? createRenderbuffer();
  • WebGLShader? createShader(GLenum type);
  • WebGLTexture? createTexture();
  • void cullFace(GLenum mode);
  • void deleteBuffer(WebGLBuffer? buffer);
  • void deleteFramebuffer(WebGLFramebuffer? framebuffer);
  • void deleteProgram(WebGLProgram? program);
  • void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer);
  • void deleteShader(WebGLShader? shader);
  • void deleteTexture(WebGLTexture? texture);
  • void depthFunc(GLenum func);
  • void depthMask(GLboolean flag);
  • void depthRange(GLclampf zNear, GLclampf zFar);
  • void detachShader(WebGLProgram? program, WebGLShader? shader);
  • void disable(GLenum cap);
  • void disableVertexAttribArray(GLuint index);
  • void drawArrays(GLenum mode, GLint first, GLsizei count);
  • void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
  • void enable(GLenum cap);
  • void enableVertexAttribArray(GLuint index);
  • void finish();
  • void flush();
  • void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer? renderbuffer);
  • void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, WebGLTexture? texture, GLint level);
  • void frontFace(GLenum mode);
  • void generateMipmap(GLenum target);
  • WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, GLuint index);
  • WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index);
  • sequence? getAttachedShaders(WebGLProgram? program);
  • [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram? program, DOMString name);
  • any getBufferParameter(GLenum target, GLenum pname);
  • any getParameter(GLenum pname);
  • [WebGLHandlesContextLoss] GLenum getError();
  • any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname);
  • any getProgramParameter(WebGLProgram? program, GLenum pname);
  • DOMString? getProgramInfoLog(WebGLProgram? program);
  • any getRenderbufferParameter(GLenum target, GLenum pname);
  • any getShaderParameter(WebGLShader? shader, GLenum pname);
  • WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
  • DOMString? getShaderInfoLog(WebGLShader? shader);
  • DOMString? getShaderSource(WebGLShader? shader);
  • any getTexParameter(GLenum target, GLenum pname);
  • any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
  • WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name);
  • any getVertexAttrib(GLuint index, GLenum pname);
  • [WebGLHandlesContextLoss] GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname);
  • void hint(GLenum target, GLenum mode);
  • [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer);
  • [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap);
  • [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer);
  • [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
  • [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
  • [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
  • [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
  • void lineWidth(GLfloat width);
  • void linkProgram(WebGLProgram? program);
  • void pixelStorei(GLenum pname, GLint param);
  • void polygonOffset(GLfloat factor, GLfloat units);
  • void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView? pixels);
  • void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
  • void sampleCoverage(GLclampf value, GLboolean invert);
  • void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
  • void shaderSource(WebGLShader? shader, DOMString source);\
  • void stencilFunc(GLenum func, GLint ref, GLuint mask);
  • void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
  • void stencilMask(GLuint mask);
  • void stencilMaskSeparate(GLenum face, GLuint mask);
  • void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
  • void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
  • 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, TexImageSource? source); // May throw DOMException
  • void texParameterf(GLenum target, GLenum pname, GLfloat param);
  • void texParameteri(GLenum target, GLenum pname, GLint param);
  • 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, TexImageSource? source); // May throw DOMException
  • void uniform1f(WebGLUniformLocation? location, GLfloat x);
  • void uniform1fv(WebGLUniformLocation? location, Float32Array v);
  • void uniform1fv(WebGLUniformLocation? location, sequence v);
  • void uniform1i(WebGLUniformLocation? location, GLint x);
  • void uniform1iv(WebGLUniformLocation? location, Int32Array v);
  • void uniform1iv(WebGLUniformLocation? location, sequence v);
  • void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
  • void uniform2fv(WebGLUniformLocation? location, Float32Array v);
  • void uniform2fv(WebGLUniformLocation? location, sequence v);
  • void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
  • void uniform2iv(WebGLUniformLocation? location, Int32Array v);
  • void uniform2iv(WebGLUniformLocation? location, sequence v);
  • void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
  • void uniform3fv(WebGLUniformLocation? location, Float32Array v);
  • void uniform3fv(WebGLUniformLocation? location, sequence v);
  • void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
  • void uniform3iv(WebGLUniformLocation? location, Int32Array v);
  • void uniform3iv(WebGLUniformLocation? location, sequence v);
  • void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
  • void uniform4fv(WebGLUniformLocation? location, Float32Array v);
  • void uniform4fv(WebGLUniformLocation? location, sequence v);
  • void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
  • void uniform4iv(WebGLUniformLocation? location, Int32Array v);
  • void uniform4iv(WebGLUniformLocation? location, sequence v);
  • void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
  • void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,sequence value);
  • void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,Float32Array value);
  • void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,sequence value);
  • void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,Float32Array value);
  • void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,sequence value);
  • void useProgram(WebGLProgram? program);
  • void validateProgram(WebGLProgram? program);
  • void vertexAttrib1f(GLuint indx, GLfloat x);
  • void vertexAttrib1fv(GLuint indx, Float32Array values);
  • void vertexAttrib1fv(GLuint indx, sequence values);
  • void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
  • void vertexAttrib2fv(GLuint indx, Float32Array values);
  • void vertexAttrib2fv(GLuint indx, sequence values);
  • void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
  • void vertexAttrib3fv(GLuint indx, Float32Array values);
  • void vertexAttrib3fv(GLuint indx, sequence values);
  • void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
  • void vertexAttrib4fv(GLuint indx, Float32Array values);
  • void vertexAttrib4fv(GLuint indx, sequence values);
  • void vertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
  • void viewport(GLint x, GLint y, GLsizei width, GLsizei height);

Change bundler from webpack to browserify

webpackの外部パッケージの依存解決の失敗の多さが問題。

webpackのバンドリングタスクも残しつつ、browserifyに移行していきたい。

まずテスト環境のみbrowserifyに移行するつもりだが、productのビルド環境とテスト環境が異なるというのは問題であるために、それに伴いproduct環境も移行する。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.