computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit e0dcc19d528ce088e27e39b20105156b27d27c26
parent dab766af6f2a3f8ce54d0ce27494bce191a30aea
Author: Adam M <aemalone@gmail.com>
Date:   Tue,  6 Aug 2019 00:28:26 -0500

Merge branch 'folypace' into laundrypoly

Diffstat:
Apresets/computerscare-boly-puttons/All A.vcvm | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apresets/computerscare-boly-puttons/All B.vcvm | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/ComputerscareFolyPace.cpp | 55++++++++++++++++++++++++++++++++++++++++++++++---------
3 files changed, 198 insertions(+), 9 deletions(-)

diff --git a/presets/computerscare-boly-puttons/All A.vcvm b/presets/computerscare-boly-puttons/All A.vcvm @@ -0,0 +1,75 @@ +{ + "id": 76, + "plugin": "computerscare", + "version": "1.0.3", + "model": "computerscare-bolyputtons", + "params": [ + { + "id": 0, + "value": 0.0 + }, + { + "id": 1, + "value": 0.0 + }, + { + "id": 2, + "value": 0.0 + }, + { + "id": 3, + "value": 0.0 + }, + { + "id": 4, + "value": 0.0 + }, + { + "id": 5, + "value": 0.0 + }, + { + "id": 6, + "value": 0.0 + }, + { + "id": 7, + "value": 0.0 + }, + { + "id": 8, + "value": 0.0 + }, + { + "id": 9, + "value": 0.0 + }, + { + "id": 10, + "value": 0.0 + }, + { + "id": 11, + "value": 0.0 + }, + { + "id": 12, + "value": 0.0 + }, + { + "id": 13, + "value": 0.0 + }, + { + "id": 14, + "value": 0.0 + }, + { + "id": 15, + "value": 0.0 + } + ], + "leftModuleId": 75, + "rightModuleId": 77, + "outputRange": 0 +} +\ No newline at end of file diff --git a/presets/computerscare-boly-puttons/All B.vcvm b/presets/computerscare-boly-puttons/All B.vcvm @@ -0,0 +1,75 @@ +{ + "id": 76, + "plugin": "computerscare", + "version": "1.0.3", + "model": "computerscare-bolyputtons", + "params": [ + { + "id": 0, + "value": 1.0 + }, + { + "id": 1, + "value": 1.0 + }, + { + "id": 2, + "value": 1.0 + }, + { + "id": 3, + "value": 1.0 + }, + { + "id": 4, + "value": 1.0 + }, + { + "id": 5, + "value": 1.0 + }, + { + "id": 6, + "value": 1.0 + }, + { + "id": 7, + "value": 1.0 + }, + { + "id": 8, + "value": 1.0 + }, + { + "id": 9, + "value": 1.0 + }, + { + "id": 10, + "value": 1.0 + }, + { + "id": 11, + "value": 1.0 + }, + { + "id": 12, + "value": 1.0 + }, + { + "id": 13, + "value": 1.0 + }, + { + "id": 14, + "value": 1.0 + }, + { + "id": 15, + "value": 1.0 + } + ], + "leftModuleId": 75, + "rightModuleId": 77, + "outputRange": 0 +} +\ No newline at end of file diff --git a/src/ComputerscareFolyPace.cpp b/src/ComputerscareFolyPace.cpp @@ -17,6 +17,8 @@ struct FolyPace : Module { LISSAJOUS_PARAM, TRIG_PARAM, EXTERNAL_PARAM, + TRIM, + OFFSET, NUM_PARAMS }; enum InputIds { @@ -55,6 +57,8 @@ struct FolyPace : Module { configParam(X_POS_PARAM, -10.f, 10.f, 0.f, "X position", " V"); configParam(Y_SCALE_PARAM, -2.f, 8.f, 0.f, "Y scale", " V/div", 1 / 2.f, 5); configParam(Y_POS_PARAM, -10.f, 10.f, 0.f, "Y position", " V"); + configParam(TRIM, -2.f, 2.f, 1.f, "Input Trim"); + configParam(OFFSET, -5.f, 5.f, 0.f, "Input Offset", " Volts"); const float timeBase = (float) BUFFER_SIZE / 6; configParam(TIME_PARAM, 6.f, 16.f, 14.f, "Time", " ms/div", 1 / 2.f, 1000 * timeBase); configParam(LISSAJOUS_PARAM, 0.f, 1.f, 0.f); @@ -235,16 +239,15 @@ struct FolyPaceDisplay : TransparentWidget { float errx = 10 + 3 * sin(M) + 4 * sin(M - 2 - 882.2); float erry = 10 + 2 * sin(J) + 4 * sin(J - erly / 20); - float irisRad = erly*0.4*(1+0.4*sin(K-D+1)); + float irisRad = erly*0.4*(1.3+0.4*sin(K-D+1)); float pupilRad = irisRad * 0.4 * (1 + 0.6*sin(E)); float gazeDir = 3.14159 * (1 + sin(B - K)); - float gazeStrength = 4 * (1.2 + 0.3 * sin(D - 1) + 0.4 * sin(1 - L / 2)); + float gazeStrength = 4 * (1.3 + 0.3 * sin(D - 1) + 0.4 * sin(1 - L / 2)); - NVGcolor irisColor = nvgHSLA(s,l,h, 0xff); + NVGcolor irisColor = nvgHSLA(l,s,h, 0xff); NVGcolor pupilColor = nvgHSLA(0.1, 0.1, 0.1, 0xff); - //assert(bufferY); //nvgSave(args.vg); Rect b = Rect(Vec(0, 0), box.size); @@ -256,17 +259,27 @@ struct FolyPaceDisplay : TransparentWidget { drawHead(args,fx,fy,frx,fry,faceColor); + + float leftEyebrowHeight = erly*(1.9 + 0.6*sin(G)+0.3*sin(K-B/2)); + float rightEyebrowHeight = erly*(1.9 + 0.6*sin(G-2.2+N)+0.2*sin(L+33)); + float leftEyebrowAngle = 0.5*sin(C)+0.2*sin(H/2-2); + float rightEyebrowAngle = 0.7*sin(F)+0.3*sin(2-I); + NVGcolor eyebrowColor = nvgHSLA(0.1,0.2,0.2,0xff); + float eyebrowThickness = 5.f * (1.3+sin(M-2)); + float eyebrowLength = frx*0.3*(2.2+sin(G)+0.4*sin(B-2)); + drawEyes(args, epx, epy, eyeSpacing, erlx, erly, 1, irisRad, pupilRad, gazeDir, gazeStrength, irisColor, pupilColor); + drawEyebrows(args,epx,epy,eyeSpacing,leftEyebrowHeight,rightEyebrowHeight,leftEyebrowAngle,rightEyebrowAngle,eyebrowColor,eyebrowThickness,eyebrowLength); float mouthX = ox; float mouthY = oy +0.5*fry*(1+0.4*sin(C/2)); float mouthWidth = frx*0.7 * (1.2 + 0.6*sin(C)); - float mouthOpen = fry*0.2*(1+sin(O)); + float mouthOpen = fry*0.06*(1+sin(O)-sin(A*2+44)); float mouthSmile = sin(D) * 2.3; float mouthSkew = sin(L) - sin(H); - float mouthThickness = 3.4f; - NVGcolor mouthLipColor = nvgHSLA(0.5f, 0.2, 0.5, 0xff); + float mouthThickness = 5.4*(sin(H)-sin(M/2)); + NVGcolor mouthLipColor = nvgHSLA(0.1*sin(N)-0.1, 0.6+0.3*sin(M), 0.5+.4*sin(I), 0xff); nvgGlobalCompositeOperation(args.vg, NVG_ATOP); @@ -278,6 +291,28 @@ struct FolyPaceDisplay : TransparentWidget { nvgResetScissor(args.vg); //nvgRestore(args.vg); } + + void drawEyebrows(const DrawArgs &args,float x,float y, float eyeSpacing,float leftEyebrowHeight,float rightEyebrowHeight,float leftEyebrowAngle,float rightEyebrowAngle,NVGcolor eyebrowColor,float eyebrowThickness,float eyebrowLength) { + nvgBeginPath(args.vg); + nvgStrokeColor(args.vg,eyebrowColor); + nvgStrokeWidth(args.vg, eyebrowThickness); + float cosLeft = cos(leftEyebrowAngle); + float sinLeft = sin(leftEyebrowAngle); + float cosRight = cos(rightEyebrowAngle); + float sinRight = sin(rightEyebrowAngle); + + float r = eyebrowLength / 2; + + nvgMoveTo(args.vg,x - eyeSpacing/2 - r * cosLeft,y - leftEyebrowHeight - r*sinLeft); + nvgLineTo(args.vg,x - eyeSpacing/2 + r * cosLeft,y - leftEyebrowHeight + r*sinLeft); + //nvgStroke(args.vg); + + nvgMoveTo(args.vg,x + eyeSpacing/2 - r * cosRight,y - rightEyebrowHeight - r*sinRight); + nvgLineTo(args.vg,x + eyeSpacing/2 + r * cosRight,y - rightEyebrowHeight + r*sinRight); + nvgStroke(args.vg); + + nvgClosePath(args.vg); + } void drawHead(const DrawArgs &args, float x, float y, float width, float height, NVGcolor color) { nvgBeginPath(args.vg); @@ -294,6 +329,7 @@ struct FolyPaceDisplay : TransparentWidget { void drawMouth(const DrawArgs &args, float x, float y, float width, float open, float smile, float skew, float thickness, NVGcolor lipColor) { nvgBeginPath(args.vg); nvgStrokeWidth(args.vg, thickness); + nvgStrokeColor(args.vg,lipColor); //nvgStrokeWidth(args.vg, 4.5f); nvgMoveTo(args.vg, x - width / 2, y - 20.f * smile); @@ -303,11 +339,12 @@ struct FolyPaceDisplay : TransparentWidget { //bottom nvgBezierTo(args.vg, x + width / 4, y + smile * open, x - width / 4, y + smile * open, x - width / 2, y - 10.f * smile); - + nvgClosePath(args.vg); nvgGlobalCompositeOperation(args.vg, NVG_ATOP); nvgFillColor(args.vg,nvgRGBA(0,0,0,0xff)); + nvgStroke(args.vg); nvgFill(args.vg); - nvgClosePath(args.vg); + } void drawEyes(const DrawArgs &args, float x, float y, float spacing, float rx, float ry, float open, float irisRad, float pupilRad, float gazeDir, float gazeStrength, NVGcolor irisColor, NVGcolor pupilColor) { float leftX = x - spacing / 2;