rsidwell

dc_cracklep.java

Mar 20th, 2017
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.55 KB | None | 0 0
  1. /*
  2. JWildfire - an image and animation processor written in Java
  3. Copyright (C) 1995-2011 Andreas Maschke
  4.  
  5. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
  6. General Public License as published by the Free Software Foundation; either version 2.1 of the
  7. License, or (at your option) any later version.
  8.  
  9. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
  10. even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12.  
  13. You should have received a copy of the GNU Lesser General Public License along with this software;
  14. if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  15. 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  16. */
  17.  
  18. package org.jwildfire.create.tina.variation;
  19.  
  20. import org.jwildfire.base.Tools;
  21.  
  22. public class DCCracklePFunc extends DCCrackleWFFunc {
  23. private static final long serialVersionUID = 1L;
  24.  
  25. public static final String PARAM_PRESET = "preset";
  26. public static final String PARAM_Z = "z"; // private in class CrackleFunc for some reason
  27.  
  28. private static final String[] additionalParamNames = { PARAM_PRESET };
  29.  
  30. private int preset = 0;
  31. private double pcellsize = 1.0;
  32. private double ppower = 0.2;
  33. private double pdistort = 0.0;
  34. private double pscale = 1.0;
  35. private double pz = 0.0;
  36.  
  37. // dc_crackleP_wf by Brad Stefanov and Rick Sidwell
  38. // This is a specialization of dc_crackle_wf by Andreas Maschke, which is a specialization of crackle, originally invented
  39. // by Neil Slater, see http://slobo777.deviantart.com/art/Apo-Plugins-Hexes-And-Crackle-99243824.
  40. // It is based on the Crackle Styles Chooser script by Ian Anderson and Anu Wilde (adapted for JWildfire by Mick Hogan).
  41. // An additional parameter "preset" will set the other parameters; see the script for names of the values
  42.  
  43.  
  44. @Override
  45. public String getName() {
  46. return "dc_cracklep";
  47. }
  48.  
  49. @Override
  50. public String[] getParameterNames() {
  51. return joinArrays(additionalParamNames, super.getParameterNames());
  52. }
  53.  
  54. @Override
  55. public Object[] getParameterValues() {
  56. return joinArrays(new Object[] { preset }, super.getParameterValues() );
  57. }
  58.  
  59. @Override
  60. public void setParameter(String pName, double pValue) {
  61. if (PARAM_PRESET.equalsIgnoreCase(pName)) {
  62. preset = Tools.FTOI(pValue);
  63. switch (preset) {
  64. case 0:
  65. pcellsize = 1.0; ppower = 0.2; pdistort = 0.0; pscale = 1.00; pz=0.0;
  66. break;
  67. case 1:
  68. pcellsize = 0.5; ppower = 0.5; pdistort = 1.0; pscale = 0.95; pz=10.0;
  69. break;
  70. case 2:
  71. pcellsize = 0.5; ppower = 0.01; pdistort = 0.5; pscale = 1.0; pz=0.0;
  72. break;
  73. case 3:
  74. pcellsize = 0.05; ppower = 0.9; pdistort = 0.9; pscale = 0.5; pz=0.0;
  75. break;
  76. case 4:
  77. pcellsize = 0.5; ppower = 1.0; pdistort = 1.0; pscale = 0.93; pz=10.0;
  78. break;
  79. case 5:
  80. pcellsize = 1.0; ppower = 1.0; pdistort = 0.0; pscale = 0.9; pz=0.0;
  81. break;
  82. case 6:
  83. pcellsize = 0.8; ppower = 0.5; pdistort = 0.5; pscale = 0.8; pz=0.5;
  84. break;
  85. case 7:
  86. pcellsize = 0.2; ppower = 0.01; pdistort = 0.0; pscale = 0.4; pz=2.0;
  87. break;
  88. case 8:
  89. pcellsize = 1.0; ppower = 0.5; pdistort = 0.25; pscale = 0.5; pz=0.0;
  90. break;
  91. case 9:
  92. pcellsize = 0.6; ppower = 0.75; pdistort = 1.0; pscale = 0.25; pz=0.75;
  93. break;
  94. case 10:
  95. pcellsize = 0.5; ppower = 25.0; pdistort = 0.0; pscale = 9.0; pz=6.0;
  96. break;
  97. case 11:
  98. pcellsize = 0.2; ppower = 1.0; pdistort = 0.0; pscale = 0.4; pz=0.0;
  99. break;
  100. case 12:
  101. pcellsize = 1.5; ppower = 0.01; pdistort = 0.0; pscale = 0.4; pz=0.0;
  102. break;
  103. case 13:
  104. pcellsize = 8.0; ppower = 0.01; pdistort = 0.0; pscale = 0.4; pz=0.0;
  105. break;
  106. case 14:
  107. pcellsize = 0.2; ppower = 0.05; pdistort = 1.0; pscale = 5.0; pz=0.0;
  108. break;
  109. case 15:
  110. pcellsize = 0.07; ppower = 0.05; pdistort = 0.5; pscale = 9.0; pz=6.0;
  111. break;
  112. case 16:
  113. pcellsize = 0.2; ppower = 0.1; pdistort = 0.0; pscale = 1.5; pz=2.0;
  114. break;
  115. case 17:
  116. pcellsize = 0.297494; ppower = 0.662265; pdistort = 0.0708866; pscale = 0.228156; pz=0.0;
  117. break;
  118. case 18:
  119. pcellsize = 0.205939; ppower = 1.0; pdistort = 0.0; pscale = 0.6298; pz=0.35;
  120. break;
  121. case 19:
  122. pcellsize = 0.5; ppower = 0.001; pdistort = 1.0; pscale = 2.0; pz=0.0;
  123. break;
  124. case 20:
  125. pcellsize = 0.5; ppower = 0.0005; pdistort = 0.748; pscale = 1.465; pz=6.0;
  126. break;
  127. }
  128. super.setParameter(PARAM_CELLSIZE, pcellsize);
  129. super.setParameter(PARAM_POWER, ppower);
  130. super.setParameter(PARAM_DISTORT, pdistort);
  131. super.setParameter(PARAM_SCALE, pscale);
  132. super.setParameter(PARAM_Z, pz);
  133. }
  134. else
  135. super.setParameter(pName, pValue);
  136. }
  137.  
  138. }
Add Comment
Please, Sign In to add comment