Removed binary files

This commit is contained in:
n00b
2024-09-28 11:56:07 -04:00
parent 1bf67ba02c
commit 44a2793f37
53 changed files with 3222 additions and 1582 deletions

BIN
rcbasic_runtime/FreeMono.ttf Executable file

Binary file not shown.

Binary file not shown.

View File

@@ -1,3 +0,0 @@
export LD_LIBRARY_PATH=LD_LIBRARY_PATH$:$PWD/lib
./rcbasic_build test.bas
./rcbasic_runtime test.cbc

View File

@@ -1,50 +0,0 @@
-=( Map Information )=- -----------------------------------------------
<Title> : Return to Castle: Quake
<Date> : 02/02/02 - ren 11/17/2002
<Filename> : map-20kdm2.pk3
<Author> : Michael "<|3FG20K>" Cook
<Email Address> : bfg20k@nycap.rr.com / bfg20k@planetquake.com
<Website> : http://www.planetquake.com/bfg20k
<Description> : This is an Evil7 Castle! It has three tiers,
tight spaces, and plenty of room for various
battles.
<Additional Credits> : [HFX]Evil, for making great textures.
-=( Construction )=- --------------------------------------------------
<Base> : None.
<Editor(s) Used> : Q3Radiant - Build 202 & Q3Build
<Known Bugs> : This isn't really a bug, but an added feature;
you can walk on top of the battlements.
<Construction Time> : 3 weeks.
<Compile Machine> : 866mhz PIII, 512mb RAM
-=( Play Information )=- ----------------------------------------------
<Mod> : A good one.
<Players> : 2-8 Players
<Bots> : Duh! wait, I THINK they're smarter than Forrest
Gump... You'll have to clarify that for me =).
-={ Installation }=- --------------------------------------------------
<Installation> : Unzip the the zip file map-20kdm2.zip into
your "Quake III Arena\baseq3" directory
Run Quake III Arena, and under console type
"/map 20kdm2" or select under Skirmish in
SIngle Player mode.
-=( Copyright / Permissions )=- ---------------------------------------
<Copyright> : You not include or distribute this map in any
sort of commercial product without permission
from the author. You may not mass distribute
this level via any non-electronic means
including but not limited to compact disks,
and floppy disks without permission from the
author.
-=( This is the End )=- -----------------------------------------------

View File

