forked from SFTtech/openage
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git.sft.mx:openage
Conflicts: .gitignore
- Loading branch information
Showing
18 changed files
with
454 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ bin | |
lib | ||
data/age | ||
callgrind.out.* | ||
data/perf.data* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,58 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env python3 | ||
|
||
#totally braindead and stupid configure file for openage | ||
# | ||
#rewrite it if you got any better plan. | ||
|
||
function rls() { | ||
mkdir -p bin¬ | ||
cd bin && cmake -DCMAKE_BUILD_TYPE=Release .. $@ | ||
} | ||
|
||
function dbg() { | ||
mkdir -p bin | ||
cd bin && cmake -DCMAKE_BUILD_TYPE=Debug .. $@ | ||
} | ||
|
||
function help() { | ||
echo -e "openage configure script" | ||
echo -e "" | ||
echo -e "initializes cmake so you can compile the project afterwards" | ||
echo -e "" | ||
echo -e "usage:" | ||
echo -e "\t./configure <mode>" | ||
echo -e "" | ||
echo -e "\tmode:\t<debug|release>" | ||
echo -e "\t\tdebug: build project with debug symbols and without optimisation" | ||
echo -e "\t\trelease: build project with optimisations and no debug support" | ||
} | ||
|
||
|
||
if [[ $# -eq 1 ]]; then | ||
if [[ $1 == "debug" ]]; then | ||
dbg | ||
elif [[ $1 == "release" ]]; then | ||
rls | ||
else | ||
help | ||
fi | ||
else | ||
help | ||
fi | ||
#rewrite it if you got any better idea. | ||
|
||
|
||
import os | ||
import argparse | ||
|
||
cmake_binary = "cmake" | ||
|
||
aboutmsg = "openage configure script, initializes cmake so you can compile the project afterwards" | ||
epilogmsg = "this script honors the CXX environment variable, but it has a lower priority than the --compiler option." | ||
|
||
ap = argparse.ArgumentParser(description=aboutmsg, epilog=epilogmsg) | ||
ap.add_argument("--mode", "-m", choices=["debug", "release"], default="release", help="an integer for the accumulator") | ||
ap.add_argument("--compiler", "-c", help="the compiler to use: clang++, g++") | ||
|
||
|
||
def prepare_binfolder(): | ||
os.makedirs("bin", exist_ok=True) | ||
os.chdir("bin/") | ||
|
||
def get_build_type(t): | ||
prefix = "-DCMAKE_BUILD_TYPE=" | ||
res = "" | ||
if t == "debug": | ||
res = prefix + "Debug" | ||
elif t == "release": | ||
res = prefix + "Release" | ||
else: | ||
raise Exception("unknown build type %s" % t) | ||
return [res] | ||
|
||
def get_compiler(t): | ||
prefix = "-DCMAKE_CXX_COMPILER=" | ||
res = prefix + t | ||
return [res] | ||
|
||
|
||
if __name__ == "__main__": | ||
args = ap.parse_args() | ||
prepare_binfolder() | ||
|
||
cmake_args = [] | ||
if args.mode != None: | ||
cmake_args += get_build_type(args.mode) | ||
|
||
cxx = args.compiler | ||
if cxx == None: | ||
if "CXX" in os.environ: | ||
cxx = os.environ['CXX'] | ||
if cxx != None: | ||
cmake_args += get_compiler(cxx) | ||
|
||
cmake_call = cmake_binary + " " + " ".join(cmake_args) + " .." | ||
os.system(cmake_call) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
//vertex shader for applying an alpha mask to a texture | ||
#version 120 | ||
|
||
//modelview*projection matrix | ||
uniform mat4 mvp_matrix; | ||
|
||
//the position of this vertex | ||
attribute vec4 vertex_position; | ||
|
||
//send the texture coordinates to the fragmentshader | ||
attribute vec2 base_tex_coordinates; | ||
attribute vec2 mask_tex_coordinates; | ||
|
||
//send the texture coordinates to the fragmentshader | ||
varying vec2 base_tex_position; | ||
varying vec2 mask_tex_position; | ||
|
||
void main(void) { | ||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_TexCoord[1] = gl_MultiTexCoord1; | ||
gl_FrontColor = gl_Color; | ||
//transform the position with the mvp matrix | ||
gl_Position = gl_ModelViewProjectionMatrix * vertex_position; | ||
|
||
//set the fixpoints for the tex coordinates at this vertex | ||
mask_tex_position = mask_tex_coordinates; | ||
base_tex_position = base_tex_coordinates; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
//total basic standard texture mapping fragment shader | ||
#version 120 | ||
|
||
//total basic standard texture drawing fragment shader | ||
|
||
//the texture data | ||
uniform sampler2D texture; | ||
|
||
//interpolated texture coordinates recieved from vertex shader | ||
varying vec2 tex_position; | ||
|
||
void main (void) { | ||
//this sets the fragment color to the corresponding texel. | ||
gl_FragColor = texture2D(texture, gl_TexCoord[0].st); | ||
//gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0); //force it to blue | ||
gl_FragColor = texture2D(texture, tex_position); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
//total basic standard texture mapping vertex shader | ||
#version 120 | ||
|
||
//modelview*projection matrix | ||
uniform mat4 mvp_matrix; | ||
|
||
//the position of this vertex | ||
attribute vec4 vertex_position; | ||
|
||
//the texture coordinates assigned to this vertex | ||
attribute vec2 tex_coordinates; | ||
|
||
//interpolated texture coordinates sent to fragment shader | ||
varying vec2 tex_position; | ||
|
||
void main(void) { | ||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | ||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
gl_FrontColor = gl_Color; | ||
//transform the vertex coordinates | ||
gl_Position = gl_ModelViewProjectionMatrix * vertex_position; | ||
|
||
//pass the fix points for texture coordinates set at this vertex | ||
tex_position = tex_coordinates; | ||
} |
Oops, something went wrong.