Pārlūkot izejas kodu

Revert "start supporting backgroundColor for Cube and Mulitres panoramas"

This reverts commit 2491c2b4dc.
pull/567/head
Matthew Petroff pirms 6 gadiem
vecāks
revīzija
97daf7d186
1 mainītis faili ar 10 papildinājumiem un 19 dzēšanām
  1. +10
    -19
      src/js/libpannellum.js

+ 10
- 19
src/js/libpannellum.js Parādīt failu

@@ -325,11 +325,6 @@ function Renderer(container) {
program.texCoordLocation = gl.getAttribLocation(program, 'a_texCoord');
gl.enableVertexAttribArray(program.texCoordLocation);

// Set background color
program.backgroundColor = gl.getUniformLocation(program, 'u_backgroundColor');
var color = params.backgroundColor ? params.backgroundColor : [0, 0, 0];
gl.uniform4fv(program.backgroundColor, color.concat([1]));

if (imageType != 'multires') {
// Provide texture coordinates for rectangle
if (!texCoordBuffer)
@@ -356,6 +351,13 @@ function Renderer(container) {
gl.uniform1f(program.v, vaov / Math.PI);
gl.uniform1f(program.vo, voffset / Math.PI * 2);

// Set background color
if (imageType == 'equirectangular') {
program.backgroundColor = gl.getUniformLocation(program, 'u_backgroundColor');
var color = params.backgroundColor ? params.backgroundColor : [0, 0, 0];
gl.uniform4fv(program.backgroundColor, color.concat([1]));
}

// Create texture
program.texture = gl.createTexture();
gl.bindTexture(glBindType, program.texture);
@@ -1285,10 +1287,7 @@ var fragEquiCubeBase = [
var fragCube = fragEquiCubeBase + [
// Look up color from texture
'float cosphi = cos(phi);',
'if(false)', // TODO: calculate if outside image
'gl_FragColor = u_backgroundColor;',
'else',
'gl_FragColor = textureCube(u_imageCube, vec3(cosphi*sin(lambda), sin(phi), cosphi*cos(lambda)));',
'gl_FragColor = textureCube(u_imageCube, vec3(cosphi*sin(lambda), sin(phi), cosphi*cos(lambda)));',
'}'
].join('\n');

@@ -1311,24 +1310,16 @@ var fragEquirectangular = fragEquiCubeBase + [

// Fragment shader
var fragMulti = [
'precision mediump float;',

'varying mediump vec2 v_texCoord;',
'uniform sampler2D u_sampler;',
//'uniform mediump vec4 u_color;',

// Background color (display for partial panoramas)
'uniform vec4 u_backgroundColor;',

'void main(void) {',
// Look up color from texture
'if(false)', // TODO: calculate if outside image
'gl_FragColor = u_backgroundColor;',
'else',
'gl_FragColor = texture2D(u_sampler, v_texCoord);',
'gl_FragColor = texture2D(u_sampler, v_texCoord);',
// 'gl_FragColor = u_color;',
'}'
].join('\n');
].join('');

return {
renderer: function(container, image, imagetype, dynamic) {


Notiek ielāde…
Atcelt
Saglabāt