public void ChangeParameter(PARAMS parameter, float duration, float intensity, int priority = 0) { // Duration and priority will be set to one KeyFramedGesture changeParam = new KeyFramedGesture("Change " + parameter.ToString(), new List <float> { 1 }, new List <keyFramedPARAM> { new keyFramedPARAM(parameter, new List <float> { 1 }) }); //Call the gesture with the right duration and intensity Gesture(changeParam, priority, duration, intensity); }
public keyFramedPARAM(PARAMS param, List <float> keyframeValues) { this.param = param; this.keyFrameValues = keyframeValues; }
public static void CreateSphericalData(int width, int height, PARAMS parameters, ref Color[] spherical, ref Color[] left, ref Color[] right, ref Color[] front, ref Color[] back, ref Color[] down, ref Color[] top) { int i, j, k, aj, ai, index, found, u = 0, v = 0; double x, y, longitude, latitude, denom, mu; double rsum, gsum, bsum; XYZ p = new XYZ(); p.x = 0; p.y = 0; p.z = 0; XYZ q = new XYZ(); q.x = 0; q.y = 0; q.z = 0; for (j = 0; j < parameters.outheight; j++) { for (i = 0; i < parameters.outwidth; i++) { if (i < parameters.width1 || i >= parameters.width2) // Subset image { continue; } // Supersampling antialising sum rsum = 0; gsum = 0; bsum = 0; // Antialiasing loops for (ai = 0; ai < parameters.antialias; ai++) { x = (i + ai / (double)parameters.antialias) / (double)parameters.outwidth; // 0 ... 1 for (aj = 0; aj < parameters.antialias; aj++) { y = 2 * (j + aj / (double)parameters.antialias) / (double)parameters.outheight - 1; // -1 ... 1 // Calculate latitude and longitude if (parameters.usesine) { latitude = Math.Asin(y); } else { latitude = y * 0.5 * Math.PI; // -pi/2 ... pi/2 } longitude = x * 2 * Math.PI; // 0 ... 2pi // p is the ray from the camera position into the scene p.x = Math.Cos(latitude) * Math.Cos(longitude); p.y = Math.Sin(latitude); p.z = Math.Cos(latitude) * Math.Sin(longitude); // Apply rotation aboutup vector p = TextureTools.RotateSphericalY(p, parameters.thetay); // Find which face the vector intersects found = -1; for (k = 0; k < 6; k++) { denom = -(parameters.faces[k].a * p.x + parameters.faces[k].b * p.y + parameters.faces[k].c * p.z); // Is p parallel to face? Shouldn't actually happen. if (Math.Abs(denom) < 0.000001) { continue; } // Is the intersection on the back pointing ray? if ((mu = parameters.faces[k].d / denom) < 0) { continue; } // q is the intersection point q.x = mu * p.x; q.y = mu * p.y; q.z = mu * p.z; // Find out which face it is on switch (k) { case LEFT: case RIGHT: if (q.y <= 1 && q.y >= -1 && q.z <= 1 && q.z >= -1) { found = k; } if (parameters.eac) { q.y = Math.Atan(q.y) * 4 / Math.PI; q.z = Math.Atan(q.z) * 4 / Math.PI; } break; case FRONT: case BACK: if (q.x <= 1 && q.x >= -1 && q.y <= 1 && q.y >= -1) { found = k; } if (parameters.eac) { q.x = Math.Atan(q.x) * 4 / Math.PI; q.y = Math.Atan(q.y) * 4 / Math.PI; } break; case TOP: case DOWN: if (q.x <= 1 && q.x >= -1 && q.z <= 1 && q.z >= -1) { found = k; } if (parameters.eac) { q.x = Math.Atan(q.x) * 4 / Math.PI; q.z = Math.Atan(q.z) * 4 / Math.PI; } break; } if (found >= 0) { break; } } if (found < 0 || found > 5) { UnityEngine.Debug.LogWarning("TEXTURE: Didn't find an intersecting face - shouldn't happen!"); continue; } // Determine the u,v coordinate switch (found) { case LEFT: u = (int)(0.5 * width * (q.z + 1)); v = (int)(0.5 * height * (q.y + 1)); break; case RIGHT: u = (int)(0.5 * width * (1 - q.z)); v = (int)(0.5 * height * (q.y + 1)); break; case FRONT: u = (int)(0.5 * width * (1 - q.x)); v = (int)(0.5 * height * (q.y + 1)); break; case BACK: u = (int)(0.5 * width * (q.x + 1)); v = (int)(0.5 * height * (q.y + 1)); break; case DOWN: u = (int)(0.5 * width * (1 - q.x)); v = (int)(0.5 * height * (1 + q.z)); break; case TOP: u = (int)(0.5 * width * (1 - q.x)); v = (int)(0.5 * height * (1 - q.z)); break; } if (u >= width) { u = width - 1; } if (v >= height) { v = height - 1; } if (u < 0 || u >= width || v < 0 || v >= height) { UnityEngine.Debug.LogWarning(String.Format("TEXTURE: Illegal (u,v) coordinate ({1},{2}) on face {3}", u, v, found)); continue; } // Sum over the supersampling set index = v * width + u; switch (found) { case LEFT: rsum += left[index].r; gsum += left[index].g; bsum += left[index].b; break; case RIGHT: rsum += right[index].r; gsum += right[index].g; bsum += right[index].b; break; case FRONT: rsum += front[index].r; gsum += front[index].g; bsum += front[index].b; break; case BACK: rsum += back[index].r; gsum += back[index].g; bsum += back[index].b; break; case DOWN: rsum += down[index].r; gsum += down[index].g; bsum += down[index].b; break; case TOP: rsum += top[index].r; gsum += top[index].g; bsum += top[index].b; break; } } } // Finally update the spherical image index = j * (parameters.width2 - parameters.width1) + i - parameters.width1; spherical[index].r = (float)rsum / (parameters.antialias * parameters.antialias); spherical[index].g = (float)gsum / (parameters.antialias * parameters.antialias); spherical[index].b = (float)bsum / (parameters.antialias * parameters.antialias); } } }