Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
  JavaGaming.org - Pastebin



Author: Roquen (posted 2014-02-17 11:50:01, viewed 143 times)

1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69   70   71   72   73   74   75   76   77   78   79   80   81   82   83   84   85   86   87   88   89   90   91   92   93   94   95   96   97   98   99   100   101   102   103   104   105   106   107   108   109   110   111   112   113   114   115   116   117   118   119   120   121   122   123   124   125   126   127   128   129   130   131   132   133   134   135   136   137   138   139   140   141   142   143   144   145   146   147   148   149   150   151   152   153   154   155   156   157   158   159   160   161   162   163   164   165   166   167   168   169   170   171   172   173   174   175   176   177   178   179   180   181   182   183   184   185   186   187   188   189   190   191   192   193   194   195   196   197   198   199   200   201   202   203   204   205   206   207   208   209   210   211   212   213   214   215   216   217   218   219   220   221   222   223   224   225   226   227   228   229   230   231   232   233   234   235   236   237   238   239   240   241   242   243   244   245   246   247   248   249   250   251   252   253   254   255   256   257   258   259   260   261   262   263   264   265   266   267   268   269   270   271   272   273   274   275   276   277   278   279   280   281   282   283   284   285   286   287   288   289   290   291   292   293   294   295   296   297   298   299   300   301   302   303   304   305   306   307   308   309   310   311   312   313   314   315   316   317   318   319   320   321   322   323   324   325   326   327   328   329   330   331   332   333   334   335   336   337   338   339   340   341   342   343   344   345   346   347   348   349   350   351   352   353   354   355   356   357   358   359   360   361   362   363   364   365   366   367   368   369   370   371   372   373   374   375   376   377   378   379   380   381   382   383   384   385   386   387   388   389   390   391   392   393   394   395   396   397   398   399   400   401   402   403   404   405   406   407   408   409   410   411   412   413   414   415   416   417   418   419   420   421   422   423   424   425   426   427  
/*!
 * <info>
 *  KalisetMashup
 * </info>
 */
#ifdef SYNTHCLIPSE
#include <synthclipse>
#endif

//! <camera type="2D" />

// Output generated from file: C:/cygwin/usr/local/src/Shaders/Fragmentarium/Kali.frag
// Created: Sun Sep 15 22:55:24 2013

#include "Progressive2D.frag"

//! <group name="KalisetMashup" />
// INFO: KalisetMashup

// Number of iterations
uniform int  Iterations; //! slider[1,200,1000]

// Skip this number of iterations before starting coloring
uniform int  PreIterations; //! slider[0,1,1000]

uniform float R; //! slider[0,0,1]
uniform float G; //! slider[0,0.4,1]
uniform float B; //! slider[0,0.7,1]
uniform float C; //! slider[0,1,2]
uniform bool Julia; //! checkbox[false]


uniform vec2 JuliaC; //! slider[(-3,-3),(0,0),(3,3)]

uniform float angle; //! slider[-3.14159,1.5708,3.14159]


vec2 rot = vec2(1.0,0.0);



void init() 
{
}

vec2 domainMap(vec2 c);

vec2 xform(vec2 p, vec2 c);

vec2 mapCenter = vec2(0.5,0.5);
float mapRadius =0.4;
uniform bool ShowMap; //! checkbox[true]
uniform float MapZoom; //! slider[0.01,2.1,6]
uniform float EscapeSize; //! slider[0,5,11]
float escape = pow(10.0,EscapeSize);
vec3 getMapColor2D(vec2 c) {
   vec2 p =  (aaCoord-mapCenter)/(mapRadius);
   p*=MapZoom; p.x/=pixelSize.x/pixelSize.y;
   if (abs(p.x)<4.0*pixelSize.y*MapZoom) return vec3(0.0,0.0,0.0);
   if (abs(p.y)<4.0*pixelSize.x*MapZoom) return vec3(0.0,0.0,0.0);
   p += JuliaC;
   float mean = 0.0;
   vec2 z =  p;
   int Iter = 200; // 'const int' crashes on my ATI card?
   int i = 0;
   for (i = 0; i < Iter; i++) {
      z = xform(z, p);
      mean+=length(z);
      if (dot(z,z)> escape) break;
   }
   mean/=float(i);
   float co =   1.0 - log2(.5*log2(mean/0.5));
   return vec3( .5+.5*cos(6.2831*co+0.5),.5+.5*cos(6.2831*co + 0.5),.5+.5*cos(6.2831*co +0.5) );
   
}

uniform int ColoringType; //! slider[0,0,2]
uniform float ColorFactor; //! slider[0,0.5,1]