@@ -1,317 +0,0 @@
Sub cat( cat_name$ )
Print""
Print "---------------------["; UCase$(cat_name$); " Test]---------------------"
End Sub
cat("Console I/O")
FPrint("Single Line")
FPrint("Two\nLines")
Print ""
user_input$ = Input$("Enter Something: ")
Print ""
Print "You type: "; user_input$
cat("Arrays")
Dim num_array1D[7]
Dim str_array1D$[11]
Dim usr_array1D[22] As Empty
Dim num_array2D[4, 6]
Dim str_array2D$[3, 9]
Dim usr_array2D[2,5] As Empty
Dim num_array3D[13,11,6]
Dim str_array3D[11,22,7]
Dim usr_array3D[12,5,14] As Empty
Print "*** ArrayDim() Test ***"
Print ""
Print "num_array1D[] dimensions: expected=1, returned="; ArrayDim(num_array1D)
Print "str_array1D[] dimensions: expected=1, returned="; ArrayDim(str_array1D)
Print "usr_array1D[] dimensions: expected=1, returned="; ArrayDim(usr_array1D)
Print ""
Print "num_array2D[] dimensions: expected=2, returned="; ArrayDim(num_array2D)
Print "str_array2D[] dimensions: expected=2, returned="; ArrayDim(str_array2D)
Print "usr_array2D[] dimensions: expected=2, returned="; ArrayDim(usr_array2D)
Print ""
Print "num_array3D[] dimensions: expected=3, returned="; ArrayDim(num_array3D)
Print "str_array3D[] dimensions: expected=3, returned="; ArrayDim(str_array3D)
Print "usr_array3D[] dimensions: expected=3, returned="; ArrayDim(usr_array3D)
Print ""
Print "*** ArraySize() Test ***"
Print ""
Print "num_array1D[] Size: expected=7,0,0, returned="; ArraySize(num_array1D,1); ","; ArraySize(num_array1D,2); ","; ArraySize(num_array1D,3)
Print "str_array1D[] Size: expected=11,0,0, returned="; ArraySize(str_array1D,1); ","; ArraySize(str_array1D,2); ","; ArraySize(str_array1D,3)
Print "usr_array1D[] Size: expected=22,0,0, returned="; ArraySize(usr_array1D,1); ","; ArraySize(usr_array1D,2); ","; ArraySize(usr_array1D,3)
Print ""
Print "num_array2D[] Size: expected=4,6,0, returned="; ArraySize(num_array2D,1); ","; ArraySize(num_array2D,2); ","; ArraySize(num_array2D,3)
Print "str_array2D[] Size: expected=3,9,0, returned="; ArraySize(str_array2D,1); ","; ArraySize(str_array2D,2); ","; ArraySize(str_array2D,3)
Print "usr_array2D[] Size: expected=2,5,0, returned="; ArraySize(usr_array2D,1); ","; ArraySize(usr_array2D,2); ","; ArraySize(usr_array2D,3)
Print ""
Print "num_array3D[] Size: expected=13,11,6, returned="; ArraySize(num_array3D,1); ","; ArraySize(num_array3D,2); ","; ArraySize(num_array3D,3)
Print "str_array3D[] Size: expected=11,22,7, returned="; ArraySize(str_array3D,1); ","; ArraySize(str_array3D,2); ","; ArraySize(str_array3D,3)
Print "usr_array3D[] Size: expected=12,5,14, returned="; ArraySize(usr_array3D,1); ","; ArraySize(usr_array3D,2); ","; ArraySize(usr_array3D,3)
Print ""
Print "*** ArrayCopy() Test ***"
Print ""
Dim num_array_copy1D_smaller[3]
Dim num_array_copy1D_bigger[21]
Dim str_array_copy1D_smaller$[3]
Dim str_array_copy1D_bigger$[21]
num_array1D[0] = -4
num_array1D[1] = 12
num_array1D[2] = 9
num_array1D[6] = 99
str_array1D$[0] = "zero"
str_array1D$[4] = "FoUr"
str_array1D$[9] = "NINE"
str_array1D$[10] = "ten"
Type Test_Type1
Dim x[5]
Dim y[7,5]
Dim txt_var1$
Dim txt_var2$[14]
End Type
Type Test_Type2
Dim t2_var1[7,5] As Test_Type1
Dim v1[25]
Dim txt_var1$
End Type
Type Test_Type3
Dim tst_t[7,5,9] As Test_Type2
Dim tst_t2 As Test_Type2
Dim x, y[6,5], z[21]
Dim txt_var1$[8,7]
End Type
Dim type_array[10] As Test_Type3
Dim type_array_copy_smaller[3]
Dim type_array_copy_bigger[19]
type_array[0].tst_t[3,4,7].t2_var1[5,3].txt_var2$[7] = "test type array Case One"
type_array[0].tst_t[3,4,7].t2_var1[5,3].y[4,2] = 42
type_array[9].tst_t[6,4,8].t2_var1[5,3].txt_var2$[7] = "test type array Case Two"
type_array[0].tst_t[3,4,7].v1[4] = 29.54
type_array[9].txt_var1$[5,6] = "test type array Case Three"
ArrayCopy(num_array1D, num_array_copy1D_smaller)
ArrayCopy(num_array1D, num_array_copy1D_bigger)
ArrayCopy(str_array1D, str_array_copy1D_smaller)
ArrayCopy(str_array1D, str_array_copy1D_bigger)
Print "test type"
ArrayCopy(type_array, type_array_copy_smaller)
Print "Not Dead yet"
ArrayCopy(type_array, type_array_copy_bigger)
Print "num_array1D[] Size: expected=7,0,0, returned="; ArraySize(num_array1D,1); ","; ArraySize(num_array1D,2); ","; ArraySize(num_array1D,3)
Print "str_array1D[] Size: expected=11,0,0, returned="; ArraySize(str_array1D,1); ","; ArraySize(str_array1D,2); ","; ArraySize(str_array1D,3)
Print "usr_array1D[] Size: expected=22,0,0, returned="; ArraySize(usr_array1D,1); ","; ArraySize(usr_array1D,2); ","; ArraySize(usr_array1D,3)
'Testing User Types
Type TestType1
Dim x, y[5]
Dim txt$[7]
Dim t2$
End Type
Type TestType2
Dim a
Dim b[12] As TestType1
Dim c As TestType1
End Type
Type TestType3
Dim r[6] As TestType2
Dim c As TestType1
End Type
Dim v[20] As TestType3
v[4].r[2].b[11].txt$[4] = "hello"
Print "Testing User Defined Types"
Print "------------------------------"
For i = 0 to ArraySize(v[4].r[2].b[11].txt$, 1)-1
Print "txt["; i; "] = "; v[4].r[2].b[11].txt$[i]
Next
Print ""
Print "Testing Graphics and Physics"
'Testing Graphics
OpenWindow("Test Window", 640, 480, 0, 0)
Dim w, h
GetWindowSize(w, h)
Print "Win Size = "; w;", "; h
canvas1 = OpenCanvas(640, 480, 0, 0, 640, 480, 0)
canvas2 = OpenCanvas(640, 480, 0, 0, 640, 480, 0)
SetCanvasZ(canvas2, 0)
SetCanvas3D(canvas1, true)
fnt$ = "NotoSansJP-VariableFont_wght.ttf"
hud_font = loadFont(fnt, 12)
Canvas(canvas2)
SetColor(RGB(255,255,255))
Dim hud_txt$[9]
hud_txt$[0] = "W/A/S/D Keys to Move"
hud_txt$[1] = "R/F Keys to Move Up/Down"
hud_txt$[2] = "Arrow Keys to Rotate Camera"
hud_txt$[3] = "Z Key to Rotate Character"
hud_txt$[4] = "X Key to Move Character Forward"
hud_txt$[5] = "C Key to Move Character Up"
For i = 0 to 5
DrawText(hud_txt$[i], 10, 10+(i*15))
Next
Canvas(canvas1)
mesh1 = LoadMesh("media/sydney.md2")
actor1 = CreateMeshActor(mesh1)
actor1_texture = LoadImage("media/sydney.bmp")
mat = CreateMaterial()
SetMaterialTexture(mat, 0, actor1_texture)
SetMaterialLighting(mat, false)
SetActorMaterial(actor1, 0, mat)
a_mat = GetActorMaterial(actor1, 0)
SetMaterialLighting(a_mat, false)
SetActorSolid(actor1, true)
SetActorCollisionShape(actor1, 4, 25)
TranslateActor(actor1, 0, 150, 0)
level = LoadMeshFromArchive("media/map-20kdm2.pk3", "20kdm2.bsp")
actor2 = CreateMeshOctreeActor(level)
SetActorSolid(actor2, true)
SetActorCollisionShape(actor2, 7, 0)
Dim ax, ay, az
Canvas(canvas1)
SetActorPosition(actor1, 1160, 399, 2122)
SetActorRotation(actor1, 0, 0, 0)
SetCameraPosition(984, 488, 2303)
SetCameraRotation(23, 1216, 0)
init = true
i = 0
Dim vx, vy, vz
mass = 8
GetActorLocalInertia(actor1, vx, vy, vz)
SetActorMassProperties(actor1, mass, vx, vy, vz)
SetActorGravity(actor1, 0, -100, 0)
While Not Key(K_ESCAPE)
SetActorAngularVelocityWorld(actor1, 0, 0, 0)
If Key(K_W) Then
Canvas(canvas1)
TranslateCamera(0,0,10)
ElseIf Key(K_S) Then
Canvas(canvas1)
TranslateCamera(0,0,-10)
End If
If Key(K_A) Then
Canvas(canvas1)
TranslateCamera(-10,0,0)
ElseIf Key(K_D) Then
Canvas(canvas1)
TranslateCamera(10,0,0)
End If
If Key(K_R) Then
Canvas(canvas1)
Dim crx, cry, crz
GetCameraPosition(crx, cry, crz)
SetCameraPosition(crx, cry+10, crz)
ElseIf Key(K_F) Then
Canvas(canvas1)
'TranslateCameraW(0, -10, 0) - Haven't added this function yet
Dim crx, cry, crz
GetCameraPosition(crx, cry, crz)
SetCameraPosition(crx, cry-10, crz)
End If
If Key(K_UP) Then
Canvas(canvas1)
RotateCamera(1, 0, 0)
ElseIf Key(K_DOWN) Then
Canvas(canvas1)
RotateCamera(-1, 0, 0)
End If
If Key(K_LEFT) Then
Canvas(canvas1)
Dim crx, cry, crz
GetCameraRotation(crx, cry, crz)
RotateCamera(-1*crx, 0, 0)
RotateCamera(0, -1, 0)
RotateCamera(crx, 0, 0)
ElseIf Key(K_RIGHT) Then
Canvas(canvas1)
Dim crx, cry, crz
GetCameraRotation(crx, cry, crz)
SetCameraRotation(crx, cry+1, crz)
End If
If Key(K_Z) Then
SetActorAngularVelocityLocal(actor1, 0, 10, 0)
End If
If Key(K_X) Then
SetActorLinearVelocityLocal(actor1, 60, 0, 0)
End If
If Key(K_C) Then
SetActorLinearVelocityLocal(actor1, 0, 60, 0)
End If
Update()
Wend

