add: readme new asset and rename binary name
This commit is contained in:
parent
ea77933330
commit
c882cbf80e
3 changed files with 85 additions and 2 deletions
11
Makefile
11
Makefile
|
|
@ -1,11 +1,18 @@
|
||||||
SRC_DIR = srcs/
|
SRC_DIR = srcs/
|
||||||
SRCS= \
|
SRCS= \
|
||||||
$(SRC_DIR)main.cpp \
|
$(SRC_DIR)main.cpp \
|
||||||
$(SRC_DIR)windowManager/WindowManager.cpp
|
$(SRC_DIR)windowManager/WindowManager.cpp \
|
||||||
|
$(SRC_DIR)noise/perlin.cpp \
|
||||||
|
$(SRC_DIR)math/Vector2.cpp \
|
||||||
|
$(SRC_DIR)effects/cloud.cpp \
|
||||||
|
$(SRC_DIR)effects/graph.cpp \
|
||||||
|
$(SRC_DIR)effects/marble.cpp \
|
||||||
|
$(SRC_DIR)effects/random.cpp \
|
||||||
|
$(SRC_DIR)effects/wood.cpp \
|
||||||
|
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
NAME = window
|
NAME = perlin
|
||||||
|
|
||||||
CC = c++
|
CC = c++
|
||||||
CFLAGS = -Wall -Wextra -Werror -g3
|
CFLAGS = -Wall -Wextra -Werror -g3
|
||||||
|
|
|
||||||
76
Readme.md
Normal file
76
Readme.md
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
# perlin noise experimentations
|
||||||
|
This is a simple project to experiment with perlin noise. The project is written in c++ using X11 for the windowing system.
|
||||||
|
There are 5 different way to generate iamges using perlin noise built-in the project:
|
||||||
|
|
||||||
|
- cloud effects using 2 superposed perlin noise
|
||||||
|
- graph representation of perlin noise in 2D
|
||||||
|
- marble effect
|
||||||
|
- wood effect
|
||||||
|
- one effect that I don't know how to describe
|
||||||
|
|
||||||
|
## usage:
|
||||||
|
```bash
|
||||||
|
# clone:
|
||||||
|
git clone https://github.com/lohhiiccc/Noise-generator
|
||||||
|
# compile:
|
||||||
|
make
|
||||||
|
# run:
|
||||||
|
./perlin
|
||||||
|
```
|
||||||
|
|
||||||
|
## how to use it:
|
||||||
|
- press space bar to change the effect
|
||||||
|
- press escape to quit the program
|
||||||
|
## dependencies:
|
||||||
|
- X11
|
||||||
|
- g++
|
||||||
|
- make
|
||||||
|
|
||||||
|
## how it works:
|
||||||
|
The project is divided in 3 main parts:
|
||||||
|
- the noise generation
|
||||||
|
- cache pseudo-random gradient vectors based on seed
|
||||||
|
- cut the image in a grid of cells
|
||||||
|
- for each cell, generate a pseudo-random gradient vector
|
||||||
|
- for each pixel in the cell, calculate the distance to the 4 corners of the cell and interpolate the gradient vectors
|
||||||
|
- the image generation
|
||||||
|
- image are basically 2D array of uint32_t
|
||||||
|
- the x11 windowing system
|
||||||
|
- open a connection to the X server
|
||||||
|
- get a default root window
|
||||||
|
- define window properties
|
||||||
|
- create the main window
|
||||||
|
- event handling
|
||||||
|
- key press event
|
||||||
|
- quit the program with escape key
|
||||||
|
- change the effect with space bar
|
||||||
|
- close window event
|
||||||
|
|
||||||
|
|
||||||
|
## How to add effects:
|
||||||
|
- create effect function in effects folder
|
||||||
|
- follow the same pointer function signature as the other effects ```int (*name)(uint32_t *image, bool &needUpdate)```
|
||||||
|
- add the effect in the ```main.cpp``` file by adding the function pointer in the vector of function pointers ```window.load_render(<new_effect_name>);```
|
||||||
|
- make again the project !
|
||||||
|
|
||||||
|
## some visual examples:
|
||||||
|
### cloud effect:
|
||||||
|

|
||||||
|
|
||||||
|
### graph representation:
|
||||||
|

|
||||||
|
|
||||||
|
### marble effect:
|
||||||
|

|
||||||
|
|
||||||
|
### wood effect:
|
||||||
|

|
||||||
|
|
||||||
|
### unknown effect:
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
# author:
|
||||||
|
- @lohhiiccc
|
||||||
|
|
||||||
|
this is my first project with X11, i may have done some things wrong, feel free to tell me how to improve it.
|
||||||
BIN
asset/cloud-perlin_noise.GIF
Normal file
BIN
asset/cloud-perlin_noise.GIF
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 MiB |
Loading…
Add table
Reference in a new issue