vec3 color(vec2 c) {


    rot.x = cos(angle);
    rot.y = sin(angle);

   if (ShowMap && Julia) {
      vec2 w = (aaCoord-mapCenter);
      w.y/=(pixelSize.y/pixelSize.x);
      if (length(w)<mapRadius) return getMapColor2D(c);
      if (length(w)<mapRadius+0.01) return vec3(0.0,0.0,0.0);
   }
   
   vec2 z = domainMap(c);
   int i = 0;
   float ci = 0.0;

     c = Julia ? JuliaC : z;


   if (ColoringType == 0) {
      float mean = 0.0;
      for (i = 0; i < Iterations; i++) {
         z = xform(z, c);
         if (i>PreIterations) mean+=length(z);
         if (dot(z,z)> escape && i>PreIterations) break;
      }
      mean/=float(i-PreIterations);
      ci =  1.0 - log2(.5*log2(mean/C));
   } else if (ColoringType == 1) {
      float m = 0.0;
      for (i = 0; i < Iterations; i++) {
         z = xform(z, c);
         if (i>PreIterations) m = mix(m,length(z),ColorFactor);
         if (dot(z,z)> escape && i>PreIterations) break;
      }
      ci =  1.0 - log2(.5*log2(m/C));
   } else if (ColoringType == 2) {
      for (i = 0; i < Iterations; i++) {
         z = xform(z, c);
         if (dot(z,z)> escape && i>PreIterations) break;
      }
      ci =  float( i) + 1.0 - log2(.5*log2(dot(z,z)));   
   }
   return vec3( .5+.5*cos(6.*ci+R),.5+.5*cos(6.*ci + G),.5+.5*cos(6.*ci +B) );
}




uniform float MinRadius; //! slider[0,0,10]
uniform float Scaling; //! slider[-15,-2,15]
uniform bool  SymX; //! checkbox[false]
uniform bool  SymY; //! checkbox[false]
uniform bool  Invert; //! checkbox[false]
uniform vec2 InvertC; //! slider[(-100,-100),(0,0),(100,100)]


vec2 cayley(vec2 p)
{
  vec2 r;
  float s = 1.0+p.y;
  s *= s;
  s += p.x*p.x;
  r.x = p.x*p.x + p.y*p.y - 1.0;
  r.y = -p.x*p.x;
  r *= (1.0/s);
  return r;
}

// invert point 'p' about circle at 'c' with radius squared 'rs'
vec2 circleInvert(vec2 p, vec2 c, float rs)
{
  vec2  d = p-c;
  float s = rs/dot(d,d);

  return c + s*d;
}

// invert point 'p' about unit circle at 'c'
vec2 circleInvert(vec2 p, vec2 c)
{
  vec2 d = p-c;
  return c + d/dot(d,d);
}

vec2 minvert(vec2 p, vec2 c)
{
  vec2 d = p;
  return d/dot(d,d);
}


vec2 domainMap(vec2 c)
{
   if (SymX) c.x = abs(c.x);
   if (SymY) c.y = abs(c.y);

   if (Invert) {
      c = circleInvert(c, InvertC);
  }
   return c;
}

vec2 renorm(vec2 p)
{
    float  m = dot(p, p);
     vec2 r;

   if (m<MinRadius) {
      r =p/(MinRadius*MinRadius);
   }else {
      r =p/m*Scaling;
   }

  return r;
}

vec2 xform(vec2 p, vec2 c)
{
  vec2 r;

  r.y = p.x*p.x;
  r.x = p.y*p.y;

  // TODO: change to a vec2 param
  r = circleInvert(r, vec2(angle));
  r += c;

   return r;
}

/*!
 * <preset name="P2">
 *  Center = 21.4586,14.678
 *  Zoom = 0.0131084
 *  Gamma = 2.2
 *  ToneMapping = 1
 *  Exposure = 1
 *  Brightness = 1
 *  Contrast = 1
 *  Saturation = 1
 *  AARange = 2
 *  AAExp = 1
 *  GaussianAA = true
 *  Iterations = 95
 *  PreIterations = 1
 *  R = 0
 *  G = 0.4
 *  B = 0.7
 *  C = 1
 *  Julia = true
 *  JuliaC = -0.984,-0.984
 *  angle = 0.65753
 *  ShowMap = false
 *  MapZoom = 2.1
 *  EscapeSize = 5
 *  ColoringType = 0
 *  ColorFactor = 0.5
 *  MinRadius = 0
 *  Scaling = -4.0434
 *  SymX = false
 *  SymY = false
 *  Invert = true
 *  InvertC = 0.97,0.97
 * </preset>
 */

/*!
 * <preset name="P1">
 *  Center = 5274.28,5349.08
 *  Zoom = 0.000115994
 *  Gamma = 2.2
 *  ToneMapping = 1
 *  Exposure = 1
 *  Brightness = 1
 *  Contrast = 1
 *  Saturation = 1
 *  AARange = 2
 *  AAExp = 1
 *  GaussianAA = true
 *  Iterations = 95
 *  PreIterations = 1
 *  R = 0
 *  G = 0.4
 *  B = 0.7
 *  C = 1
 *  Julia = false
 *  JuliaC = -0.984,-0.984
 *  angle = 0.65753
 *  ShowMap = false
 *  MapZoom = 2.1
 *  EscapeSize = 5
 *  ColoringType = 0
 *  ColorFactor = 0.5
 *  MinRadius = 0
 *  Scaling = -4.0434
 *  SymX = false
 *  SymY = false
 *  Invert = true
 *  InvertC = -2,-2
 * </preset>
 */


