diff --git a/BonVision/BonVision.csproj b/BonVision/BonVision.csproj index b5de10c..c9f3a4b 100644 --- a/BonVision/BonVision.csproj +++ b/BonVision/BonVision.csproj @@ -26,10 +26,11 @@ + - - - + + + diff --git a/BonVision/Primitives/DrawModelArray.bonsai b/BonVision/Primitives/DrawModelArray.bonsai new file mode 100644 index 0000000..b8b5c1f --- /dev/null +++ b/BonVision/Primitives/DrawModelArray.bonsai @@ -0,0 +1,370 @@ + + + Draws multiple model instances using per-instance 4x3 transform matrix data array. + + + + Source1 + + + ViewMatrix + + + + + + + + + + + + Prepend + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + Prepend + 0 + + + + + + + + 0 + + + + + + + + + + Prepend + 0 + + + + + + + + 0 + + + + + + + + + + Prepend + 0 + + + + + Prepend + 1 + 1 + 1 + + + + + modelview + ModelArray + + + + + + + + normalMatrix + ModelArray + + + + ProjectionMatrix + + + + projection + ModelArray + + + + Light + + + + light + ModelArray + + + + + + + UpdateMaterial + + + + Source1 + + + + + + Eye + + 0.2 + 0.2 + 0.2 + + + + + + + + + + + + 0.2 + 0.2 + 0.2 + 1 + + + + + colorAmbient + ModelArray + + + + + + + Eye + + 0.8 + 0.8 + 0.8 + + + + + + + + + + + + 0.8 + 0.8 + 0.8 + 1 + + + + + colorDiffuse + ModelArray + + + + + + + Eye + + 0.8 + 0.8 + 0.8 + + + + + + + + + + + + 0.8 + 0.8 + 0.8 + 1 + + + + + colorSpecular + ModelArray + + + + + + + + 10 + + + + + shininess + ModelArray + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Source2 + + + + + + Item2 + + + + ModelArray + Plane + DynamicDraw + + + 3 + false + Float + 1 + + + 3 + false + Float + 1 + + + 3 + false + Float + 1 + + + 3 + false + Float + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BonVision/Primitives/DrawTexturedModelArray.bonsai b/BonVision/Primitives/DrawTexturedModelArray.bonsai new file mode 100644 index 0000000..fc41639 --- /dev/null +++ b/BonVision/Primitives/DrawTexturedModelArray.bonsai @@ -0,0 +1,370 @@ + + + Draws multiple textured model instances using per-instance 4x3 transform matrix data array. + + + + Source1 + + + ViewMatrix + + + + + + + + + + + + Prepend + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + Prepend + 0 + + + + + + + + 0 + + + + + + + + + + Prepend + 0 + + + + + + + + 0 + + + + + + + + + + Prepend + 0 + + + + + Prepend + 1 + 1 + 1 + + + + + modelview + TexturedModelArray + + + + + + + + normalMatrix + TexturedModelArray + + + + ProjectionMatrix + + + + projection + TexturedModelArray + + + + Light + + + + light + TexturedModelArray + + + + + + + UpdateMaterial + + + + Source1 + + + + + + Eye + + 0.2 + 0.2 + 0.2 + + + + + + + + + + + + 0.2 + 0.2 + 0.2 + 1 + + + + + colorAmbient + TexturedModelArray + + + + + + + Eye + + 0.8 + 0.8 + 0.8 + + + + + + + + + + + + 0.8 + 0.8 + 0.8 + 1 + + + + + colorDiffuse + TexturedModelArray + + + + + + + Eye + + 0.8 + 0.8 + 0.8 + + + + + + + + + + + + 0.8 + 0.8 + 0.8 + 1 + + + + + colorSpecular + TexturedModelArray + + + + + + + + 10 + + + + + shininess + TexturedModelArray + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Source2 + + + + + + Item2 + + + + TexturedModelArray + Plane + DynamicDraw + + + 3 + false + Float + 1 + + + 3 + false + Float + 1 + + + 3 + false + Float + 1 + + + 3 + false + Float + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BonVision/Shaders/ModelArray.vert b/BonVision/Shaders/ModelArray.vert new file mode 100644 index 0000000..442ecc4 --- /dev/null +++ b/BonVision/Shaders/ModelArray.vert @@ -0,0 +1,21 @@ +#version 400 +uniform mat4 modelview; +uniform mat4 projection; +uniform mat4 normalMatrix; +layout(location = 0) in vec3 vp; +layout(location = 1) in vec3 vn; +layout(location = 2) in vec3 mt; +layout(location = 3) in vec3 mr0; +layout(location = 4) in vec3 mr1; +layout(location = 5) in vec3 mr2; +out vec3 position; +out vec3 normal; + +void main() +{ + mat3 mr = mat3(mr0, mr1, mr2); + vec4 v = modelview * vec4(mr * vp + mt, 1.0); + gl_Position = projection * v; + position = vec3(v); + normal = normalize(vec3(normalMatrix * vec4(mr * vn, 0.0))); +} diff --git a/BonVision/Shaders/TexturedModelArray.vert b/BonVision/Shaders/TexturedModelArray.vert new file mode 100644 index 0000000..429fb33 --- /dev/null +++ b/BonVision/Shaders/TexturedModelArray.vert @@ -0,0 +1,24 @@ +#version 400 +uniform mat4 modelview; +uniform mat4 projection; +uniform mat4 normalMatrix; +layout(location = 0) in vec3 vp; +layout(location = 1) in vec2 vt; +layout(location = 2) in vec3 vn; +layout(location = 3) in vec3 mt; +layout(location = 4) in vec3 mr0; +layout(location = 5) in vec3 mr1; +layout(location = 6) in vec3 mr2; +out vec3 position; +out vec2 texCoord; +out vec3 normal; + +void main() +{ + mat3 mr = mat3(mr0, mr1, mr2); + vec4 v = modelview * vec4(mr * vp + mt, 1.0); + gl_Position = projection * v; + position = vec3(v); + texCoord = vt; + normal = normalize(vec3(normalMatrix * vec4(mr * vn, 0.0))); +}