Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Fractal textures for Jax!
Because I can! Also, fractals are oh-so-useful for terrain generation, cloud simulation, lava, and various other natural-looking effects.
This gem requires Jax and RMagick 2.
Add the following to your Gemfile:
gem 'jax-fractals'
Or, for the latest development version, the following:
gem 'jax-fractals', :git => "http://github.com/sinisterchipmunk/jax-fractals"
Then type:
bundle install
The quickest way to get a fractal image into your app is to generate it from the command line:
rails generate fractal name-of-fractal
By default, it will have pixel dimensions 128x128, and will be generated with a smoothness factor of 2. You can customize all of these options:
rails generate fractal name-of-fractal --width=256 --height=256 --smoothness=1.25
A different fractal image will be generated each time the generator is run unless a random seed is specified:
rails generate fractal name-of-fractal --seed=100
You can also change the colors for the low and high values, which default to black and white, respectively. The following example will replace black with red, and white with blue:
rails generate fractal name-of-fractal --low-color=ff0000 --high-color=0000ff
Sometimes you need the fractal to include an alpha (transparency) channel, so that the lower values are more transparent and the higher ones are more opaque. Simple!
rails generate fractal name-of-fractal --alpha
Occasionally, you'll want to generate a fractal that is guaranteed to have intensity values equal to 0 along its borders. This is useful if you're generating a single cloud in the sky (as opposed to a tileable texture) or an island in the sea. To do this with the generator:
rails generate fractal name-of-fractal --island
To mount the fractal controller, add the following to your routes.rb file:
mount Fractal::Engine => "/fractals"
Restart the Rails server, and you can generate a fractal by visiting its URL. There is a single required parameter, its ID, which is used as a random seed. You can also pass width, height, smoothness and color parameters.
Experiment with the following examples:
Once generated, fractals will be stored in the Rails cache, so that they only need to be generated one time. After generation, the cached copy will be returned instead.
Height maps will work with any image, not just fractals, but they play so nicely together that I couldn't resist adding the Heightmap model to this library.
The easiest way to create a height map is to create a resource file. In your Rails or Jax project, create the file app/assets/jax/resources/heightmaps/test.resource
and add the following information to it:
path: "/fractals/5"
xz_scale: 0.75
y_scale: 8.0
This will load the fractal dynamically from the Fractals controller (note: you have to change the path to reference a static image if you're not using Rails), scale its width and depth by 3/4, and then scale its height by 8 to produce a hilly (but not too mountainous!) terrain.
If you want to texture it (and who wouldn't?), create a material like you'd create any other Jax material:
$ jax g material ground texture
Then, set it in the resource file:
material: "ground"
To add the "test" heightmap to the world, add it like you would any other Jax model instance. Do this in your Jax controller:
@world.addObject Heightmap.find "test"
Done!
FAQs
Unknown package
We found that jax-fractals demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.