提交 f38765b5 编写于 作者: M Mr.doob

CanvasRenderer: Texture performanceness.

上级 2d7916a5
......@@ -509,14 +509,6 @@ THREE.CanvasRenderer = function ( parameters ) {
if ( texture !== null ) {
if ( texture.version === 0 ||
texture instanceof THREE.CompressedTexture ||
texture instanceof THREE.DataTexture ) {
setFillStyle( 'rgba( 0, 0, 0, 1 )' );
} else {
var pattern = _patterns[ texture.id ];
if ( pattern === undefined || pattern.version !== texture.version ) {
......@@ -526,8 +518,14 @@ THREE.CanvasRenderer = function ( parameters ) {
}
if ( pattern.canvas !== undefined ) {
setFillStyle( pattern.canvas );
} else {
setFillStyle( 'rgba( 0, 0, 0, 1 )' );
}
//
......@@ -821,6 +819,17 @@ THREE.CanvasRenderer = function ( parameters ) {
function textureToPattern( texture ) {
if ( texture.version === 0 ||
texture instanceof THREE.CompressedTexture ||
texture instanceof THREE.DataTexture ) {
return {
canvas: undefined,
version: texture.version
}
}
var image = texture.image;
var canvas = document.createElement( 'canvas' );
......@@ -853,22 +862,12 @@ THREE.CanvasRenderer = function ( parameters ) {
return {
canvas: _context.createPattern( canvas, repeat ),
version: texture.version
};
}
}
function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) {
if ( texture.version === 0 ||
texture instanceof THREE.CompressedTexture ||
texture instanceof THREE.DataTexture ) {
setFillStyle( 'rgba( 0, 0, 0, 1)' );
_context.fill();
return;
}
var pattern = _patterns[ texture.id ];
if ( pattern === undefined || pattern.version !== texture.version ) {
......@@ -878,8 +877,18 @@ THREE.CanvasRenderer = function ( parameters ) {
}
if ( pattern.canvas !== undefined ) {
setFillStyle( pattern.canvas );
} else {
setFillStyle( 'rgba( 0, 0, 0, 1)' );
_context.fill();
return;
}
// http://extremelysatisfactorytotalitarianism.com/blog/?p=2120
var a, b, c, d, e, f, det, idet,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册