Plasma Engine  2.0
Loading...
Searching...
No Matches
DecalAsset.h
1#pragma once
2
3#include <EditorFramework/Assets/AssetDocumentGenerator.h>
4#include <EditorFramework/Assets/SimpleAssetDocument.h>
5
8
10{
11 using StorageType = plInt8;
12
13 enum Enum
14 {
15 BaseColor,
16 BaseColorNormal,
17 BaseColorORM,
18 BaseColorNormalORM,
19 BaseColorEmissive,
20
21 Default = BaseColor
22 };
23};
24
25PL_DECLARE_REFLECTABLE_TYPE(PL_NO_LINKAGE, plDecalMode);
26
28{
29 PL_ADD_DYNAMIC_REFLECTION(plDecalAssetProperties, plReflectedClass);
30
31public:
33
34 static void PropertyMetaStateEventHandler(plPropertyMetaStateEvent& e);
35
37 bool m_bBlendModeColorize = false;
38
39 plString m_sAlphaMask;
40 plString m_sBaseColor;
41 plString m_sNormal;
42 plString m_sORM;
43 plString m_sEmissive;
44
45 bool NeedsBaseColor() const { return true; }
46 bool NeedsNormal() const { return m_Mode == plDecalMode::BaseColorNormal || m_Mode == plDecalMode::BaseColorNormalORM; }
47 bool NeedsORM() const { return m_Mode == plDecalMode::BaseColorORM || m_Mode == plDecalMode::BaseColorNormalORM; }
48 bool NeedsEmissive() const { return m_Mode == plDecalMode::BaseColorEmissive; }
49};
50
51
52class plDecalAssetDocument : public plSimpleAssetDocument<plDecalAssetProperties>
53{
55
56public:
58
59protected:
60 virtual plTransformStatus InternalTransformAsset(plStreamWriter& stream, plStringView sOutputTag, const plPlatformProfile* pAssetProfile,
61 const plAssetFileHeader& AssetHeader, plBitflags<plTransformFlags> transformFlags) override;
62
64};
65
67
69{
71
72public:
75
76 virtual void GetImportModes(plStringView sAbsInputFile, plDynamicArray<plAssetDocumentGenerator::ImportMode>& out_modes) const override;
77 virtual plStringView GetDocumentExtension() const override { return "plDecalAsset"; }
78 virtual plStringView GetGeneratorGroup() const override { return "Images"; }
79 virtual plStatus Generate(plStringView sInputFileAbs, plStringView sMode, plDynamicArray<plDocument*>& out_generatedDocuments) override;
80};
The thumbnail info containing the hash of the file is appended to assets. The serialized size of this...
Definition AssetDocument.h:49
Provides functionality for importing files as asset documents.
Definition AssetDocumentGenerator.h:23
Simple class to handle asset file headers (the very first bytes in all transformed asset files)
Definition AssetFileHeader.h:8
Definition DecalAsset.h:69
virtual plStringView GetDocumentExtension() const override
Returns the target asset document file extension.
Definition DecalAsset.h:77
virtual plStatus Generate(plStringView sInputFileAbs, plStringView sMode, plDynamicArray< plDocument * > &out_generatedDocuments) override
Tells the generator to create a new asset document with the chosen mode.
Definition DecalAsset.cpp:191
virtual void GetImportModes(plStringView sAbsInputFile, plDynamicArray< plAssetDocumentGenerator::ImportMode > &out_modes) const override
Used to fill out which import modes may be available for the given asset.
Definition DecalAsset.cpp:177
virtual plStringView GetGeneratorGroup() const override
Allows to merge the import modes of multiple generators in the UI in one group.
Definition DecalAsset.h:78
Definition DecalAsset.h:53
virtual plTransformStatus InternalTransformAsset(plStreamWriter &stream, plStringView sOutputTag, const plPlatformProfile *pAssetProfile, const plAssetFileHeader &AssetHeader, plBitflags< plTransformFlags > transformFlags) override
Override this and write the transformed file for the given szOutputTag into the given stream.
Definition DecalAsset.cpp:78
virtual plTransformStatus InternalCreateThumbnail(const ThumbnailInfo &ThumbnailInfo) override
Override this function to generate a thumbnail. Only called if GetAssetFlags returns plAssetDocumentF...
Definition DecalAsset.cpp:83
Definition DecalAsset.h:28
Definition DynamicArray.h:81
Definition PlatformProfile.h:25
All classes that should be dynamically reflectable, need to be derived from this base class.
Definition DynamicRTTI.h:86
Definition SimpleAssetDocument.h:23
Interface for binary out (write) streams.
Definition Stream.h:107
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
Definition DecalAsset.h:10
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Event that is broadcast whenever information about how to present properties is required.
Definition PropertyMetaState.h:35
An plResult with an additional message for the reason of failure.
Definition Status.h:12
Definition Declarations.h:114