New examples from @chriscamacho (#23)
* complete fog example as both fog and basic lighting need the light system it made sense to seperate it out, there are a few functions from raymath int rlmath.py * added shaders custom uniform * added shaders_texture_waves.py * added shaders_texture_drawing.py * bug fix - unwanted transparent effect! * complete fog example as both fog and basic lighting need the light system it made sense to seperate it out, there are a few functions from raymath int rlmath.py * added shaders custom uniform * added shaders_texture_waves.py * initial commit still WIP * updated raylib * undo all changes in this branch except for the example updates * remove local raylib-c Co-authored-by: codifies <nospam@antispam.com>
This commit is contained in:
parent
16aec6a0e3
commit
8824449bc1
27 changed files with 120 additions and 912 deletions
|
@ -8,8 +8,20 @@ http://bedroomcoders.co.uk/raylib-fog/
|
|||
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
#<<<<<<< HEAD
|
||||
#<<<<<<< HEAD
|
||||
#<<<<<<< HEAD
|
||||
from raylib.static import rl, ffi
|
||||
#=======
|
||||
#from raylib.dynamic import raylib as rl, ffi
|
||||
#>>>>>>> ffe4403 (complete fog example)
|
||||
#=======
|
||||
#from raylib.static import rl, ffi
|
||||
#>>>>>>> 10b63b9 (added shaders_texture_waves.py)
|
||||
#=======
|
||||
#from raylib.static import rl, ffi
|
||||
#>>>>>>> 1775ffc4b093c881ee44a8027b4143add066d738
|
||||
from raylib.colors import *
|
||||
import math
|
||||
|
||||
|
@ -39,10 +51,20 @@ model3.materials[0].maps[rl.MAP_DIFFUSE].texture = texture
|
|||
|
||||
light = Light(LIGHT_POINT, [ 0, 4, 0 ], Vector3Zero(), WHITE)
|
||||
lightSystem = LightSystem([ 0.2, 0.2, 0.2, 1.0 ], light)
|
||||
|
||||
#
|
||||
#<<<<<<< HEAD
|
||||
#<<<<<<< HEAD
|
||||
fog_color = ffi.new('float[]', [0.2,0.2,1.0,1.0])
|
||||
fogC = rl.GetShaderLocation(lightSystem.shader, b'fogColor')
|
||||
rl.SetShaderValue(lightSystem.shader, fogC, fog_color, rl.UNIFORM_VEC4);
|
||||
#=======
|
||||
#fog_color = [0.2, 0.2, 1.0, 1.0]
|
||||
#>>>>>>> ffe4403 (complete fog example)
|
||||
#=======
|
||||
#fog_color = ffi.new('float[]', [0.2,0.2,1.0,1.0])
|
||||
fogC = rl.GetShaderLocation(lightSystem.shader, b'fogColor')
|
||||
rl.SetShaderValue(lightSystem.shader, fogC, fog_color, rl.UNIFORM_VEC4);
|
||||
#>>>>>>> 1775ffc4b093c881ee44a8027b4143add066d738
|
||||
fogD = rl.GetShaderLocation(lightSystem.shader, b'FogDensity')
|
||||
fogDensity = 0.12
|
||||
|
||||
|
@ -62,8 +84,8 @@ while not rl.WindowShouldClose():
|
|||
lightSystem.update(camera.position)
|
||||
|
||||
|
||||
model.transform = MatrixMultiply(model.transform, MatrixRotateX(-0.025))[0]
|
||||
model.transform = MatrixMultiply(model.transform, MatrixRotateZ(0.012))[0]
|
||||
model.transform = ffi.cast("Matrix *",MatrixMultiply(model.transform, MatrixRotateX(-0.025)))[0]
|
||||
model.transform = ffi.cast("Matrix *",MatrixMultiply(model.transform, MatrixRotateZ(0.012)))[0]
|
||||
|
||||
if rl.IsKeyDown(rl.KEY_UP):
|
||||
fogDensity = min(fogDensity + 0.001, 1)
|
||||
|
@ -76,8 +98,16 @@ while not rl.WindowShouldClose():
|
|||
rl.BeginDrawing()
|
||||
|
||||
rl.ClearBackground([int(255 * i) for i in fog_color])
|
||||
#<<<<<<< HEAD
|
||||
#<<<<<<< HEAD
|
||||
# if rl.IsKeyDown(rl.KEY_SPACE):
|
||||
# rl.ClearBackground(BLACK)
|
||||
#=======
|
||||
#>>>>>>> ffe4403 (complete fog example)
|
||||
#=======
|
||||
if rl.IsKeyDown(rl.KEY_SPACE):
|
||||
rl.ClearBackground(BLACK)
|
||||
#>>>>>>> 1775ffc4b093c881ee44a8027b4143add066d738
|
||||
|
||||
rl.BeginMode3D(camera[0])
|
||||
rl.DrawModel(model, [0] * 3, 1, WHITE)
|
||||
|
|
Reference in a new issue