summaryrefslogtreecommitdiffstats
path: root/o3d/samples/o3djs
diff options
context:
space:
mode:
authorluchen@google.com <luchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-22 18:23:55 +0000
committerluchen@google.com <luchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-22 18:23:55 +0000
commita94ede07c59c3be79641234930638be4ae40947c (patch)
tree26f1053c2d982c7edd33893f8b4719fd208bb495 /o3d/samples/o3djs
parent23781f7eda2276973b2da5e7bf34fb455af825e5 (diff)
downloadchromium_src-a94ede07c59c3be79641234930638be4ae40947c.zip
chromium_src-a94ede07c59c3be79641234930638be4ae40947c.tar.gz
chromium_src-a94ede07c59c3be79641234930638be4ae40947c.tar.bz2
Adding WebGL version of the trends demo, including the original and new particle versions. Differences in the non-particle version:
* Switched the created energy texture from 3x32 (NPOT) to 4x32; made the energy shard width smaller. * In the shaders, added abs before the sqrt call to normalize behavior across CG/GLSL. Translated GLSL shader string in particles.js to be more human readable. Review URL: http://codereview.chromium.org/2934013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53363 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3djs')
-rw-r--r--o3d/samples/o3djs/particles.js675
1 files changed, 173 insertions, 502 deletions
diff --git a/o3d/samples/o3djs/particles.js b/o3d/samples/o3djs/particles.js
index 66f604a..f6b7d4e 100644
--- a/o3d/samples/o3djs/particles.js
+++ b/o3d/samples/o3djs/particles.js
@@ -271,103 +271,10 @@ o3djs.particles.FX_STRINGS_CG = [
'// #o3d PixelShaderEntryPoint pixelShaderFunction\n' +
'// #o3d MatrixLoadOrder RowMajor\n'}];
-// Auto-generated by convert.py.
o3djs.particles.FX_STRINGS_GLSL = [
{ name: 'particle3d', fxString: '' +
- '// glslv profile log:\n' +
- '// (0) : warning C7011: implicit cast from "float1" to "float"\n' +
- '// 109 lines, 1 warnings, 0 errors.\n' +
- '\n' +
- '// glslf profile log:\n' +
- '// 109 lines, 0 errors.\n' +
- '\n' +
- '// glslv output by Cg compiler\n' +
- '// cgc version 2.0.0010, build date Dec 12 2007\n' +
- '// command line args: -profile glslv\n' +
- '//vendor NVIDIA Corporation\n' +
- '//version 2.0.0.10\n' +
- '//profile glslv\n' +
- '//program vertexShaderFunction\n' +
- '//semantic worldViewProjection : WORLDVIEWPROJECTION\n' +
- '//semantic world : WORLD\n' +
- '//semantic worldVelocity\n' +
- '//semantic worldAcceleration\n' +
- '//semantic timeRange\n' +
- '//semantic time\n' +
- '//semantic timeOffset\n' +
- '//semantic frameDuration\n' +
- '//semantic numFrames\n' +
- '//semantic rampSampler\n' +
- '//semantic colorSampler\n' +
- '//var float4x4 worldViewProjection : WORLDVIEWPROJECTION : _ZZ2SworldViewProjection[0], 4 : -1 : 1\n' +
- '//var float4x4 world : WORLD : _ZZ2Sworld[0], 4 : -1 : 1\n' +
- '//var float3 worldVelocity : : _ZZ2SworldVelocity : -1 : 1\n' +
- '//var float3 worldAcceleration : : _ZZ2SworldAcceleration : -1 : 1\n' +
- '//var float timeRange : : _ZZ2StimeRange : -1 : 1\n' +
- '//var float time : : _ZZ2Stime : -1 : 1\n' +
- '//var float timeOffset : : _ZZ2StimeOffset : -1 : 1\n' +
- '//var float frameDuration : : _ZZ2SframeDuration : -1 : 1\n' +
- '//var float numFrames : : _ZZ2SnumFrames : -1 : 1\n' +
- '//var sampler rampSampler : : : -1 : 0\n' +
- '//var sampler colorSampler : : : -1 : 0\n' +
- '//var float4 input.uvLifeTimeFrameStart : $vin.POSITION : POSITION : 0 : 1\n' +
- '//var float4 input.positionStartTime : $vin.TEXCOORD0 : TEXCOORD0 : 0 : 1\n' +
- '//var float4 input.velocityStartSize : $vin.TEXCOORD1 : TEXCOORD1 : 0 : 1\n' +
- '//var float4 input.accelerationEndSize : $vin.TEXCOORD2 : TEXCOORD2 : 0 : 1\n' +
- '//var float4 input.spinStartSpinSpeed : $vin.TEXCOORD3 : TEXCOORD3 : 0 : 1\n' +
- '//var float4 input.orientation : $vin.TEXCOORD4 : TEXCOORD4 : 0 : 1\n' +
- '//var float4 input.colorMult : $vin.COLOR : COLOR : 0 : 1\n' +
- '//var float4 vertexShaderFunction.position : $vout.POSITION : POSITION : -1 : 1\n' +
- '//var float2 vertexShaderFunction.texcoord : $vout.TEXCOORD0 : TEXCOORD0 : -1 : 1\n' +
- '//var float1 vertexShaderFunction.percentLife : $vout.TEXCOORD1 : TEXCOORD1 : -1 : 1\n' +
- '//var float4 vertexShaderFunction.colorMult : $vout.TEXCOORD2 : TEXCOORD2 : -1 : 1\n' +
- '\n' +
- 'attribute vec4 position;\n' +
- 'attribute vec4 texcoord0;\n' +
- 'attribute vec4 texcoord1;\n' +
- 'attribute vec4 texcoord2;\n' +
- 'attribute vec4 texcoord3;\n' +
- 'attribute vec4 texcoord4;\n' +
- 'vec4 _glPositionTemp;\n' +
- 'uniform vec4 dx_clipping;\n' +
- '\n' +
- 'struct VertexShaderInput {\n' +
- ' vec4 uvLifeTimeFrameStart;\n' +
- ' vec4 positionStartTime;\n' +
- ' vec4 velocityStartSize;\n' +
- ' vec4 accelerationEndSize;\n' +
- ' vec4 spinStartSpinSpeed;\n' +
- ' vec4 orientation;\n' +
- ' vec4 colorMult;\n' +
- '};\n' +
- '\n' +
- 'struct PixelShaderInput {\n' +
- ' vec4 position;\n' +
- ' vec2 texcoord;\n' +
- ' float percentLife;\n' +
- ' vec4 colorMult;\n' +
- '};\n' +
- '\n' +
- 'PixelShaderInput _ZZ3Sret_0;\n' +
- 'vec4 _ZZ3SrZh0027;\n' +
- 'vec4 _ZZ3SvZh0027;\n' +
- 'vec4 _ZZ3SrZh0029;\n' +
- 'vec4 _ZZ3SvZh0029;\n' +
- 'float _ZZ3ScZh0031;\n' +
- 'float _ZZ3SaZh0031;\n' +
- 'float _ZZ3SaZh0033;\n' +
- 'float _ZZ3SxZh0035;\n' +
- 'float _ZZ3SxZh0039;\n' +
- 'float _ZZ3ScZh0041;\n' +
- 'float _ZZ3SaZh0041;\n' +
- 'float _ZZ3SaZh0043;\n' +
- 'float _ZZ3SxZh0045;\n' +
- 'float _ZZ3SaZh0051;\n' +
- 'float _ZZ3SaZh0053;\n' +
- 'vec4 _ZZ3SrZh0055;\n' +
- 'vec4 _ZZ3SrZh0057;\n' +
- 'uniform mat4 worldviewprojection;\n' +
'uniform mat4 world;\n' +
+ 'uniform mat4 worldViewProjection;\n' +
'uniform vec3 worldVelocity;\n' +
'uniform vec3 worldAcceleration;\n' +
'uniform float timeRange;\n' +
@@ -376,271 +283,114 @@ o3djs.particles.FX_STRINGS_GLSL = [
'uniform float frameDuration;\n' +
'uniform float numFrames;\n' +
'\n' +
- ' // main procedure, the original name was vertexShaderFunction\n' +
- 'void main()\n' +
- '{\n' +
- '\n' +
- ' PixelShaderInput _ZZ4Soutput;\n' +
- ' vec3 _ZZ4Svelocity;\n' +
- ' vec3 _ZZ4Sacceleration;\n' +
- ' float _ZZ4SlocalTime;\n' +
- ' float _ZZ4SpercentLife;\n' +
- ' float _ZZ4Sframe;\n' +
- ' float _ZZ4SuOffset;\n' +
- ' float _ZZ4Su;\n' +
- ' float _ZZ4Ssize;\n' +
- ' float _ZZ4Ss;\n' +
- ' float _ZZ4Sc;\n' +
- ' vec4 _ZZ4SrotatedPoint;\n' +
- ' vec3 _ZZ4Scenter;\n' +
- ' vec4 _ZZ4Sq2;\n' +
- ' vec4 _ZZ4Sqx;\n' +
- ' vec4 _ZZ4Sqy;\n' +
- ' vec4 _ZZ4Sqz;\n' +
- ' vec4 _ZZ4SZaTMP9[4];\n' +
- '\n' +
- ' _ZZ3SvZh0027 = vec4(texcoord1.x, texcoord1.y, texcoord1.z, 0.00000000E+00);\n' +
- ' _ZZ3SrZh0027 = _ZZ3SvZh0027.x*world[0];\n' +
- ' _ZZ3SrZh0027 = _ZZ3SrZh0027 + _ZZ3SvZh0027.y*world[1];\n' +
- ' _ZZ3SrZh0027 = _ZZ3SrZh0027 + _ZZ3SvZh0027.z*world[2];\n' +
- ' _ZZ3SrZh0027 = _ZZ3SrZh0027 + _ZZ3SvZh0027.w*world[3];\n' +
- ' _ZZ4Svelocity = _ZZ3SrZh0027.xyz + worldVelocity;\n' +
- ' _ZZ3SvZh0029 = vec4(texcoord2.x, texcoord2.y, texcoord2.z, 0.00000000E+00);\n' +
- ' _ZZ3SrZh0029 = _ZZ3SvZh0029.x*world[0];\n' +
- ' _ZZ3SrZh0029 = _ZZ3SrZh0029 + _ZZ3SvZh0029.y*world[1];\n' +
- ' _ZZ3SrZh0029 = _ZZ3SrZh0029 + _ZZ3SvZh0029.z*world[2];\n' +
- ' _ZZ3SrZh0029 = _ZZ3SrZh0029 + _ZZ3SvZh0029.w*world[3];\n' +
- ' _ZZ4Sacceleration = _ZZ3SrZh0029.xyz + worldAcceleration;\n' +
- ' _ZZ3SaZh0031 = (time - timeOffset) - texcoord0.w;\n' +
- ' _ZZ3SaZh0033 = _ZZ3SaZh0031/timeRange;\n' +
- ' _ZZ3SxZh0035 = abs(_ZZ3SaZh0033);\n' +
- ' _ZZ3ScZh0031 = fract(_ZZ3SxZh0035)*abs(timeRange);\n' +
- ' _ZZ4SlocalTime = _ZZ3SaZh0031 < 0.00000000E+00 ? -_ZZ3ScZh0031 : _ZZ3ScZh0031;\n' +
- ' _ZZ4SpercentLife = _ZZ4SlocalTime/position.z;\n' +
- ' _ZZ3SxZh0039 = _ZZ4SlocalTime/frameDuration + position.w;\n' +
- ' _ZZ3SaZh0041 = floor(_ZZ3SxZh0039);\n' +
- ' _ZZ3SaZh0043 = _ZZ3SaZh0041/numFrames;\n' +
- ' _ZZ3SxZh0045 = abs(_ZZ3SaZh0043);\n' +
- ' _ZZ3ScZh0041 = fract(_ZZ3SxZh0045)*abs(numFrames);\n' +
- ' _ZZ4Sframe = _ZZ3SaZh0041 < 0.00000000E+00 ? -_ZZ3ScZh0041 : _ZZ3ScZh0041;\n' +
- ' _ZZ4SuOffset = _ZZ4Sframe/numFrames;\n' +
- ' _ZZ4Su = _ZZ4SuOffset + (position.x + 5.00000000E-01)*(1.00000000E+00/numFrames);\n' +
- ' _ZZ4Soutput.texcoord = vec2(_ZZ4Su, position.y + 5.00000000E-01);\n' +
- ' _ZZ4Ssize = texcoord1.w + _ZZ4SpercentLife*(texcoord2.w - texcoord1.w);\n' +
- ' _ZZ4Ssize = _ZZ4SpercentLife < 0.00000000E+00 || _ZZ4SpercentLife > 1.00000000E+00 ? 0.00000000E+00 : _ZZ4Ssize;\n' +
- ' _ZZ3SaZh0051 = texcoord3.x + texcoord3.y*_ZZ4SlocalTime;\n' +
- ' _ZZ4Ss = sin(_ZZ3SaZh0051);\n' +
- ' _ZZ3SaZh0053 = texcoord3.x + texcoord3.y*_ZZ4SlocalTime;\n' +
- ' _ZZ4Sc = cos(_ZZ3SaZh0053);\n' +
- ' _ZZ4SrotatedPoint = vec4((position.x*_ZZ4Sc + position.y*_ZZ4Ss)*_ZZ4Ssize, 0.00000000E+00, (position.x*_ZZ4Ss - position.y*_ZZ4Sc)*_ZZ4Ssize, 1.00000000E+00);\n' +
- ' _ZZ4Scenter = _ZZ4Svelocity*_ZZ4SlocalTime + _ZZ4Sacceleration*_ZZ4SlocalTime*_ZZ4SlocalTime + texcoord0.xyz;\n' +
- ' _ZZ4Sq2 = texcoord4 + texcoord4;\n' +
- ' _ZZ4Sqx = texcoord4.xxxw*_ZZ4Sq2.xyzx;\n' +
- ' _ZZ4Sqy = texcoord4.xyyw*_ZZ4Sq2.xyzy;\n' +
- ' _ZZ4Sqz = texcoord4.xxzw*_ZZ4Sq2.xxzz;\n' +
- ' _ZZ4SZaTMP9[0] = vec4((1.00000000E+00 - _ZZ4Sqy.y) - _ZZ4Sqz.z, _ZZ4Sqx.y + _ZZ4Sqz.w, _ZZ4Sqx.z - _ZZ4Sqy.w, 0.00000000E+00);\n' +
- ' _ZZ4SZaTMP9[1] = vec4(_ZZ4Sqx.y - _ZZ4Sqz.w, (1.00000000E+00 - _ZZ4Sqx.x) - _ZZ4Sqz.z, _ZZ4Sqy.z + _ZZ4Sqx.w, 0.00000000E+00);\n' +
- ' _ZZ4SZaTMP9[2] = vec4(_ZZ4Sqx.z + _ZZ4Sqy.w, _ZZ4Sqy.z - _ZZ4Sqx.w, (1.00000000E+00 - _ZZ4Sqx.x) - _ZZ4Sqy.y, 0.00000000E+00);\n' +
- ' _ZZ4SZaTMP9[3] = vec4(_ZZ4Scenter.x, _ZZ4Scenter.y, _ZZ4Scenter.z, 1.00000000E+00);\n' +
- ' _ZZ3SrZh0055 = _ZZ4SrotatedPoint.x*_ZZ4SZaTMP9[0];\n' +
- ' _ZZ3SrZh0055 = _ZZ3SrZh0055 + _ZZ4SrotatedPoint.y*_ZZ4SZaTMP9[1];\n' +
- ' _ZZ3SrZh0055 = _ZZ3SrZh0055 + _ZZ4SrotatedPoint.z*_ZZ4SZaTMP9[2];\n' +
- ' _ZZ3SrZh0055 = _ZZ3SrZh0055 + _ZZ4SrotatedPoint.w*_ZZ4SZaTMP9[3];\n' +
- ' _ZZ3SrZh0057 = _ZZ3SrZh0055.x*worldviewprojection[0];\n' +
- ' _ZZ3SrZh0057 = _ZZ3SrZh0057 + _ZZ3SrZh0055.y*worldviewprojection[1];\n' +
- ' _ZZ3SrZh0057 = _ZZ3SrZh0057 + _ZZ3SrZh0055.z*worldviewprojection[2];\n' +
- ' _ZZ3SrZh0057 = _ZZ3SrZh0057 + _ZZ3SrZh0055.w*worldviewprojection[3];\n' +
- ' _ZZ4Soutput.percentLife = _ZZ4SpercentLife;\n' +
- ' _ZZ3Sret_0.position = _ZZ3SrZh0057;\n' +
- ' _ZZ3Sret_0.texcoord = _ZZ4Soutput.texcoord;\n' +
- ' _ZZ3Sret_0.percentLife = _ZZ4Soutput.percentLife;\n' +
- ' _ZZ3Sret_0.colorMult = gl_Color;\n' +
- ' gl_TexCoord[0].xy = _ZZ4Soutput.texcoord;\n' +
- ' gl_TexCoord[2] = gl_Color;\n' +
- ' _glPositionTemp = _ZZ3SrZh0057; gl_Position = vec4(_glPositionTemp.x + _glPositionTemp.w * dx_clipping.x, dx_clipping.w * (_glPositionTemp.y + _glPositionTemp.w * dx_clipping.y), _glPositionTemp.z * 2 - _glPositionTemp.w, _glPositionTemp.w);\n' +
- ' gl_TexCoord[1].x = _ZZ4Soutput.percentLife;\n' +
- ' return;\n' +
- '} // main end\n' +
- '\n' +
- '\n' +
- '// #o3d SplitMarker\n' +
- '// #o3d MatrixLoadOrder RowMajor\n' +
- '\n' +
- '// glslf output by Cg compiler\n' +
- '// cgc version 2.0.0010, build date Dec 12 2007\n' +
- '// command line args: -profile glslf\n' +
- '//vendor NVIDIA Corporation\n' +
- '//version 2.0.0.10\n' +
- '//profile glslf\n' +
- '//program pixelShaderFunction\n' +
- '//semantic worldViewProjection : WORLDVIEWPROJECTION\n' +
- '//semantic world : WORLD\n' +
- '//semantic worldVelocity\n' +
- '//semantic worldAcceleration\n' +
- '//semantic timeRange\n' +
- '//semantic time\n' +
- '//semantic timeOffset\n' +
- '//semantic frameDuration\n' +
- '//semantic numFrames\n' +
- '//semantic rampSampler\n' +
- '//semantic colorSampler\n' +
- '//var float4x4 worldViewProjection : WORLDVIEWPROJECTION : , 4 : -1 : 0\n' +
- '//var float4x4 world : WORLD : , 4 : -1 : 0\n' +
- '//var float3 worldVelocity : : : -1 : 0\n' +
- '//var float3 worldAcceleration : : : -1 : 0\n' +
- '//var float timeRange : : : -1 : 0\n' +
- '//var float time : : : -1 : 0\n' +
- '//var float timeOffset : : : -1 : 0\n' +
- '//var float frameDuration : : : -1 : 0\n' +
- '//var float numFrames : : : -1 : 0\n' +
- '//var sampler rampSampler : : _ZZ2SrampSampler : -1 : 1\n' +
- '//var sampler colorSampler : : _ZZ2ScolorSampler : -1 : 1\n' +
- '//var float2 input.texcoord : $vin.TEXCOORD0 : TEXCOORD0 : 0 : 1\n' +
- '//var float1 input.percentLife : $vin.TEXCOORD1 : TEXCOORD1 : 0 : 1\n' +
- '//var float4 input.colorMult : $vin.TEXCOORD2 : TEXCOORD2 : 0 : 1\n' +
- '//var float4 pixelShaderFunction : $vout.COLOR : COLOR : -1 : 1\n' +
+ 'attribute vec4 position; // uv, lifeTime, frameStart\n' +
+ 'attribute vec4 texCoord0; // position.xyz, startTime\n' +
+ 'attribute vec4 texCoord1; // velocity.xyz, startSize\n' +
+ 'attribute vec4 texCoord2; // acceleration.xyz, endSize\n' +
+ 'attribute vec4 texCoord3; // spinStart.x, spinSpeed.y\n' +
+ 'attribute vec4 texCoord4; // orientation\n' +
+ 'attribute vec4 color; //\n' +
+ '\n' +
+ 'varying vec4 v_position;\n' +
+ 'varying vec2 v_texcoord;\n' +
+ 'varying float v_percentLife;\n' +
+ 'varying vec4 v_colorMult;\n' +
+ '\n' +
+ 'void main() {\n' +
+ ' vec4 uvLifeTimeFrameStart = position;\n' +
+ ' vec4 positionStartTime = texCoord0;\n' +
+ ' vec4 velocityStartSize = texCoord1;\n' +
+ ' vec4 accelerationEndSize = texCoord2;\n' +
+ ' vec4 spinStartSpinSpeed = texCoord3;\n' +
+ ' vec4 orientation = texCoord4;\n' +
+ ' vec4 colorMult = color;\n' +
+ ' vec2 uv = uvLifeTimeFrameStart.xy;\n' +
+ ' float lifeTime = uvLifeTimeFrameStart.z;\n' +
+ ' float frameStart = uvLifeTimeFrameStart.w;\n' +
+ ' vec3 position = positionStartTime.xyz;\n' +
+ ' float startTime = positionStartTime.w;\n' +
+ ' vec3 velocity = (world * vec4(velocityStartSize.xyz, 0)).xyz\n' +
+ ' + worldVelocity;\n' +
+ ' float startSize = velocityStartSize.w;\n' +
+ ' vec3 acceleration = (world *\n' +
+ ' vec4(accelerationEndSize.xyz, 0)).xyz + worldAcceleration;\n' +
+ ' float endSize = accelerationEndSize.w;\n' +
+ ' float spinStart = spinStartSpinSpeed.x;\n' +
+ ' float spinSpeed = spinStartSpinSpeed.y;\n' +
+ '\n' +
+ ' float localTime = mod((time - timeOffset - startTime),\n' +
+ ' timeRange);\n' +
+ ' float percentLife = localTime / lifeTime;\n' +
'\n' +
+ ' float frame = mod(floor(localTime / frameDuration + frameStart),\n' +
+ ' numFrames);\n' +
+ ' float uOffset = frame / numFrames;\n' +
+ ' float u = uOffset + (uv.x + 0.5) * (1.0 / numFrames);\n' +
'\n' +
+ ' v_texcoord = vec2(u, uv.y + 0.5);\n' +
+ ' v_colorMult = colorMult;\n' +
'\n' +
- 'struct VertexShaderInput {\n' +
- ' vec4 positionStartTime;\n' +
- ' vec4 velocityStartSize;\n' +
- ' vec4 accelerationEndSize;\n' +
- ' vec4 spinStartSpinSpeed;\n' +
- ' vec4 orientation;\n' +
- ' vec4 colorMult;\n' +
- '};\n' +
+ ' float size = mix(startSize, endSize, percentLife);\n' +
+ ' size = (percentLife < 0.0 || percentLife > 1.0) ? 0.0 : size;\n' +
+ ' float s = sin(spinStart + spinSpeed * localTime);\n' +
+ ' float c = cos(spinStart + spinSpeed * localTime);\n' +
'\n' +
- 'struct PixelShaderInput {\n' +
- ' vec2 texcoord;\n' +
- ' float percentLife;\n' +
- ' vec4 colorMult;\n' +
- '};\n' +
+ ' vec4 rotatedPoint = vec4((uv.x * c + uv.y * s) * size, 0.0,\n' +
+ ' (uv.x * s - uv.y * c) * size, 1.0);\n' +
+ ' vec3 center = velocity * localTime +\n' +
+ ' acceleration * localTime * localTime + \n' +
+ ' position;\n' +
+ ' \n' +
+ ' vec4 q2 = orientation + orientation;\n' +
+ ' vec4 qx = orientation.xxxw * q2.xyzx;\n' +
+ ' vec4 qy = orientation.xyyw * q2.xyzy;\n' +
+ ' vec4 qz = orientation.xxzw * q2.xxzz;\n' +
+ ' \n' +
+ ' mat4 localMatrix = mat4(\n' +
+ ' (1.0 - qy.y) - qz.z, \n' +
+ ' qx.y + qz.w, \n' +
+ ' qx.z - qy.w,\n' +
+ ' 0,\n' +
+ ' \n' +
+ ' qx.y - qz.w, \n' +
+ ' (1.0 - qx.x) - qz.z, \n' +
+ ' qy.z + qx.w,\n' +
+ ' 0,\n' +
+ ' \n' +
+ ' qx.z + qy.w, \n' +
+ ' qy.z - qx.w, \n' +
+ ' (1.0 - qx.x) - qy.y,\n' +
+ ' 0,\n' +
+ ' \n' +
+ ' center.x, center.y, center.z, 1.0);\n' +
+ ' rotatedPoint = localMatrix * rotatedPoint;\n' +
+ ' gl_Position = worldViewProjection * rotatedPoint;\n' +
+ ' v_percentLife = percentLife;\n' +
+ '}\n' +
'\n' +
- 'vec4 _ZZ3Sret_0;\n' +
- 'sampler2D _ZZ3SsZh0016;\n' +
- 'vec2 _ZZ3ScZh0016;\n' +
- 'sampler2D _ZZ3SsZh0018;\n' +
- 'uniform sampler rampSampler;\n' +
- 'uniform sampler colorSampler;\n' +
+ '// #o3d SplitMarker\n' +
'\n' +
- ' // main procedure, the original name was pixelShaderFunction\n' +
- 'void main()\n' +
- '{\n' +
+ 'varying vec4 v_position;\n' +
+ 'varying vec2 v_texcoord;\n' +
+ 'varying float v_percentLife;\n' +
+ 'varying vec4 v_colorMult;\n' +
'\n' +
- ' PixelShaderInput _ZZ4Sinput;\n' +
- ' vec4 _ZZ4ScolorMult;\n' +
- ' vec4 _ZZ4Scolor;\n' +
+ '// We need to implement 1D!\n' +
+ 'uniform sampler2D rampSampler;\n' +
+ 'uniform sampler2D colorSampler;\n' +
+ '\n' +
+ 'void main() {\n' +
+ ' vec4 colorMult = texture2D(rampSampler, \n' +
+ ' vec2(v_percentLife, 0.5)) * v_colorMult;\n' +
+ ' vec4 color = texture2D(colorSampler, v_texcoord) * colorMult;\n' +
+ ' gl_FragColor = color;\n' +
+ '}\n' +
'\n' +
- ' _ZZ4Sinput.percentLife = gl_TexCoord[1].x;\n' +
- ' _ZZ3SsZh0016 = sampler2D(rampSampler);\n' +
- ' _ZZ3ScZh0016 = vec2(_ZZ4Sinput.percentLife, 5.00000000E-01);\n' +
- ' _ZZ4ScolorMult = texture2D(_ZZ3SsZh0016, _ZZ3ScZh0016)*gl_TexCoord[2];\n' +
- ' _ZZ3SsZh0018 = sampler2D(colorSampler);\n' +
- ' _ZZ4Scolor = texture2D(_ZZ3SsZh0018, gl_TexCoord[0].xy)*_ZZ4ScolorMult;\n' +
- ' _ZZ3Sret_0 = _ZZ4Scolor;\n' +
- ' gl_FragColor = _ZZ4Scolor;\n' +
- ' return;\n' +
- '} // main end\n'},
+ '// #o3d MatrixLoadOrder RowMajor\n'},
{ name: 'particle2d', fxString: '' +
- '// glslv profile log:\n' +
- '// (0) : warning C7011: implicit cast from "float1" to "float"\n' +
- '// 93 lines, 1 warnings, 0 errors.\n' +
- '\n' +
- '// glslf profile log:\n' +
- '// 93 lines, 0 errors.\n' +
- '\n' +
- '// glslv output by Cg compiler\n' +
- '// cgc version 2.0.0010, build date Dec 12 2007\n' +
- '// command line args: -profile glslv\n' +
- '//vendor NVIDIA Corporation\n' +
- '//version 2.0.0.10\n' +
- '//profile glslv\n' +
- '//program vertexShaderFunction\n' +
- '//semantic viewProjection : VIEWPROJECTION\n' +
- '//semantic world : WORLD\n' +
- '//semantic viewInverse : VIEWINVERSE\n' +
- '//semantic worldVelocity\n' +
- '//semantic worldAcceleration\n' +
- '//semantic timeRange\n' +
- '//semantic time\n' +
- '//semantic timeOffset\n' +
- '//semantic frameDuration\n' +
- '//semantic numFrames\n' +
- '//semantic rampSampler\n' +
- '//semantic colorSampler\n' +
- '//var float4x4 viewProjection : VIEWPROJECTION : _ZZ2SviewProjection[0], 4 : -1 : 1\n' +
- '//var float4x4 world : WORLD : _ZZ2Sworld[0], 4 : -1 : 1\n' +
- '//var float4x4 viewInverse : VIEWINVERSE : _ZZ2SviewInverse[0], 4 : -1 : 1\n' +
- '//var float3 worldVelocity : : _ZZ2SworldVelocity : -1 : 1\n' +
- '//var float3 worldAcceleration : : _ZZ2SworldAcceleration : -1 : 1\n' +
- '//var float timeRange : : _ZZ2StimeRange : -1 : 1\n' +
- '//var float time : : _ZZ2Stime : -1 : 1\n' +
- '//var float timeOffset : : _ZZ2StimeOffset : -1 : 1\n' +
- '//var float frameDuration : : _ZZ2SframeDuration : -1 : 1\n' +
- '//var float numFrames : : _ZZ2SnumFrames : -1 : 1\n' +
- '//var sampler rampSampler : : : -1 : 0\n' +
- '//var sampler colorSampler : : : -1 : 0\n' +
- '//var float4 input.uvLifeTimeFrameStart : $vin.POSITION : POSITION : 0 : 1\n' +
- '//var float4 input.positionStartTime : $vin.TEXCOORD0 : TEXCOORD0 : 0 : 1\n' +
- '//var float4 input.velocityStartSize : $vin.TEXCOORD1 : TEXCOORD1 : 0 : 1\n' +
- '//var float4 input.accelerationEndSize : $vin.TEXCOORD2 : TEXCOORD2 : 0 : 1\n' +
- '//var float4 input.spinStartSpinSpeed : $vin.TEXCOORD3 : TEXCOORD3 : 0 : 1\n' +
- '//var float4 input.colorMult : $vin.COLOR : COLOR : 0 : 1\n' +
- '//var float4 vertexShaderFunction.position : $vout.POSITION : POSITION : -1 : 1\n' +
- '//var float2 vertexShaderFunction.texcoord : $vout.TEXCOORD0 : TEXCOORD0 : -1 : 1\n' +
- '//var float1 vertexShaderFunction.percentLife : $vout.TEXCOORD1 : TEXCOORD1 : -1 : 1\n' +
- '//var float4 vertexShaderFunction.colorMult : $vout.TEXCOORD2 : TEXCOORD2 : -1 : 1\n' +
- '\n' +
- 'attribute vec4 position;\n' +
- 'attribute vec4 texcoord0;\n' +
- 'attribute vec4 texcoord1;\n' +
- 'attribute vec4 texcoord2;\n' +
- 'attribute vec4 texcoord3;\n' +
- 'vec4 _glPositionTemp;\n' +
- 'uniform vec4 dx_clipping;\n' +
- '\n' +
- 'struct VertexShaderInput {\n' +
- ' vec4 uvLifeTimeFrameStart;\n' +
- ' vec4 positionStartTime;\n' +
- ' vec4 velocityStartSize;\n' +
- ' vec4 accelerationEndSize;\n' +
- ' vec4 spinStartSpinSpeed;\n' +
- ' vec4 colorMult;\n' +
- '};\n' +
- '\n' +
- 'struct PixelShaderInput {\n' +
- ' vec4 position;\n' +
- ' vec2 texcoord;\n' +
- ' float percentLife;\n' +
- ' vec4 colorMult;\n' +
- '};\n' +
- '\n' +
- 'PixelShaderInput _ZZ3Sret_0;\n' +
- 'vec4 _ZZ3SrZh0027;\n' +
- 'vec4 _ZZ3SvZh0027;\n' +
- 'vec4 _ZZ3SrZh0029;\n' +
- 'vec4 _ZZ3SvZh0029;\n' +
- 'vec4 _ZZ3SrZh0031;\n' +
- 'vec4 _ZZ3SvZh0031;\n' +
- 'float _ZZ3ScZh0033;\n' +
- 'float _ZZ3SaZh0033;\n' +
- 'float _ZZ3SaZh0035;\n' +
- 'float _ZZ3SxZh0037;\n' +
- 'float _ZZ3SxZh0041;\n' +
- 'float _ZZ3ScZh0043;\n' +
- 'float _ZZ3SaZh0043;\n' +
- 'float _ZZ3SaZh0045;\n' +
- 'float _ZZ3SxZh0047;\n' +
- 'float _ZZ3SaZh0053;\n' +
- 'float _ZZ3SaZh0055;\n' +
- 'vec4 _ZZ3SrZh0057;\n' +
- 'vec4 _ZZ3SvZh0057;\n' +
- 'vec3 _ZZ3SZaTMP58;\n' +
- 'vec3 _ZZ3SZaTMP59;\n' +
- 'uniform mat4 viewprojection;\n' +
+ 'uniform mat4 viewProjection;\n' +
'uniform mat4 world;\n' +
- 'uniform mat4 viewinverse;\n' +
+ 'uniform mat4 viewInverse;\n' +
'uniform vec3 worldVelocity;\n' +
'uniform vec3 worldAcceleration;\n' +
'uniform float timeRange;\n' +
@@ -649,169 +399,90 @@ o3djs.particles.FX_STRINGS_GLSL = [
'uniform float frameDuration;\n' +
'uniform float numFrames;\n' +
'\n' +
- ' // main procedure, the original name was vertexShaderFunction\n' +
- 'void main()\n' +
- '{\n' +
- '\n' +
- ' PixelShaderInput _ZZ4Soutput;\n' +
- ' vec3 _ZZ4Svelocity;\n' +
- ' vec3 _ZZ4Sacceleration;\n' +
- ' float _ZZ4SlocalTime;\n' +
- ' float _ZZ4SpercentLife;\n' +
- ' float _ZZ4Sframe;\n' +
- ' float _ZZ4SuOffset;\n' +
- ' float _ZZ4Su;\n' +
- ' float _ZZ4Ssize;\n' +
- ' float _ZZ4Ss;\n' +
- ' float _ZZ4Sc;\n' +
- ' vec2 _ZZ4SrotatedPoint;\n' +
- ' vec3 _ZZ4SlocalPosition;\n' +
- '\n' +
- ' _ZZ3SvZh0027 = vec4(texcoord0.x, texcoord0.y, texcoord0.z, 1.00000000E+00);\n' +
- ' _ZZ3SrZh0027 = _ZZ3SvZh0027.x*world[0];\n' +
- ' _ZZ3SrZh0027 = _ZZ3SrZh0027 + _ZZ3SvZh0027.y*world[1];\n' +
- ' _ZZ3SrZh0027 = _ZZ3SrZh0027 + _ZZ3SvZh0027.z*world[2];\n' +
- ' _ZZ3SrZh0027 = _ZZ3SrZh0027 + _ZZ3SvZh0027.w*world[3];\n' +
- ' _ZZ3SvZh0029 = vec4(texcoord1.x, texcoord1.y, texcoord1.z, 0.00000000E+00);\n' +
- ' _ZZ3SrZh0029 = _ZZ3SvZh0029.x*world[0];\n' +
- ' _ZZ3SrZh0029 = _ZZ3SrZh0029 + _ZZ3SvZh0029.y*world[1];\n' +
- ' _ZZ3SrZh0029 = _ZZ3SrZh0029 + _ZZ3SvZh0029.z*world[2];\n' +
- ' _ZZ3SrZh0029 = _ZZ3SrZh0029 + _ZZ3SvZh0029.w*world[3];\n' +
- ' _ZZ4Svelocity = _ZZ3SrZh0029.xyz + worldVelocity;\n' +
- ' _ZZ3SvZh0031 = vec4(texcoord2.x, texcoord2.y, texcoord2.z, 0.00000000E+00);\n' +
- ' _ZZ3SrZh0031 = _ZZ3SvZh0031.x*world[0];\n' +
- ' _ZZ3SrZh0031 = _ZZ3SrZh0031 + _ZZ3SvZh0031.y*world[1];\n' +
- ' _ZZ3SrZh0031 = _ZZ3SrZh0031 + _ZZ3SvZh0031.z*world[2];\n' +
- ' _ZZ3SrZh0031 = _ZZ3SrZh0031 + _ZZ3SvZh0031.w*world[3];\n' +
- ' _ZZ4Sacceleration = _ZZ3SrZh0031.xyz + worldAcceleration;\n' +
- ' _ZZ3SaZh0033 = (time - timeOffset) - texcoord0.w;\n' +
- ' _ZZ3SaZh0035 = _ZZ3SaZh0033/timeRange;\n' +
- ' _ZZ3SxZh0037 = abs(_ZZ3SaZh0035);\n' +
- ' _ZZ3ScZh0033 = fract(_ZZ3SxZh0037)*abs(timeRange);\n' +
- ' _ZZ4SlocalTime = _ZZ3SaZh0033 < 0.00000000E+00 ? -_ZZ3ScZh0033 : _ZZ3ScZh0033;\n' +
- ' _ZZ4SpercentLife = _ZZ4SlocalTime/position.z;\n' +
- ' _ZZ3SxZh0041 = _ZZ4SlocalTime/frameDuration + position.w;\n' +
- ' _ZZ3SaZh0043 = floor(_ZZ3SxZh0041);\n' +
- ' _ZZ3SaZh0045 = _ZZ3SaZh0043/numFrames;\n' +
- ' _ZZ3SxZh0047 = abs(_ZZ3SaZh0045);\n' +
- ' _ZZ3ScZh0043 = fract(_ZZ3SxZh0047)*abs(numFrames);\n' +
- ' _ZZ4Sframe = _ZZ3SaZh0043 < 0.00000000E+00 ? -_ZZ3ScZh0043 : _ZZ3ScZh0043;\n' +
- ' _ZZ4SuOffset = _ZZ4Sframe/numFrames;\n' +
- ' _ZZ4Su = _ZZ4SuOffset + (position.x + 5.00000000E-01)*(1.00000000E+00/numFrames);\n' +
- ' _ZZ4Soutput.texcoord = vec2(_ZZ4Su, position.y + 5.00000000E-01);\n' +
- ' _ZZ4Ssize = texcoord1.w + _ZZ4SpercentLife*(texcoord2.w - texcoord1.w);\n' +
- ' _ZZ4Ssize = _ZZ4SpercentLife < 0.00000000E+00 || _ZZ4SpercentLife > 1.00000000E+00 ? 0.00000000E+00 : _ZZ4Ssize;\n' +
- ' _ZZ3SaZh0053 = texcoord3.x + texcoord3.y*_ZZ4SlocalTime;\n' +
- ' _ZZ4Ss = sin(_ZZ3SaZh0053);\n' +
- ' _ZZ3SaZh0055 = texcoord3.x + texcoord3.y*_ZZ4SlocalTime;\n' +
- ' _ZZ4Sc = cos(_ZZ3SaZh0055);\n' +
- ' _ZZ4SrotatedPoint = vec2(position.x*_ZZ4Sc + position.y*_ZZ4Ss, -position.x*_ZZ4Ss + position.y*_ZZ4Sc);\n' +
- ' _ZZ3SZaTMP58.x = viewinverse[0].x;\n' +
- ' _ZZ3SZaTMP58.y = viewinverse[0].y;\n' +
- ' _ZZ3SZaTMP58.z = viewinverse[0].z;\n' +
- ' _ZZ3SZaTMP59.x = viewinverse[1].x;\n' +
- ' _ZZ3SZaTMP59.y = viewinverse[1].y;\n' +
- ' _ZZ3SZaTMP59.z = viewinverse[1].z;\n' +
- ' _ZZ4SlocalPosition = (_ZZ3SZaTMP58*_ZZ4SrotatedPoint.x + _ZZ3SZaTMP59*_ZZ4SrotatedPoint.y)*_ZZ4Ssize + _ZZ4Svelocity*_ZZ4SlocalTime + _ZZ4Sacceleration*_ZZ4SlocalTime*_ZZ4SlocalTime + _ZZ3SrZh0027.xyz;\n' +
- ' _ZZ3SvZh0057 = vec4(_ZZ4SlocalPosition.x, _ZZ4SlocalPosition.y, _ZZ4SlocalPosition.z, 1.00000000E+00);\n' +
- ' _ZZ3SrZh0057 = _ZZ3SvZh0057.x*viewprojection[0];\n' +
- ' _ZZ3SrZh0057 = _ZZ3SrZh0057 + _ZZ3SvZh0057.y*viewprojection[1];\n' +
- ' _ZZ3SrZh0057 = _ZZ3SrZh0057 + _ZZ3SvZh0057.z*viewprojection[2];\n' +
- ' _ZZ3SrZh0057 = _ZZ3SrZh0057 + _ZZ3SvZh0057.w*viewprojection[3];\n' +
- ' _ZZ4Soutput.percentLife = _ZZ4SpercentLife;\n' +
- ' _ZZ3Sret_0.position = _ZZ3SrZh0057;\n' +
- ' _ZZ3Sret_0.texcoord = _ZZ4Soutput.texcoord;\n' +
- ' _ZZ3Sret_0.percentLife = _ZZ4Soutput.percentLife;\n' +
- ' _ZZ3Sret_0.colorMult = gl_Color;\n' +
- ' gl_TexCoord[0].xy = _ZZ4Soutput.texcoord;\n' +
- ' gl_TexCoord[2] = gl_Color;\n' +
- ' _glPositionTemp = _ZZ3SrZh0057; gl_Position = vec4(_glPositionTemp.x + _glPositionTemp.w * dx_clipping.x, dx_clipping.w * (_glPositionTemp.y + _glPositionTemp.w * dx_clipping.y), _glPositionTemp.z * 2 - _glPositionTemp.w, _glPositionTemp.w);\n' +
- ' gl_TexCoord[1].x = _ZZ4Soutput.percentLife;\n' +
- ' return;\n' +
- '} // main end\n' +
- '\n' +
+ 'attribute vec4 position; // uv, lifeTime, frameStart\n' +
+ 'attribute vec4 texCoord0; // position.xyz, startTime\n' +
+ 'attribute vec4 texCoord1; // velocity.xyz, startSize\n' +
+ 'attribute vec4 texCoord2; // acceleration.xyz, endSize\n' +
+ 'attribute vec4 texCoord3; // spinStart.x, spinSpeed.y\n' +
+ 'attribute vec4 color; //\n' +
+ '\n' +
+ 'varying vec4 v_position;\n' +
+ 'varying vec2 v_texcoord;\n' +
+ 'varying float v_percentLife;\n' +
+ 'varying vec4 v_colorMult;\n' +
+ '\n' +
+ 'void main() {\n' +
+ ' vec4 uvLifeTimeFrameStart = position;\n' +
+ ' vec4 positionStartTime = texCoord0;\n' +
+ ' vec4 velocityStartSize = texCoord1;\n' +
+ ' vec4 accelerationEndSize = texCoord2;\n' +
+ ' vec4 spinStartSpinSpeed = texCoord3;\n' +
+ ' vec4 colorMult = color;\n' +
+ ' vec2 uv = uvLifeTimeFrameStart.xy;\n' +
+ ' float lifeTime = uvLifeTimeFrameStart.z;\n' +
+ ' float frameStart = uvLifeTimeFrameStart.w;\n' +
+ ' vec3 position = (world * vec4(positionStartTime.xyz, 1.0)).xyz;\n' +
+ ' float startTime = positionStartTime.w;\n' +
+ ' vec3 velocity = (world * vec4(velocityStartSize.xyz, 0)).xyz \n' +
+ ' + worldVelocity;\n' +
+ ' float startSize = velocityStartSize.w;\n' +
+ ' vec3 acceleration = (world *\n' +
+ ' vec4(accelerationEndSize.xyz, 0)).xyz + worldAcceleration;\n' +
+ ' float endSize = accelerationEndSize.w;\n' +
+ ' float spinStart = spinStartSpinSpeed.x;\n' +
+ ' float spinSpeed = spinStartSpinSpeed.y;\n' +
+ '\n' +
+ ' float localTime = mod((time - timeOffset - startTime),\n' +
+ ' timeRange);\n' +
+ ' float percentLife = localTime / lifeTime;\n' +
'\n' +
- '// #o3d SplitMarker\n' +
- '// #o3d MatrixLoadOrder RowMajor\n' +
+ ' float frame = mod(floor(localTime / frameDuration + frameStart),\n' +
+ ' numFrames);\n' +
+ ' float uOffset = frame / numFrames;\n' +
+ ' float u = uOffset + (uv.x + 0.5) * (1.0 / numFrames);\n' +
'\n' +
- '// glslf output by Cg compiler\n' +
- '// cgc version 2.0.0010, build date Dec 12 2007\n' +
- '// command line args: -profile glslf\n' +
- '//vendor NVIDIA Corporation\n' +
- '//version 2.0.0.10\n' +
- '//profile glslf\n' +
- '//program pixelShaderFunction\n' +
- '//semantic viewProjection : VIEWPROJECTION\n' +
- '//semantic world : WORLD\n' +
- '//semantic viewInverse : VIEWINVERSE\n' +
- '//semantic worldVelocity\n' +
- '//semantic worldAcceleration\n' +
- '//semantic timeRange\n' +
- '//semantic time\n' +
- '//semantic timeOffset\n' +
- '//semantic frameDuration\n' +
- '//semantic numFrames\n' +
- '//semantic rampSampler\n' +
- '//semantic colorSampler\n' +
- '//var float4x4 viewProjection : VIEWPROJECTION : , 4 : -1 : 0\n' +
- '//var float4x4 world : WORLD : , 4 : -1 : 0\n' +
- '//var float4x4 viewInverse : VIEWINVERSE : , 4 : -1 : 0\n' +
- '//var float3 worldVelocity : : : -1 : 0\n' +
- '//var float3 worldAcceleration : : : -1 : 0\n' +
- '//var float timeRange : : : -1 : 0\n' +
- '//var float time : : : -1 : 0\n' +
- '//var float timeOffset : : : -1 : 0\n' +
- '//var float frameDuration : : : -1 : 0\n' +
- '//var float numFrames : : : -1 : 0\n' +
- '//var sampler rampSampler : : _ZZ2SrampSampler : -1 : 1\n' +
- '//var sampler colorSampler : : _ZZ2ScolorSampler : -1 : 1\n' +
- '//var float2 input.texcoord : $vin.TEXCOORD0 : TEXCOORD0 : 0 : 1\n' +
- '//var float1 input.percentLife : $vin.TEXCOORD1 : TEXCOORD1 : 0 : 1\n' +
- '//var float4 input.colorMult : $vin.TEXCOORD2 : TEXCOORD2 : 0 : 1\n' +
- '//var float4 pixelShaderFunction : $vout.COLOR : COLOR : -1 : 1\n' +
+ ' v_texcoord = vec2(u, uv.y + 0.5);\n' +
+ ' v_colorMult = colorMult;\n' +
'\n' +
+ ' vec3 basisX = viewInverse[0].xyz;\n' +
+ ' vec3 basisZ = viewInverse[1].xyz;\n' +
'\n' +
+ ' float size = mix(startSize, endSize, percentLife);\n' +
+ ' size = (percentLife < 0.0 || percentLife > 1.0) ? 0.0 : size;\n' +
+ ' float s = sin(spinStart + spinSpeed * localTime);\n' +
+ ' float c = cos(spinStart + spinSpeed * localTime);\n' +
'\n' +
- 'struct VertexShaderInput {\n' +
- ' vec4 positionStartTime;\n' +
- ' vec4 velocityStartSize;\n' +
- ' vec4 accelerationEndSize;\n' +
- ' vec4 spinStartSpinSpeed;\n' +
- ' vec4 colorMult;\n' +
- '};\n' +
+ ' vec2 rotatedPoint = vec2(uv.x * c + uv.y * s, \n' +
+ ' -uv.x * s + uv.y * c);\n' +
+ ' vec3 localPosition = vec3(basisX * rotatedPoint.x +\n' +
+ ' basisZ * rotatedPoint.y) * size +\n' +
+ ' velocity * localTime +\n' +
+ ' acceleration * localTime * localTime + \n' +
+ ' position;\n' +
'\n' +
- 'struct PixelShaderInput {\n' +
- ' vec2 texcoord;\n' +
- ' float percentLife;\n' +
- ' vec4 colorMult;\n' +
- '};\n' +
+ ' gl_Position = (viewProjection * vec4(localPosition, 1.0));\n' +
+ ' v_percentLife = percentLife;\n' +
+ '}\n' +
'\n' +
- 'vec4 _ZZ3Sret_0;\n' +
- 'sampler2D _ZZ3SsZh0017;\n' +
- 'vec2 _ZZ3ScZh0017;\n' +
- 'sampler2D _ZZ3SsZh0019;\n' +
- 'uniform sampler rampSampler;\n' +
- 'uniform sampler colorSampler;\n' +
+ '// #o3d SplitMarker\n' +
'\n' +
- ' // main procedure, the original name was pixelShaderFunction\n' +
- 'void main()\n' +
- '{\n' +
+ 'varying vec4 v_position;\n' +
+ 'varying vec2 v_texcoord;\n' +
+ 'varying float v_percentLife;\n' +
+ 'varying vec4 v_colorMult;\n' +
'\n' +
- ' PixelShaderInput _ZZ4Sinput;\n' +
- ' vec4 _ZZ4ScolorMult;\n' +
- ' vec4 _ZZ4Scolor;\n' +
+ '// We need to implement 1D!\n' +
+ 'uniform sampler2D rampSampler;\n' +
+ 'uniform sampler2D colorSampler;\n' +
+ '\n' +
+ 'void main() {\n' +
+ ' vec4 colorMult = texture2D(rampSampler, \n' +
+ ' vec2(v_percentLife, 0.5)) * v_colorMult;\n' +
+ ' vec4 color = texture2D(colorSampler, v_texcoord) * colorMult;\n' +
+ ' gl_FragColor = color;\n' +
+ '}\n' +
'\n' +
- ' _ZZ4Sinput.percentLife = gl_TexCoord[1].x;\n' +
- ' _ZZ3SsZh0017 = sampler2D(rampSampler);\n' +
- ' _ZZ3ScZh0017 = vec2(_ZZ4Sinput.percentLife, 5.00000000E-01);\n' +
- ' _ZZ4ScolorMult = texture2D(_ZZ3SsZh0017, _ZZ3ScZh0017)*gl_TexCoord[2];\n' +
- ' _ZZ3SsZh0019 = sampler2D(colorSampler);\n' +
- ' _ZZ4Scolor = texture2D(_ZZ3SsZh0019, gl_TexCoord[0].xy)*_ZZ4ScolorMult;\n' +
- ' _ZZ3Sret_0 = _ZZ4Scolor;\n' +
- ' gl_FragColor = _ZZ4Scolor;\n' +
- ' return;\n' +
- '} // main end\n'}];
-
+ '// #o3d MatrixLoadOrder RowMajor\n'}];
/**
* Sets the shader language used. Passing 'glsl' will cause all generated