This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Created by JunHo on 2015-03-29. | |
| */ | |
| var SoftEngine; | |
| (function(W){ | |
| W['requestAnimationFrame'] = (function(){ | |
| return W['requestAnimationFrame'] || | |
| W['webkitRequestAnimationFrame'] || | |
| W['mozRequestAnimationFrame'] || | |
| function(callback){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ( function( global ){ | |
| var MoGL = (function(){ | |
| var isFactory, isSuperChain, | |
| uuidProp, isAliveProp, idProp, | |
| uuid, counter, totalCount, | |
| MoGL, fn; | |
| //내부용 상수 | |
| isFactory = {factory:1},//팩토리 함수용 식별상수 | |
| isSuperChain = {superChain:1},//생성자체인용 상수 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ( function( W ){ | |
| 'use strict'; | |
| (function(){ //webGL은 되지만 지원되지 않는 기능의 polyfill | |
| var test = function test(){}; | |
| if(!('name' in test) || test.name != 'test'){ //함수에 name속성이 없다면.. | |
| Object.defineProperty( Function.prototype, 'name', { | |
| get:function(){ | |
| var f; | |
| if(!('__name' in this)){//캐쉬에서 없다면 | |
| f = this.toString();//함수를 문자열로 바꿔서 function과 ()사이의 문자열을 이름으로 추출 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .method('matPerspective', { | |
| description:'퍼스펙티브 매트릭스', | |
| sample: [ | |
| 'var mtx = new Matrix();', | |
| 'mtx.matPerspective(55, 4/3,0.1,1000);' | |
| ], | |
| ret: ['this - 메서드체이닝을 위해 자신을 반환함.'], | |
| param:[ | |
| 'fov:number - 시야각, degree 단위로 입력', | |
| 'aspect:number - 가로/세로비율', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function abc() { | |
| var a = 'bbb'; | |
| console.log(a); // ---- 1 | |
| function c() { | |
| console.log(a); // --- 2 | |
| (function() { | |
| console.log(a); // --- 3 | |
| a = 'ccc'; | |
| })(); | |
| var a; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var obj = { | |
| a: console.log(this), // --- 1 | |
| fn: function() { | |
| console.log(this); // --- 2 | |
| function fn() { | |
| console.log(this); // --- 3 | |
| } | |
| fn(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var a = 0; | |
| for(var i = 5; i--; ) { a++; }; | |
| console.log(a); | |
| var b = 0; | |
| for(var i = 5; i--, i;){ b++; }; | |
| console.log(b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Child(aa, bb) { | |
| this.aa = aa; | |
| this.bb = bb; | |
| } | |
| function Parent() { | |
| } | |
| Parent.prototype.a = [1]; | |
| Parent.prototype.f = function() { | |
| this.a.push(this.a.length + 1); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function closure(start) { | |
| return function count() { | |
| return { | |
| inc: function() { start++; }, | |
| get: function() { return start; } | |
| } | |
| } | |
| } | |
| var f1 = closure(0); | |
| var f2 = f1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>무제 문서</title> | |
| </head> | |
| <body> | |
| <canvas id="c" width="500" height="500"></canvas> | |
| <script id="2d-vertex-shader2" type="notjs"> | |
| attribute vec4 a_position; |