Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
SwizzledImage.h
Go to the documentation of this file.
1#pragma once
2
3#include "Actor/Image/Image.h"
4#include "Math/math_fwd.h"
5#include "SDL/sdl_interface.h"
6
7#include <Common/primitive_type.h>
8
9#include <memory>
10#include <string>
11#include <string_view>
12
13namespace ph
14{
15
18class SwizzledImage : public Image
19{
20public:
21 std::shared_ptr<TTexture<Image::ArrayType>> genNumericTexture(
22 const CookingContext& ctx) override;
23
24 std::shared_ptr<TTexture<math::Spectrum>> genColorTexture(
25 const CookingContext& ctx) override;
26
30 std::shared_ptr<TTexture<real>> genRealTexture(const CookingContext& ctx);
31 std::shared_ptr<TTexture<math::Vector2R>> genVector2RTexture(const CookingContext& ctx);
32 std::shared_ptr<TTexture<math::Vector3R>> genVector3RTexture(const CookingContext& ctx);
33 std::shared_ptr<TTexture<math::Vector4R>> genVector4RTexture(const CookingContext& ctx);
35
36 SwizzledImage& setInput(std::shared_ptr<Image> image);
37 SwizzledImage& setSwizzleSubscripts(std::string swizzleSubscripts);
38
42 Image* getInput() const;
43
46 std::string_view getSwizzleSubscripts() const;
47
48private:
49 std::shared_ptr<Image> m_input;
50 std::string m_swizzleSubscripts;
51
52public:
54 {
55 ClassType clazz("swizzled-image");
56 clazz.docName("Swizzled Image");
57 clazz.description(
58 "An image whose primary purpose is to swizzle the output of a source image.");
59 clazz.baseOn<Image>();
60
61 TSdlReference<Image, OwnerType> input("input", &OwnerType::m_input);
62 input.description("Reference to an input image that will be swizzled.");
63 clazz.addField(input);
64
65 TSdlString<OwnerType> swizzleSubscripts("swizzle-subscripts", &OwnerType::m_swizzleSubscripts);
66 swizzleSubscripts.description(
67 "Subscripts for imge value swizzling. Supported subscript sets: "
68 "1. Cartesian coordinates \"xyzw\", "
69 "2. Colors \"rgba\", "
70 "3. Image/texture coordinates \"stpq\", "
71 "4. Hex-based subscripts (for wide vector types) \"0123456789ABCDEF\".");
72 swizzleSubscripts.optional();
73 clazz.addField(swizzleSubscripts);
74
75 return clazz;
76 }
77};
78
79}// end namespace ph
Information about the world being cooked.
Definition CookingContext.h:24
Definition Image.h:21
An image whose primary purpose is to swizzle the output of a source image.
Definition SwizzledImage.h:19
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< SwizzledImage >)
Definition SwizzledImage.h:53
Image * getInput() const
Get the input image.
Definition SwizzledImage.cpp:345
std::shared_ptr< TTexture< real > > genRealTexture(const CookingContext &ctx)
Generates numeric texture of an alternative type.
Definition SwizzledImage.cpp:272
std::string_view getSwizzleSubscripts() const
Get the swizzle subscripts for the image.
Definition SwizzledImage.cpp:350
std::shared_ptr< TTexture< Image::ArrayType > > genNumericTexture(const CookingContext &ctx) override
Definition SwizzledImage.cpp:182
std::shared_ptr< TTexture< math::Vector4R > > genVector4RTexture(const CookingContext &ctx)
Definition SwizzledImage.cpp:319
std::shared_ptr< TTexture< math::Vector3R > > genVector3RTexture(const CookingContext &ctx)
Definition SwizzledImage.cpp:305
SwizzledImage & setInput(std::shared_ptr< Image > image)
Definition SwizzledImage.cpp:333
std::shared_ptr< TTexture< math::Spectrum > > genColorTexture(const CookingContext &ctx) override
Definition SwizzledImage.cpp:210
SwizzledImage & setSwizzleSubscripts(std::string swizzleSubscripts)
Definition SwizzledImage.cpp:339
std::shared_ptr< TTexture< math::Vector2R > > genVector2RTexture(const CookingContext &ctx)
Definition SwizzledImage.cpp:291
SDL binding type for a canonical SDL resource class.
Definition TSdlOwnerClass.h:23
A value that points to a SDL resource.
Definition TSdlReference.h:21
Definition TSdlString.h:14
TSdlValue & description(std::string descriptionStr)
Definition TSdlValue.ipp:95
TSdlValue & optional()
Definition TSdlValue.ipp:103
The root for all renderer implementations.
Definition EEngineProject.h:6