This repository has been archived by the owner on Dec 31, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reinforced vbo loading so that shader attributes can vary. Testing he…
…re with no normals.
- Loading branch information
Showing
11 changed files
with
116 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifdef GL_ES | ||
precision highp float; | ||
#endif | ||
|
||
varying vec2 Tc; | ||
varying vec3 V; | ||
|
||
uniform sampler2D texture; | ||
|
||
void main (void) | ||
{ | ||
vec4 Dm = texture2D( texture, Tc ); | ||
|
||
vec3 L = normalize(gl_LightSource[0].position.xyz); | ||
vec3 E = normalize(-V); | ||
|
||
vec4 Iamb = gl_FrontLightProduct[0].ambient * Dm; | ||
vec4 Idiff = gl_FrontLightProduct[0].diffuse * Dm; | ||
|
||
gl_FragColor = gl_FrontMaterial.emission + Iamb + Idiff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const int MAXBONES = 92; | ||
|
||
attribute vec3 position; | ||
attribute vec2 texcoord; | ||
attribute vec4 boneWeights; | ||
attribute vec4 boneIndices; | ||
|
||
uniform bool isAnimated; | ||
uniform mat4 boneMatrices[MAXBONES]; | ||
uniform mat4 invTransposeMatrices[MAXBONES]; | ||
|
||
varying vec2 Tc; | ||
varying vec3 V; | ||
|
||
void main() | ||
{ | ||
vec4 pos = vec4(position, 1.0); | ||
if( isAnimated ) { | ||
pos = boneMatrices[int(boneIndices.x)] * pos * boneWeights.x + | ||
boneMatrices[int(boneIndices.y)] * pos * boneWeights.y + | ||
boneMatrices[int(boneIndices.z)] * pos * boneWeights.z + | ||
boneMatrices[int(boneIndices.w)] * pos * boneWeights.w ; | ||
|
||
pos.w = 1.0; | ||
} | ||
V = (gl_ModelViewMatrix * pos).xyz; | ||
Tc = texcoord; | ||
gl_Position = gl_ModelViewProjectionMatrix * pos; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#pragma once | ||
#include "cinder/CinderResources.h" | ||
|
||
#define RES_SKINNING_VERT CINDER_RESOURCE( ../../../resources/, skinning_vert_normals.glsl, 128, GLSL ) | ||
#define RES_SKINNING_FRAG CINDER_RESOURCE( ../../../resources/, skinning_frag_normals.glsl, 129, GLSL ) | ||
#define RES_SKINNING_VERT CINDER_RESOURCE( ../../../resources/, skinning_vert_normals.glsl, 128, GLSL ) | ||
#define RES_SKINNING_FRAG CINDER_RESOURCE( ../../../resources/, skinning_frag_normals.glsl, 129, GLSL ) | ||
#define RES_SKINNING_VERT_NO_NORMALS CINDER_RESOURCE( ../../../resources/, skinning_vert_no_normals.glsl, 130, GLSL ) | ||
#define RES_SKINNING_FRAG_NO_NORMALS CINDER_RESOURCE( ../../../resources/, skinning_frag_no_normals.glsl, 131, GLSL ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters