Permalink
Browse files

A few quick fixes for some issues making it not render properly on NV…

…idia cards.
  • Loading branch information...
1 parent 3354d42 commit a92ff6c362343e8f895ff1148239c0e2abb50489 @emoller emoller committed Nov 10, 2011
View
@@ -15,8 +15,8 @@
</comments>
<source_data>file:///C:/Users/emoller/Documents/public_html/webgldemo/assets/maya/space-station-erik-late.ma</source_data>
</contributor>
- <created>2011-11-01T21:19:47</created>
- <modified>2011-11-01T21:19:47</modified>
+ <created>2011-11-09T17:59:03</created>
+ <modified>2011-11-09T17:59:03</modified>
<unit name="centimeter" meter="0.01"/>
<up_axis>Y_UP</up_axis>
</asset>
@@ -1676,32 +1676,8 @@
<reflectivity>
<float>0.5</float>
</reflectivity>
- <transparent opaque="A_ONE">
- <texture texture="file5-sampler" texcoord="TEX1">
- <extra>
- <technique profile="OpenCOLLADAMaya">
- <blend_mode>NONE</blend_mode>
- <coverageU>1</coverageU>
- <coverageV>1</coverageV>
- <fast>0</fast>
- <mirrorU>0</mirrorU>
- <mirrorV>0</mirrorV>
- <noiseU>0</noiseU>
- <noiseV>0</noiseV>
- <offsetU>0</offsetU>
- <offsetV>0</offsetV>
- <repeatU>1</repeatU>
- <repeatV>1</repeatV>
- <rotateFrame>0</rotateFrame>
- <rotateUV>0</rotateUV>
- <stagger>0</stagger>
- <translateFrameU>0</translateFrameU>
- <translateFrameV>0</translateFrameV>
- <wrapU>1</wrapU>
- <wrapV>1</wrapV>
- </technique>
- </extra>
- </texture>
+ <transparent opaque="RGB_ZERO">
+ <color>0 0 0 1</color>
</transparent>
<transparency>
<float>1</float>
@@ -1758,20 +1734,20 @@
</effect>
<effect id="lambert3-fx">
<profile_COMMON>
- <newparam sid="file5_2-surface">
+ <newparam sid="file5_1-surface">
<surface type="2D">
- <init_from>file5_2</init_from>
+ <init_from>file5_1</init_from>
</surface>
</newparam>
- <newparam sid="file5_2-sampler">
+ <newparam sid="file5_1-sampler">
<sampler2D>
- <source>file5_2-surface</source>
+ <source>file5_1-surface</source>
</sampler2D>
</newparam>
<technique sid="common">
<lambert>
<emission>
- <texture texture="file5_2-sampler" texcoord="TEX0">
+ <texture texture="file5_1-sampler" texcoord="TEX0">
<extra>
<technique profile="OpenCOLLADAMaya">
<blend_mode>NONE</blend_mode>
@@ -1798,31 +1774,7 @@
</texture>
</emission>
<ambient>
- <texture texture="file5_2-sampler" texcoord="TEX1">
- <extra>
- <technique profile="OpenCOLLADAMaya">
- <blend_mode>NONE</blend_mode>
- <coverageU>1</coverageU>
- <coverageV>1</coverageV>
- <fast>0</fast>
- <mirrorU>0</mirrorU>
- <mirrorV>0</mirrorV>
- <noiseU>0</noiseU>
- <noiseV>0</noiseV>
- <offsetU>0</offsetU>
- <offsetV>0</offsetV>
- <repeatU>1</repeatU>
- <repeatV>1</repeatV>
- <rotateFrame>0</rotateFrame>
- <rotateUV>0</rotateUV>
- <stagger>0</stagger>
- <translateFrameU>0</translateFrameU>
- <translateFrameV>0</translateFrameV>
- <wrapU>1</wrapU>
- <wrapV>1</wrapV>
- </technique>
- </extra>
- </texture>
+ <color>0 0 0 1</color>
</ambient>
<diffuse>
<color>0 0 0 1</color>
@@ -1879,31 +1831,7 @@
</texture>
</emission>
<ambient>
- <texture texture="file7-sampler" texcoord="TEX1">
- <extra>
- <technique profile="OpenCOLLADAMaya">
- <blend_mode>NONE</blend_mode>
- <coverageU>1</coverageU>
- <coverageV>1</coverageV>
- <fast>0</fast>
- <mirrorU>0</mirrorU>
- <mirrorV>0</mirrorV>
- <noiseU>0</noiseU>
- <noiseV>0</noiseV>
- <offsetU>0</offsetU>
- <offsetV>0</offsetV>
- <repeatU>1</repeatU>
- <repeatV>1</repeatV>
- <rotateFrame>0</rotateFrame>
- <rotateUV>0</rotateUV>
- <stagger>0</stagger>
- <translateFrameU>0</translateFrameU>
- <translateFrameV>0</translateFrameV>
- <wrapU>1</wrapU>
- <wrapV>1</wrapV>
- </technique>
- </extra>
- </texture>
+ <color>0 0 0 1</color>
</ambient>
<diffuse>
<color>0 0 0 1</color>
@@ -2663,7 +2591,7 @@
</technique>
</extra>
</image>
- <image id="file5_2" name="file5">
+ <image id="file5_1" name="file5">
<init_from>file:///C:/Users/emoller/Documents/public_html/webgldemo/assets/maya/textures/monitorDisplay3.png</init_from>
<extra>
<technique profile="OpenCOLLADAMaya">
@@ -3426,7 +3354,6 @@
<technique_common>
<instance_material symbol="blinn4SG" target="#customPillar">
<bind_vertex_input semantic="TEX0" input_semantic="TEXCOORD" input_set="0"/>
- <bind_vertex_input semantic="TEX1" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
</technique_common>
</bind_material>
@@ -3449,7 +3376,6 @@
<technique_common>
<instance_material symbol="blinn4SG" target="#customPillar">
<bind_vertex_input semantic="TEX0" input_semantic="TEXCOORD" input_set="0"/>
- <bind_vertex_input semantic="TEX1" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
</technique_common>
</bind_material>
@@ -3478,11 +3404,9 @@
<technique_common>
<instance_material symbol="lambert3SG" target="#lambert3">
<bind_vertex_input semantic="TEX0" input_semantic="TEXCOORD" input_set="0"/>
- <bind_vertex_input semantic="TEX1" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
<instance_material symbol="lambert4SG" target="#lambert4">
<bind_vertex_input semantic="TEX0" input_semantic="TEXCOORD" input_set="0"/>
- <bind_vertex_input semantic="TEX1" input_semantic="TEXCOORD" input_set="0"/>
</instance_material>
</technique_common>
</bind_material>
View
@@ -26,11 +26,18 @@ function CameraPrototype() {
viewMatrix().make(this.getAccumulatedTransform()).invertRigidBody();
if (this.subtype == 'perspective') {
projectionMatrix().makePerspective(this.yfov, this.aspect, this.znear, this.zfar);
- }
- else if (this.subtype == 'orthographic') {
+ } else if (this.subtype == 'orthographic') {
projectionMatrix().makeOrtho(-this.xmag, this.xmag, -this.ymag, this.ymag, this.znear, this.zfar);
}
}
+
+ this.drawSkeleton = function(dbgDraw, frames) {
+ /*var alen = 0.3
+ dbgDraw.drawLine(0,0,-alen, -alen,-alen,alen, dbgDraw.RED,frames, 1);
+ dbgDraw.drawLine(0,0,-alen, -alen, alen,alen, dbgDraw.RED,frames, 1);
+ dbgDraw.drawLine(0,0,-alen, alen,-alen,alen, dbgDraw.RED,frames, 1);
+ dbgDraw.drawLine(0,0,-alen, alen, alen,alen, dbgDraw.RED,frames, 1);*/
+ }
};
CameraPrototype.prototype = Node.prototype;
View
@@ -252,7 +252,7 @@ var demo = new (function () {
window.canvas = document.getElementById('webgl');
var gl = canvas.getContext('webgl', { 'alpha' : false }) || canvas.getContext('experimental-webgl', { 'alpha' : false });
if (!gl) {
- alert("Unable to initialize WebGL.");
+ alert('Unable to initialize WebGL.');
return false;
}
// The gl variable is used by other scripts
@@ -264,7 +264,7 @@ var demo = new (function () {
window.addEventListener('keydown', function(e) { that.handleKeyDown(e); }, false);
window.addEventListener('keyup', function(e) { that.handleKeyUp(e); }, false);
- gl.getExtension("OES_standard_derivatives");
+ gl.getExtension('OES_standard_derivatives');
gl.clearDepth(1.0);
gl.enable(gl.DEPTH_TEST);
gl.depthFunc(gl.LEQUAL);
View
@@ -88,15 +88,13 @@ function LightPrototype() {
}
}
- this.draw = function(jointMatrices, lights) {
-/*
- if (this.subtype == "point") {
+ this.drawSkeleton = function(dbgDraw, frames) {
+ if (this.subtype == 'point') {
var alen = 0.3
dbgDraw.drawLine(-alen,0,0, alen,0,0, dbgDraw.RED,frames, 1);
dbgDraw.drawLine(0,-alen,0, 0,alen,0, dbgDraw.RED,frames, 1);
dbgDraw.drawLine(0,0,-alen, 0,0,alen, dbgDraw.RED,frames, 1);
}
-*/
}
}
View
@@ -404,32 +404,34 @@ function MaterialPrototype() {
}
gl.uniform1i(this.shaderProgram.numLightsUniform, numLights);
- gl.uniform1iv(this.shaderProgram.lightTypeUniform, lightType);
- gl.uniform4fv(this.shaderProgram.lightLocationUniform, lightLocation);
- gl.uniformMatrix4fv(this.shaderProgram.lightViewMatixUniform, false, flatten(lightViewMatix));
- gl.uniformMatrix4fv(this.shaderProgram.lightVPMatrixUniform, false, flatten(lightVPMatrix));
- gl.uniform3fv(this.shaderProgram.lightDiffuseColorUniform, lightDiffuseColor);
- if (this.type == 'phong')
- gl.uniform3fv(this.shaderProgram.lightSpecularColorUniform, lightSpecularColor);
+ if (numLights > 0) {
+ gl.uniform1iv(this.shaderProgram.lightTypeUniform, lightType);
+ gl.uniform4fv(this.shaderProgram.lightLocationUniform, lightLocation);
+ gl.uniformMatrix4fv(this.shaderProgram.lightViewMatixUniform, false, flatten(lightViewMatix));
+ gl.uniformMatrix4fv(this.shaderProgram.lightVPMatrixUniform, false, flatten(lightVPMatrix));
+ gl.uniform3fv(this.shaderProgram.lightDiffuseColorUniform, lightDiffuseColor);
+ if (this.type == 'phong')
+ gl.uniform3fv(this.shaderProgram.lightSpecularColorUniform, lightSpecularColor);
- if (this.shadowReceiver) {
- gl.uniform1iv(this.shaderProgram.castsShadowsUniform, lightCastsShadows);
- gl.uniform1iv(this.shaderProgram.shadowSamplerUniform, lightShadowSampler);
- for (var l = 0; l < numLights; ++l) {
- if (lights[l].castsShadows) {
- gl.activeTexture(gl.TEXTURE7 + l);
- gl.bindTexture(gl.TEXTURE_2D, lights[l].shadowTexture);
+ if (this.shadowReceiver) {
+ gl.uniform1iv(this.shaderProgram.castsShadowsUniform, lightCastsShadows);
+ gl.uniform1iv(this.shaderProgram.shadowSamplerUniform, lightShadowSampler);
+ for (var l = 0; l < numLights; ++l) {
+ if (lights[l].castsShadows) {
+ gl.activeTexture(gl.TEXTURE7 + l);
+ gl.bindTexture(gl.TEXTURE_2D, lights[l].shadowTexture);
+ }
}
}
- }
- } else if (this.type == 'shadowmap') {
- var light = lights[0]; // HACKERY...
- var lightPos = light.getAccumulatedTransform();
- gl.uniform4f(this.shaderProgram.lightLocationUniform, lightPos.t0, lightPos.t1, lightPos.t2, light.radius);
- gl.uniform1i(this.shaderProgram.lightTypeUniform, light.getType());
- if (light.subtype=='directional')
- gl.uniformMatrix4fv(this.shaderProgram.lightViewMatixUniform, false, lightPos.flatten());
+ } else if (this.type == 'shadowmap') {
+ var light = lights[0]; // HACKERY...
+ var lightPos = light.getAccumulatedTransform();
+ gl.uniform4f(this.shaderProgram.lightLocationUniform, lightPos.t0, lightPos.t1, lightPos.t2, light.radius);
+ gl.uniform1i(this.shaderProgram.lightTypeUniform, light.getType());
+ if (light.subtype=='directional')
+ gl.uniformMatrix4fv(this.shaderProgram.lightViewMatixUniform, false, lightPos.flatten());
+ }
}
if (this.hasTexture()) {
View
@@ -29,7 +29,7 @@ function MeshPrototype() {
thisObj.loadingDone.call();
}
}
- request.open("GET", file, true);
+ request.open('GET', file, true);
}
this.handleMeshLoaded = function (txt) {
@@ -47,8 +47,8 @@ function MeshPrototype() {
}
if (this.shadowCaster) {
this.outstandingRequests += 2;
- this.shadowGenMaterial = materialCache.loadMaterial("shadowgen", function() { thisObj.handleMaterialLoaded(mat); });
- this.shadowGenSkinnedMaterial = materialCache.loadMaterial("shadowgenskinned", function() { thisObj.handleMaterialLoaded(mat); });
+ this.shadowGenMaterial = materialCache.loadMaterial('shadowgen', function() { thisObj.handleMaterialLoaded(mat); });
+ this.shadowGenSkinnedMaterial = materialCache.loadMaterial('shadowgenskinned', function() { thisObj.handleMaterialLoaded(mat); });
}
}
@@ -69,7 +69,7 @@ function MeshPrototype() {
var mat = this.materials[m];
this.needsTexCoord |= mat.hasTexture();
this.needsEmissiveTexCoord |= mat.hasEmissiveTex;
- this.needsNormals |= (mat.type != "matte");
+ this.needsNormals |= (mat.type != 'matte' && mat.type != 'custom' && mat.type != 'shadowmap');
}
if (this.needsNormals) {
@@ -221,7 +221,7 @@ function MeshPrototype() {
end = this.materialStarts[m + 1];
/*if (lights.length < 1) {
- alert("Doing ambient pass!");
+ alert('Doing ambient pass!'');
if (mat.skinned)
mat = this.ambientSkinnedMaterial;
@@ -234,7 +234,7 @@ function MeshPrototype() {
gl.bindBuffer(gl.ARRAY_BUFFER, this.mVertexPositionBuffer);
gl.vertexAttribPointer(mat.shaderProgram.vertexPositionAttribute, this.mVertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0);
- if (mat.type != "matte") {
+ if (mat.type != 'matte' && mat.type != 'custom' && mat.type != 'shadowmap') {
gl.bindBuffer(gl.ARRAY_BUFFER, this.mVertexNormalBuffer);
gl.vertexAttribPointer(mat.shaderProgram.vertexNormalAttribute, this.mVertexNormalBuffer.itemSize, gl.FLOAT, false, 0, 0);
}
View
@@ -109,7 +109,7 @@ function doPreprocess(txt, defined) {
}
}
// Build the outdata by iterating over the lines.
- var res = "";
+ var res = '';
var currentDir = 0;
for (var j = 0; j < lines.length; ++j) {
// Update the current currentDirective.
Oops, something went wrong.

0 comments on commit a92ff6c

Please sign in to comment.