/// Calculates an approximate inverse to the given radial distortion parameters. public static Distortion ApproximateInverse(Distortion distort, float maxRadius = 1, int numSamples = 10) { const int numCoefficients = 2; // R + k1*R^3 + k2*R^5 = r, with R = rp = distort(r) // Repeating for numSamples: // [ R0^3, R0^5 ] * [ K1 ] = [ r0 - R0 ] // [ R1^3, R1^5 ] [ K2 ] [ r1 - R1 ] // [ R2^3, R2^5 ] [ r2 - R2 ] // [ etc... ] [ etc... ] // That is: // matA * [K1, K2] = y // Solve: // [K1, K2] = inverse(transpose(matA) * matA) * transpose(matA) * y double[,] matA = new double[numSamples, numCoefficients]; double[] vecY = new double[numSamples]; for (int i = 0; i < numSamples; ++i) { float r = maxRadius * (i + 1) / (float)numSamples; double rp = distort.distort(r); double v = rp; for (int j = 0; j < numCoefficients; ++j) { v *= rp * rp; matA[i, j] = v; } vecY[i] = r - rp; } double[] vecK = solveLeastSquares(matA, vecY); return(new Distortion { k1 = (float)vecK[0], k2 = (float)vecK[1] }); }
public static Task <byte[]> GenerateAsync( ShaderStage stage, Albedo albedo, Bump_Mapping bump_mapping, Alpha_Test alpha_test, Specular_Mask specular_mask, Material_Model material_model, Environment_Mapping environment_mapping, Self_Illumination self_illumination, Blend_Mode blend_mode, Parallax parallax, Misc misc, Distortion distortion, Soft_fade soft_fade ) { return(Task.Run(() => GenerateShader( stage, albedo, bump_mapping, alpha_test, specular_mask, material_model, environment_mapping, self_illumination, blend_mode, parallax, misc, distortion, soft_fade ))); }
public static void EnableDistortion(Material material, Distortion type) { for (int a = 0; a < DISTORTION.Length; ++a) { material.DisableKeyword(DISTORTION[a]); } material.EnableKeyword(DISTORTION[(int)type]); }
protected Distortion RemoveAura() { if (selectionHighLight != null) { selectionHighLight.Die(); selectionHighLight = null; } return(null); }
void UpdateViewAndMaterialParameters(HmdParameters hmd, DisplayParameters display) { Distortion distortion = new Distortion(hmd.DistortionK1, hmd.DistortionK2); distortion.DistortionK1 = hmd.DistortionK1; distortion.DistortionK2 = hmd.DistortionK2; float zNear = _camWorldLeft.nearClipPlane; float zFar = _camWorldLeft.farClipPlane; Fov displayDistancesLeft = Calculator.GetFovDistancesLeft(display, hmd); // То, как должен видеть левый глаз свой кусок экрана. Без линзы. C учётом только размеров дисплея Fov fovDisplayTanAngles = displayDistancesLeft / hmd.ScreenToLensDist; // FoV шлема Fov hmdMaxFovTanAngles = Fov.AnglesToTanAngles(hmd.MaxFovAngles); // То, как должен видеть левый глаз свой кусок экрана. Без линзы. C учётом размеров дисплея и FoV шлема Fov fovEyeTanAglesLeft = Fov.Min(fovDisplayTanAngles, hmdMaxFovTanAngles); // То, как должен видеть левый глаз. Мнимое изображение (после увеличения идеальной линзой без искажений). С широким углом. Именно так надо снять сцену Fov fovWorldTanAnglesLeft = Calculator.DistortTanAngles(fovEyeTanAglesLeft, distortion); Matrix4x4 projWorldLeft; Matrix4x4 projWorldRight; Calculator.ComposeProjectionMatricesFromFovTanAngles(fovWorldTanAnglesLeft, zNear, zFar, out projWorldLeft, out projWorldRight); Matrix4x4 projEyeLeft; Matrix4x4 projEyeRight; Calculator.ComposeProjectionMatricesFromFovTanAngles(fovDisplayTanAngles, zNear, zFar, out projEyeLeft, out projEyeRight); _camWorldLeft.transform.localPosition = 0.5f * Vector3.left * hmd.InterlensDistance; _camWorldRight.transform.localPosition = 0.5f * Vector3.right * hmd.InterlensDistance; _camEyeLeft.transform.localPosition = 0.5f * Vector3.left * hmd.InterlensDistance; _camEyeRight.transform.localPosition = 0.5f * Vector3.right * hmd.InterlensDistance; _camWorldLeft.projectionMatrix = projWorldLeft; _camWorldRight.projectionMatrix = projWorldRight; _camWorldLeftScaler.SetFov(fovWorldTanAnglesLeft); _camWorldRightScaler.SetFov(fovWorldTanAnglesLeft.GetFlippedHorizontally()); _camEyeLeft.projectionMatrix = projEyeLeft; _camEyeRight.projectionMatrix = projEyeRight; EyeMaterialLeft.SetFloat("_DistortionK1", hmd.DistortionK1); EyeMaterialRight.SetFloat("_DistortionK1", hmd.DistortionK1); EyeMaterialLeft.SetFloat("_DistortionK2", hmd.DistortionK2); EyeMaterialRight.SetFloat("_DistortionK2", hmd.DistortionK2); }
public CameraCalibrationResult(int _width, int _height, Extrinsics __extrinsics, Intrinsics __intrinsics, Distortion __distortion, double _error) { width = _width; height = _height; this._extrinsics = __extrinsics; this._intrinsics = __intrinsics; this._distortion = __distortion; error = _error; }
public static ShaderGeneratorResult GenerateShader( ShaderStage stage, Albedo albedo, Bump_Mapping bump_mapping, Alpha_Test alpha_test, Specular_Mask specular_mask, Material_Model material_model, Environment_Mapping environment_mapping, Self_Illumination self_illumination, Blend_Mode blend_mode, Parallax parallax, Misc misc, Distortion distortion, Soft_fade soft_fade ) { if (!HaloShaderGeneratorPrivate.IsBaseDLLLoaded) { return(null); } Type shadergeneratortype = HaloShaderGeneratorPrivate.HaloShaderGeneratorAssembly.ExportedTypes.Where(t => t.Name == "ShaderGenerator").FirstOrDefault(); if (shadergeneratortype == null) { return(null); } var result = (byte[])shadergeneratortype.GetMethod("GenerateShader").Invoke(null, new object[] { stage, albedo, bump_mapping, alpha_test, specular_mask, material_model, environment_mapping, self_illumination, blend_mode, parallax, misc, distortion, soft_fade }); if (result == null) { return(null); } return(new ShaderGeneratorResult(result)); }
private void Awake() { if (Instance != null) { Destroy(Instance.gameObject); } Instance = this; DontDestroyOnLoad(gameObject); m_distortion = new Distortion(); m_audioDistorter = GetComponent <AudioDistortion>(); m_audioDistorter.SetDistortion(m_distortion); }
public CubicHermiteSpline(Distortion distortion, float[] x) { _x = x; _fx = new float[x.Length]; _dfx = new float[x.Length]; for (int i = 0; i < x.Length; ++i) { // Значения обратной функции в узлах считается численно _fx[i] = distortion.Undistort(x[i]); // Значение производной обратной функции == 1 / производную прямой функции _dfx[i] = 1f / distortion.DistortDerivative(_fx[i]); } }
protected Distortion MakeAura(GameThing thing) { if (selectionHighLight != null) { if (selectionHighLight.Owner == thing) { return(selectionHighLight); } RemoveAura(); } selectionHighLight = parent.MakeAura(thing); return(selectionHighLight); }
public DeckViewModel() { _progressBarTimer = new Timer(100); _progressBarTimer.Elapsed += (s, e) => { if (!IsDragging) { OnPropertyChanged(nameof(Position)); } }; Player.MediaEnded += (s, e) => { Player.Stop(); Position = Player.Reverse ? Player.Duration.TotalSeconds : 0; _progressBarTimer.Stop(); }; Reverb.ApplyOn(Player); Distortion.ApplyOn(Player); Echo.ApplyOn(Player); AutoWah.ApplyOn(Player); Rotate.ApplyOn(Player); #region Commands PlayCommand = new DelegateCommand(Play); StopCommand = new DelegateCommand(Stop); SoftDistortionCommand = new DelegateCommand(Distortion.Soft); MediumDistortionCommand = new DelegateCommand(Distortion.Medium); HardDistortionCommand = new DelegateCommand(Distortion.Hard); VeryHardDistortionCommand = new DelegateCommand(Distortion.VeryHard); ManyEchoesCommand = new DelegateCommand(Echo.ManyEchoes); ReverseEchoesCommand = new DelegateCommand(Echo.ReverseEchoes); RoboticEchoesCommand = new DelegateCommand(Echo.RoboticVoice); SmallEchoesCommand = new DelegateCommand(Echo.Small); SlowAutoWahCommand = new DelegateCommand(AutoWah.Slow); FastAutoWahCommand = new DelegateCommand(AutoWah.Fast); HiFastAutoWahCommand = new DelegateCommand(AutoWah.HiFast); ResetPitchCommand = new DelegateCommand(() => Player.Pitch = 0); ResetFrequencyCommand = new DelegateCommand(() => Player.Frequency = 44100); ResetPanCommand = new DelegateCommand(() => Player.Balance = 0); ResetTempoCommand = new DelegateCommand(() => Player.Tempo = 0); #endregion }
/// <summary> /// Runs the filter on the image using the specific filter /// type's ProcessBlock method. /// </summary> private void RunFilter(String filter, EffectParameters param, ref FloatToInt[] input, ref FloatToInt[] output, int length) { switch (filter) { case "Echo": Echo echo = new Echo((EchoParameters)param); echo.ProcessBlock(ref input, ref output, input.Length); break; case "Amplify": Amplify amplify = new Amplify((AmplifyParameters)param); amplify.ProcessBlock(ref input, ref output, input.Length); break; case "Bass Boost": BassBoost BassBoost = new BassBoost((BassBoostParameters)param); BassBoost.ProcessBlock(ref input, ref output, input.Length); break; case "Phaser": Phaser Phaser = new Phaser((PhaserParameters)param); Phaser.ProcessBlock(ref input, ref output, input.Length); break; case "Fade In": FadeIn FadeIn = new FadeIn((FadeInParameters)param); FadeIn.ProcessBlock(ref input, ref output, input.Length); break; case "Fade Out": FadeOut FadeOut = new FadeOut((FadeOutParameters)param); FadeOut.ProcessBlock(ref input, ref output, input.Length); break; case "Distortion": Distortion distortion = new Distortion((DistortionParameters)param); distortion.ProcessBlock(ref input, ref output, input.Length); break; default: StatusText.Content = "Invalid filter"; break; } }
/// Calculates an approximate inverse to the given radial distortion parameters. public static Distortion ApproximateInverse(Distortion distort, float maxRadius = 1, int numSamples = 100) { const int numCoefficients = 6; // R + K1*R^3 + K2*R^5 = r, with R = rp = distort(r) // Repeating for numSamples: // [ R0^3, R0^5 ] * [ K1 ] = [ r0 - R0 ] // [ R1^3, R1^5 ] [ K2 ] [ r1 - R1 ] // [ R2^3, R2^5 ] [ r2 - R2 ] // [ etc... ] [ etc... ] // That is: // matA * [K1, K2] = y // Solve: // [K1, K2] = inverse(transpose(matA) * matA) * transpose(matA) * y double[,] matA = new double[numSamples, numCoefficients]; double[] vecY = new double[numSamples]; for (int i = 0; i < numSamples; ++i) { float r = maxRadius * (i + 1) / (float)numSamples; double rp = distort.distort(r); double v = rp; for (int j = 0; j < numCoefficients; ++j) { v *= rp * rp; matA[i, j] = v; } vecY[i] = r - rp; } double[] vecK = solveLeastSquares(matA, vecY); // Convert to float for use in a fresh Distortion object. float[] coefficients = new float[vecK.Length]; for (int i = 0; i < vecK.Length; ++i) { coefficients[i] = (float)vecK[i]; } return(new Distortion { Coef = coefficients }); }
public void Write(XmlElement parent) { XmlElement me = parent.OwnerDocument.CreateElement("CameraCalibrationData"); if (Rotation != null) { Rotation.Write(me, "rotation"); } if (Translation != null) { Translation.Write(me, "translation"); } if (Intrinsic != null) { Intrinsic.Write(me, "intrinsic"); } if (Distortion != null) { Distortion.Write(me, "distortion"); } parent.AppendChild(me); }
/// The projection matrix for a given eye. /// This matrix is an off-axis perspective projection with near and far /// clipping planes of 1m and 1000m, respectively. The CardboardEye script /// takes care of adjusting the matrix for its particular camera. public Matrix4x4 Projection(Eye eye, Distortion distortion = Distortion.Distorted) { return(device.GetProjection(eye, distortion)); }
public ProjectorCalibrationResult(int _width, int _height, Extrinsics _extrinsics, Intrinsics _intrinsics, Distortion _distortion, double _error) : base(_width, _height, _extrinsics, _intrinsics, _distortion, _error) { }
/// Calculates an approximate inverse to the given radial distortion parameters. public static Distortion ApproximateInverse(Distortion distort, float maxRadius = 1, int numSamples = 100) { const int numCoefficients = 6; // R + K1*R^3 + K2*R^5 = r, with R = rp = distort(r) // Repeating for numSamples: // [ R0^3, R0^5 ] * [ K1 ] = [ r0 - R0 ] // [ R1^3, R1^5 ] [ K2 ] [ r1 - R1 ] // [ R2^3, R2^5 ] [ r2 - R2 ] // [ etc... ] [ etc... ] // That is: // matA * [K1, K2] = y // Solve: // [K1, K2] = inverse(transpose(matA) * matA) * transpose(matA) * y double[,] matA = new double[numSamples, numCoefficients]; double[] vecY = new double[numSamples]; for (int i = 0; i < numSamples; ++i) { float r = maxRadius * (i + 1) / (float) numSamples; double rp = distort.distort(r); double v = rp; for (int j = 0; j < numCoefficients; ++j) { v *= rp * rp; matA[i, j] = v; } vecY[i] = r - rp; } double[] vecK = solveLeastSquares(matA, vecY); // Convert to float for use in a fresh Distortion object. float[] coefficients = new float[vecK.Length]; for (int i = 0; i < vecK.Length; ++i) { coefficients[i] = (float) vecK[i]; } return new Distortion { Coef = coefficients }; }
public void SetDistortion(Distortion distortion) { m_distortion = distortion; }
/// The screen space viewport that the camera for the specified eye should render into. /// In the _Distorted_ case, this will be either the left or right half of the `StereoScreen` /// render texture. In the _Undistorted_ case, it refers to the actual rectangle on the /// screen that the eye can see. public Rect Viewport(Eye eye, Distortion distortion = Distortion.Distorted) { return device.GetViewport(eye, distortion); }
/// The projection matrix for a given eye. /// This matrix is an off-axis perspective projection with near and far /// clipping planes of 1m and 1000m, respectively. The CardboardEye script /// takes care of adjusting the matrix for its particular camera. public Matrix4x4 Projection(Eye eye, Distortion distortion = Distortion.Distorted) { return device.GetProjection(eye, distortion); }
internal DistortedOutlineShape(int xSize, int ySize, SmoothOutlineShape baseShape, Distortion distortion) : base(xSize, ySize) { this.baseShape = baseShape; this.distortion = distortion; }
public static byte[] GenerateShader( ShaderStage stage, Albedo albedo, Bump_Mapping bump_mapping, Alpha_Test alpha_test, Specular_Mask specular_mask, Material_Model material_model, Environment_Mapping environment_mapping, Self_Illumination self_illumination, Blend_Mode blend_mode, Parallax parallax, Misc misc, Distortion distortion, Soft_fade soft_fade ) { string template = $"shader.hlsl"; List <D3D.SHADER_MACRO> macros = new List <D3D.SHADER_MACRO>(); switch (stage) { //case ShaderStage.Default: case ShaderStage.Albedo: //case ShaderStage.Static_Per_Pixel: //case ShaderStage.Static_Per_Vertex: //case ShaderStage.Static_Sh: case ShaderStage.Static_Prt_Ambient: case ShaderStage.Static_Prt_Linear: case ShaderStage.Static_Prt_Quadratic: //case ShaderStage.Dynamic_Light: //case ShaderStage.Shadow_Generate: case ShaderStage.Active_Camo: //case ShaderStage.Lightmap_Debug_Mode: //case ShaderStage.Static_Per_Vertex_Color: //case ShaderStage.Dynamic_Light_Cinematic: //case ShaderStage.Sfx_Distort: break; default: return(null); } // prevent the definition helper from being included macros.Add(new D3D.SHADER_MACRO { Name = "_DEFINITION_HELPER_HLSLI", Definition = "1" }); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <ShaderStage>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <ShaderType>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Albedo>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Bump_Mapping>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Alpha_Test>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Specular_Mask>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Material_Model>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Environment_Mapping>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Self_Illumination>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Blend_Mode>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Parallax>()); macros.AddRange(ShaderGeneratorBase.CreateMethodEnumDefinitions <Misc>()); macros.Add(ShaderGeneratorBase.CreateMacro("calc_albedo_ps", albedo, "calc_albedo_", "_ps")); if (albedo == Albedo.Constant_Color) { macros.Add(ShaderGeneratorBase.CreateMacro("calc_albedo_vs", albedo, "calc_albedo_", "_vs")); } macros.Add(ShaderGeneratorBase.CreateMacro("calc_bumpmap_ps", bump_mapping, "calc_bumpmap_", "_ps")); macros.Add(ShaderGeneratorBase.CreateMacro("calc_bumpmap_vs", bump_mapping, "calc_bumpmap_", "_vs")); macros.Add(ShaderGeneratorBase.CreateMacro("calc_alpha_test_ps", alpha_test, "calc_alpha_test_", "_ps")); macros.Add(ShaderGeneratorBase.CreateMacro("calc_specular_mask_ps", specular_mask, "calc_specular_mask_", "_ps")); macros.Add(ShaderGeneratorBase.CreateMacro("calc_self_illumination_ps", self_illumination, "calc_self_illumination_", "_ps")); macros.Add(ShaderGeneratorBase.CreateMacro("calc_parallax_ps", parallax, "calc_parallax_", "_ps")); switch (parallax) { case Parallax.Simple_Detail: macros.Add(ShaderGeneratorBase.CreateMacro("calc_parallax_vs", Parallax.Simple, "calc_parallax_", "_vs")); break; default: macros.Add(ShaderGeneratorBase.CreateMacro("calc_parallax_vs", parallax, "calc_parallax_", "_vs")); break; } macros.Add(ShaderGeneratorBase.CreateMacro("material_type", material_model, "material_type_")); macros.Add(ShaderGeneratorBase.CreateMacro("envmap_type", environment_mapping, "envmap_type_")); macros.Add(ShaderGeneratorBase.CreateMacro("blend_type", blend_mode, "blend_type_")); macros.Add(ShaderGeneratorBase.CreateMacro("shaderstage", stage, "shaderstage_")); macros.Add(ShaderGeneratorBase.CreateMacro("shadertype", stage, "shadertype_")); macros.Add(ShaderGeneratorBase.CreateMacro("albedo_arg", albedo, "k_albedo_")); macros.Add(ShaderGeneratorBase.CreateMacro("self_illumination_arg", self_illumination, "k_self_illumination_")); macros.Add(ShaderGeneratorBase.CreateMacro("material_type_arg", material_model, "k_material_model_")); macros.Add(ShaderGeneratorBase.CreateMacro("envmap_type_arg", environment_mapping, "k_environment_mapping_")); macros.Add(ShaderGeneratorBase.CreateMacro("blend_type_arg", blend_mode, "k_blend_mode_")); var shader_bytecode = ShaderGeneratorBase.GenerateSource(template, macros, "entry_" + stage.ToString().ToLower(), "ps_3_0"); return(shader_bytecode); }
/// The screen space viewport that the camera for the specified eye should render into. /// In the _Distorted_ case, this will be either the left or right half of the `StereoScreen` /// render texture. In the _Undistorted_ case, it refers to the actual rectangle on the /// screen that the eye can see. public Rect Viewport(Eye eye, Distortion distortion = Distortion.Distorted) { return(device.GetViewport((GvrViewerInternal.Eye)eye, (GvrViewerInternal.Distortion)distortion)); }
/// The projection matrix for a given eye. /// This matrix is an off-axis perspective projection with near and far /// clipping planes of 1m and 1000m, respectively. The GvrEye script /// takes care of adjusting the matrix for its particular camera. public Matrix4x4 Projection(Eye eye, Distortion distortion = Distortion.Distorted) { return(device.GetProjection((GvrViewerInternal.Eye)eye, (GvrViewerInternal.Distortion)distortion)); }
public void WriteOutputToFile(String cameraName, String lensName, String focalLength, String aperture, UInt16[] distortionValues, Distortion distortion, Distortion dist2, String filename) { bool fileExists = File.Exists("results.txt"); TextWriter tw = new StreamWriter("results.txt", true, Encoding.UTF8); if (!fileExists) { tw.Write(GetHeader()); } tw.Write(cameraName); tw.Write("\t'"); tw.Write(lensName); tw.Write("\t'"); tw.Write(focalLength); tw.Write("\t'"); //tw.Write(aperture); //tw.Write("\t'"); tw.Write("{0}\t'{1:F15}\t'{2:F15}\t'{3:F15}\t'{4:F15}\t'", distortion.n, distortion.scale, distortion.a, distortion.b, distortion.c); tw.Write("{0}\t'{1:F15}\t'{2:F15}\t'{3:F15}\t'{4:F15}\t'", dist2.n, dist2.scale, dist2.a, dist2.b, dist2.c); for (int i = 0; i < 16; i++) { tw.Write(Convert.ToString(distortionValues[i], 16).PadLeft(4, '0')); if (i < 15) tw.Write("\t'"); } tw.Write("\t"); tw.WriteLine(Path.GetFileName(filename)); // close the stream tw.Close(); }
public Distortion GetDistortion(int id) { Distortion distortion = new Distortion(); return distortion; }
/// The screen space viewport that the camera for the specified eye should render into. /// In the _Distorted_ case, this will be either the left or right half of the `StereoScreen` /// render texture. In the _Undistorted_ case, it refers to the actual rectangle on the /// screen that the eye can see. public Rect Viewport(Eye eye, Distortion distortion = Distortion.Distorted) { return(device.GetViewport(eye, distortion)); }
/// Calculates an approximate inverse to the given radial distortion parameters. public static Distortion ApproximateInverse(Distortion distort, float maxRadius = 1, int numSamples = 10) { const int numCoefficients = 2; // R + k1*R^3 + k2*R^5 = r, with R = rp = distort(r) // Repeating for numSamples: // [ R0^3, R0^5 ] * [ K1 ] = [ r0 - R0 ] // [ R1^3, R1^5 ] [ K2 ] [ r1 - R1 ] // [ R2^3, R2^5 ] [ r2 - R2 ] // [ etc... ] [ etc... ] // That is: // matA * [K1, K2] = y // Solve: // [K1, K2] = inverse(transpose(matA) * matA) * transpose(matA) * y double[,] matA = new double[numSamples, numCoefficients]; double[] vecY = new double[numSamples]; for (int i = 0; i < numSamples; ++i) { float r = maxRadius * (i + 1) / (float) numSamples; double rp = distort.distort(r); double v = rp; for (int j = 0; j < numCoefficients; ++j) { v *= rp * rp; matA[i, j] = v; } vecY[i] = r - rp; } double[] vecK = solveLeastSquares(matA, vecY); return new Distortion { k1 = (float)vecK[0], k2 = (float)vecK[1] }; }
public override void OnInspectorGUI() { m_object.Update(); DrawDefaultInspector(); Distortion _2dxScript = (Distortion)target; //Texture2D icon = Resources.Load("2dxfxinspector") as Texture2D; //if (icon) //{ // Rect r; // float ih = icon.height; // float iw = icon.width; // float result = ih / iw; // float w = Screen.width; // result = result * w; // r = GUILayoutUtility.GetRect(ih, result); // EditorGUI.DrawTextureTransparent(r, icon); //} EditorGUILayout.PropertyField(m_object.FindProperty("ActiveUpdate"), new GUIContent("Active Update", "Active Update, for animation / Animator only")); EditorGUILayout.PropertyField(m_object.FindProperty("ForceMaterial"), new GUIContent("Shared Material", "Use a unique material, reduce drastically the use of draw call")); if (_2dxScript.ForceMaterial == null) { _2dxScript.ActiveChange = true; } else { if (GUILayout.Button("Remove Shared Material")) { _2dxScript.ForceMaterial = null; _2dxScript.ShaderChange = 1; _2dxScript.ActiveChange = true; _2dxScript.CallUpdate(); } EditorGUILayout.PropertyField(m_object.FindProperty("ActiveChange"), new GUIContent("Change Material Property", "Change The Material Property")); } if (_2dxScript.ActiveChange) { EditorGUILayout.BeginVertical("Box"); Texture2D icone = Resources.Load("2dxfx-icon-clip_left") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_OffsetX"), new GUIContent("Offset X", icone, "Change the offset of X")); icone = Resources.Load("2dxfx-icon-clip_right") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_OffsetY"), new GUIContent("Offset Y", icone, "Change the offset of Y")); icone = Resources.Load("2dxfx-icon-size_x") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_DistanceX"), new GUIContent("Distance X", icone, "Change the distance of X")); icone = Resources.Load("2dxfx-icon-size_y") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_DistanceY"), new GUIContent("Distance Y", icone, "Change the distance of Y")); icone = Resources.Load("2dxfx-icon-time") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_WaveTimeX"), new GUIContent("Wave Time X", icone, "Change the time speed of the wave X")); icone = Resources.Load("2dxfx-icon-time") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_WaveTimeY"), new GUIContent("Wave Time Y", icone, "Change the time speed of the wave Y")); icone = Resources.Load("2dxfx-icon-time") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("AutoPlayWaveX"), new GUIContent("Active AutoPlay Wave X", icone, "Active the time speed")); if (_2dxScript.AutoPlayWaveX) { icone = Resources.Load("2dxfx-icon-time") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("AutoPlaySpeedX"), new GUIContent("AutoPlay Speed X", icone, "Speed of the auto play X")); } icone = Resources.Load("2dxfx-icon-time") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("AutoPlayWaveY"), new GUIContent("Active AutoPlay Wave Y", icone, "Active the time speed")); if (_2dxScript.AutoPlayWaveY) { icone = Resources.Load("2dxfx-icon-time") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("AutoPlaySpeedY"), new GUIContent("AutoPlay Speed Y", icone, "Speed of the auto play Y")); } icone = Resources.Load("2dxfx-icon-pixel") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("AutoRandom"), new GUIContent("Auto Random", icone, "Active the random value")); if (_2dxScript.AutoRandom) { icone = Resources.Load("2dxfx-icon-value") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("AutoRandomRange"), new GUIContent("Auto Random Range", icone, "Change the random value")); } EditorGUILayout.BeginVertical("Box"); icone = Resources.Load("2dxfx-icon-fade") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_Alpha"), new GUIContent("Fading", icone, "Fade from nothing to showing")); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); } m_object.ApplyModifiedProperties(); }
public void WriteOutputToFile(String cameraName, String lensName, String focalLength, String aperture, UInt16[] distortionValues, Distortion distortion, Distortion dist2, String filename) { bool fileExists = File.Exists("results.txt"); TextWriter tw = new StreamWriter("results.txt", true, Encoding.UTF8); if (!fileExists) { tw.Write(GetHeader()); } tw.Write(cameraName); tw.Write("\t'"); tw.Write(lensName); tw.Write("\t'"); tw.Write(focalLength); tw.Write("\t'"); //tw.Write(aperture); //tw.Write("\t'"); tw.Write("{0}\t'{1:F15}\t'{2:F15}\t'{3:F15}\t'{4:F15}\t'", distortion.n, distortion.scale, distortion.a, distortion.b, distortion.c); tw.Write("{0}\t'{1:F15}\t'{2:F15}\t'{3:F15}\t'{4:F15}\t'", dist2.n, dist2.scale, dist2.a, dist2.b, dist2.c); for (int i = 0; i < 16; i++) { tw.Write(Convert.ToString(distortionValues[i], 16).PadLeft(4, '0')); if (i < 15) { tw.Write("\t'"); } } tw.Write("\t"); tw.WriteLine(Path.GetFileName(filename)); // close the stream tw.Close(); }