Skip to content

Commit

Permalink
Merge branch 'master' of git.sft.mx:openage
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
  • Loading branch information
mic-e committed Dec 2, 2013
2 parents 7c1b8ff + 79b848a commit d93cfc2
Show file tree
Hide file tree
Showing 18 changed files with 454 additions and 189 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ bin
lib
data/age
callgrind.out.*
data/perf.data*
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ project(openage)
#maybe use clang
#set(CMAKE_CXX_COMPILER "clang++" )

set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -std=c++11")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -std=c++11 -march=native -mtune=native")

set(EXECUTABLE_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/bin")
set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/lib")


set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -Werror")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -Og")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Werror -O3 -flto=4")

add_subdirectory("src")

Expand Down
71 changes: 61 additions & 10 deletions README → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ or create free media files yourself.
dependencies
============

python3
python3 imaging library (PIL) -> pillow
opengl 2.1
ftgl
dejavu font
freetype2
fontconfig
python3
python3 imaging library (PIL) -> pillow
opengl 2.1
glew
ftgl
dejavu font
freetype2
fontconfig



Expand Down Expand Up @@ -72,57 +73,107 @@ how to compile && run
=====================

on POSIX:
---------

./configure <release|debug>
make
make AGE2DIR=~/.wine-age/drive_c/programs/ms-games/aoe2 media
cd data && ../bin/openage

for other make targets, see:

make help


alternate method: get developer function aliases by sourcing "build_helpers":
source build_helpers

then type (depending on what build configuration you want):

rls

or

dbg

to compile the sources, type:

make

to convert the media files, see above.

to run the binary, type:

run

note that you can use these instructions everywhere, independent of your pwd (aliases, remember?)


on WINDOWS:
-----------

if you are keen on porting the game, go for it.


documentation
=============

static docs
-----------

general documentation files reside in the doc/ directory.
you can find ideas, milestones, planning and workflow descriptions etc in there.

dynamic docs
------------

dynamic documentation files are generated from comments in the source code, using doxygen.
the dynamic docs tend to only describe stuff you could also understand by reading the code itself,
so don't expect too much, use the static docs instead.

after you configured the project, you can invoke

make doc

to create doxygen html and LaTeX files.


after creation, view them in a browser by

$(browser) bin/doc/html/index.html


or, if you want to create LaTeX documents:
make -C bin/doc/latex/ pdf
$(pdfviewer) bin/doc/latex/refman.pdf

make -C bin/doc/latex/ pdf
$(pdfviewer) bin/doc/latex/refman.pdf


i'd recommend looking at the source, as we try do write stuff as readable as possible.


contributing
============

* we hate people, so don't even think about helping
* i'm sure that nobody out there likes age of empires
* none of you is interested in making this project more awesome
* as always, this free software project has NO interest in creating a community
* so please don't even think about helping us

guidelines:
* don't write **bugreports**, openage is totally bugfree, of course
* don't **fix bugs** yourself, see above, we don't have bugs
* don't implement **new features**, they are crap anyway
* don't EVER send **pull-requests**!
* don't note the irony, you idiot

contact
=======

currently you can use these communication channels to reach us morons:
* IRC: #sfttech on freenode.org
* XMPP: openage@chat.sft.mx


cheers, happy hecking.
cheers, happy hecking.
93 changes: 55 additions & 38 deletions configure
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)
13 changes: 10 additions & 3 deletions data/shaders/alphamask.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@
//applies an alpha mask texture to a base texture,
//then draws the masked texture.

//the base and mask texture, base is the plain terrain tile
uniform sampler2D base_texture;
uniform sampler2D mask_texture;

//disable blending and show the mask instead
uniform bool show_mask;

//get those interpolated texture position from vertexshader
varying vec2 base_tex_position;
varying vec2 mask_tex_position;


void main()
{
//get the texel from the uniform texture.
vec4 base_pixel = texture2D(base_texture, gl_TexCoord[0].xy);
vec4 mask_pixel = texture2D(mask_texture, gl_TexCoord[1].xy);
vec4 base_pixel = texture2D(base_texture, base_tex_position);
vec4 mask_pixel = texture2D(mask_texture, mask_tex_position);

float factor = 1.0 - mask_pixel.x;

vec4 blended_pixel = vec4(base_pixel.r, base_pixel.g, base_pixel.b, base_pixel.a - factor);

//force to pink
//base_pixel = vec4(255.0/255.0, 20.0/255.0, 147.0/255.0, 1.0);
//blended_pixel = vec4(255.0/255.0, 20.0/255.0, 147.0/255.0, 1.0);
if (show_mask) {
gl_FragColor = mask_pixel;
} else {
Expand Down
23 changes: 19 additions & 4 deletions data/shaders/alphamask.vert.glsl
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;
}
11 changes: 8 additions & 3 deletions data/shaders/maptexture.frag.glsl
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);
}
20 changes: 17 additions & 3 deletions data/shaders/maptexture.vert.glsl
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;
}
Loading

0 comments on commit d93cfc2

Please sign in to comment.