Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
GMengerSponge.h
Go to the documentation of this file.
1#pragma once
2
4#include "SDL/sdl_interface.h"
5
6#include <Common/primitive_type.h>
7
8namespace ph
9{
10
11class GCuboid;
12
13class GMengerSponge final : public Geometry
14{
15public:
17 explicit GMengerSponge(uint32 numIteration);
18
19 void storeCooked(
20 CookedGeometry& out_geometry,
21 const CookingContext& ctx) const override;
22
23 void genPrimitive(
24 const PrimitiveBuildingMaterial& data,
25 std::vector<std::unique_ptr<Primitive>>& out_primitives) const override;
26
27private:
28 uint32 m_numIteration;
29
30 void genMengerSpongeRecursive(
31 const math::Vector3R& minVertex,
32 const math::Vector3R& maxVertex,
33 uint32 currentIteration,
34 std::vector<GCuboid>& cubes) const;
35
36public:
38 {
39 ClassType clazz("menger-sponge");
40 clazz.docName("Menger Sponge Geometry");
41 clazz.description("A fractal geometry.");
42 clazz.baseOn<Geometry>();
43
44 TSdlInteger<OwnerType, uint32> numIteration("iterations", &OwnerType::m_numIteration);
45 numIteration.description("Number of recursive iterations on the fractal surface detail.");
46 numIteration.defaultTo(3);
47 clazz.addField(numIteration);
48
49 return clazz;
50 }
51};
52
53}// end namespace ph
Definition CookedGeometry.h:13
Information about the world being cooked.
Definition CookingContext.h:24
Definition GMengerSponge.h:14
void storeCooked(CookedGeometry &out_geometry, const CookingContext &ctx) const override
Store data suitable for rendering into out_geometry.
Definition GMengerSponge.cpp:23
GMengerSponge()
Definition GMengerSponge.cpp:14
void genPrimitive(const PrimitiveBuildingMaterial &data, std::vector< std::unique_ptr< Primitive > > &out_primitives) const override
Definition GMengerSponge.cpp:40
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< GMengerSponge >)
Definition GMengerSponge.h:37
Definition Geometry.h:21
Definition PrimitiveBuildingMaterial.h:11
A field class that binds a integral member variable.
Definition TSdlInteger.h:21
SDL binding type for a canonical SDL resource class.
Definition TSdlOwnerClass.h:23
The root for all renderer implementations.
Definition EEngineProject.h:6