Skip to content

Commit ad91a75

Browse files
Add Fortran (#144)
* C to Fortran translation * Swap the enums for raw parameters * Add a simple example.
1 parent 6fd081a commit ad91a75

File tree

3 files changed

+2671
-0
lines changed

3 files changed

+2671
-0
lines changed

‎Fortran/README.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Getting Started
2+
3+
Here's an example for creating a 128x128 array of OpenSimplex2S noise
4+
5+
```Fortran
6+
program test_fast_noise
7+
use :: fast_noise_lite
8+
use, intrinsic :: iso_c_binding
9+
implicit none
10+
11+
type(fnl_state) :: noise_state
12+
real(c_float), dimension(128,128) :: noise_data
13+
integer(c_int) :: x, y
14+
15+
! Create the state.
16+
noise_state = fnl_state()
17+
noise_state%noise_type = FNL_NOISE_OPENSIMPLEX2S
18+
19+
! Collect the noise data.
20+
do y = 1,128
21+
do x = 1,128
22+
noise_data(x,y) = fnl_get_noise_2d(noise_state, real(x, c_float), real(y, c_float))
23+
end do
24+
end do
25+
26+
! Do something with this data...
27+
end program test_fast_noise
28+
```

0 commit comments

Comments
 (0)