From 6b5876e76e17c892721151d55b1d74914cee187c Mon Sep 17 00:00:00 2001 From: bruno-f-cruz Date: Wed, 23 Aug 2023 10:59:38 -0700 Subject: [PATCH 1/3] Enable native debugging mode --- BonVision/Properties/launchSettings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BonVision/Properties/launchSettings.json b/BonVision/Properties/launchSettings.json index ee1d35e..d17951e 100644 --- a/BonVision/Properties/launchSettings.json +++ b/BonVision/Properties/launchSettings.json @@ -3,7 +3,8 @@ "Bonsai": { "commandName": "Executable", "executablePath": "$(registry:HKEY_CURRENT_USER\\Software\\Goncalo Lopes\\Bonsai@InstallDir)Bonsai.exe", - "commandLineArgs": "--lib:$(TargetDir)." + "commandLineArgs": "--lib:$(TargetDir).", + "nativeDebugging": true } } } \ No newline at end of file From 449a3cb90b4c657f78abe01e0c774e9a7e85703e Mon Sep 17 00:00:00 2001 From: bruno-f-cruz Date: Wed, 23 Aug 2023 11:00:08 -0700 Subject: [PATCH 2/3] Add Shift and Scale uniforms --- BonVision/Shaders/TexturedModel.frag | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BonVision/Shaders/TexturedModel.frag b/BonVision/Shaders/TexturedModel.frag index f745747..62c0647 100644 --- a/BonVision/Shaders/TexturedModel.frag +++ b/BonVision/Shaders/TexturedModel.frag @@ -1,4 +1,6 @@ #version 400 +uniform vec2 shift; +uniform vec2 scale = vec2(1, 1); uniform vec4 colorAmbient; uniform vec4 colorDiffuse; uniform vec4 colorSpecular; @@ -15,11 +17,11 @@ void main() vec3 L = normalize(light - position); vec3 R = normalize(-reflect(L, normal)); vec3 V = normalize(-position); - vec4 texel = texture(textureDiffuse, texCoord); + vec4 texel = texture(textureDiffuse, texCoord * scale + shift); vec4 Iamb = colorAmbient * texel; vec4 Idiff = colorDiffuse * vec4(texel.rgb * max(dot(normal, L), 0.0), texel.a); vec4 Ispec = vec4(colorSpecular.rgb * pow(max(dot(R, V), 0.0), shininess), colorSpecular.a * texel.a); fragColor = Iamb + Idiff + Ispec; -} +} \ No newline at end of file From bee800af0ef8d556a7aa17e9cc07329b0d0b2751 Mon Sep 17 00:00:00 2001 From: bruno-f-cruz Date: Wed, 23 Aug 2023 11:01:17 -0700 Subject: [PATCH 3/3] Expose Scaling and Shift in primitives --- BonVision/Primitives/DrawTexturedModel.bonsai | 135 ++++++++++++----- .../Primitives/DrawTexturedModelArray.bonsai | 143 +++++++++++++----- 2 files changed, 198 insertions(+), 80 deletions(-) diff --git a/BonVision/Primitives/DrawTexturedModel.bonsai b/BonVision/Primitives/DrawTexturedModel.bonsai index e2b6baf..d879e84 100644 --- a/BonVision/Primitives/DrawTexturedModel.bonsai +++ b/BonVision/Primitives/DrawTexturedModel.bonsai @@ -1,12 +1,11 @@  - - Draws a textured and transformed 3D model stimulus. @@ -28,20 +27,6 @@ 0 - - - - - - - - - - - - - - @@ -99,6 +84,11 @@ 0 + + + + + Prepend @@ -143,6 +133,12 @@ + + + + + + UpdateMaterial @@ -285,6 +281,67 @@ + + + + + + + + TextureScaleShift + + + + Source1 + + + + + + + + 1 + 1 + + + + + scale + TexturedModel + + + + + + + + + 0 + 0 + + + + + shift + TexturedModel + + + + + + + + + + + + + + + + + + TexturedModel @@ -295,37 +352,39 @@ + - - - - - - + + + + + - - - + + + - - - - - + + + + + - + - + - - - - - - + + + + + + + + \ No newline at end of file diff --git a/BonVision/Primitives/DrawTexturedModelArray.bonsai b/BonVision/Primitives/DrawTexturedModelArray.bonsai index 9b0209e..9ef121e 100644 --- a/BonVision/Primitives/DrawTexturedModelArray.bonsai +++ b/BonVision/Primitives/DrawTexturedModelArray.bonsai @@ -1,12 +1,11 @@  - - Draws multiple textured model instances using per-instance 4x3 transform matrix data array. @@ -15,9 +14,6 @@ ViewMatrix - - - @@ -31,17 +27,6 @@ 0 - - - - - - - - - - - @@ -99,6 +84,11 @@ 0 + + + + + Prepend @@ -143,6 +133,12 @@ + + + + + + UpdateMaterial @@ -285,6 +281,64 @@ + + + + + + + + TextureScaleShift + + + + Source1 + + + + + + + + 1 + 1 + + + + + scale + TexturedModelArray + + + + + + + + + 0 + 0 + + + + + shift + TexturedModelArray + + + + + + + + + + + + + + + Source2 @@ -294,6 +348,9 @@ Item2 + + + TexturedModelArray @@ -331,40 +388,42 @@ + - - - - - - - - + + + + + + + - - - + + + - - - - - + + + + + - + - + - - - - - - - + + + + + + + - + + + \ No newline at end of file