- !!ARBvp1.0
- # Eingangsattribute
- ATTRIB iPos = vertex.position;
- ATTRIB iNormal = vertex.normal;
- # Programmparameter
- PARAM mvinv[4] = { state.matrix.modelview.invtrans };
- PARAM mvp[4] = { state.matrix.mvp };
- PARAM lightDir = state.light[0].position;
- PARAM halfDir = state.light[0].half;
- PARAM specExp = state.material.shininess;
- PARAM ambientCol = state.lightprod[0].ambient;
- PARAM diffuseCol = state.lightprod[0].diffuse;
- PARAM specularCol = state.lightprod[0].specular;
- # Temporäre Variablen
- TEMP eyeNormal, temp, dots, lightcoefs;
- # Ausgangsattribute
- OUTPUT oPos = result.position;
- OUTPUT oColor = result.color;
- # Vertex in Clipkoordinaten umwandeln
- DP4 oPos.x, mvp[0], iPos;
- DP4 oPos.y, mvp[1], iPos;
- DP4 oPos.z, mvp[2], iPos;
- DP4 oPos.w, mvp[3], iPos;
- # Normale in eyespace transformieren
- DP3 eyeNormal.x, mvinv[0], iNormal;
- DP3 eyeNormal.y, mvinv[1], iNormal;
- DP3 eyeNormal.z, mvinv[2], iNormal;
- # Diffuses und spekulatives Punktprodukt berechnen
- # und unter Nutzung von LIT die
- # Beleuchtungskoeffizienten berechnen
- DP3 dots.x, eyeNormal, lightDir;
- DP3 dots.y, eyeNormal, halfDir;
- MOV dots.w, specExp.x;
- LIT lightcoefs, dots;
- # Farbbestandteile sammeln und addieren
- MAD temp, lightcoefs.y, diffuseCol, ambientCol;
- MAD oColor.xyz, lightcoefs.z, specularCol, temp;
- MOV oColor.w, diffuseCol.w;
- MUL oColor.xyz, temp, vertex.color.primary;
- # Texturkoordinaten durchschleifen
- MOV result.texcoord, vertex.texcoord;
- END