Skip to content

Commit

Permalink
Other Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonny K authored and Jonny K committed Jan 1, 2025
1 parent 91a6a86 commit bbfb455
Show file tree
Hide file tree
Showing 13 changed files with 290 additions and 274 deletions.
141 changes: 141 additions & 0 deletions common/src/FloatType.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/*
Copyright (C) 2010-2017 Kristian Duske
This file is part of TrenchBroom.
TrenchBroom is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
TrenchBroom is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "vm/constants.h"
#include <cstddef>

using FloatType = double;

namespace vm
{
enum class side;
enum class direction;
enum class rotation_axis;
enum class plane_status;

template <typename T, size_t S>
class vec;

using vec1f = vec<float, 1>;
using vec1d = vec<double, 1>;
using vec1i = vec<int, 1>;
using vec1l = vec<long, 1>;
using vec1s = vec<size_t, 1>;
using vec1b = vec<bool, 1>;

using vec2f = vec<float, 2>;
using vec2d = vec<double, 2>;
using vec2i = vec<int, 2>;
using vec2l = vec<long, 2>;
using vec2s = vec<size_t, 2>;
using vec2b = vec<bool, 2>;

using vec3f = vec<float, 3>;
using vec3d = vec<double, 3>;
using vec3i = vec<int, 3>;
using vec3l = vec<long, 3>;
using vec3s = vec<size_t, 3>;
using vec3b = vec<bool, 3>;

using vec4f = vec<float, 4>;
using vec4d = vec<double, 4>;
using vec4i = vec<int, 4>;
using vec4l = vec<long, 4>;
using vec4s = vec<size_t, 4>;
using vec4b = vec<bool, 4>;

template <typename T, size_t R, size_t C>
class mat;

using mat2x2f = mat<float, 2, 2>;
using mat3x3f = mat<float, 3, 3>;
using mat4x4f = mat<float, 4, 4>;
using mat2x2d = mat<double, 2, 2>;
using mat3x3d = mat<double, 3, 3>;
using mat4x4d = mat<double, 4, 4>;

template <typename T>
class quat;

using quatf = quat<float>;
using quatd = quat<double>;

template <typename T, size_t S>
class bbox;

using bbox1f = bbox<float, 1>;
using bbox1d = bbox<double, 1>;
using bbox2f = bbox<float, 2>;
using bbox2d = bbox<double, 2>;
using bbox3f = bbox<float, 3>;
using bbox3d = bbox<double, 3>;

template <typename T, size_t S>
class line;

using line3f = line<float, 3>;
using line3d = line<double, 3>;

template <typename T, size_t S>
class plane;

using plane3f = plane<float, 3>;
using plane3d = plane<double, 3>;

template <typename T, size_t S>
class ray;

using ray3f = ray<float, 3>;
using ray3d = ray<double, 3>;

template <typename T, size_t S>
class segment;

using segment3d = segment<double, 3>;
using segment3f = segment<float, 3>;
using segment2d = segment<double, 2>;
using segment2f = segment<float, 2>;

template <typename T, size_t S>
class polygon;

using polygon2f = polygon<float, 2>;
using polygon2d = polygon<double, 2>;
using polygon3f = polygon<float, 3>;
using polygon3d = polygon<double, 3>;

using vec3 = vec<FloatType, 3>;
using vec4 = vec<FloatType, 4>;
using vec2 = vec<FloatType, 2>;
using mat4x4 = mat<FloatType, 4, 4>;
using quat3 = quat<FloatType>;
using line3 = line<FloatType, 3>;
using line2 = line<FloatType, 2>;
using ray3 = ray<FloatType, 3>;
using segment3 = segment<FloatType, 3>;
using plane3 = plane<FloatType, 3>;
using polygon3 = polygon<FloatType, 3>;
using bbox3 = bbox<FloatType, 3>;
using bbox2 = bbox<FloatType, 2>;

using C = constants<FloatType>;

} // namespace vm
140 changes: 0 additions & 140 deletions common/src/View/GLContextManager.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions common/src/io/MapFileSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ class N64FileSerializer : public Quake2FileSerializer
}

private:
void doWriteBrushFooter(std::ostream& stream, const Model::Brush& brush) const override
void doWriteBrushFooter(std::ostream& stream, const mdl::Brush& brush) const override
{
writeVertexColors(stream, brush);
}
void doWriteBrushFace(std::ostream& stream, const Model::BrushFace& face) const override
void doWriteBrushFace(std::ostream& stream, const mdl::BrushFace& face) const override
{
writeFacePoints(stream, face);
writeValveMaterialInfo(stream, face);
Expand All @@ -301,7 +301,7 @@ class N64FileSerializer : public Quake2FileSerializer
fmt::format_to(std::ostreambuf_iterator<char>(stream), "\n");
}

void writeVertexColors(std::ostream& stream, const Model::Brush& brush) const
void writeVertexColors(std::ostream& stream, const mdl::Brush& brush) const
{
fmt::format_to(std::ostreambuf_iterator<char>(stream),
"[\n");
Expand Down
18 changes: 9 additions & 9 deletions common/src/io/MapParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MapParser
virtual void onEndEntity(const FileLocation& endLocation, ParserStatus& status) = 0;
virtual void onBeginBrush(const FileLocation& location, ParserStatus& status) = 0;
virtual void onEndBrush(const FileLocation& endLocation, ParserStatus& status) = 0;
virtual void onColorBlock(ParserStatus& status) = 0;
virtual void onColorBlock(const FileLocation& location, ParserStatus& status) = 0;
virtual void onStandardBrushFace(
const FileLocation& location,
mdl::MapFormat targetMapFormat,
Expand All @@ -75,14 +75,14 @@ class MapParser
const vm::vec3d& vAxis,
ParserStatus& status) = 0;
virtual void onN64BrushFace(
size_t line,
Model::MapFormat targetMapFormat,
const vm::vec3& point1,
const vm::vec3& point2,
const vm::vec3& point3,
const Model::BrushFaceAttributes& attribs,
const vm::vec3& texAxisX,
const vm::vec3& texAxisY,
const FileLocation& location,
mdl::MapFormat targetMapFormat,
const vm::vec3d& point1,
const vm::vec3d& point2,
const vm::vec3d& point3,
const mdl::BrushFaceAttributes& attribs,
const vm::vec3d& texAxisX,
const vm::vec3d& texAxisY,
ParserStatus& status) = 0;
virtual void onPatch(
const FileLocation& startLocation,
Expand Down
Loading

0 comments on commit bbfb455

Please sign in to comment.