- milkshapeviewerxna.zip
- MilkshapeViewer - Copy
- MilkshapeViewer.sln
- MilkshapeViewer
- bin
- x86
- Debug
- Content
- VertexShader.xnb
- MilkshapeViewer.exe
- model
- axe.jpg
- diablo.ms3d
- dwarf.jpg
- dwarf1.ms3d
- dwarf2.jpg
- dwarf2.ms3d
- Content
- bin
- x86
- Debug
- Content.contentproj
- MilkshapeViewerContent.contentproj
- VertexShader.fx
- Game.ico
- Game1.cs
- GameThumbnail.png
- MilkshapeModels
- MilkshapeViewer.csproj
- MilkshapeViewer.csproj.Debug.cachefile
- model
- axe.jpg
- diablo.ms3d
- dwarf.jpg
- dwarf1.ms3d
- dwarf2.jpg
- dwarf2.ms3d
- Program.cs
- Properties
- viewappletcode.zip
- ViewAppletCode
- CubeViewApplet
- applet.policy
- build.xml
- build
- dist
- nbproject
- src
- Cube
- Grizle
- Models
- TestJApplet
- test
- WebApplication
- build.xml
- build
- dist
- nbproject
- Shaders
- src
- test
- web
- axe.jpg
- diablo.ms3d
- dwarf.jpg
- dwarf1.ms3d
- dwarf2.jpg
- dwarf2.ms3d
- index.jsp
- jars
- META-INF
- README.txt
- Shaders
- spheremap.bmp
- test.ms3d
- top.jpg
- WEB-INF
- viewappletcode.zip
|
/*
------------------------------------------------------------------------------------------
Author:
Boroş Tiberiu
Administrator Sistem Tel.: +40745310081
Institutul de Cercetări pentru Inteligenţă Artificială,
Academia Română
Calea 13 Septembrie, Nr. 13, CASA ACADEMIEI, Bucuresti 050711, ROMANIA
Tel.: +40-(0)213188103
Fax: +40-(0)213188142
E-mail: office@racai.ro
Web: http://www.racai.ro
------------------------------------------------------------------------------------------
*/
attribute vec4 position;
attribute vec3 normal;
attribute vec4 weight;
attribute vec4 index;
attribute float numBones;
uniform mat4 matGlobal[100];
uniform mat4 matGlobalSkeleton[100];
uniform vec4 color;
uniform vec4 lightPos;
float DotProduct(in vec4 x, in vec4 y) {
return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
}
void VectorRotate(in vec4 in1, in mat4 in2, out vec4 rez) {
rez[0] = DotProduct(in1, in2[0]);
rez[1] = DotProduct(in1, in2[1]);
rez[2] = DotProduct(in1, in2[2]);
}
void VectorIRotate(in vec4 in1, in mat4 in2, out vec4 rez) {
rez[0] = in1[0] * in2[0][0] + in1[1] * in2[1][0] + in1[2] * in2[2][0];
rez[1] = in1[0] * in2[0][1] + in1[1] * in2[1][1] + in1[2] * in2[2][1];
rez[2] = in1[0] * in2[0][2] + in1[1] * in2[1][2] + in1[2] * in2[2][2];
}
void VectorTransform(in vec4 in1,in mat4 in2, out vec4 rez) {
rez[0] = DotProduct(in1, in2[0]) + in2[0][3];
rez[1] = DotProduct(in1, in2[1]) + in2[1][3];
rez[2] = DotProduct(in1, in2[2]) + in2[2][3];
}
void VectorITransform(in vec4 in1, in mat4 in2, out vec4 rez) {
vec4 tmp;
tmp[0] = in1[0] - in2[0][3];
tmp[1] = in1[1] - in2[1][3];
tmp[2] = in1[2] - in2[2][3];
VectorIRotate(tmp, in2, rez);
}
void main()
{
vec4 transformedPosition = vec4(0.0);
vec3 transformedNormal = vec3(0.0);
vec4 curIndex = index;
vec4 curWeight = weight;
for (int i = 0; i < int(numBones); i++)
{
mat4 g44 = matGlobal[int(curIndex.x)];
mat4 s44 = matGlobalSkeleton[int(curIndex.x)];
vec4 vert = vec4(0);
vec4 norm = vec4(0);
vec4 tmpNorm = vec4(0);
vec4 tmpVert = vec4(0);
VectorITransform(gl_Vertex, s44, tmpVert);
VectorTransform(tmpVert, g44, vert);
vert[3]=1;
transformedPosition += vert * curWeight.x;
vec4 preNormal=vec4(normal.xyz,1);
VectorIRotate(preNormal, s44, tmpNorm);
VectorRotate(tmpNorm, g44, norm);
norm[3]=1;
transformedNormal += vec3(norm.xyz) * curWeight.x;
// shiftam sa avem urmatoarele valori pentru pondere si indice de os
curIndex = curIndex.yzwx;
curWeight = curWeight.yzwx;
}
gl_Position = gl_ModelViewProjectionMatrix * transformedPosition;
transformedNormal = normalize(transformedNormal);
gl_FrontColor = dot(transformedNormal, lightPos.xyz) * color;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.