Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
RasterImageBase.h
Go to the documentation of this file.
1#pragma once
2
3#include "Actor/Image/Image.h"
5#include "Math/TVector2.h"
6#include "SDL/sdl_interface.h"
7
8#include <Common/primitive_type.h>
9
10namespace ph
11{
12
13class RasterImageBase : public Image
14{
15public:
16 std::shared_ptr<TTexture<Image::ArrayType>> genNumericTexture(
17 const CookingContext& ctx) override = 0;
18
19 std::shared_ptr<TTexture<math::Spectrum>> genColorTexture(
20 const CookingContext& ctx) override = 0;
21
28 RasterImageBase& setWrapMode(EImageWrapMode horizontalWrapMode, EImageWrapMode verticalWrapMode);
29
30protected:
32
33private:
34 math::TVector2<uint32> m_resolution;
35 EImageSampleMode m_sampleMode;
36 EImageWrapMode m_wrapMode;
37 EImageWrapMode m_verticalWrapMode;
38
39public:
41 {
42 ClassType clazz("raster-base");
43 clazz.docName("Base of Raster Image");
44 clazz.description("Common information for raster-based images.");
45 clazz.baseOn<Image>();
46
47 TSdlEnumField<OwnerType, EImageSampleMode> sampleMode(&OwnerType::m_sampleMode);
48 sampleMode.description("Sample mode of the raster image.");
49 sampleMode.defaultTo(EImageSampleMode::Bilinear);
50 sampleMode.optional();
51 clazz.addField(sampleMode);
52
53 TSdlEnumField<OwnerType, EImageWrapMode> wrapMode("wrap-mode", &OwnerType::m_wrapMode);
54 wrapMode.description("Wrap mode of the raster image.");
56 wrapMode.optional();
57 clazz.addField(wrapMode);
58
59 TSdlEnumField<OwnerType, EImageWrapMode> verticalWrapMode("vertical-wrap-mode", &OwnerType::m_verticalWrapMode);
60 verticalWrapMode.description(
61 "Wrap mode of the raster image in the vertical direction. If this field is specified, the "
62 "<wrap-mode> field is treated as the horizontal wrap mode.");
63 verticalWrapMode.defaultTo(EImageWrapMode::Unspecified);
64 verticalWrapMode.optional();
65 clazz.addField(verticalWrapMode);
66
67 return clazz;
68 }
69};
70
71}// end namespace ph
Information about the world being cooked.
Definition CookingContext.h:24
Definition Image.h:21
Definition RasterImageBase.h:14
EImageWrapMode getVerticalWrapMode() const
Definition RasterImageBase.cpp:21
EImageSampleMode getSampleMode() const
Definition RasterImageBase.cpp:11
RasterImageBase & setSampleMode(EImageSampleMode mode)
Definition RasterImageBase.cpp:27
RasterImageBase & setWrapMode(EImageWrapMode mode)
Definition RasterImageBase.cpp:33
RasterImageBase & setResolution(math::TVector2< uint32 > resolution)
Definition RasterImageBase.cpp:47
math::TVector2< uint32 > getResolution() const
Definition RasterImageBase.cpp:6
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< RasterImageBase >)
Definition RasterImageBase.h:40
EImageWrapMode getHorizontalWrapMode() const
Definition RasterImageBase.cpp:16
std::shared_ptr< TTexture< math::Spectrum > > genColorTexture(const CookingContext &ctx) override=0
std::shared_ptr< TTexture< Image::ArrayType > > genNumericTexture(const CookingContext &ctx) override=0
Definition TSdlEnumField.h:23
SDL binding type for a canonical SDL resource class.
Definition TSdlOwnerClass.h:23
TSdlValue & description(std::string descriptionStr)
Definition TSdlValue.ipp:95
TSdlValue & optional()
Definition TSdlValue.ipp:103
TSdlValue & defaultTo(T defaultValue)
Definition TSdlValue.ipp:71
Represents a 2-D vector.
Definition TVector2.h:19
The root for all renderer implementations.
Definition EEngineProject.h:6
EImageSampleMode
Definition sdl_image_enums.h:9
EImageWrapMode
Definition sdl_image_enums.h:31