View File

@@ -1,16 +0,0 @@
Type test_type
Dim w
End Type
Type ano
Dim t[8] as test_type
Dim n
End Type
x[4].t.w = 13
Dim x[6] as ano
Dim y[4] as ano
Dim z[4] as ano
ArrayCopy(x, y)

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@@ -31,18 +31,63 @@
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
<Add directory="/usr/include/freetype2" />
<Add directory="/home/n00b/Projects/RCIrrlicht/include" />
<Add directory="/usr/include/bullet" />
<Add directory="/home/n00b/Projects/irrBullet/include" />
<Add directory="/home/n00b/Projects/irrTheora" />
</Compiler>
<Linker>
<Add option="-lSDL2main -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -lSDL2_mixer -lSDL2_net -logg -lvorbis -lvorbisfile -ltheora -ltheoradec -lIrrlicht -pthread" />
<Add option="-lSDL2main -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -lSDL2_mixer -lSDL2_net -logg -lvorbis -lvorbisfile -ltheora -ltheoradec -lIrrlicht -lfreetype -lbox2d -lBullet3Collision -lBullet3Common -lBullet3Dynamics -lBullet3Geometry -lBulletCollision -lBulletDynamics -lBulletInverseDynamics -lBulletSoftBody -lLinearMath -pthread" />
<Add directory="/home/n00b/Projects/RCIrrlicht/lib/Linux" />
</Linker>
<Unit filename="../../irrBullet/src/irrBullet.cpp" />
<Unit filename="../../irrBullet/src/irrBulletBoxShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletBvhTriangleMeshShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletCapsuleShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletCollisionCallBackInformation.cpp" />
<Unit filename="../../irrBullet/src/irrBulletCollisionObject.cpp" />
<Unit filename="../../irrBullet/src/irrBulletCollisionObjectAffector.cpp" />
<Unit filename="../../irrBullet/src/irrBulletCollisionObjectAffectorAttract.cpp" />
<Unit filename="../../irrBullet/src/irrBulletCollisionObjectAffectorDelete.cpp" />
<Unit filename="../../irrBullet/src/irrBulletCollisionShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletConeShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletConvexHullShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletCylinderShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletGImpactMeshShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletGhostObject.cpp" />
<Unit filename="../../irrBullet/src/irrBulletLiquidBody.cpp" />
<Unit filename="../../irrBullet/src/irrBulletMotionState.cpp" />
<Unit filename="../../irrBullet/src/irrBulletPhysicsDebug.cpp" />
<Unit filename="../../irrBullet/src/irrBulletRayCastVehicle.cpp" />
<Unit filename="../../irrBullet/src/irrBulletRigidBody.cpp" />
<Unit filename="../../irrBullet/src/irrBulletSoftBody.cpp" />
<Unit filename="../../irrBullet/src/irrBulletSphereShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletTriangleMeshShape.cpp" />
<Unit filename="../../irrBullet/src/irrBulletWorld.cpp" />
<Unit filename="../../irrBullet/src/irrBulletcommon.cpp" />
<Unit filename="RealisticWater.cpp" />
<Unit filename="RealisticWater.h" />
<Unit filename="camera.h" />
<Unit filename="gui_freetype_font.cpp" />
<Unit filename="gui_freetype_font.h" />
<Unit filename="main.cpp" />
<Unit filename="rc_audio.h" />
<Unit filename="rc_defines.h" />
<Unit filename="rc_func130_cases.h" />
<Unit filename="rc_geometry.h" />
<Unit filename="rc_gfx.h" />
<Unit filename="rc_gfx3D.h" />
<Unit filename="rc_gfx_core.h" />
<Unit filename="rc_matrix.h" />
<Unit filename="rc_media.h" />
<Unit filename="rc_net.h" />
<Unit filename="rc_os_defines.h" />
<Unit filename="rc_process.h" />
<Unit filename="rc_sprite2D.h" />
<Unit filename="rc_stdlib.h" />
<Unit filename="rc_test.h" />
<Unit filename="rc_utf8.h" />
<Unit filename="rc_video.h" />
<Unit filename="theoraplay.c">
<Option compilerVar="CC" />
</Unit>

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="main.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<ActiveTarget name="Debug" />
<File name="rc_func130_cases.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="164139" topLine="4575" />
<Cursor1 position="1992" topLine="66" />
</Cursor>
</File>
<File name="rc_media.h" open="1" top="1" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_geometry.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="48" />
<Cursor1 position="20919" topLine="666" />
</Cursor>
</File>
<File name="rc_process.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4175" topLine="118" />
<Cursor1 position="65432" topLine="2247" />
</Cursor>
</File>
<File name="rc_defines.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="rc_gfx.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="64772" topLine="1055" />
<Cursor1 position="3481" topLine="943" />
</Cursor>
</File>
<File name="rc_audio.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1584" topLine="67" />
</Cursor>
</File>
<File name="rc_gfx_core.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="10603" topLine="397" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBulletWorld.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2750" topLine="75" />
</Cursor>
</File>
<File name="rc_gfx3D.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="187021" topLine="6593" />
</Cursor>
</File>
<File name="rc_net.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1339" topLine="82" />
</Cursor>
</File>
<File name="rc_media.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="17752" topLine="678" />
</Cursor>
</File>
<File name="camera.h" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="153" />
</Cursor>
</File>
<File name="rc_stdlib.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="37957" topLine="1643" />
</Cursor>
</File>
<File name="rc_defines.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="301" topLine="0" />
</Cursor>
</File>
<File name="rc_matrix.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="26119" topLine="953" />
</Cursor>
</File>
<File name="../../irrBullet/src/irrBullet.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="7" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@@ -0,0 +1,96 @@
/*
* Copyright (c) 2013, elvman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY elvman ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL elvman BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
const float LOG2 = 1.442695;
uniform vec3 CameraPosition; // Position of main position
uniform float WaveHeight;
uniform vec4 WaterColor;
uniform float ColorBlendFactor;
uniform sampler2D WaterBump; //coverage
uniform sampler2D RefractionMap; //coverage
uniform sampler2D ReflectionMap; //coverage
uniform bool FogEnabled;
uniform int FogMode;
varying vec2 bumpMapTexCoord;
varying vec3 refractionMapTexCoord;
varying vec3 reflectionMapTexCoord;
varying vec3 position3D;
void main()
{
//bump color
vec4 bumpColor = texture2D(WaterBump, bumpMapTexCoord);
vec2 perturbation = WaveHeight * (bumpColor.rg - 0.5);
//refraction
vec2 ProjectedRefractionTexCoords = clamp(refractionMapTexCoord.xy / refractionMapTexCoord.z + perturbation, 0.0, 1.0);
//calculate final refraction color
vec4 refractiveColor = texture2D(RefractionMap, ProjectedRefractionTexCoords );
//reflection
vec2 ProjectedReflectionTexCoords = clamp(reflectionMapTexCoord.xy / reflectionMapTexCoord.z + perturbation, 0.0, 1.0);
//calculate final reflection color
vec4 reflectiveColor = texture2D(ReflectionMap, ProjectedReflectionTexCoords );
//fresnel
vec3 eyeVector = normalize(CameraPosition - position3D);
vec3 upVector = vec3(0.0, 1.0, 0.0);
//fresnel can not be lower than 0
float fresnelTerm = max( dot(eyeVector, upVector), 0.0 );
float fogFactor = 1.0;
if (FogEnabled)
{
float z = gl_FragCoord.z / gl_FragCoord.w;
if (FogMode == 1) //exp
{
float fogFactor = exp2(-gl_Fog.density * z * LOG2);
fogFactor = clamp(fogFactor, 0.0, 1.0);
}
else if (FogMode == 0) //linear
{
fogFactor = (gl_Fog.end - z) / (gl_Fog.end - gl_Fog.start);
}
else if (FogMode == 2) //exp2
{
float fogFactor = exp2(-gl_Fog.density * gl_Fog.density * z * z * LOG2);
fogFactor = clamp(fogFactor, 0.0, 1.0);
}
}
vec4 combinedColor = refractiveColor * fresnelTerm + reflectiveColor * (1.0 - fresnelTerm);
vec4 finalColor = ColorBlendFactor * WaterColor + (1.0 - ColorBlendFactor) * combinedColor;
gl_FragColor = mix(gl_Fog.color, finalColor, fogFactor );
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2013, elvman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY elvman ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL elvman BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
float3 CameraPosition; // Position of main position
float WaveHeight;
float4 WaterColor;
float ColorBlendFactor;
sampler2D WaterBump; //coverage
sampler2D RefractionMap; //coverage
sampler2D ReflectionMap; //coverage
// Pixel shader output structure
struct PS_OUTPUT
{
float4 color : COLOR0; // Pixel color
};
struct PS_INPUT
{
float4 position : POSITION; // vertex position
float2 bumpMapTexCoord : TEXCOORD0;
float3 refractionMapTexCoord : TEXCOORD1;
float3 reflectionMapTexCoord : TEXCOORD2;
float3 position3D : TEXCOORD3;
};
PS_OUTPUT main( PS_INPUT input )
{
PS_OUTPUT output;
//bump color
float4 bumpColor = tex2D(WaterBump, input.bumpMapTexCoord);
float2 perturbation = WaveHeight * (bumpColor.rg - 0.5);
//refraction
float2 ProjectedRefractionTexCoords = saturate(input.refractionMapTexCoord.xy / input.refractionMapTexCoord.z + perturbation);
//calculate final refraction color
float4 refractiveColor = tex2D(RefractionMap, ProjectedRefractionTexCoords );
//reflection
float2 ProjectedReflectionTexCoords = saturate(input.reflectionMapTexCoord.xy / input.reflectionMapTexCoord.z + perturbation);
//calculate final reflection color
float4 reflectiveColor = tex2D(ReflectionMap, ProjectedReflectionTexCoords );
//fresnel
float3 eyeVector = normalize(CameraPosition - input.position3D);
float3 upVector = float3(0.0, 1.0, 0.0);
//fresnel can not be lower than 0
float fresnelTerm = max( dot(eyeVector, upVector), 0.0 );
float4 combinedColor = refractiveColor * fresnelTerm + reflectiveColor * (1.0 - fresnelTerm);
output.color = ColorBlendFactor * WaterColor + (1.0 - ColorBlendFactor) * combinedColor;
return output;
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2013, elvman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY elvman ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL elvman BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//uniform mat4 View;
uniform mat4 WorldViewProj; // World * View * Projection transformation
uniform mat4 WorldReflectionViewProj; // World * Reflection View * Projection transformation
uniform float WaveLength;
uniform float Time;
uniform float WindForce;
uniform vec2 WindDirection;
// Vertex shader output structure
varying vec2 bumpMapTexCoord;
varying vec3 refractionMapTexCoord;
varying vec3 reflectionMapTexCoord;
varying vec3 position3D;
void main()
{
//color = gl_Color;
// transform position to clip space
vec4 pos = WorldViewProj * gl_Vertex;
gl_Position = pos;
// calculate vawe coords
bumpMapTexCoord = gl_MultiTexCoord0.xy / WaveLength + Time * WindForce * WindDirection;
// refraction texcoords
refractionMapTexCoord.x = 0.5 * (pos.w + pos.x);
refractionMapTexCoord.y = 0.5 * (pos.w + pos.y);
refractionMapTexCoord.z = pos.w;
// reflection texcoords
pos = WorldReflectionViewProj * gl_Vertex;
reflectionMapTexCoord.x = 0.5 * (pos.w + pos.x);
reflectionMapTexCoord.y = 0.5 * (pos.w + pos.y);
reflectionMapTexCoord.z = pos.w;
// position of the vertex
position3D = gl_Vertex.xyz;
}

View File

@@ -0,0 +1,80 @@
/*
* Copyright (c) 2013, elvman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY elvman ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL elvman BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//float4x4 View;
float4x4 WorldViewProj; // World * View * Projection transformation
float4x4 WorldReflectionViewProj; // World * Reflection View * Projection transformation
float WaveLength;
float Time;
float WindForce;
float2 WindDirection;
// Vertex shader output structure
struct VS_OUTPUT
{
float4 position : POSITION; // vertex position
float2 bumpMapTexCoord : TEXCOORD0;
float3 refractionMapTexCoord : TEXCOORD1;
float3 reflectionMapTexCoord : TEXCOORD2;
float3 position3D : TEXCOORD3;
};
struct VS_INPUT
{
float4 position : POSITION;
float4 color : COLOR0;
float2 texCoord0 : TEXCOORD0;
};
VS_OUTPUT main(VS_INPUT input)
{
VS_OUTPUT output;
// transform position to clip space
float4 pos = mul(input.position, WorldViewProj);
output.position = pos;
// calculate vawe coords
output.bumpMapTexCoord = input.texCoord0 / WaveLength + Time * WindForce * WindDirection;
// refraction texcoords
output.refractionMapTexCoord.x = 0.5 * (pos.w + pos.x);
output.refractionMapTexCoord.y = 0.5 * (pos.w - pos.y);
output.refractionMapTexCoord.z = pos.w;
// reflection texcoords
pos = mul(input.position, WorldReflectionViewProj);
output.reflectionMapTexCoord.x = 0.5 * (pos.w + pos.x);
output.reflectionMapTexCoord.y = 0.5 * (pos.w - pos.y);
output.reflectionMapTexCoord.z = pos.w;
// position of the vertex
output.position3D = input.position;
return output;
}