Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lighting, fixed sky box, tracker, automated tests #38

Merged
merged 118 commits into from
Jan 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
c66de17
Add google test library with a single failing test
jonathan-voss Sep 13, 2018
b30c496
Split some things into abstract base classes
jonathan-voss Sep 15, 2018
8829b53
Split out CPlayerManager abstract base class
jonathan-voss Sep 16, 2018
d0e75ef
Embark on high risk attempt to separate gl
jonathan-voss Sep 16, 2018
f660a74
Successfully running a test that does nothing
jonathan-voss Sep 16, 2018
20cc0bb
Test a falling hector until it hits the ground
jonathan-voss Sep 17, 2018
a80ab8e
Fix sound crashes
jonathan-voss Sep 18, 2018
568b863
Add test for hector falling with scaled gravity
jonathan-voss Sep 18, 2018
9637b94
Merge remote-tracking branch 'origin/master' into testing
jonathan-voss Sep 18, 2018
95003fa
Add test for grenade trajectory
jonathan-voss Sep 19, 2018
143f3fc
Scale grenade trajectory
jonathan-voss Sep 20, 2018
d05c758
Scale walking and test walking
jonathan-voss Sep 20, 2018
8af3b35
Merge remote-tracking branch 'origin/master' into testing
jonathan-voss Sep 21, 2018
c386bbd
Merge remote-tracking branch 'origin/master' into testing
jonathan-voss Sep 21, 2018
313f3e6
Merge remote-tracking branch 'origin/master' into testing
jonathan-voss Sep 22, 2018
dd71d93
Fix test failure message
jonathan-voss Sep 22, 2018
9bd3458
More convenient test setup
jonathan-voss Sep 22, 2018
97cd94c
fixes for network CAvaraApp casts
assertivist Sep 22, 2018
4b07b29
Improve high fps walk acceleration
jonathan-voss Sep 23, 2018
9f73e89
CLEANING
jonathan-voss Sep 23, 2018
48e7aec
Merge branch 'master' of https://github.com/assertivist/Avara into te…
assertivist Sep 25, 2018
bd0b27f
Fix compilation error
jonathan-voss Sep 25, 2018
c776344
Fix test segfaults possibly?
jonathan-voss Sep 25, 2018
a30cd84
Merge remote-tracking branch 'origin/master' into testing
jonathan-voss Sep 26, 2018
ce7edaa
Hone in more on accurate hector movement
jonathan-voss Sep 28, 2018
d5b4844
HONE IN ON CORRECT HECTOR WALK FORWARD
jonathan-voss Sep 28, 2018
9ce4fc1
Merge remote-tracking branch 'origin/master' into testing
jonathan-voss Sep 28, 2018
ea819f7
Use clang for tests too.
jonathan-voss Sep 28, 2018
6c088dc
Merge branch 'master' into testing
jonathan-voss Sep 28, 2018
c01a131
Merge branch 'master' into testing
assertivist Oct 4, 2018
f8ef0f4
Testing changes to pict2svg
assertivist Oct 16, 2018
fd7474b
still trying to figure out Paint/FrameSame<thing>
assertivist Oct 21, 2018
3a8ad43
Should have Frame/PaintSame* working, now need to fix text offsets
assertivist Oct 22, 2018
2ea9eea
pict2svg seems to be working now, time to script out creating these f…
assertivist Oct 27, 2018
918c24f
Attempt at refactoring forker for use with pict2svg -- doesn't work, …
assertivist Oct 29, 2018
d365fc9
added old converter source because i can't get forker to work, added …
assertivist Jan 29, 2019
e4673f1
pict2svg now runs against every level without crashing--some text x/y…
assertivist Feb 4, 2019
4fbd95e
pict2svg: fixed text positioning a little
assertivist Feb 4, 2019
cc221c1
Added xml parser (pugixml), started work on SVGParser
assertivist Feb 4, 2019
894cd6a
Slowly adding extensions to LevelLoader to handle SVG data structure,…
assertivist Feb 4, 2019
df45ce8
arc handling w/svgparser mostly working, added rect line thickness aw…
assertivist Feb 10, 2019
70b7cf1
Split out a separate application (somewhat poorly) for level previewi…
assertivist Feb 12, 2019
5141afa
started setting up loading svgs dynamically
assertivist Feb 17, 2019
dbf1082
add pict2svg to makefile
assertivist Feb 19, 2019
0599373
Merge branch 'travis' into testing
assertivist Feb 25, 2019
343b2dc
Run 'make tests' on Travis within testing branch
assertivist Feb 25, 2019
35ad904
Merge with testing
assertivist Apr 3, 2019
be74fc9
Fixes after merging with testing
assertivist Apr 18, 2019
46e01db
Merge svglevels with testing
assertivist Apr 22, 2019
13a22fe
Merge branch 'master' of https://github.com/assertivist/Avara into sv…
assertivist Apr 22, 2019
2e53277
a first attempt at proper lighting
assertivist May 3, 2019
936ce7f
Fix syntax error in shader
rherriman May 4, 2019
b120dde
refactor geometry shader to be a little more readable and remove Avar…
assertivist May 5, 2019
3327f25
attempt to limit output to 16 bit color
assertivist May 6, 2019
9e36acf
fixed self-intersecting faces, should also be double-sided faces
assertivist Jun 28, 2019
ccd017f
Merge branch 'lighting' into svglevels
assertivist Jun 28, 2019
a7c8898
Merge branch 'master' into svglevels
assertivist Jun 28, 2019
9faaa40
remove unnecessary include in svg parser
assertivist Jun 28, 2019
c145c84
Travis update to get builds for all branches
assertivist Jun 28, 2019
98c4fe3
Merge remote-tracking branch 'origin' into svglevels
assertivist Jun 28, 2019
f2b8408
fix a few things in pict2svg.py
assertivist Jun 28, 2019
5ef0ba6
fix filenames in deploy script
assertivist Jun 28, 2019
13b4994
Merge branch 'master' into svglevels
assertivist Jun 28, 2019
4eb254c
update travis to build on all branches for all platforms
assertivist Jun 28, 2019
d14ac50
Merge branch 'master' into svglevels
assertivist Jun 28, 2019
0b941ed
normals are being rotated but who knows if they are right
assertivist Jul 1, 2019
ea22962
Merge branch 'svglevels' of github.com:assertivist/Avara into svglevels
assertivist Jul 1, 2019
b683855
commiting WIP rendering system update as laptop battery dies -- moved…
assertivist Jul 8, 2019
ea3a828
closer but the Y axis of the final image seems to be reversed
assertivist Jul 8, 2019
7f99596
moved projection matrix out of vertex shader and figured out x/z flip…
assertivist Jul 8, 2019
878bc6d
successfully refactored to only upload vertex data a few times (at in…
assertivist Jul 8, 2019
d9d4644
trying to fix rendering bugs
assertivist Aug 30, 2019
1e01a9e
Adding a new level from Scarlet Swordfish
assertivist Aug 31, 2019
809fa83
Bug caused by incorrect shader program being selected during uniform …
assertivist Nov 13, 2019
4560c91
remove extra includes from AvaraGL
assertivist Nov 13, 2019
5c1f7b4
fix windows travis build
assertivist Nov 13, 2019
e3f9646
Remove execinfo.h -- no longer needed
assertivist Nov 13, 2019
1214532
refactor projection matrix to be modified at runtime for different wi…
assertivist Nov 13, 2019
132f16c
sky orientation fixed with skybox geometry but it has seams at the co…
assertivist Dec 20, 2019
156b3a8
fixed sky shader
assertivist Dec 22, 2019
d52a690
Take us back to single sided shapes with FACE_CULL off. We will attem…
assertivist Jan 12, 2020
0286e77
Much brighter--normal transform applied, using gl_FrontFacing in frag…
assertivist Jan 19, 2020
21ba95a
Add 'decal' support to the shader--lifts flat geometry in the z-buffe…
assertivist Jan 19, 2020
51fe419
clearer z-value scaling for decals
assertivist Jan 19, 2020
a21cd3f
reverse entire normal, not just y value, if not front face
assertivist Jan 19, 2020
7f19633
lighting looks much closer to original but not sure of the lights act…
assertivist Jan 21, 2020
f6c4731
Another pass on working lighting--internally consistent but doesn't m…
assertivist Jan 22, 2020
35b25b1
Add dan's patch to fix the lighting!
assertivist Jan 22, 2020
53de88a
clean up branch for merge, move cartesian conversion of light vectors…
assertivist Jan 24, 2020
f5ac2cb
Testing changes to pict2svg
assertivist Oct 16, 2018
fe536c8
Should have Frame/PaintSame* working, now need to fix text offsets
assertivist Oct 22, 2018
b668099
Add google test library with a single failing test
jonathan-voss Sep 13, 2018
83df6d9
Split some things into abstract base classes
jonathan-voss Sep 15, 2018
a37a7c4
Split out CPlayerManager abstract base class
jonathan-voss Sep 16, 2018
cf06573
Embark on high risk attempt to separate gl
jonathan-voss Sep 16, 2018
6fd3705
Successfully running a test that does nothing
jonathan-voss Sep 16, 2018
5902660
Test a falling hector until it hits the ground
jonathan-voss Sep 17, 2018
ac4d151
Fix sound crashes
jonathan-voss Sep 18, 2018
0e5aa76
Add test for hector falling with scaled gravity
jonathan-voss Sep 18, 2018
34c4fef
Add test for grenade trajectory
jonathan-voss Sep 19, 2018
c6ee51a
Scale grenade trajectory
jonathan-voss Sep 20, 2018
d363bc5
Scale walking and test walking
jonathan-voss Sep 20, 2018
2a85360
Fix test failure message
jonathan-voss Sep 22, 2018
294e00c
More convenient test setup
jonathan-voss Sep 22, 2018
20f238d
fixes for network CAvaraApp casts
assertivist Sep 22, 2018
64a3a33
Improve high fps walk acceleration
jonathan-voss Sep 23, 2018
ca7f0fa
CLEANING
jonathan-voss Sep 23, 2018
f1a36d0
Fix changes made to CBSPPart.cpp during merge with testing/lighting b…
assertivist Jan 24, 2020
c0e544e
Merge with avaraline master and fix tests after rendering changes
assertivist Jan 24, 2020
b75d095
fix tests one more time
assertivist Jan 24, 2020
5b7b08b
Merge branch 'master' of https://github.com/avaraline/Avara
assertivist Jan 24, 2020
2c9e16a
merge testing branch
assertivist Jan 24, 2020
d3a91a3
clean up shader and shortcut function
assertivist Jan 24, 2020
8dc810f
Merge with testing branch properly
assertivist Jan 24, 2020
5c5bb90
Initial implementation of a tracker
dcwatson Jan 24, 2020
12a5043
i made a mess
assertivist Jan 25, 2020
7594f87
Merge tracker branch
assertivist Jan 26, 2020
a440c2e
Remove svglevels testing stuff
assertivist Jan 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ build
*.orig
*.rej
xcuserdata
__pycache__
*.pyc
*.sublime-project
*.sublime-workspace
.vscode
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
skip_cleanup: true
script: bash deploy.bash linux
on:
branch: master
all_branches: true
- stage: test
os: osx
before_install:
Expand All @@ -22,12 +22,13 @@ jobs:
- sudo cp -R /Volumes/SDL2/SDL2.framework /Library/Frameworks/
script:
- make -j3 macapp SIGNING_ID=NONE
- make tests
deploy:
provider: script
skip_cleanup: true
script: bash deploy.bash mac
on:
branch: master
all_branches: true
- stage: test
os: windows
before_install:
Expand All @@ -39,8 +40,7 @@ jobs:
skip_cleanup: true
script: bash deploy.bash windows
on:
branch: master
after_script: powershell -Command "Stop-Computer"
all_branches: true
addons:
apt:
packages:
Expand All @@ -51,6 +51,8 @@ addons:
- libegl1-mesa-dev
- libgles2-mesa-dev
- libsdl2-net-dev
- libdirectfb-dev
script:
- make -j3
- make tests

28 changes: 23 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ CC = clang
CXX = clang++

BUILD_DIR ?= build
SRC_DIRS ?= $(shell find src -type d -not -path src) vendor/glad vendor/nanovg vendor/nanogui
SRC_DIRS ?= $(shell find src -type d -not -path src) vendor/glad vendor/nanovg vendor/nanogui vendor/pugixml vendor

UNAME := $(shell uname)
SRCS := $(shell find $(SRC_DIRS) -maxdepth 1 -name '*.cpp' -or -name '*.c')

INCFLAGS := $(addprefix -I, $(SRC_DIRS)) -Ivendor
INCFLAGS := $(addprefix -I, $(SRC_DIRS)) -Ivendor -Ivendor/gtest/include
CPPFLAGS := ${CPPFLAGS}
CPPFLAGS += $(INCFLAGS) -MMD -MP -g -Wno-multichar -DNANOGUI_GLAD
CXXFLAGS := ${CXXFLAGS}
Expand All @@ -20,11 +20,11 @@ ifeq ($(UNAME), Darwin)
# MacOS
SRCS += $(shell find $(SRC_DIRS) -maxdepth 1 -name '*.mm')
CPPFLAGS += -F/Library/Frameworks
LDFLAGS += -F/Library/Frameworks -lstdc++ -lm -framework SDL2 -framework SDL2_net -framework OpenGL -framework AppKit
LDFLAGS += -F/Library/Frameworks -lstdc++ -lm -lpthread -framework SDL2 -framework SDL2_net -framework OpenGL -framework AppKit
POST_PROCESS ?= dsymutil
else ifneq (,$(findstring NT-10.0,$(UNAME)))
# Windows - should match for MSYS2 on Win10
LDFLAGS += -lstdc++ -lm -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lglu32 -lopengl32 -lws2_32 -lcomdlg32
LDFLAGS += -lstdc++ -lm -lpthread -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lglu32 -lopengl32 -lws2_32 -lcomdlg32
POST_PROCESS ?= ls -lh
else
# Linux
Expand All @@ -47,8 +47,12 @@ SIGNING_ID := Y56DGU8P8X

avara: $(BUILD_DIR)/Avara resources

tests: $(BUILD_DIR)/tests resources

bspviewer: $(BUILD_DIR)/BSPViewer resources

levelviewer: $(BUILD_DIR)/AvaraLevelViewer resources

macapp: avara
rm -rf $(BUILD_DIR)/Avara.app
$(MKDIR_P) $(BUILD_DIR)/Avara.app/Contents/{Frameworks,MacOS,Resources}
Expand Down Expand Up @@ -76,11 +80,24 @@ $(BUILD_DIR)/Avara: $(OBJS) $(BUILD_DIR)/src/Avara.cpp.o
$(CXX) $(OBJS) $(BUILD_DIR)/src/Avara.cpp.o -o $@ $(LDFLAGS)
$(POST_PROCESS) $@

# Tests
$(BUILD_DIR)/tests: $(OBJS) $(BUILD_DIR)/src/tests.cpp.o $(BUILD_DIR)/vendor/gtest-all.cc.o
$(CXX) $(OBJS) $(BUILD_DIR)/vendor/gtest-all.cc.o $(BUILD_DIR)/src/tests.cpp.o -o $@ $(LDFLAGS)
$(POST_PROCESS) $@

# Google test
$(BUILD_DIR)/vendor/gtest-all.cc.o:
$(CXX) -isystem vendor/gtest/include/ -Ivendor/gtest/ -pthread -c vendor/gtest/src/gtest-all.cc -o $@
# BSPViewer
$(BUILD_DIR)/BSPViewer: $(OBJS) $(BUILD_DIR)/src/BSPViewer.cpp.o
$(CC) $(OBJS) $(BUILD_DIR)/src/BSPViewer.cpp.o -o $@ $(LDFLAGS)
$(POST_PROCESS) $@

# LevelViewer
$(BUILD_DIR)/AvaraLevelViewer: $(OBJS) $(BUILD_DIR)/src/AvaraLevelViewer.cpp.o
$(CXX) $(OBJS) $(BUILD_DIR)/src/AvaraLevelViewer.cpp.o -o $@ $(LDFLAGS)
$(POST_PROCESS) $@

# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) $(dir $@)
Expand All @@ -101,10 +118,11 @@ $(BUILD_DIR)/%.mm.o: %.mm
clean:
$(RM) -r $(BUILD_DIR)

publish:
publish:
scp build/Avara-*.zip avaraline.net:/srv/http/avaraline/dev/builds/

resources:
# python3 bin/pict2svg.py
cp -r bsps levels rsrc shaders $(BUILD_DIR)

-include $(DEPS)
Expand Down
Empty file added bin/Converter/__init__.py
Empty file.
Empty file added bin/Converter/bspt/__init__.py
Empty file.
134 changes: 134 additions & 0 deletions bin/Converter/bspt/datatypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
from Converter.helpers import *


UniquePointLength = 16


class UniquePoint():
size = 16

def __init__(self, raw_data=None):
if raw_data is None:
self.x = 0
self.y = 0
self.z = 0
self.w = 0
else:
assert(len(raw_data) == UniquePointLength)
self.x = bytes_to_fixed(raw_data[0:4])
self.y = bytes_to_fixed(raw_data[4:8])
self.z = bytes_to_fixed(raw_data[8:12])
self.w = bytes_to_fixed(raw_data[12:16])

def __repr__(self):
tup = (self.x, self.y, self.z, self.w)
return "UniquePoint(%f %f %f %f)" % tup

def serialize(self):
return self.as_list_4()

def as_list_3(self):
return [self.x, self.y, self.z]

def as_list_4(self):
return [self.x, self.y, self.z, self.w]


NormalRecordLength = 8


class NormalRecord():
def __init__(self, raw_data):
assert(len(raw_data) == NormalRecordLength)
self.normal_index = bytes_to_unsigned_short(raw_data[0:2])
self.base_point_index = bytes_to_unsigned_short(raw_data[2:4])
self.color_index = bytes_to_unsigned_short(raw_data[4:6])
self.visibility_flags = bytes_to_unsigned_short(raw_data[6:8])

def __repr__(self):
tup = (self.normal_index, self.base_point_index, self.color_index, self.visibility_flags)
return "NormalRecord (%d %d %d %d)" % tup

def serialize(self):
return [
self.normal_index,
self.base_point_index,
self.color_index,
self.visibility_flags
]


EdgeRecordLength = 4


class EdgeRecord():
def __init__(self, raw_data):
assert(len(raw_data) == EdgeRecordLength)
self.a = bytes_to_unsigned_short(raw_data[0:2])
self.b = bytes_to_unsigned_short(raw_data[2:4])

def __repr__(self):
tup = (self.a, self.b)
return "EdgeRecord (%d %d)" % tup

def serialize(self):
return [self.a, self.b]


PolyRecordLength = 16


class PolyRecord():
def __init__(self, raw_data):
assert(len(raw_data) == PolyRecordLength)
self.first_edge = bytes_to_unsigned_short(raw_data[0:2])
self.edge_count = bytes_to_unsigned_short(raw_data[2:4])
self.normal_index = bytes_to_unsigned_short(raw_data[4:6])
self.front_poly = bytes_to_unsigned_short(raw_data[6:8])
self.back_poly = bytes_to_unsigned_short(raw_data[8:10])
self.visibility = bytes_to_unsigned_short(raw_data[10:12])
self.reserved = bytes_to_unsigned_long(raw_data[12:16])

def __repr__(self):
tup = (self.first_edge, self.edge_count, self.normal_index, self.front_poly, self.back_poly, self.visibility)
return "PolyRecord (%d %d %d %d %d %d)" % tup

def serialize(self):
return [
self.first_edge,
self.edge_count,
self.normal_index,
self.front_poly,
self.back_poly,
self.visibility,
self.reserved
]


ColorRecordLength = (32 * 2) + 4


class ColorRecord():
def __init__(self, raw_data):
assert(len(raw_data) == ColorRecordLength)
self.color_long = bytes_to_long(raw_data[0:4])
# convert to RGBA float color format
self.color = [
((self.color_long >> 8) & 0xff) / 254.0,
((self.color_long >> 16) & 0xff) / 254.0,
((self.color_long >> 24) & 0xff) / 254.0,
(self.color_long & 0xff) / 254.0
]
# colorCache[32] (COLORCACHESIZE)
# this is not useful to most people because
# it was used to store intermediate shades
# of a color when shading it with white light
self.color_cache = [bytes_to_unsigned_short(x)
for x in chunks(raw_data[4:ColorRecordLength], 2)]

def __repr__(self):
tup = (self.color, self.color_cache)
return "ColorRecord (%s %s)" % tup

def serialize(self):
return self.color
Loading