Skip to content

Commit

Permalink
Move medium event to own header file
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 1619a75854609ec073e8c82dec8dfb89d8b21b78
  • Loading branch information
Vertexwahn committed Jan 7, 2024
1 parent 4f08469 commit 6fbc1f2
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 30 deletions.
9 changes: 9 additions & 0 deletions devertexwahn/flatland/rendering/scene/shape/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ cc_test(
],
)

cc_library(
name = "medium_event",
hdrs = ["medium_event.h"],
deps = [
"//math:frame",
],
)

cc_library(
name = "polygon",
hdrs = ["polygon.h"],
Expand Down Expand Up @@ -110,6 +118,7 @@ cc_library(
hdrs = ["shape.h"],
deps = [
":emitter",
":medium_event",
"//core:object",
"//flatland/rendering/bsdf:svg_material",
"//math:axis_aligned_bounding_box",
Expand Down
46 changes: 46 additions & 0 deletions devertexwahn/flatland/rendering/scene/shape/medium_event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* SPDX-FileCopyrightText: Copyright 2024 Julian Amann <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once
#ifndef De_Vertexwahn_Core_MediumEvent_0348b3b2_3d75_4489_a2a5_7d4a6f7c0801_h
#define De_Vertexwahn_Core_MediumEvent_0348b3b2_3d75_4489_a2a5_7d4a6f7c0801_h

#include "math/frame.h"

#include "core/namespace.h"

DE_VERTEXWAHN_BEGIN_NAMESPACE

template <typename ScalarType, unsigned int Dimension>
class ShapeType;

template<typename ScalarType, unsigned int Dimension>
struct MediumEventType {
using Scalar = ScalarType;
using Point = PointType<ScalarType, Dimension>;
using Normal = NormalType<ScalarType, Dimension>;
using Frame = FrameType<ScalarType, Dimension>;

Point p; // intersection point
Scalar t; // distance to intersection point
Frame geo_frame; // geo_frame regarding to world space
Frame sh_frame; // shading frame

const ShapeType<ScalarType, Dimension> *shape = nullptr;
};

template <typename ScalarType>
using MediumEvent2 = MediumEventType<ScalarType, 2>;
template <typename ScalarType>
using MediumEvent3 = MediumEventType<ScalarType, 3>;

using MediumEvent2f = MediumEvent2<float>;
using MediumEvent2d = MediumEvent2<double>;
using MediumEvent3f = MediumEvent3<float>;
using MediumEvent3d = MediumEvent3<double>;

DE_VERTEXWAHN_END_NAMESPACE

#endif // end define De_Vertexwahn_Core_MediumEvent_0348b3b2_3d75_4489_a2a5_7d4a6f7c0801_h
35 changes: 5 additions & 30 deletions devertexwahn/flatland/rendering/scene/shape/shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,16 @@
#ifndef De_Vertexwahn_Flatland_Shape_1aef9b7b_dc9e_4d86_96c6_3552a8001293_h
#define De_Vertexwahn_Flatland_Shape_1aef9b7b_dc9e_4d86_96c6_3552a8001293_h

#include "core/object.h"
#include "math/axis_aligned_bounding_box.h"
#include "math/frame.h"
#include "flatland/rendering/bsdf/svg_material.h"
#include "flatland/rendering/scene/shape/emitter.h"
#include "flatland/rendering/scene/shape/medium_event.h"

DE_VERTEXWAHN_BEGIN_NAMESPACE

template <typename ScalarType, unsigned int Dimension>
class ShapeType;

template<typename ScalarType, unsigned int Dimension>
struct MediumEventType {
using Scalar = ScalarType;
using Point = PointType<ScalarType, Dimension>;
using Normal = NormalType<ScalarType, Dimension>;
using Frame = FrameType<ScalarType, Dimension>;

Point p; // intersection point
Scalar t; // distance to intersection point
Frame geo_frame; // geo_frame regarding to world space
Frame sh_frame; // shading frame

const ShapeType<ScalarType, Dimension> *shape = nullptr;
};
#include "math/axis_aligned_bounding_box.h"
#include "math/frame.h"

template <typename ScalarType>
using MediumEvent2 = MediumEventType<ScalarType, 2>;
template <typename ScalarType>
using MediumEvent3 = MediumEventType<ScalarType, 3>;
#include "core/object.h"

using MediumEvent2f = MediumEvent2<float>;
using MediumEvent2d = MediumEvent2<double>;
using MediumEvent3f = MediumEvent3<float>;
using MediumEvent3d = MediumEvent3<double>;
DE_VERTEXWAHN_BEGIN_NAMESPACE

template <typename ScalarType, unsigned int Dimension>
class ShapeTypeBase : public Object {
Expand Down

0 comments on commit 6fbc1f2

Please sign in to comment.