/*!
 * <preset name="default">
 *  Center = -0.106999,-0.32802
 *  Zoom = 0.274423
 *  Gamma = 2.2
 *  ToneMapping = 1
 *  Exposure = 1
 *  Brightness = 1
 *  Contrast = 1
 *  Saturation = 1
 *  AARange = 2
 *  AAExp = 1
 *  GaussianAA = true
 *  Iterations = 95
 *  PreIterations = 1
 *  R = 0
 *  G = 0.4
 *  B = 0.7
 *  C = 1
 *  Julia = true
 *  JuliaC = -0.984,-0.984
 *  ShowMap = false
 *  MapZoom = 2.1
 *  EscapeSize = 5
 *  ColoringType = 0
 *  ColorFactor = 0.5
 *  MinRadius = 0
 *  Scaling = -4.0434
 *  SymX = false
 *  SymY = false
 *  Invert = false
 *  InvertC = 0.97,0.97
 *  angle = 0.65753
 * </preset>
 */

/*!
 * <preset name="DX">
 *  Center = -0.106999,-0.32802
 *  Zoom = 0.274423
 *  Gamma = 2.2
 *  ToneMapping = 1
 *  Exposure = 1
 *  Brightness = 1
 *  Contrast = 1
 *  Saturation = 1
 *  AARange = 2
 *  AAExp = 1
 *  GaussianAA = true
 *  Iterations = 95
 *  PreIterations = 1
 *  R = 0
 *  G = 0.4
 *  B = 0.7
 *  C = 1.1125
 *  Julia = true
 *  ShowMap = false
 *  MapZoom = 2.1
 *  EscapeSize = 5
 *  ColoringType = 0
 *  ColorFactor = 0.5
 *  MinRadius = 0
 *  Scaling = -4.0434
 *  Invert = false
 *  InvertC = 0.97,0.97
 *  JuliaC = -0.984,-0.984
 *  angle = 0.65753
 *  SymX = false
 *  SymY = false
 * </preset>
 */

/*!
 * <preset name="X1">
 *  Center = 0.307512,0.190781
 *  Zoom = 0.17181
 *  Gamma = 2.2
 *  ToneMapping = 1
 *  Exposure = 1
 *  Brightness = 1
 *  Contrast = 1
 *  Saturation = 1
 *  AARange = 2
 *  AAExp = 1
 *  GaussianAA = true
 *  Iterations = 95
 *  PreIterations = 1
 *  R = 0
 *  G = 0.4
 *  B = 0.7
 *  C = 1
 *  Julia = true
 *  ShowMap = false
 *  MapZoom = 2.1
 *  EscapeSize = 5
 *  ColoringType = 0
 *  ColorFactor = 0.5
 *  MinRadius = 0
 *  Scaling = -0.5175
 *  Invert = false
 *  InvertC = 1.852,1.852
 *  JuliaC = -0.984,-0.9231
 *  angle = 0.65753
 *  SymX = false
 *  SymY = false
 * </preset>
 */

/*!
 * <preset name="X2">
 *  Center = -0.106999,-0.32802
 *  Zoom = 0.161047
 *  Gamma = 2.2
 *  ToneMapping = 1
 *  Exposure = 1
 *  Brightness = 1
 *  Contrast = 1
 *  Saturation = 1
 *  AARange = 2
 *  AAExp = 1
 *  GaussianAA = true
 *  Iterations = 95
 *  PreIterations = 1
 *  R = 0
 *  G = 0.4
 *  B = 0.7
 *  C = 0.825
 *  Julia = true
 *  ShowMap = false
 *  MapZoom = 2.1
 *  EscapeSize = 5
 *  ColoringType = 0
 *  ColorFactor = 0.5
 *  MinRadius = 0
 *  Scaling = -4.0434
 *  Invert = false
 *  InvertC = 0.97,0.97
 *  JuliaC = -1.75386,-1.56924
 *  angle = 0.71402
 *  SymX = false
 *  SymY = false
 * </preset>
 */





Dump your java code here :



Special syntax:
  • To highlight a line (yellow background), prefix it with '@@'
  • To indicate that a line should be removed (red background), prefix it with '-'
  • To indicate that a line should be added (green background), prefix it with '+'
  • To post multiple snippets, seperate them by '~~~~'
  EOF
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (12 views)
2014-07-29 18:09:19

Riven (10 views)
2014-07-29 18:08:52

Dwinin (9 views)
2014-07-29 10:59:34

E.R. Fleming (26 views)
2014-07-29 03:07:13

E.R. Fleming (10 views)
2014-07-29 03:06:25

pw (40 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (27 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!