Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
3b63de52
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3b63de52
编写于
2月 07, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WebGLRenderer code clean up.
上级
2340b75d
变更
6
展开全部
显示空白变更内容
内联
并排
Showing
6 changed file
with
938 addition
and
851 deletion
+938
-851
build/three.js
build/three.js
+459
-415
build/three.min.js
build/three.min.js
+20
-21
src/renderers/WebGLRendererOld.js
src/renderers/WebGLRendererOld.js
+1
-1
src/renderers/webgl/LowLevelRenderer.js
src/renderers/webgl/LowLevelRenderer.js
+216
-178
src/renderers/webgl/ShaderBuilder.js
src/renderers/webgl/ShaderBuilder.js
+241
-235
utils/build/includes/commonOld.json
utils/build/includes/commonOld.json
+1
-1
未找到文件。
build/three.js
浏览文件 @
3b63de52
...
...
@@ -21130,7 +21130,7 @@ THREE.WebGLRenderer = function ( parameters ) {
/*global THREE:false */
THREE.WebGLRenderer.LowLevelRenderer = function
(parameters)
{
THREE.WebGLRenderer.LowLevelRenderer = function
( parameters )
{
parameters = parameters || {};
...
...
@@ -21310,7 +21310,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setDefaultGLState () {
...
...
@@ -21331,7 +21331,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );
}
;
}
// Fallback filters for non-power-of-2 textures
...
...
@@ -21345,67 +21345,67 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return _gl.LINEAR;
}
;
}
function getContext() {
return _gl;
}
;
}
function getDomElement(){
return _canvas;
}
;
}
function getPrecision() {
return _precision;
}
;
}
function getCurrentWidth(){
return _currentWidth;
}
;
}
function getCurrentHeight(){
return _currentHeight;
}
;
}
function supportsVertexTextures() {
return _supportsVertexTextures;
}
;
}
function supportsFloatTextures() {
return _glExtensionTextureFloat;
}
;
}
function supportsStandardDerivatives() {
return _glExtensionStandardDerivatives;
}
;
}
function supportsCompressedTextureS3TC() {
return _glExtensionCompressedTextureS3TC;
}
;
}
function getMaxAnisotropy() {
return _maxAnisotropy;
}
;
}
function setSize( width, height ) {
...
...
@@ -21414,7 +21414,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
setViewport( 0, 0, _canvas.width, _canvas.height );
}
;
}
function setViewport( x, y, width, height ) {
...
...
@@ -21426,19 +21426,19 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight );
}
;
}
function setScissor( x, y, width, height ) {
_gl.scissor( x, y, width, height );
}
;
}
function enableScissorTest( enable ) {
enable ? _gl.enable( _gl.SCISSOR_TEST ) : _gl.disable( _gl.SCISSOR_TEST );
}
;
}
// Clearing
...
...
@@ -21449,7 +21449,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );
}
;
}
function setClearColor( color, alpha ) {
...
...
@@ -21458,19 +21458,19 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );
}
;
}
function getClearColor() {
return _clearColor;
}
;
}
function getClearAlpha() {
return _clearAlpha;
}
;
}
function clear( color, depth, stencil ) {
...
...
@@ -21482,115 +21482,146 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl.clear( bits );
}
;
}
function clearTarget( renderTarget, color, depth, stencil ) {
setRenderTarget( renderTarget );
clear( color, depth, stencil );
}
;
}
function deleteBuffer(buffer){
_gl.deleteBuffer(buffer);
};
}
function deleteTexture(texture){
_gl.deleteTexture( texture );
};
}
function deleteFramebuffer(Framebuffer){
_gl.deleteFramebuffer(Framebuffer);
};
}
function deleteRenderbuffer(RenderBuffer){
_gl.deleteRenderbuffer(RenderBuffer);
};
}
function deleteProgram(RenderBuffer){
_gl.deleteProgram(RenderBuffer);
};
}
function createBuffer(){
return _gl.createBuffer();
};
}
function setStaticArrayBuffer(buffer,data){
bindArrayBuffer( buffer );
_gl.bufferData( _gl.ARRAY_BUFFER, data, _gl.STATIC_DRAW );
}
;
}
function setStaticIndexBuffer(buffer,data){
bindElementArrayBuffer( buffer );
_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, data, _gl.STATIC_DRAW );
}
;
}
function setDynamicArrayBuffer(buffer,data){
bindArrayBuffer( buffer );
_gl.bufferData( _gl.ARRAY_BUFFER, data, _gl.DYNAMIC_DRAW );
}
;
}
function setDynamicIndexBuffer(buffer,data){
bindElementArrayBuffer( buffer );
_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, data, _gl.DYNAMIC_DRAW );
}
;
}
function drawTriangles(count){
_gl.drawArrays( _gl.TRIANGLES, 0, count );
};
}
function drawTriangleStrip(count){
_gl.drawArrays( _gl.TRIANGLE_STRIP, 0, count );
};
}
function drawLines(count){
_gl.drawArrays( _gl.LINES, 0, count );
};
}
function drawLineStrip(count){
_gl.drawArrays( _gl.LINE_STRIP, 0, count );
};
}
function drawPoints(count){
_gl.drawArrays( _gl.POINTS, 0, count );
};
}
function drawTriangleElements(buffer,count,offset){
bindElementArrayBuffer( buffer );
_gl.drawElements( _gl.TRIANGLES, count, _gl.UNSIGNED_SHORT, offset ); // 2 bytes per Uint16
};
}
function drawLineElements(buffer,count,offset){
bindElementArrayBuffer( buffer );
_gl.drawElements( _gl.LINES, count, _gl.UNSIGNED_SHORT, offset ); // 2 bytes per Uint16
};
}
var _boundBuffer;
function bindArrayBuffer(buffer){
if (_boundBuffer != buffer){
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
_boundBuffer = buffer;
}
}
;
}
function bindElementArrayBuffer(buffer){
if (_boundBuffer != buffer){
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, buffer );
_boundBuffer = buffer;
}
}
;
}
function enableAttribute( attribute ) {
...
...
@@ -21601,7 +21632,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function disableAttributes() {
...
...
@@ -21616,10 +21647,12 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function getAttribLocation( program, id ){
return _gl.getAttribLocation( program, id );
}
function setFloatAttribute(index,buffer,size,offset){
...
...
@@ -21628,7 +21661,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
enableAttribute( index );
_gl.vertexAttribPointer( index, size, _gl.FLOAT, false, 0, offset );
}
;
}
function getUniformLocation( program, id ){
...
...
@@ -21640,91 +21673,91 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl.uniform1i( uniform, value );
}
;
}
function uniform1f(uniform,value){
_gl.uniform1f( uniform, value );
}
;
}
function uniform2f(uniform,value1, value2){
_gl.uniform2f( uniform, value1, value2 );
}
;
}
function uniform3f(uniform, value1, value2, value3){
_gl.uniform3f( uniform, value1, value2, value3 );
}
;
}
function uniform4f(uniform, value1, value2, value3, value4){
_gl.uniform4f( uniform, value1, value2, value3, value4);
}
;
}
function uniform1iv(uniform,value){
_gl.uniform1iv( uniform, value );
}
;
}
function uniform2iv(uniform,value){
_gl.uniform2iv( uniform, value );
}
;
}
function uniform3iv(uniform,value){
_gl.uniform3iv( uniform, value );
}
;
}
function uniform1fv(uniform,value){
_gl.uniform1fv( uniform, value );
}
;
}
function uniform2fv(uniform,value){
_gl.uniform2fv( uniform, value );
}
;
}
function uniform3fv(uniform,value){
_gl.uniform3fv( uniform, value );
}
;
}
function uniform4fv(uniform,value){
_gl.uniform3fv( uniform, value );
}
;
}
function uniformMatrix3fv(location,value){
_gl.uniformMatrix3fv( location, false, value );
}
;
}
function uniformMatrix4fv(location,value){
_gl.uniformMatrix4fv( location, false, value );
}
;
}
function useProgram(program){
_gl.useProgram( program );
}
;
}
function setFaceCulling( cullFace, frontFaceDirection ) {
...
...
@@ -21762,7 +21795,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setMaterialFaces( material ) {
...
...
@@ -21801,7 +21834,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setPolygonOffset ( polygonoffset, factor, units ) {
...
...
@@ -21830,7 +21863,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setBlending( blending, blendEquation, blendSrc, blendDst ) {
...
...
@@ -21903,7 +21936,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setDepthTest( depthTest ) {
...
...
@@ -21923,7 +21956,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setDepthWrite( depthWrite ) {
...
...
@@ -21934,7 +21967,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setTexture( texture, slot ) {
...
...
@@ -22041,7 +22074,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setCubeTexture ( texture, slot ) {
...
...
@@ -22126,7 +22159,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
// Textures
...
...
@@ -22134,7 +22167,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return ( value & ( value - 1 ) ) === 0;
}
;
}
function setTextureParameters ( textureType, texture, isImagePowerOfTwo ) {
...
...
@@ -22167,14 +22200,14 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setupFrameBuffer ( framebuffer, renderTarget, textureTarget ) {
_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureTarget, renderTarget.__webglTexture, 0 );
}
;
}
function setupRenderBuffer ( renderbuffer, renderTarget ) {
...
...
@@ -22202,7 +22235,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setRenderTarget( renderTarget ) {
...
...
@@ -22351,7 +22384,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_currentWidth = width;
_currentHeight = height;
}
;
}
function clampToMaxSize ( image, maxSize ) {
...
...
@@ -22377,7 +22410,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return canvas;
}
;
}
function updateRenderTargetMipmap ( renderTarget ) {
...
...
@@ -22395,14 +22428,14 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function setCubeTextureDynamic ( texture, slot ) {
_gl.activeTexture( _gl.TEXTURE0 + slot );
_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.__webglTexture );
}
;
}
// Map three.js constants to WebGL constants
function paramThreeToGL ( p ) {
...
...
@@ -22465,7 +22498,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return 0;
}
;
}
function compileShader(vertexShader, fragmentShader){
...
...
@@ -22492,7 +22525,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return program;
}
;
}
function resetState(){
...
...
@@ -22531,7 +22564,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return shader;
}
;
}
function addLineNumbers ( string ) {
...
...
@@ -22548,7 +22581,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return chunks.join( "\n" );
}
;
}
function setLineWidth ( width ) {
...
...
@@ -22560,114 +22593,123 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
this.context = _gl;
return {
context: _gl,
this.autoScaleCubemaps = _autoScaleCubemaps;
this.supportsBoneTextures = _supportsBoneTextures;
this.precision = _precision;
this.maxVertexUniformVectors = _gl.getParameter( _gl.MAX_VERTEX_UNIFORM_VECTORS );
autoScaleCubemaps: _autoScaleCubemaps,
supportsBoneTextures: _supportsBoneTextures,
precision: _precision,
maxVertexUniformVectors: _gl.getParameter( _gl.MAX_VERTEX_UNIFORM_VECTORS ),
// Methods
this.getContext = getContext;
this.getDomElement = getDomElement;
this.getPrecision = getPrecision;
this.getCurrentWidth = getCurrentWidth;
this.getCurrentHeight = getCurrentHeight;
this.supportsVertexTextures = supportsVertexTextures;
this.supportsFloatTextures = supportsFloatTextures;
this.supportsStandardDerivatives = supportsStandardDerivatives;
this.supportsCompressedTextureS3TC = supportsCompressedTextureS3TC;
this.getMaxAnisotropy = getMaxAnisotropy;
this.setRenderTarget = setRenderTarget;
this.setSize = setSize;
this.setViewport = setViewport;
this.setScissor = setScissor;
this.enableScissorTest = enableScissorTest;
this.setClearColorHex = setClearColorHex;
this.setClearColor = setClearColor;
this.getClearColor = getClearColor;
this.getClearAlpha = getClearAlpha;
this.clear = clear;
this.clearTarget = clearTarget;
this.deleteBuffer = deleteBuffer;
this.deleteTexture = deleteTexture;
this.deleteFramebuffer = deleteFramebuffer;
this.deleteRenderbuffer = deleteRenderbuffer;
this.deleteProgram = deleteProgram;
this.createBuffer = createBuffer;
this.setStaticArrayBuffer = setStaticArrayBuffer;
this.setStaticIndexBuffer = setStaticIndexBuffer;
this.setDynamicArrayBuffer = setDynamicArrayBuffer;
this.setDynamicIndexBuffer = setDynamicIndexBuffer;
this.drawTriangles = drawTriangles;
this.drawTriangleStrip = drawTriangleStrip;
this.drawLines = drawLines;
this.drawLineStrip = drawLineStrip;
this.drawPoints = drawPoints;
this.drawTriangleElements = drawTriangleElements;
this.drawLineElements = drawLineElements;
this.bindArrayBuffer = bindArrayBuffer;
this.bindElementArrayBuffer = bindElementArrayBuffer;
this.enableAttribute = enableAttribute;
this.disableAttributes = disableAttributes;
this.getAttribLocation = getAttribLocation;
this.setFloatAttribute = setFloatAttribute;
this.getUniformLocation= getUniformLocation;
this.uniform1i = uniform1i;
this.uniform1f = uniform1f;
this.uniform2f = uniform2f;
this.uniform3f = uniform3f;
this.uniform4f = uniform4f;
this.uniform1iv = uniform1iv;
this.uniform2iv = uniform2iv;
this.uniform3iv = uniform3iv;
this.uniform1fv = uniform1fv;
this.uniform2fv = uniform2fv;
this.uniform3fv = uniform3fv;
this.uniform4fv = uniform4fv;
this.uniformMatrix3fv = uniformMatrix3fv;
this.uniformMatrix4fv = uniformMatrix4fv;
this.useProgram = useProgram;
this.compileShader = compileShader;
this.setFaceCulling = setFaceCulling;
this.setMaterialFaces = setMaterialFaces;
this.setPolygonOffset = setPolygonOffset;
this.setBlending = setBlending;
this.setDepthTest = setDepthTest;
this.setDepthWrite = setDepthWrite;
this.setTexture = setTexture;
this.setCubeTexture = setCubeTexture;
this.updateRenderTargetMipmap = updateRenderTargetMipmap;
this.setCubeTextureDynamic = setCubeTextureDynamic;
this.paramThreeToGL = paramThreeToGL;
this.setLineWidth = setLineWidth;
this.resetState = resetState;
};
THREE.WebGLRenderer.ShaderBuilder = function(renderer,info){
getContext: getContext,
getDomElement: getDomElement,
getPrecision: getPrecision,
getCurrentWidth: getCurrentWidth,
getCurrentHeight: getCurrentHeight,
supportsVertexTextures: supportsVertexTextures,
supportsFloatTextures: supportsFloatTextures,
supportsStandardDerivatives: supportsStandardDerivatives,
supportsCompressedTextureS3TC: supportsCompressedTextureS3TC,
getMaxAnisotropy: getMaxAnisotropy,
setRenderTarget: setRenderTarget,
setSize: setSize,
setViewport: setViewport,
setScissor: setScissor,
enableScissorTest: enableScissorTest,
setClearColorHex: setClearColorHex,
setClearColor: setClearColor,
getClearColor: getClearColor,
getClearAlpha: getClearAlpha,
clear: clear,
clearTarget: clearTarget,
deleteBuffer: deleteBuffer,
deleteTexture: deleteTexture,
deleteFramebuffer: deleteFramebuffer,
deleteRenderbuffer: deleteRenderbuffer,
deleteProgram: deleteProgram,
createBuffer: createBuffer,
setStaticArrayBuffer: setStaticArrayBuffer,
setStaticIndexBuffer: setStaticIndexBuffer,
setDynamicArrayBuffer: setDynamicArrayBuffer,
setDynamicIndexBuffer: setDynamicIndexBuffer,
drawTriangles: drawTriangles,
drawTriangleStrip: drawTriangleStrip,
drawLines: drawLines,
drawLineStrip: drawLineStrip,
drawPoints: drawPoints,
drawTriangleElements: drawTriangleElements,
drawLineElements: drawLineElements,
bindArrayBuffer: bindArrayBuffer,
bindElementArrayBuffer: bindElementArrayBuffer,
enableAttribute: enableAttribute,
disableAttributes: disableAttributes,
getAttribLocation: getAttribLocation,
setFloatAttribute: setFloatAttribute,
getUniformLocation: getUniformLocation,
uniform1i: uniform1i,
uniform1f: uniform1f,
uniform2f: uniform2f,
uniform3f: uniform3f,
uniform4f: uniform4f,
uniform1iv: uniform1iv,
uniform2iv: uniform2iv,
uniform3iv: uniform3iv,
uniform1fv: uniform1fv,
uniform2fv: uniform2fv,
uniform3fv: uniform3fv,
uniform4fv: uniform4fv,
uniformMatrix3fv: uniformMatrix3fv,
uniformMatrix4fv: uniformMatrix4fv,
useProgram: useProgram,
compileShader: compileShader,
setFaceCulling: setFaceCulling,
setMaterialFaces: setMaterialFaces,
setPolygonOffset: setPolygonOffset,
setBlending: setBlending,
setDepthTest: setDepthTest,
setDepthWrite: setDepthWrite,
setTexture: setTexture,
setCubeTexture: setCubeTexture,
updateRenderTargetMipmap: updateRenderTargetMipmap,
setCubeTextureDynamic: setCubeTextureDynamic,
paramThreeToGL: paramThreeToGL,
setLineWidth: setLineWidth,
resetState: resetState
}
};
THREE.WebGLRenderer.ShaderBuilder = function ( renderer, info ) {
this.renderer = renderer;
this.info = info;
this.programs = [],
this.programs_counter = 0;
}
THREE.WebGLRenderer.ShaderBuilder.prototype.buildProgram = function ( shaderID, fragmentShader, vertexShader, uniforms, attributes, defines, parameters ) {
};
THREE.extend( THREE.WebGLRenderer.ShaderBuilder.prototype, {
buildProgram: function ( shaderID, fragmentShader, vertexShader, uniforms, attributes, defines, parameters ) {
var renderer = this.renderer;
var p, pl, d, program, code;
...
...
@@ -22890,7 +22932,6 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.buildProgram = function ( shaderID,
].join("\n");
program = renderer.compileShader(prefix_vertex + vertexShader, prefix_fragment + fragmentShader);
//console.log( prefix_fragment + fragmentShader );
...
...
@@ -22965,9 +23006,9 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.buildProgram = function ( shaderID,
return program;
};
},
THREE.WebGLRenderer.ShaderBuilder.prototype.generateDefines = function
( defines ) {
generateDefines: function
( defines ) {
var value, chunk, chunks = [];
...
...
@@ -22983,24 +23024,24 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.generateDefines = function( defines
return chunks.join( "\n" );
};
},
// Shader parameters cache
THREE.WebGLRenderer.ShaderBuilder.prototype.cacheUniformLocations = function
( program, identifiers ) {
cacheUniformLocations: function
( program, identifiers ) {
var i, l, id, renderer = this.renderer;
for
( i = 0, l = identifiers.length; i < l; i ++ ) {
for
( i = 0, l = identifiers.length; i < l; i ++ ) {
id = identifiers[ i ];
program.uniforms[ id ] = renderer.getUniformLocation( program, id );
}
};
},
THREE.WebGLRenderer.ShaderBuilder.prototype.cacheAttributeLocations = function
( program, identifiers ) {
cacheAttributeLocations: function
( program, identifiers ) {
var i, l, id, renderer = this.renderer;
...
...
@@ -23011,9 +23052,9 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.cacheAttributeLocations = function(
}
};
},
THREE.WebGLRenderer.ShaderBuilder.prototype.removeProgram = function
( program ) {
removeProgram: function
( program ) {
var i, il, programInfo;
var deleteProgram = false;
...
...
@@ -23064,7 +23105,10 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.removeProgram = function( program )
this.info.memory.programs --;
}
}
}
} );
THREE.WebGLRenderer.Object3DRenderer = function ( lowlevelrenderer, info ) {
...
...
build/three.min.js
浏览文件 @
3b63de52
此差异已折叠。
点击以展开。
src/renderers/WebGLRendererOld.js
浏览文件 @
3b63de52
...
...
@@ -5,7 +5,7 @@
* @author szimek / https://github.com/szimek/
*/
THREE
.
WebGLRenderer
Old
=
function
(
parameters
)
{
THREE
.
WebGLRenderer
=
function
(
parameters
)
{
console
.
log
(
'
THREE.WebGLRenderer
'
,
THREE
.
REVISION
);
...
...
src/renderers/webgl/LowLevelRenderer.js
浏览文件 @
3b63de52
/*global THREE:false */
THREE
.
WebGLRenderer
.
LowLevelRenderer
=
function
(
parameters
)
{
THREE
.
WebGLRenderer
.
LowLevelRenderer
=
function
(
parameters
)
{
parameters
=
parameters
||
{};
...
...
@@ -181,7 +181,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setDefaultGLState
()
{
...
...
@@ -202,7 +202,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl
.
clearColor
(
_clearColor
.
r
,
_clearColor
.
g
,
_clearColor
.
b
,
_clearAlpha
);
}
;
}
// Fallback filters for non-power-of-2 textures
...
...
@@ -216,67 +216,67 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return
_gl
.
LINEAR
;
}
;
}
function
getContext
()
{
return
_gl
;
}
;
}
function
getDomElement
(){
return
_canvas
;
}
;
}
function
getPrecision
()
{
return
_precision
;
}
;
}
function
getCurrentWidth
(){
return
_currentWidth
;
}
;
}
function
getCurrentHeight
(){
return
_currentHeight
;
}
;
}
function
supportsVertexTextures
()
{
return
_supportsVertexTextures
;
}
;
}
function
supportsFloatTextures
()
{
return
_glExtensionTextureFloat
;
}
;
}
function
supportsStandardDerivatives
()
{
return
_glExtensionStandardDerivatives
;
}
;
}
function
supportsCompressedTextureS3TC
()
{
return
_glExtensionCompressedTextureS3TC
;
}
;
}
function
getMaxAnisotropy
()
{
return
_maxAnisotropy
;
}
;
}
function
setSize
(
width
,
height
)
{
...
...
@@ -285,7 +285,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
setViewport
(
0
,
0
,
_canvas
.
width
,
_canvas
.
height
);
}
;
}
function
setViewport
(
x
,
y
,
width
,
height
)
{
...
...
@@ -297,19 +297,19 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl
.
viewport
(
_viewportX
,
_viewportY
,
_viewportWidth
,
_viewportHeight
);
}
;
}
function
setScissor
(
x
,
y
,
width
,
height
)
{
_gl
.
scissor
(
x
,
y
,
width
,
height
);
}
;
}
function
enableScissorTest
(
enable
)
{
enable
?
_gl
.
enable
(
_gl
.
SCISSOR_TEST
)
:
_gl
.
disable
(
_gl
.
SCISSOR_TEST
);
}
;
}
// Clearing
...
...
@@ -320,7 +320,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl
.
clearColor
(
_clearColor
.
r
,
_clearColor
.
g
,
_clearColor
.
b
,
_clearAlpha
);
}
;
}
function
setClearColor
(
color
,
alpha
)
{
...
...
@@ -329,19 +329,19 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl
.
clearColor
(
_clearColor
.
r
,
_clearColor
.
g
,
_clearColor
.
b
,
_clearAlpha
);
}
;
}
function
getClearColor
()
{
return
_clearColor
;
}
;
}
function
getClearAlpha
()
{
return
_clearAlpha
;
}
;
}
function
clear
(
color
,
depth
,
stencil
)
{
...
...
@@ -353,115 +353,146 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl
.
clear
(
bits
);
}
;
}
function
clearTarget
(
renderTarget
,
color
,
depth
,
stencil
)
{
setRenderTarget
(
renderTarget
);
clear
(
color
,
depth
,
stencil
);
}
;
}
function
deleteBuffer
(
buffer
){
_gl
.
deleteBuffer
(
buffer
);
};
}
function
deleteTexture
(
texture
){
_gl
.
deleteTexture
(
texture
);
};
}
function
deleteFramebuffer
(
Framebuffer
){
_gl
.
deleteFramebuffer
(
Framebuffer
);
};
}
function
deleteRenderbuffer
(
RenderBuffer
){
_gl
.
deleteRenderbuffer
(
RenderBuffer
);
};
}
function
deleteProgram
(
RenderBuffer
){
_gl
.
deleteProgram
(
RenderBuffer
);
};
}
function
createBuffer
(){
return
_gl
.
createBuffer
();
};
}
function
setStaticArrayBuffer
(
buffer
,
data
){
bindArrayBuffer
(
buffer
);
_gl
.
bufferData
(
_gl
.
ARRAY_BUFFER
,
data
,
_gl
.
STATIC_DRAW
);
}
;
}
function
setStaticIndexBuffer
(
buffer
,
data
){
bindElementArrayBuffer
(
buffer
);
_gl
.
bufferData
(
_gl
.
ELEMENT_ARRAY_BUFFER
,
data
,
_gl
.
STATIC_DRAW
);
}
;
}
function
setDynamicArrayBuffer
(
buffer
,
data
){
bindArrayBuffer
(
buffer
);
_gl
.
bufferData
(
_gl
.
ARRAY_BUFFER
,
data
,
_gl
.
DYNAMIC_DRAW
);
}
;
}
function
setDynamicIndexBuffer
(
buffer
,
data
){
bindElementArrayBuffer
(
buffer
);
_gl
.
bufferData
(
_gl
.
ELEMENT_ARRAY_BUFFER
,
data
,
_gl
.
DYNAMIC_DRAW
);
}
;
}
function
drawTriangles
(
count
){
_gl
.
drawArrays
(
_gl
.
TRIANGLES
,
0
,
count
);
};
}
function
drawTriangleStrip
(
count
){
_gl
.
drawArrays
(
_gl
.
TRIANGLE_STRIP
,
0
,
count
);
};
}
function
drawLines
(
count
){
_gl
.
drawArrays
(
_gl
.
LINES
,
0
,
count
);
};
}
function
drawLineStrip
(
count
){
_gl
.
drawArrays
(
_gl
.
LINE_STRIP
,
0
,
count
);
};
}
function
drawPoints
(
count
){
_gl
.
drawArrays
(
_gl
.
POINTS
,
0
,
count
);
};
}
function
drawTriangleElements
(
buffer
,
count
,
offset
){
bindElementArrayBuffer
(
buffer
);
_gl
.
drawElements
(
_gl
.
TRIANGLES
,
count
,
_gl
.
UNSIGNED_SHORT
,
offset
);
// 2 bytes per Uint16
};
}
function
drawLineElements
(
buffer
,
count
,
offset
){
bindElementArrayBuffer
(
buffer
);
_gl
.
drawElements
(
_gl
.
LINES
,
count
,
_gl
.
UNSIGNED_SHORT
,
offset
);
// 2 bytes per Uint16
};
}
var
_boundBuffer
;
function
bindArrayBuffer
(
buffer
){
if
(
_boundBuffer
!=
buffer
){
_gl
.
bindBuffer
(
_gl
.
ARRAY_BUFFER
,
buffer
);
_boundBuffer
=
buffer
;
}
}
;
}
function
bindElementArrayBuffer
(
buffer
){
if
(
_boundBuffer
!=
buffer
){
_gl
.
bindBuffer
(
_gl
.
ELEMENT_ARRAY_BUFFER
,
buffer
);
_boundBuffer
=
buffer
;
}
}
;
}
function
enableAttribute
(
attribute
)
{
...
...
@@ -472,7 +503,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
disableAttributes
()
{
...
...
@@ -487,10 +518,12 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
getAttribLocation
(
program
,
id
){
return
_gl
.
getAttribLocation
(
program
,
id
);
}
function
setFloatAttribute
(
index
,
buffer
,
size
,
offset
){
...
...
@@ -499,7 +532,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
enableAttribute
(
index
);
_gl
.
vertexAttribPointer
(
index
,
size
,
_gl
.
FLOAT
,
false
,
0
,
offset
);
}
;
}
function
getUniformLocation
(
program
,
id
){
...
...
@@ -511,91 +544,91 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_gl
.
uniform1i
(
uniform
,
value
);
}
;
}
function
uniform1f
(
uniform
,
value
){
_gl
.
uniform1f
(
uniform
,
value
);
}
;
}
function
uniform2f
(
uniform
,
value1
,
value2
){
_gl
.
uniform2f
(
uniform
,
value1
,
value2
);
}
;
}
function
uniform3f
(
uniform
,
value1
,
value2
,
value3
){
_gl
.
uniform3f
(
uniform
,
value1
,
value2
,
value3
);
}
;
}
function
uniform4f
(
uniform
,
value1
,
value2
,
value3
,
value4
){
_gl
.
uniform4f
(
uniform
,
value1
,
value2
,
value3
,
value4
);
}
;
}
function
uniform1iv
(
uniform
,
value
){
_gl
.
uniform1iv
(
uniform
,
value
);
}
;
}
function
uniform2iv
(
uniform
,
value
){
_gl
.
uniform2iv
(
uniform
,
value
);
}
;
}
function
uniform3iv
(
uniform
,
value
){
_gl
.
uniform3iv
(
uniform
,
value
);
}
;
}
function
uniform1fv
(
uniform
,
value
){
_gl
.
uniform1fv
(
uniform
,
value
);
}
;
}
function
uniform2fv
(
uniform
,
value
){
_gl
.
uniform2fv
(
uniform
,
value
);
}
;
}
function
uniform3fv
(
uniform
,
value
){
_gl
.
uniform3fv
(
uniform
,
value
);
}
;
}
function
uniform4fv
(
uniform
,
value
){
_gl
.
uniform3fv
(
uniform
,
value
);
}
;
}
function
uniformMatrix3fv
(
location
,
value
){
_gl
.
uniformMatrix3fv
(
location
,
false
,
value
);
}
;
}
function
uniformMatrix4fv
(
location
,
value
){
_gl
.
uniformMatrix4fv
(
location
,
false
,
value
);
}
;
}
function
useProgram
(
program
){
_gl
.
useProgram
(
program
);
}
;
}
function
setFaceCulling
(
cullFace
,
frontFaceDirection
)
{
...
...
@@ -633,7 +666,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setMaterialFaces
(
material
)
{
...
...
@@ -672,7 +705,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setPolygonOffset
(
polygonoffset
,
factor
,
units
)
{
...
...
@@ -701,7 +734,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setBlending
(
blending
,
blendEquation
,
blendSrc
,
blendDst
)
{
...
...
@@ -774,7 +807,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setDepthTest
(
depthTest
)
{
...
...
@@ -794,7 +827,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setDepthWrite
(
depthWrite
)
{
...
...
@@ -805,7 +838,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setTexture
(
texture
,
slot
)
{
...
...
@@ -912,7 +945,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setCubeTexture
(
texture
,
slot
)
{
...
...
@@ -997,7 +1030,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
// Textures
...
...
@@ -1005,7 +1038,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return
(
value
&
(
value
-
1
)
)
===
0
;
}
;
}
function
setTextureParameters
(
textureType
,
texture
,
isImagePowerOfTwo
)
{
...
...
@@ -1038,14 +1071,14 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setupFrameBuffer
(
framebuffer
,
renderTarget
,
textureTarget
)
{
_gl
.
bindFramebuffer
(
_gl
.
FRAMEBUFFER
,
framebuffer
);
_gl
.
framebufferTexture2D
(
_gl
.
FRAMEBUFFER
,
_gl
.
COLOR_ATTACHMENT0
,
textureTarget
,
renderTarget
.
__webglTexture
,
0
);
}
;
}
function
setupRenderBuffer
(
renderbuffer
,
renderTarget
)
{
...
...
@@ -1073,7 +1106,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setRenderTarget
(
renderTarget
)
{
...
...
@@ -1222,7 +1255,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
_currentWidth
=
width
;
_currentHeight
=
height
;
}
;
}
function
clampToMaxSize
(
image
,
maxSize
)
{
...
...
@@ -1248,7 +1281,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return
canvas
;
}
;
}
function
updateRenderTargetMipmap
(
renderTarget
)
{
...
...
@@ -1266,14 +1299,14 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
}
;
}
function
setCubeTextureDynamic
(
texture
,
slot
)
{
_gl
.
activeTexture
(
_gl
.
TEXTURE0
+
slot
);
_gl
.
bindTexture
(
_gl
.
TEXTURE_CUBE_MAP
,
texture
.
__webglTexture
);
}
;
}
// Map three.js constants to WebGL constants
function
paramThreeToGL
(
p
)
{
...
...
@@ -1336,7 +1369,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return
0
;
}
;
}
function
compileShader
(
vertexShader
,
fragmentShader
){
...
...
@@ -1363,7 +1396,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return
program
;
}
;
}
function
resetState
(){
...
...
@@ -1402,7 +1435,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return
shader
;
}
;
}
function
addLineNumbers
(
string
)
{
...
...
@@ -1419,7 +1452,7 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
return
chunks
.
join
(
"
\n
"
);
}
;
}
function
setLineWidth
(
width
)
{
...
...
@@ -1431,102 +1464,107 @@ THREE.WebGLRenderer.LowLevelRenderer = function(parameters){
}
};
}
return
{
this
.
context
=
_gl
;
context
:
_gl
,
this
.
autoScaleCubemaps
=
_autoScaleCubemaps
;
this
.
supportsBoneTextures
=
_supportsBoneTextures
;
this
.
precision
=
_precision
;
this
.
maxVertexUniformVectors
=
_gl
.
getParameter
(
_gl
.
MAX_VERTEX_UNIFORM_VECTORS
);
autoScaleCubemaps
:
_autoScaleCubemaps
,
supportsBoneTextures
:
_supportsBoneTextures
,
precision
:
_precision
,
maxVertexUniformVectors
:
_gl
.
getParameter
(
_gl
.
MAX_VERTEX_UNIFORM_VECTORS
),
// Methods
this
.
getContext
=
getContext
;
this
.
getDomElement
=
getDomElement
;
this
.
getPrecision
=
getPrecision
;
this
.
getCurrentWidth
=
getCurrentWidth
;
this
.
getCurrentHeight
=
getCurrentHeight
;
this
.
supportsVertexTextures
=
supportsVertexTextures
;
this
.
supportsFloatTextures
=
supportsFloatTextures
;
this
.
supportsStandardDerivatives
=
supportsStandardDerivatives
;
this
.
supportsCompressedTextureS3TC
=
supportsCompressedTextureS3TC
;
this
.
getMaxAnisotropy
=
getMaxAnisotropy
;
this
.
setRenderTarget
=
setRenderTarget
;
this
.
setSize
=
setSize
;
this
.
setViewport
=
setViewport
;
this
.
setScissor
=
setScissor
;
this
.
enableScissorTest
=
enableScissorTest
;
this
.
setClearColorHex
=
setClearColorHex
;
this
.
setClearColor
=
setClearColor
;
this
.
getClearColor
=
getClearColor
;
this
.
getClearAlpha
=
getClearAlpha
;
this
.
clear
=
clear
;
this
.
clearTarget
=
clearTarget
;
this
.
deleteBuffer
=
deleteBuffer
;
this
.
deleteTexture
=
deleteTexture
;
this
.
deleteFramebuffer
=
deleteFramebuffer
;
this
.
deleteRenderbuffer
=
deleteRenderbuffer
;
this
.
deleteProgram
=
deleteProgram
;
this
.
createBuffer
=
createBuffer
;
this
.
setStaticArrayBuffer
=
setStaticArrayBuffer
;
this
.
setStaticIndexBuffer
=
setStaticIndexBuffer
;
this
.
setDynamicArrayBuffer
=
setDynamicArrayBuffer
;
this
.
setDynamicIndexBuffer
=
setDynamicIndexBuffer
;
this
.
drawTriangles
=
drawTriangles
;
this
.
drawTriangleStrip
=
drawTriangleStrip
;
this
.
drawLines
=
drawLines
;
this
.
drawLineStrip
=
drawLineStrip
;
this
.
drawPoints
=
drawPoints
;
this
.
drawTriangleElements
=
drawTriangleElements
;
this
.
drawLineElements
=
drawLineElements
;
this
.
bindArrayBuffer
=
bindArrayBuffer
;
this
.
bindElementArrayBuffer
=
bindElementArrayBuffer
;
this
.
enableAttribute
=
enableAttribute
;
this
.
disableAttributes
=
disableAttributes
;
this
.
getAttribLocation
=
getAttribLocation
;
this
.
setFloatAttribute
=
setFloatAttribute
;
this
.
getUniformLocation
=
getUniformLocation
;
this
.
uniform1i
=
uniform1i
;
this
.
uniform1f
=
uniform1f
;
this
.
uniform2f
=
uniform2f
;
this
.
uniform3f
=
uniform3f
;
this
.
uniform4f
=
uniform4f
;
this
.
uniform1iv
=
uniform1iv
;
this
.
uniform2iv
=
uniform2iv
;
this
.
uniform3iv
=
uniform3iv
;
this
.
uniform1fv
=
uniform1fv
;
this
.
uniform2fv
=
uniform2fv
;
this
.
uniform3fv
=
uniform3fv
;
this
.
uniform4fv
=
uniform4fv
;
this
.
uniformMatrix3fv
=
uniformMatrix3fv
;
this
.
uniformMatrix4fv
=
uniformMatrix4fv
;
this
.
useProgram
=
useProgram
;
this
.
compileShader
=
compileShader
;
this
.
setFaceCulling
=
setFaceCulling
;
this
.
setMaterialFaces
=
setMaterialFaces
;
this
.
setPolygonOffset
=
setPolygonOffset
;
this
.
setBlending
=
setBlending
;
this
.
setDepthTest
=
setDepthTest
;
this
.
setDepthWrite
=
setDepthWrite
;
this
.
setTexture
=
setTexture
;
this
.
setCubeTexture
=
setCubeTexture
;
this
.
updateRenderTargetMipmap
=
updateRenderTargetMipmap
;
this
.
setCubeTextureDynamic
=
setCubeTextureDynamic
;
this
.
paramThreeToGL
=
paramThreeToGL
;
this
.
setLineWidth
=
setLineWidth
;
this
.
resetState
=
resetState
;
getContext
:
getContext
,
getDomElement
:
getDomElement
,
getPrecision
:
getPrecision
,
getCurrentWidth
:
getCurrentWidth
,
getCurrentHeight
:
getCurrentHeight
,
supportsVertexTextures
:
supportsVertexTextures
,
supportsFloatTextures
:
supportsFloatTextures
,
supportsStandardDerivatives
:
supportsStandardDerivatives
,
supportsCompressedTextureS3TC
:
supportsCompressedTextureS3TC
,
getMaxAnisotropy
:
getMaxAnisotropy
,
setRenderTarget
:
setRenderTarget
,
setSize
:
setSize
,
setViewport
:
setViewport
,
setScissor
:
setScissor
,
enableScissorTest
:
enableScissorTest
,
setClearColorHex
:
setClearColorHex
,
setClearColor
:
setClearColor
,
getClearColor
:
getClearColor
,
getClearAlpha
:
getClearAlpha
,
clear
:
clear
,
clearTarget
:
clearTarget
,
deleteBuffer
:
deleteBuffer
,
deleteTexture
:
deleteTexture
,
deleteFramebuffer
:
deleteFramebuffer
,
deleteRenderbuffer
:
deleteRenderbuffer
,
deleteProgram
:
deleteProgram
,
createBuffer
:
createBuffer
,
setStaticArrayBuffer
:
setStaticArrayBuffer
,
setStaticIndexBuffer
:
setStaticIndexBuffer
,
setDynamicArrayBuffer
:
setDynamicArrayBuffer
,
setDynamicIndexBuffer
:
setDynamicIndexBuffer
,
drawTriangles
:
drawTriangles
,
drawTriangleStrip
:
drawTriangleStrip
,
drawLines
:
drawLines
,
drawLineStrip
:
drawLineStrip
,
drawPoints
:
drawPoints
,
drawTriangleElements
:
drawTriangleElements
,
drawLineElements
:
drawLineElements
,
bindArrayBuffer
:
bindArrayBuffer
,
bindElementArrayBuffer
:
bindElementArrayBuffer
,
enableAttribute
:
enableAttribute
,
disableAttributes
:
disableAttributes
,
getAttribLocation
:
getAttribLocation
,
setFloatAttribute
:
setFloatAttribute
,
getUniformLocation
:
getUniformLocation
,
uniform1i
:
uniform1i
,
uniform1f
:
uniform1f
,
uniform2f
:
uniform2f
,
uniform3f
:
uniform3f
,
uniform4f
:
uniform4f
,
uniform1iv
:
uniform1iv
,
uniform2iv
:
uniform2iv
,
uniform3iv
:
uniform3iv
,
uniform1fv
:
uniform1fv
,
uniform2fv
:
uniform2fv
,
uniform3fv
:
uniform3fv
,
uniform4fv
:
uniform4fv
,
uniformMatrix3fv
:
uniformMatrix3fv
,
uniformMatrix4fv
:
uniformMatrix4fv
,
useProgram
:
useProgram
,
compileShader
:
compileShader
,
setFaceCulling
:
setFaceCulling
,
setMaterialFaces
:
setMaterialFaces
,
setPolygonOffset
:
setPolygonOffset
,
setBlending
:
setBlending
,
setDepthTest
:
setDepthTest
,
setDepthWrite
:
setDepthWrite
,
setTexture
:
setTexture
,
setCubeTexture
:
setCubeTexture
,
updateRenderTargetMipmap
:
updateRenderTargetMipmap
,
setCubeTextureDynamic
:
setCubeTextureDynamic
,
paramThreeToGL
:
paramThreeToGL
,
setLineWidth
:
setLineWidth
,
resetState
:
resetState
}
};
src/renderers/webgl/ShaderBuilder.js
浏览文件 @
3b63de52
THREE
.
WebGLRenderer
.
ShaderBuilder
=
function
(
renderer
,
info
){
THREE
.
WebGLRenderer
.
ShaderBuilder
=
function
(
renderer
,
info
)
{
this
.
renderer
=
renderer
;
this
.
info
=
info
;
this
.
programs
=
[],
this
.
programs_counter
=
0
;
}
THREE
.
WebGLRenderer
.
ShaderBuilder
.
prototype
.
buildProgram
=
function
(
shaderID
,
fragmentShader
,
vertexShader
,
uniforms
,
attributes
,
defines
,
parameters
)
{
};
THREE
.
extend
(
THREE
.
WebGLRenderer
.
ShaderBuilder
.
prototype
,
{
buildProgram
:
function
(
shaderID
,
fragmentShader
,
vertexShader
,
uniforms
,
attributes
,
defines
,
parameters
)
{
var
renderer
=
this
.
renderer
;
var
p
,
pl
,
d
,
program
,
code
;
...
...
@@ -229,7 +233,6 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.buildProgram = function ( shaderID,
].
join
(
"
\n
"
);
program
=
renderer
.
compileShader
(
prefix_vertex
+
vertexShader
,
prefix_fragment
+
fragmentShader
);
//console.log( prefix_fragment + fragmentShader );
...
...
@@ -304,9 +307,9 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.buildProgram = function ( shaderID,
return
program
;
};
},
THREE
.
WebGLRenderer
.
ShaderBuilder
.
prototype
.
generateDefines
=
function
(
defines
)
{
generateDefines
:
function
(
defines
)
{
var
value
,
chunk
,
chunks
=
[];
...
...
@@ -322,24 +325,24 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.generateDefines = function( defines
return
chunks
.
join
(
"
\n
"
);
};
},
// Shader parameters cache
THREE
.
WebGLRenderer
.
ShaderBuilder
.
prototype
.
cacheUniformLocations
=
function
(
program
,
identifiers
)
{
cacheUniformLocations
:
function
(
program
,
identifiers
)
{
var
i
,
l
,
id
,
renderer
=
this
.
renderer
;
for
(
i
=
0
,
l
=
identifiers
.
length
;
i
<
l
;
i
++
)
{
for
(
i
=
0
,
l
=
identifiers
.
length
;
i
<
l
;
i
++
)
{
id
=
identifiers
[
i
];
program
.
uniforms
[
id
]
=
renderer
.
getUniformLocation
(
program
,
id
);
}
};
},
THREE
.
WebGLRenderer
.
ShaderBuilder
.
prototype
.
cacheAttributeLocations
=
function
(
program
,
identifiers
)
{
cacheAttributeLocations
:
function
(
program
,
identifiers
)
{
var
i
,
l
,
id
,
renderer
=
this
.
renderer
;
...
...
@@ -350,9 +353,9 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.cacheAttributeLocations = function(
}
};
},
THREE
.
WebGLRenderer
.
ShaderBuilder
.
prototype
.
removeProgram
=
function
(
program
)
{
removeProgram
:
function
(
program
)
{
var
i
,
il
,
programInfo
;
var
deleteProgram
=
false
;
...
...
@@ -403,4 +406,7 @@ THREE.WebGLRenderer.ShaderBuilder.prototype.removeProgram = function( program )
this
.
info
.
memory
.
programs
--
;
}
}
}
}
);
utils/build/includes/commonOld.json
浏览文件 @
3b63de52
...
...
@@ -74,7 +74,7 @@
"src/scenes/FogExp2.js"
,
"src/renderers/CanvasRenderer.js"
,
"src/renderers/WebGLShaders.js"
,
"src/renderers/WebGLRenderer.js"
,
"src/renderers/WebGLRenderer
Old
.js"
,
"src/renderers/WebGLRenderTarget.js"
,
"src/renderers/WebGLRenderTargetCube.js"
,
"src/renderers/renderables/RenderableVertex.js"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录