chore: initial commit

This commit is contained in:
fallenoak 2020-11-22 23:25:22 -06:00
commit c955dd6531
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
16 changed files with 18109 additions and 0 deletions

47
.clang-format Normal file
View file

@ -0,0 +1,47 @@
---
AccessModifierOffset: 0
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: Never
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
ColumnLimit: 0
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: false
DerivePointerAlignment: false
IncludeBlocks: Merge
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: "<[[:alnum:].]+>"
Priority: 4
- Regex: ".*"
Priority: 1
SortPriority: 0
IndentGotoLabels: false
IndentWidth: 4
MaxEmptyLinesToKeep: 1
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PointerAlignment: Left
SortIncludes: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyBlock: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
Standard: c++11
TabWidth: 4
UseCRLF: false
UseTab: Never

1
.clang-format-ignore Normal file
View file

@ -0,0 +1 @@
/test/catch.hpp

15
.editorconfig Normal file
View file

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[tempest/**/*]
indent_size = 4
indent_style = space
[test/**/*]
indent_size = 4
indent_style = space

42
.github/workflows/push.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Push
on:
push:
branches:
- master
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: Ubuntu Latest (GCC)
os: ubuntu-latest
build_type: Release
cc: gcc
cxx: g++
- name: macOS Latest (Clang)
os: macos-latest
build_type: Release
cc: clang
cxx: clang++
steps:
- uses: actions/checkout@v2
- name: Prepare
run: mkdir build
- name: Configure
run: cd build && cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
- name: Build
run: cd build && make
- name: Test
run: ./build/test/TempestTest

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
.DS_Store
.idea
.vscode
/build
/dist

36
CMakeLists.txt Normal file
View file

@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 2.8)
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR
"In-source builds not allowed.
Please make a new directory (called a build directory) and run CMake from there.
You may need to remove CMakeCache.txt."
)
endif()
# Project
project(tempest)
set(CMAKE_CXX_STANDARD 11)
# Arch defines
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(WHOA_ARCH_64 1)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(WHOA_ARCH_32 1)
endif()
# OS defines
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(WHOA_PLATFORM_WIN 1)
add_definitions(-DWHOA_PLATFORM_WIN)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(WHOA_PLATFORM_LINUX 1)
add_definitions(-DWHOA_PLATFORM_LINUX)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(WHOA_PLATFORM_MAC 1)
add_definitions(-DWHOA_PLATFORM_MAC)
endif()
add_subdirectory(tempest)
add_subdirectory(test)

24
LICENSE Normal file
View file

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>

49
README.md Normal file
View file

@ -0,0 +1,49 @@
# Typhoon
Typhoon is an unofficial open source implementation of the Tempest math
library circa 2010.
The Tempest math library is a collection of 3D-math-centric classes and
functions created by the talented folks at Blizzard Entertainment for use in
their games.
This project attempts to provide a version of Tempest compatible with the
version used in the final release build of World of Warcraft: Wrath of the
Lich King in 2010: 3.3.5a (12340).
In the spirit of documenting what is presumed to have existed at the time,
this project makes every attempt to maintain the canonical names, layouts, and
side effects of the original implementation of Tempest. At the same time, it
attempts to ensure portability and compatibility with modern 64-bit systems.
## FAQ
**Why?**
It's fascinating to explore the development practices used to build a modern
major video game.
**Why 3.3.5a?**
The game and its libraries have become significantly more complex in the
intervening 10+ years. By picking 3.3.5a, it's possible to imagine this
implementation will eventually be complete.
**Will this let me cheat in the game?**
No. Tempest is a math library, and none of its routines are particularly
relevant to the anti-cheat measures found in the game.
**Can I use this in my own development projects?**
It's probably a bad idea. The original library remains closed source, and this
project is in no way official.
## Legal
This project is released into the public domain.
World of Warcraft: Wrath of the Lich King ©2008 Blizzard Entertainment, Inc.
All rights reserved. Wrath of the Lich King is a trademark, and World of
Warcraft, Warcraft and Blizzard Entertainment are trademarks or registered
trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.

13
tempest/CMakeLists.txt Normal file
View file

@ -0,0 +1,13 @@
file(GLOB TEMPEST_SOURCES
"*.cpp"
"vector/*.cpp"
)
add_library(tempest STATIC
${TEMPEST_SOURCES}
)
target_include_directories(tempest
PUBLIC
${PROJECT_SOURCE_DIR}
)

6
tempest/Vector.hpp Normal file
View file

@ -0,0 +1,6 @@
#ifndef TEMPEST_VECTOR_HPP
#define TEMPEST_VECTOR_HPP
#include "tempest/vector/C3Vector.hpp"
#endif

View file

@ -0,0 +1,13 @@
#include "tempest/vector/C3Vector.hpp"
C3Vector& C3Vector::operator*=(float a) {
this->x *= a;
this->y *= a;
this->z *= a;
return *this;
}
float C3Vector::SquaredMag() const {
return this->x * this->x + this->y * this->y + this->z * this->z;
}

View file

@ -0,0 +1,21 @@
#ifndef TEMPEST_VECTOR_C_3VECTOR_HPP
#define TEMPEST_VECTOR_C_3VECTOR_HPP
class C3Vector {
public:
// Member variables
float x = 0.0f;
float y = 0.0f;
float z = 0.0f;
// Member functions
C3Vector() = default;
C3Vector(float x, float y, float z)
: x(x)
, y(y)
, z(z){};
C3Vector& operator*=(float a);
float SquaredMag() const;
};
#endif

31
test/CMakeLists.txt Normal file
View file

@ -0,0 +1,31 @@
file(GLOB_RECURSE TEST_SOURCES "*.cpp")
if(WHOA_PLATFORM_MAC)
set_source_files_properties(${TEST_SOURCES}
PROPERTIES COMPILE_FLAGS "-x objective-c++"
)
add_executable(TempestTest ${TEST_SOURCES})
target_link_libraries(TempestTest
PRIVATE
tempest
"-framework AppKit"
)
endif()
if(WHOA_PLATFORM_LINUX OR WHOA_PLATFORM_WIN)
add_executable(TempestTest ${TEST_SOURCES})
target_link_libraries(TempestTest
PRIVATE
tempest
)
endif()
target_include_directories(TempestTest
PRIVATE
${PROJECT_SOURCE_DIR}
)
install(TARGETS TempestTest DESTINATION "bin")

2
test/Test.cpp Normal file
View file

@ -0,0 +1,2 @@
#define CATCH_CONFIG_MAIN
#include "test/Test.hpp"

1
test/Test.hpp Normal file
View file

@ -0,0 +1 @@
#include "test/catch.hpp"

17802
test/catch.hpp Normal file

File diff suppressed because it is too large Load diff