IDatasmithSceneElements.h
1 // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
2 
3 #pragma once
4 
5 #include "DatasmithDefinitions.h"
6 #include "DatasmithTypes.h"
7 
8 #include "Containers/Map.h"
9 #include "Math/Color.h"
10 #include "Math/Vector.h"
11 #include "Math/Quat.h"
12 #include "Templates/SharedPointer.h"
13 #include "Misc/SecureHash.h"
14 
20 
21 /** Root class for every element in a Datasmith scene */
22 class DATASMITHCORE_API IDatasmithElement
23 {
24 public:
25  virtual ~IDatasmithElement() {}
26 
27  /** returns if this DatasmithElement is of a specified type */
28  virtual bool IsA(EDatasmithElementType Type) const = 0;
29 
30  /** returns if this DatasmithElement is of a specified subtype of its EDatasmithElementType*/
31  virtual bool IsSubType(uint64 SubType) const = 0;
32 
33  /** Gets the element name */
34  virtual const TCHAR* GetName() const = 0;
35 
36  /** Sets the element name */
37  virtual void SetName( const TCHAR* InName ) = 0;
38 
39  /** Gets the element label used in the UI */
40  virtual const TCHAR* GetLabel() const = 0;
41 
42  /** Sets the element label used in the UI */
43  virtual void SetLabel(const TCHAR* InLabel) = 0;
44 
45  /**
46  * Return a MD5 hash of the content of the Element. Used to quickly identify Element with identical content.
47  * @param bForce Force recalculation of the hash if it was already cached
48  * @return The MD5 hash of the Element properties
49  */
50  virtual FMD5Hash CalculateElementHash(bool bForce) = 0;
51 };
52 
53 class DATASMITHCORE_API IDatasmithKeyValueProperty : public IDatasmithElement
54 {
55 public:
56  virtual ~IDatasmithKeyValueProperty() {}
57 
58  /** Get the type of this property */
59  virtual EDatasmithKeyValuePropertyType GetPropertyType() const = 0;
60 
61  /** Set the type of this property */
62  virtual void SetPropertyType( EDatasmithKeyValuePropertyType InType ) = 0;
63 
64  /** Get the value of this property */
65  virtual const TCHAR* GetValue() const = 0;
66 
67  /** Sets the value of this property */
68  virtual void SetValue( const TCHAR* Value ) = 0;
69 };
70 
71 /** Base definition for Actor Elements like geometry instances, cameras or lights */
72 class DATASMITHCORE_API IDatasmithActorElement : public IDatasmithElement
73 {
74 public:
75  virtual ~IDatasmithActorElement() {}
76 
77  /** Get absolute translation of this entity */
78  virtual FVector GetTranslation() const = 0;
79 
80  /** Set absolute translation of this entity */
81  virtual void SetTranslation(float InX, float InY, float InZ) = 0;
82 
83  /** Set absolute translation of this entity */
84  virtual void SetTranslation(const FVector& Value) = 0;
85 
86  /** Get absolute scale of this entity */
87  virtual FVector GetScale() const = 0;
88 
89  /** Set absolute scale of this entity */
90  virtual void SetScale(float InX, float InY, float InZ) = 0;
91 
92  /** Set absolute scale of this entity */
93  virtual void SetScale(const FVector& Value) = 0;
94 
95  /** Get rotation (in quaternion format) of this entity */
96  virtual FQuat GetRotation() const = 0;
97 
98  /** Set rotation (in quaternion format) of this entity */
99  virtual void SetRotation(float InX, float InY, float InZ, float InW) = 0;
100 
101  /** Set rotation (in quaternion format) of this entity */
102  virtual void SetRotation(const FQuat& Value) = 0;
103 
104  /** Sets to adjust the actor transform relative to it's parent */
105  virtual void SetUseParentTransform(bool bUseParentTransform) = 0;
106 
107  /** Returns the relative transform for this element */
108  virtual FTransform GetRelativeTransform() const = 0;
109 
110  /** Get the the name of the layer that contains this entity */
111  virtual const TCHAR* GetLayer() const = 0;
112 
113  /** Set the the the layer that contains this entity, layer will be auto-created from its name */
114  virtual void SetLayer(const TCHAR* InLayer) = 0;
115 
116  /** Add a new Tag to an Actor element */
117  virtual void AddTag(const TCHAR* InTag) = 0;
118 
119  /** Remove all Tags on the Actor element */
120  virtual void ResetTags() = 0;
121 
122  /** Get the number of tags attached to an Actor element */
123  virtual int32 GetTagsCount() const = 0;
124 
125  /** Get the 'TagIndex'th tag of an Actor element */
126  virtual const TCHAR* GetTag(int32 TagIndex) const = 0;
127 
128  /** Adds a new child to the Actor Element */
129  virtual void AddChild(const TSharedPtr< IDatasmithActorElement >& InChild, EDatasmithActorAttachmentRule AttachementRule = EDatasmithActorAttachmentRule::KeepWorldTransform) = 0;
130 
131  /** Get the number of children on this actor */
132  virtual int32 GetChildrenCount() const = 0;
133 
134  /** Get the InIndex-th child of the mesh actor */
135  virtual TSharedPtr< IDatasmithActorElement > GetChild(int32 InIndex) = 0;
136  virtual const TSharedPtr< IDatasmithActorElement >& GetChild(int32 InIndex) const = 0;
137 
138  virtual void RemoveChild(const TSharedPtr< IDatasmithActorElement >& InChild) = 0;
139 
140  /** Indicates if this actor is a standalone actor or a component, when used in a hierarchy */
141  virtual void SetIsAComponent(bool Value) = 0;
142  virtual bool IsAComponent() const = 0;
143 
144  /** Set a mesh actor as a switch or not */
145  virtual void SetAsSelector(bool bInIsASelector) = 0;
146 
147  /** Get if a mesh actor is a switch or not */
148  virtual bool IsASelector() const = 0;
149 
150  /** Set the index of the visible child of a mesh actor which is a selector */
151  virtual void SetSelectionIndex(int32 InSelectionID) = 0;
152 
153  /** Get the index of the visible child of a mesh actor which is a selector */
154  virtual int32 GetSelectionIndex() const = 0;
155 
156  /** Get a mesh actor's visibility */
157  virtual void SetVisibility(bool bInVisibility) = 0;
158 
159  /** Set a mesh actor's visibility */
160  virtual bool GetVisibility() const = 0;
161 };
162 
163 /**
164  * IDatasmithMeshElement defines an actual geometry.
165  * It won't add any instance to your scene, you'll need IDatasmithMeshActorElement for this.
166  * Notice that several IDatasmithMeshActorElements could use the this geometry.
167  */
168 class DATASMITHCORE_API IDatasmithMeshElement : public IDatasmithElement
169 {
170 public:
171  virtual ~IDatasmithMeshElement() {}
172 
173  /** Get the output filename, it can be absolute or relative to the scene file */
174  virtual const TCHAR* GetFile() const = 0;
175 
176  /** Set the output filename, it can be absolute or relative to the scene file */
177  virtual void SetFile(const TCHAR* InFile) = 0;
178 
179  /** Return a MD5 hash of the content of the Mesh Element. Used in CalculateElementHash to quickly identify Element with identical content */
180  virtual FMD5Hash GetFileHash() const = 0;
181 
182  /** Set the MD5 hash of the current mesh file. This should be a hash of its content. */
183  virtual void SetFileHash(FMD5Hash Hash) = 0;
184 
185  /**
186  * Set surface area and bounding box dimensions to be used on lightmap size calculation.
187  *
188  * @param InArea total surface area
189  * @param InWidth bounding box width
190  * @param InHeight bounding box height
191  * @param InDepth bounding box depth
192  */
193  virtual void SetDimensions(const float InArea, const float InWidth, const float InHeight, const float InDepth) = 0;
194 
195  /** Get the bounding box dimension of the mesh, in a vector in the form of (Width, Height, Depth )*/
196  virtual FVector GetDimensions() const = 0;
197 
198  /** Get the total surface area */
199  virtual float GetArea() const = 0;
200 
201  /** Get the bounding box width */
202  virtual float GetWidth() const = 0;
203 
204  /** Get the bounding box height */
205  virtual float GetHeight() const = 0;
206 
207  /** Get the bounding box depth */
208  virtual float GetDepth() const = 0;
209 
210  /** Get the UV channel that will be used for the lightmap */
211  virtual int32 GetLightmapCoordinateIndex() const = 0;
212 
213  /**
214  * Set the UV channel that will be used for the lightmap
215  * Note: If the lightmap coordinate index is something greater than -1 it will make the importer skip the lightmap generation
216  */
217  virtual void SetLightmapCoordinateIndex(int32 UVChannel) = 0;
218 
219  /** Get the source UV channel that will be used at import to generate the lightmap UVs */
220  virtual int32 GetLightmapSourceUV() const = 0;
221 
222  /** Set the source UV channel that will be used at import to generate the lightmap UVs */
223  virtual void SetLightmapSourceUV( int32 UVChannel ) = 0;
224 
225  /** Set the material slot Id to use the material MaterialPathName*/
226  virtual void SetMaterial(const TCHAR* MaterialPathName, int32 SlotId) = 0;
227 
228  /** Get the name of the material mapped to slot Id, return nullptr if slot isn't mapped */
229  virtual const TCHAR* GetMaterial(int32 SlotId) const = 0;
230 
231  /** Get the number of material slot set on this mesh */
232  virtual int32 GetMaterialSlotCount() const = 0;
233 
234  /** Get the material mapping for slot Index */
235  virtual TSharedPtr<const IDatasmithMaterialIDElement> GetMaterialSlotAt(int32 Index) const = 0;
236  virtual TSharedPtr<IDatasmithMaterialIDElement> GetMaterialSlotAt(int32 Index) = 0;
237 
238 protected:
239  /** Get number of LODs */
240  virtual int32 GetLODCount() const = 0;
241 
242  /** Set number of LODs */
243  virtual void SetLODCount(int32 Count) = 0;
244 
245  friend class FDatasmithStaticMeshImporter;
246 };
247 
248 /**
249  * IDatasmithActorElement used in any geometry instance independently if it could be static or movable.
250  * It doesn't define the actual geometry, you'll need IDatasmithMeshElement for this.
251  * Notice that several IDatasmithMeshActorElements could use the same geometry.
252  */
253 class DATASMITHCORE_API IDatasmithMeshActorElement : public IDatasmithActorElement
254 {
255 public:
256  virtual ~IDatasmithMeshActorElement() {}
257 
258  /**
259  * Adds a new material override to the Actor Element
260  *
261  * @param MaterialName name of the material, it should be unique
262  * @param Id material identifier to be used with mesh sub-material indices
263  */
264  virtual void AddMaterialOverride(const TCHAR* MaterialName, int32 Id) = 0;
265 
266  /** Adds a new material override to the Actor Element */
267  virtual void AddMaterialOverride(const TSharedPtr<IDatasmithMaterialIDElement>& Material) = 0;
268 
269  /** Get the amount of material overrides on this mesh */
270  virtual int32 GetMaterialOverridesCount() const = 0;
271 
272  /** Get the i-th material override of this actor */
273  virtual TSharedPtr<IDatasmithMaterialIDElement> GetMaterialOverride(int32 i) = 0;
274 
275  /** Get the i-th material override of this actor */
276  virtual TSharedPtr<const IDatasmithMaterialIDElement> GetMaterialOverride(int32 i) const = 0;
277 
278  /** Remove material from the Actor Element */
279  virtual void RemoveMaterialOverride(const TSharedPtr<IDatasmithMaterialIDElement>& Material) = 0;
280 
281  /** Get the path name of the StaticMesh associated with the actor */
282  virtual const TCHAR* GetStaticMeshPathName() const = 0;
283 
284  /**
285  * Set the path name of the StaticMesh that the actor is using
286  * It can be either a package path to refer to an existing mesh or a mesh name to refer to a MeshElement in the DatasmithScene
287  */
288  virtual void SetStaticMeshPathName(const TCHAR* InStaticMeshPathName) = 0;
289 };
290 
292 {
293 public:
294  /**
295  * Get the number of instances
296  * @return the number of instances
297  */
298  virtual int32 GetInstancesCount() const = 0;
299 
300  /**
301  * Reserve memory for a number of instance.
302  * @param NumInstances The number of instance.
303  * This reduce the overall time needed to add a large number of instances.
304  */
305  virtual void ReserveSpaceForInstances(int32 NumIntances) = 0;
306 
307  /**
308  * Add an instance
309  * @param Transform the transform of the instance
310  * @return the index of the new instance
311  */
312  virtual int32 AddInstance(const FTransform& Transform) = 0;
313 
314  /**
315  * Get the transform of a specified instance
316  * @param InstanceIndex The index of the instance
317  * @return The transform of the instance
318  */
319  virtual FTransform GetInstance(int32 InstanceIndex) const = 0;
320 
321  /**
322  * Remove an instance
323  * @param InstanceIndex The index of the instance to remove
324  * Note that this destruct the order of the instances
325  */
326  virtual void RemoveInstance(int32 InstanceIndex) = 0;
327 };
328 
329 class DATASMITHCORE_API IDatasmithLightActorElement : public IDatasmithActorElement
330 {
331 public:
332  virtual ~IDatasmithLightActorElement() {}
333 
334  /** Return true on light enabled, false otherwise */
335  virtual bool IsEnabled() const = 0;
336 
337  /** Set enable property of the light */
338  virtual void SetEnabled(bool bIsEnabled) = 0;
339 
340  /** Get light intensity */
341  virtual double GetIntensity() const = 0;
342 
343  /** Set light intensity */
344  virtual void SetIntensity(double Intensity) = 0;
345 
346  /** Get light color on linear mode */
347  virtual FLinearColor GetColor() const = 0;
348 
349  /** Set light color on linear mode */
350  virtual void SetColor(FLinearColor Color) = 0;
351 
352  /** Get the light temperature in Kelvin */
353  virtual double GetTemperature() const = 0;
354 
355  /** Set the light temperature in Kelvin */
356  virtual void SetTemperature(double Temperature) = 0;
357 
358  /** Get if the light color is controlled by temperature */
359  virtual bool GetUseTemperature() const = 0;
360 
361  /** Set if the light color is controlled by temperature */
362  virtual void SetUseTemperature(bool bUseTemperature) = 0;
363 
364  /** Get the path of the Ies definition file */
365  virtual const TCHAR* GetIesFile() const = 0;
366 
367  /** Set the path of the Ies definition file */
368  virtual void SetIesFile(const TCHAR* IesFile) = 0;
369 
370  /** Set if this light is controlled by Ies definition file */
371  virtual bool GetUseIes() const = 0;
372 
373  /** Get if this light is controlled by Ies definition file */
374  virtual void SetUseIes(bool bUseIes) = 0;
375 
376  /** Get the Ies brightness multiplier */
377  virtual double GetIesBrightnessScale() const = 0;
378 
379  /** Set the Ies brightness multiplier */
380  virtual void SetIesBrightnessScale(double IesBrightnessScale) = 0;
381 
382  /** Get if the emissive amount of the ies is controlled by the brightness scale */
383  virtual bool GetUseIesBrightness() const = 0;
384 
385  /** Set if the emissive amount of the ies is controlled by the brightness scale */
386  virtual void SetUseIesBrightness(bool bUseIesBrightness) = 0;
387 
388  /** Get the rotation applied to the IES shape */
389  virtual FQuat GetIesRotation() const = 0;
390 
391  /** Set the rotation to apply to the IES shape */
392  virtual void SetIesRotation(const FQuat& IesRotation) = 0;
393 
394  /** Get emissive material on this light */
395  virtual TSharedPtr< IDatasmithMaterialIDElement >& GetLightFunctionMaterial() = 0;
396 
397  /** Set emissive material on this light */
398  virtual void SetLightFunctionMaterial(const TSharedPtr< IDatasmithMaterialIDElement >& InMaterial) = 0;
399 
400  /** Set emissive material on this light */
401  virtual void SetLightFunctionMaterial(const TCHAR* InMaterialName) = 0;
402 };
403 
405 {
406 public:
407  virtual void SetIntensityUnits(EDatasmithLightUnits InUnits) = 0;
408  virtual EDatasmithLightUnits GetIntensityUnits() const = 0;
409 
410  /** Get light radius, width in case of 2D light sources */
411  virtual float GetSourceRadius() const = 0;
412 
413  /** Set light radius, width in case of 2D light sources */
414  virtual void SetSourceRadius(float SourceRadius) = 0;
415 
416  /** Get light length only affects 2D shaped lights */
417  virtual float GetSourceLength() const = 0;
418 
419  /** Set light length only affects 2D shaped lights */
420  virtual void SetSourceLength(float SourceLength) = 0;
421 
422  /** Get attenuation radius in centimeters */
423  virtual float GetAttenuationRadius() const = 0;
424 
425  /** Set attenuation radius in centimeters */
426  virtual void SetAttenuationRadius(float AttenuationRadius) = 0;
427 };
428 
430 {
431 public:
432  /** Get the inner cone angle for spot lights in degrees */
433  virtual float GetInnerConeAngle() const = 0;
434 
435  /** Set the inner cone angle for spot lights in degrees */
436  virtual void SetInnerConeAngle(float InnerConeAngle) = 0;
437 
438  /** Get the outer cone angle for spot lights in degrees */
439  virtual float GetOuterConeAngle() const = 0;
440 
441  /** Set the outer cone angle for spot lights in degrees */
442  virtual void SetOuterConeAngle(float OuterConeAngle) = 0;
443 };
444 
446 {
447 };
448 
449 /**
450  * An area light is an emissive shape (light shape) with a light component (light type)
451  */
453 {
454 public:
455  /** Get the light shape Rectangle/Sphere/Disc/Cylinder */
456  virtual EDatasmithLightShape GetLightShape() const = 0;
457 
458  /** Set the light shape Rectangle/Sphere/Disc/Cylinder */
459  virtual void SetLightShape(EDatasmithLightShape Shape) = 0;
460 
461  /** Set the type of light for an area light: Point/Spot/Rect */
462  virtual void SetLightType(EDatasmithAreaLightType LightType) = 0;
463  virtual EDatasmithAreaLightType GetLightType() const = 0;
464 
465  /** Set the area light shape size on the Y axis */
466  virtual void SetWidth(float InWidth) = 0;
467  virtual float GetWidth() const = 0;
468 
469  /** Set the area light shape size on the X axis */
470  virtual void SetLength(float InLength) = 0;
471  virtual float GetLength() const = 0;
472 };
473 
474 /**
475  * Represents a ALightmassPortal
476  *
477  * Use the actor scale to drive the portal dimensions
478  */
480 {
481 };
482 
483 class DATASMITHCORE_API IDatasmithCameraActorElement : public IDatasmithActorElement
484 {
485 public:
486  virtual ~IDatasmithCameraActorElement() {}
487 
488  /** Get camera sensor width in millimeters */
489  virtual float GetSensorWidth() const = 0;
490 
491  /** Set camera sensor width in millimeters */
492  virtual void SetSensorWidth(float SensorWidth) = 0;
493 
494  /** Get framebuffer aspect ratio (width/height) */
495  virtual float GetSensorAspectRatio() const = 0;
496 
497  /** Set framebuffer aspect ratio (width/height) */
498  virtual void SetSensorAspectRatio(float SensorAspectRatio) = 0;
499 
500  /** The focus method of the camera, either None (no DoF) or Manual */
501  virtual bool GetEnableDepthOfField() const = 0;
502 
503  /** The focus method of the camera, either None (no DoF) or Manual */
504  virtual void SetEnableDepthOfField(bool bEnableDepthOfField) = 0;
505 
506  /** Get camera focus distance in centimeters */
507  virtual float GetFocusDistance() const = 0;
508 
509  /** Set camera focus distance in centimeters */
510  virtual void SetFocusDistance(float FocusDistance) = 0;
511 
512  /** Get camera FStop also known as FNumber */
513  virtual float GetFStop() const = 0;
514 
515  /** Set camera FStop also known as FNumber */
516  virtual void SetFStop(float FStop) = 0;
517 
518  /** Get camera focal length in millimeters */
519  virtual float GetFocalLength() const = 0;
520 
521  /** Set camera focal length in millimeters */
522  virtual void SetFocalLength(float FocalLength) = 0;
523 
524  /** Get camera's postprocess */
525  virtual TSharedPtr< IDatasmithPostProcessElement >& GetPostProcess() = 0;
526 
527  /** Get camera's postprocess */
528  virtual const TSharedPtr< IDatasmithPostProcessElement >& GetPostProcess() const = 0;
529 
530  /** Set camera's postprocess */
531  virtual void SetPostProcess(const TSharedPtr< IDatasmithPostProcessElement >& PostProcess) = 0;
532 
533  /** Get camera look at actor name */
534  virtual const TCHAR* GetLookAtActor() const = 0;
535 
536  /** Set camera look at actor name */
537  virtual void SetLookAtActor(const TCHAR* ActorName) = 0;
538 
539  /** Get camera look at allow roll state */
540  virtual bool GetLookAtAllowRoll() const = 0;
541 
542  /** Set camera look at allow roll state */
543  virtual void SetLookAtAllowRoll(bool bAllow) = 0;
544 };
545 
546 class DATASMITHCORE_API IDatasmithCustomActorElement : public IDatasmithActorElement
547 {
548 public:
549  /** The class name or path to the blueprint to instantiate. */
550  virtual const TCHAR* GetClassOrPathName() const = 0;
551  virtual void SetClassOrPathName( const TCHAR* InClassOrPathName ) = 0;
552 
553  /** Get the total amount of properties in this actor */
554  virtual int32 GetPropertiesCount() const = 0;
555 
556  /** Get the property i-th of this actor */
557  virtual const TSharedPtr< IDatasmithKeyValueProperty >& GetProperty(int32 i) const = 0;
558  virtual TSharedPtr< IDatasmithKeyValueProperty >& GetProperty(int32 i) = 0;
559 
560  /** Get a property by its name if it exists */
561  virtual const TSharedPtr< IDatasmithKeyValueProperty >& GetPropertyByName(const TCHAR* Name) const = 0;
562  virtual TSharedPtr< IDatasmithKeyValueProperty >& GetPropertyByName(const TCHAR* Name) = 0;
563 
564  /** Add a property to this actor */
565  virtual void AddProperty( const TSharedPtr< IDatasmithKeyValueProperty >& Property ) = 0;
566 
567  /** Removes a property from this actor, doesn't preserve ordering */
568  virtual void RemoveProperty( const TSharedPtr< IDatasmithKeyValueProperty >& Property ) = 0;
569 };
570 
571 class DATASMITHCORE_API IDatasmithLandscapeElement : public IDatasmithActorElement
572 {
573 public:
574  /** The path to the heightmap file */
575  virtual void SetHeightmap( const TCHAR* FilePath ) = 0;
576  virtual const TCHAR* GetHeightmap() const = 0;
577 
578  /** The name or path to the material to assign to this landscape layer */
579  virtual void SetMaterial( const TCHAR* MaterialPathName ) = 0;
580  virtual const TCHAR* GetMaterial() const = 0;
581 };
582 
583 class DATASMITHCORE_API IDatasmithMaterialIDElement : public IDatasmithElement
584 {
585 public:
586  virtual ~IDatasmithMaterialIDElement() {}
587 
588  virtual int32 GetId() const = 0;
589  virtual void SetId(int32 Id) = 0;
590 };
591 
592 class DATASMITHCORE_API IDatasmithBaseMaterialElement : public IDatasmithElement
593 {
594 };
595 
597 {
598 public:
599  virtual ~IDatasmithMaterialElement() {}
600 
601  /** Returns true if the material has only one shader, false otherwise */
602  virtual bool IsSingleShaderMaterial() const = 0;
603 
604  /** Returns true if the material has a clear coat layer, false otherwise */
605  virtual bool IsClearCoatMaterial() const = 0;
606 
607  /** Adds a new shader to the material stack */
608  virtual void AddShader(const TSharedPtr< IDatasmithShaderElement >& Shader) = 0;
609 
610  /** Get the total amount of shaders in this material */
611  virtual int32 GetShadersCount() const = 0;
612 
613  /** Get the shader i-th of this material */
614  virtual TSharedPtr< IDatasmithShaderElement >& GetShader(int32 InIndex) = 0;
615 
616  /** Get the shader i-th of this material */
617  virtual const TSharedPtr< IDatasmithShaderElement >& GetShader(int32 InIndex) const = 0;
618 };
619 
621 {
622 public:
623  virtual ~IDatasmithMasterMaterialElement() {}
624 
625  virtual EDatasmithMasterMaterialType GetMaterialType() const = 0;
626  virtual void SetMaterialType( EDatasmithMasterMaterialType InType ) = 0;
627 
628  virtual EDatasmithMasterMaterialQuality GetQuality() const = 0;
629  virtual void SetQuality( EDatasmithMasterMaterialQuality InQuality ) = 0;
630 
631  /** Only used when the material type is set to Custom. The path name to an existing material to instantiate. */
632  virtual const TCHAR* GetCustomMaterialPathName() const = 0;
633  virtual void SetCustomMaterialPathName( const TCHAR* InPathName ) = 0;
634 
635  /** Get the total amount of properties in this material */
636  virtual int32 GetPropertiesCount() const = 0;
637 
638  /** Get the property i-th of this material */
639  virtual const TSharedPtr< IDatasmithKeyValueProperty >& GetProperty(int32 i) const = 0;
640  virtual TSharedPtr< IDatasmithKeyValueProperty >& GetProperty(int32 i) = 0;
641 
642  /** Get a property by its name if it exists */
643  virtual const TSharedPtr< IDatasmithKeyValueProperty >& GetPropertyByName(const TCHAR* Name) const = 0;
644  virtual TSharedPtr< IDatasmithKeyValueProperty >& GetPropertyByName(const TCHAR* Name) = 0;
645 
646  /** Add a property to this material*/
647  virtual void AddProperty( const TSharedPtr< IDatasmithKeyValueProperty >& Property ) = 0;
648 };
649 
650 class DATASMITHCORE_API IDatasmithPostProcessElement : public IDatasmithElement
651 {
652 public:
653  virtual ~IDatasmithPostProcessElement() {}
654 
655  /** Get color filter temperature in Kelvin */
656  virtual float GetTemperature() const = 0;
657 
658  /** Set color filter temperature in Kelvin */
659  virtual void SetTemperature(float Temperature) = 0;
660 
661  /** Set color filter in linear color scale */
662  virtual FLinearColor GetColorFilter() const = 0;
663 
664  /** Get color filter in linear color scale */
665  virtual void SetColorFilter(FLinearColor ColorFilter) = 0;
666 
667  /** Get vignette amount */
668  virtual float GetVignette() const = 0;
669 
670  /** Set vignette amount */
671  virtual void SetVignette(float Vignette) = 0;
672 
673  /** Get depth of field multiplier */
674  virtual float GetDof() const = 0;
675 
676  /** Set depth of field multiplier */
677  virtual void SetDof(float Dof) = 0;
678 
679  /** Get motion blur multiplier */
680  virtual float GetMotionBlur() const = 0;
681 
682  /** Set motion blur multiplier */
683  virtual void SetMotionBlur(float MotionBlur) = 0;
684 
685  /** Get color saturation */
686  virtual float GetSaturation() const = 0;
687 
688  /** Set color saturation */
689  virtual void SetSaturation(float Saturation) = 0;
690 
691  /** Get camera ISO */
692  virtual float GetCameraISO() const = 0;
693 
694  /** Set camera ISO */
695  virtual void SetCameraISO(float CameraISO) = 0;
696 
697  /** The camera shutter speed in 1/seconds (ie: 60 = 1/60s) */
698  virtual float GetCameraShutterSpeed() const = 0;
699  virtual void SetCameraShutterSpeed(float CameraShutterSpeed) = 0;
700 
701  /** Defines the opening of the camera lens, Aperture is 1/fstop, typical lens go down to f/1.2 (large opening), larger numbers reduce the DOF effect */
702  virtual float GetDepthOfFieldFstop() const = 0;
703  virtual void SetDepthOfFieldFstop( float Fstop ) = 0;
704 };
705 
706 /** Represents the APostProcessVolume object */
708 {
709 public:
710  /** The post process settings to use for this volume. */
711  virtual const TSharedRef< IDatasmithPostProcessElement >& GetSettings() const = 0;
712  virtual void SetSettings(const TSharedRef< IDatasmithPostProcessElement >& Settings) = 0;
713 
714  /** Whether this volume is enabled or not. */
715  virtual bool GetEnabled() const = 0;
716  virtual void SetEnabled( bool bEnabled ) = 0;
717 
718  /** Whether this volume covers the whole world, or just the area inside its bounds. */
719  virtual bool GetUnbound() const = 0;
720  virtual void SetUnbound( bool bUnbound) = 0;
721 };
722 
724 {
725 public:
726  virtual ~IDatasmithEnvironmentElement() {}
727 
728  /** Get the environment map */
729  virtual TSharedPtr<IDatasmithCompositeTexture>& GetEnvironmentComp() = 0;
730 
731  /** Get the environment map */
732  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetEnvironmentComp() const = 0;
733 
734  /** Set the environment map */
735  virtual void SetEnvironmentComp(const TSharedPtr<IDatasmithCompositeTexture>& EnvironmentComp) = 0;
736 
737  /** Returns true if it is used for illumination, false if it is used as background */
738  virtual bool GetIsIlluminationMap() const = 0;
739 
740  /** Set true for being used as illumination, false for being used as background */
741  virtual void SetIsIlluminationMap(bool bIsIlluminationMap) = 0;
742 };
743 
744 class DATASMITHCORE_API IDatasmithTextureElement : public IDatasmithElement
745 {
746 public:
747  virtual ~IDatasmithTextureElement() {}
748 
749  /** Get texture filename */
750  virtual const TCHAR* GetFile() const = 0;
751 
752  /** Set texture filename */
753  virtual void SetFile(const TCHAR* File) = 0;
754 
755  /** Set the output data buffer, used only when no output filename is set
756  *
757  * @param InData data to load the texture from
758  * @param InDataSize size in bytes of the buffer
759  * @param InFormat texture format(e.g. png or jpeg)
760  *
761  * @note The given data is not freed by the DatasmithImporter.
762  */
763  virtual void SetData(const uint8* InData, uint32 InDataSize, EDatasmithTextureFormat InFormat) = 0;
764 
765  /** Retun the optional data, if loading from memory */
766  virtual const uint8* GetData(uint32& OutDataSize, EDatasmithTextureFormat& OutFormat) const = 0;
767 
768  /** Return a MD5 hash of the content of the Texture Element. Used in CalculateElementHash to quickly identify Element with identical content */
769  virtual FMD5Hash GetFileHash() const = 0;
770 
771  /** Set the MD5 hash of the current texture file. This should be a hash of its content. */
772  virtual void SetFileHash(FMD5Hash Hash) = 0;
773 
774  /** Get texture usage */
775  virtual EDatasmithTextureMode GetTextureMode() const = 0;
776 
777  /** Set texture usage */
778  virtual void SetTextureMode(EDatasmithTextureMode Mode) = 0;
779 
780  /** Get texture filter */
781  virtual EDatasmithTextureFilter GetTextureFilter() const = 0;
782 
783  /** Set texture filter */
784  virtual void SetTextureFilter(EDatasmithTextureFilter Filter) = 0;
785 
786  /** Get texture X axis address mode */
787  virtual EDatasmithTextureAddress GetTextureAddressX() const = 0;
788 
789  /** Set texture X axis address mode */
790  virtual void SetTextureAddressX(EDatasmithTextureAddress Mode) = 0;
791 
792  /** Get texture Y axis address mode */
793  virtual EDatasmithTextureAddress GetTextureAddressY() const = 0;
794 
795  /** Set texture Y axis address mode */
796  virtual void SetTextureAddressY(EDatasmithTextureAddress Mode) = 0;
797 
798  /** Get allow texture resizing */
799  virtual bool GetAllowResize() const = 0;
800 
801  /** Set allow texture resizing */
802  virtual void SetAllowResize(bool bAllowResize) = 0;
803 
804  /** Get texture gamma <= 0 for auto */
805  virtual float GetRGBCurve() const = 0;
806 
807  /** Set texture gamma <= 0 for auto */
808  virtual void SetRGBCurve(const float InRGBCurve) = 0;
809 };
810 
811 class DATASMITHCORE_API IDatasmithShaderElement : public IDatasmithElement
812 {
813 public:
814  /**
815  * Realistic fresnel creates a pretty more complex node tree based on the actual fresnel equation.
816  * If this param is not enabled an aproximation will be used.
817  *
818  * It has no effect if bDisableReflectionFresnel is set to true.
819  */
820  static bool bUseRealisticFresnel;
821 
822  /** If it is set to true no fresnel effect is applied on reflection and just a constant effect is assigned to the reflection slot */
824 
825  virtual ~IDatasmithShaderElement() {}
826 
827  /** Get the Ior N value, usually Ior K is set to 0 so this will control the entire reflection fresnel effect */
828  virtual double GetIOR() const = 0;
829 
830  /** Set the Ior N value, usually Ior K is set to 0 so this will control the entire reflection fresnel effect */
831  virtual void SetIOR(double Value) = 0;
832 
833  /** Get the Ior K effect, this is used for more advanced representations of the reflection fresnel effect */
834  virtual double GetIORk() const = 0;
835 
836  /** Set the Ior K effect, this is used for more advanced representations of the reflection fresnel effect */
837  virtual void SetIORk(double Value) = 0;
838 
839  /** Get the InIndex of Refraction value */
840  virtual double GetIORRefra() const = 0;
841 
842  /** Set the InIndex of Refraction value */
843  virtual void SetIORRefra(double Value) = 0;
844 
845  /** Get the bump/normal amount */
846  virtual double GetBumpAmount() const = 0;
847 
848  /** Set the bump/normal amount */
849  virtual void SetBumpAmount(double Value) = 0;
850 
851  /** Get the two sided material attribute */
852  virtual bool GetTwoSided() const = 0;
853 
854  /** Set the two sided material attribute */
855  virtual void SetTwoSided(bool Value) = 0;
856 
857  /** Get the diffuse color in linear space */
858  virtual FLinearColor GetDiffuseColor() const = 0;
859 
860  /** Set the diffuse color in linear space */
861  virtual void SetDiffuseColor(FLinearColor Value) = 0;
862 
863  /** Get the diffuse filename */
864  virtual const TCHAR* GetDiffuseTexture() const = 0;
865 
866  /** Set the diffuse filename */
867  virtual void SetDiffuseTexture(const TCHAR* Value) = 0;
868 
869  /** Get the diffuse UV coordinates */
870  virtual FDatasmithTextureSampler GetDiffTextureSampler() const = 0;
871 
872  /** Set the diffuse UV coordinates */
873  virtual void SetDiffTextureSampler(FDatasmithTextureSampler Value) = 0;
874 
875  /** Get the diffuse compound map */
876  virtual TSharedPtr<IDatasmithCompositeTexture>& GetDiffuseComp() = 0;
877 
878  /** Get the diffuse compound map */
879  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetDiffuseComp() const = 0;
880 
881  /** Set the diffuse compound map */
882  virtual void SetDiffuseComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
883 
884  /** Get the reflectance color in linear space */
885  virtual FLinearColor GetReflectanceColor() const = 0;
886 
887  /** Set the reflectance color in linear space */
888  virtual void SetReflectanceColor(FLinearColor Value) = 0;
889 
890  /** Get the reflectance filename */
891  virtual const TCHAR* GetReflectanceTexture() const = 0;
892 
893  /** Set the reflectance filename */
894  virtual void SetReflectanceTexture(const TCHAR* Value) = 0;
895 
896  /** Get the reflectance UV coordinates */
897  virtual FDatasmithTextureSampler GetRefleTextureSampler() const = 0;
898 
899  /** Set the reflectance UV coordinates */
900  virtual void SetRefleTextureSampler(FDatasmithTextureSampler Value) = 0;
901 
902  /** Get the reflectance compound map */
903  virtual TSharedPtr<IDatasmithCompositeTexture>& GetRefleComp() = 0;
904 
905  /** Get the reflectance compound map */
906  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetRefleComp() const = 0;
907 
908  /** Set the reflectance compound map */
909  virtual void SetRefleComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
910 
911  /** Get the roughness color in linear space */
912  virtual double GetRoughness() const = 0;
913 
914  /** Set the roughness color in linear space */
915  virtual void SetRoughness(double Value) = 0;
916 
917  /** Get the roughness filename */
918  virtual const TCHAR* GetRoughnessTexture() const = 0;
919 
920  /** Set the roughness filename */
921  virtual void SetRoughnessTexture(const TCHAR* Value) = 0;
922 
923  /** Get the roughness UV coordinates */
924  virtual FDatasmithTextureSampler GetRoughTextureSampler() const = 0;
925 
926  /** Set the roughness UV coordinates */
927  virtual void SetRoughTextureSampler(FDatasmithTextureSampler Value) = 0;
928 
929  /** Get the roughness compound map */
930  virtual TSharedPtr<IDatasmithCompositeTexture>& GetRoughnessComp() = 0;
931 
932  /** Get the roughness compound map */
933  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetRoughnessComp() const = 0;
934 
935  /** Set the roughness compound map */
936  virtual void SetRoughnessComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
937 
938  /** Get the normalmapping filename */
939  virtual const TCHAR* GetNormalTexture() const = 0;
940 
941  /** Set the normalmapping filename */
942  virtual void SetNormalTexture(const TCHAR* Value) = 0;
943 
944  /** Get the normalmapping UV coordinates */
945  virtual FDatasmithTextureSampler GetNormalTextureSampler() const = 0;
946 
947  /** Set the normalmapping UV coordinates */
948  virtual void SetNormalTextureSampler(FDatasmithTextureSampler Value) = 0;
949 
950  /** Get the normalmapping compound map */
951  virtual TSharedPtr<IDatasmithCompositeTexture>& GetNormalComp() = 0;
952 
953  /** Get the normalmapping compound map */
954  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetNormalComp() const = 0;
955 
956  /** Set the normalmapping compound map */
957  virtual void SetNormalComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
958 
959  /** Get the bumpmapping filename */
960  virtual const TCHAR* GetBumpTexture() const = 0;
961 
962  /** Set the bumpmapping filename */
963  virtual void SetBumpTexture(const TCHAR* Value) = 0;
964 
965  /** Get the bumpmapping UV coordinates */
966  virtual FDatasmithTextureSampler GetBumpTextureSampler() const = 0;
967 
968  /** Set the bumpmapping UV coordinates */
969  virtual void SetBumpTextureSampler(FDatasmithTextureSampler Value) = 0;
970 
971  /** Get the bumpmapping compound map */
972  virtual TSharedPtr<IDatasmithCompositeTexture>& GetBumpComp() = 0;
973 
974  /** Get the bumpmapping compound map */
975  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetBumpComp() const = 0;
976 
977  /** Set the bumpmapping compound map */
978  virtual void SetBumpComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
979 
980  /** Get the transparency color in linear space */
981  virtual FLinearColor GetTransparencyColor() const = 0;
982 
983  /** Set the transparency color in linear space */
984  virtual void SetTransparencyColor(FLinearColor Value) = 0;
985 
986  /** Get the transparency filename */
987  virtual const TCHAR* GetTransparencyTexture() const = 0;
988 
989  /** Set the transparency filename */
990  virtual void SetTransparencyTexture(const TCHAR* Value) = 0;
991 
992  /** Get the transparency UV coordinates */
993  virtual FDatasmithTextureSampler GetTransTextureSampler() const = 0;
994 
995  /** Set the transparency UV coordinates */
996  virtual void SetTransTextureSampler(FDatasmithTextureSampler Value) = 0;
997 
998  /** Get the transparency compound map */
999  virtual TSharedPtr<IDatasmithCompositeTexture>& GetTransComp() = 0;
1000 
1001  /** Get the transparency compound map */
1002  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetTransComp() const = 0;
1003 
1004  /** Set the transparency compound map */
1005  virtual void SetTransComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
1006 
1007  /** Get the opacity mask filename */
1008  virtual const TCHAR* GetMaskTexture() const = 0;
1009 
1010  /** Set the opacity mask filename */
1011  virtual void SetMaskTexture(const TCHAR* Value) = 0;
1012 
1013  /** Get the opacity mask UV coordinates */
1014  virtual FDatasmithTextureSampler GetMaskTextureSampler() const = 0;
1015 
1016  /** Set the opacity mask UV coordinates */
1017  virtual void SetMaskTextureSampler(FDatasmithTextureSampler Value) = 0;
1018 
1019  /** Get the opacity mask compound map */
1020  virtual TSharedPtr<IDatasmithCompositeTexture>& GetMaskComp() = 0;
1021 
1022  /** Get the opacity mask compound map */
1023  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetMaskComp() const = 0;
1024 
1025  /** Set the opacity mask compound map */
1026  virtual void SetMaskComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
1027 
1028  /** Get the displacement filename */
1029  virtual const TCHAR* GetDisplaceTexture() const = 0;
1030 
1031  /** Set the displacement filename */
1032  virtual void SetDisplaceTexture(const TCHAR* Value) = 0;
1033 
1034  /** Get the displacement UV coordinates */
1035  virtual FDatasmithTextureSampler GetDisplaceTextureSampler() const = 0;
1036 
1037  /** Set the displacement UV coordinates */
1038  virtual void SetDisplaceTextureSampler(FDatasmithTextureSampler Value) = 0;
1039 
1040  /** Get the displacement value in centimeters */
1041  virtual double GetDisplace() const = 0;
1042 
1043  /** Set the displacement value in centimeters */
1044  virtual void SetDisplace(double Value) = 0;
1045 
1046  /** Get the displacement subdivision multiplier */
1047  virtual double GetDisplaceSubDivision() const = 0;
1048 
1049  /** Set the displacement subdivision multiplier */
1050  virtual void SetDisplaceSubDivision(double Value) = 0;
1051 
1052  /** Get the displacement compound map */
1053  virtual TSharedPtr<IDatasmithCompositeTexture>& GetDisplaceComp() = 0;
1054 
1055  /** Get the displacement compound map */
1056  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetDisplaceComp() const = 0;
1057 
1058  /** Set the displacement compound map */
1059  virtual void SetDisplaceComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
1060 
1061  /** Get the metalness value */
1062  virtual double GetMetal() const = 0;
1063 
1064  /** Set the metalness value */
1065  virtual void SetMetal(double Value) = 0;
1066 
1067  /** Get the diffuse filename */
1068  virtual const TCHAR* GetMetalTexture() const = 0;
1069 
1070  /** Set the diffuse filename */
1071  virtual void SetMetalTexture(const TCHAR* Value) = 0;
1072 
1073  /** Get the diffuse UV coordinates */
1074  virtual FDatasmithTextureSampler GetMetalTextureSampler() const = 0;
1075 
1076  /** Set the diffuse UV coordinates */
1077  virtual void SetMetalTextureSampler(FDatasmithTextureSampler Value) = 0;
1078 
1079  /** Get the diffuse compound map */
1080  virtual TSharedPtr<IDatasmithCompositeTexture>& GetMetalComp() = 0;
1081 
1082  /** Get the diffuse compound map */
1083  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetMetalComp() const = 0;
1084 
1085  /** Set the diffuse compound map */
1086  virtual void SetMetalComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
1087 
1088  /** Get the emmitance color in linear space */
1089  virtual FLinearColor GetEmitColor() const = 0;
1090 
1091  /** Set the emmitance color in linear space */
1092  virtual void SetEmitColor(FLinearColor Value) = 0;
1093 
1094  /** Get the emmitance filename */
1095  virtual const TCHAR* GetEmitTexture() const = 0;
1096 
1097  /** Set the emmitance filename */
1098  virtual void SetEmitTexture(const TCHAR* Value) = 0;
1099 
1100  /** Get the emmitance UV coordinates */
1101  virtual FDatasmithTextureSampler GetEmitTextureSampler() const = 0;
1102 
1103  /** Set the emmitance UV coordinates */
1104  virtual void SetEmitTextureSampler(FDatasmithTextureSampler Value) = 0;
1105 
1106  /** Get the emmitance temperature color */
1107  virtual double GetEmitTemperature() const = 0;
1108 
1109  /** Set the emmitance temperature color */
1110  virtual void SetEmitTemperature(double Value) = 0;
1111 
1112  /** Get the emmitance power in lumens */
1113  virtual double GetEmitPower() const = 0;
1114 
1115  /** Set the emmitance power in lumens */
1116  virtual void SetEmitPower(double Value) = 0;
1117 
1118  /** Get the emmitance compound map */
1119  virtual TSharedPtr<IDatasmithCompositeTexture>& GetEmitComp() = 0;
1120  /** Get the emmitance compound map */
1121 
1122  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetEmitComp() const = 0;
1123 
1124  /** Set the emmitance compound map */
1125  virtual void SetEmitComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
1126 
1127 
1128  /**
1129  * Gets material is used as lighting only.
1130  * If true the material sets the lighting mode to Unlit, regular lighting mode otherwise.
1131  */
1132  virtual bool GetLightOnly() const = 0;
1133 
1134  /**
1135  * Sets material is used as lighting only.
1136  * If true the material sets the lighting mode to Unlit, regular lighting mode otherwise.
1137  */
1138  virtual void SetLightOnly(bool Value) = 0;
1139 
1140  /**
1141  * Get the weight color in linear space.
1142  * Weight color, texture and value are only used for multilayered materials.
1143  */
1144  virtual FLinearColor GetWeightColor() const = 0;
1145 
1146  /**
1147  * Set the weight color in linear space.
1148  * Weight color, texture and value are only used for multilayered materials.
1149  */
1150  virtual void SetWeightColor(FLinearColor Value) = 0;
1151 
1152  /**
1153  * Get the weight filename
1154  * Weight color, texture and value are only used for multilayered materials.
1155  */
1156  virtual const TCHAR* GetWeightTexture() const = 0;
1157 
1158  /**
1159  * Set the weight filename
1160  * Weight color, texture and value are only used for multilayered materials.
1161  */
1162  virtual void SetWeightTexture(const TCHAR* Value) = 0;
1163 
1164  /**
1165  * Get the weight UV coordinates
1166  * Weight color, texture and value are only used for multilayered materials.
1167  */
1168  virtual FDatasmithTextureSampler GetWeightTextureSampler() const = 0;
1169 
1170  /**
1171  * Set the weight UV coordinates
1172  * Weight color, texture and value are only used for multilayered materials.
1173  */
1174  virtual void SetWeightTextureSampler(FDatasmithTextureSampler Value) = 0;
1175 
1176  /**
1177  * Get the weight compound map
1178  * Weight color, texture and value are only used for multilayered materials.
1179  */
1180  virtual TSharedPtr<IDatasmithCompositeTexture>& GetWeightComp() = 0;
1181 
1182  /**
1183  * Get the weight compound map
1184  * Weight color, texture and value are only used for multilayered materials.
1185  */
1186  virtual const TSharedPtr<IDatasmithCompositeTexture>& GetWeightComp() const = 0;
1187 
1188  /**
1189  * Set the weight compound map
1190  * Weight color, texture and value are only used for multilayered materials.
1191  */
1192  virtual void SetWeightComp(const TSharedPtr<IDatasmithCompositeTexture>& Value) = 0;
1193 
1194  /**
1195  * Get the weight power value
1196  * Weight color, texture and value are only used for multilayered materials.
1197  */
1198  virtual double GetWeightValue() const = 0;
1199 
1200  /**
1201  * Set the weight power value
1202  * Weight color, texture and value are only used for multilayered materials.
1203  */
1204  virtual void SetWeightValue(double Value) = 0;
1205 
1206  /**
1207  * Get the blending mode.
1208  * It only has effect on multilayered materials and all the layers but layer 0.
1209  */
1210  virtual EDatasmithBlendMode GetBlendMode() const = 0;
1211 
1212  /**
1213  * Set the blending mode.
1214  * It only has effect on multilayered materials and all the layers but layer 0.
1215  */
1216  virtual void SetBlendMode(EDatasmithBlendMode Value) = 0;
1217 
1218  /**
1219  * Get the if this layer is weighted as a stack.
1220  * It only has effect on multilayered materials and all the layers but layer 0.
1221  */
1222  virtual bool GetIsStackedLayer() const = 0;
1223 
1224  /**
1225  * Set the if this layer is weighted as a stack.
1226  * It only has effect on multilayered materials and all the layers but layer 0.
1227  */
1228  virtual void SetIsStackedLayer(bool Value) = 0;
1229 
1230  /** Get the domain of this shader */
1231  virtual const EDatasmithShaderUsage GetShaderUsage() const = 0;
1232 
1233  /** Set the domain of this shader */
1234  virtual void SetShaderUsage(EDatasmithShaderUsage InMaterialUsage) = 0;
1235 
1236  /** Set use Emissive for dynamic area lighting */
1237  virtual const bool GetUseEmissiveForDynamicAreaLighting() const = 0;
1238 
1239  /** Get use Emissive for dynamic area lighting */
1240  virtual void SetUseEmissiveForDynamicAreaLighting(bool InUseEmissiveForDynamicAreaLighting) = 0;
1241 };
1242 
1243 class DATASMITHCORE_API IDatasmithCompositeTexture
1244 {
1245 public:
1246  typedef TPair<float, const TCHAR*> ParamVal;
1247 
1248  virtual ~IDatasmithCompositeTexture() {}
1249 
1250  /**
1251  * Gets the validity of the composite texture.
1252  * If it returns false probably you should use the regular texture or color.
1253  */
1254  virtual bool IsValid() const = 0;
1255 
1256  /** Gets the composition mode like color correction etc */
1257  virtual EDatasmithCompMode GetMode() const = 0;
1258 
1259  /** Sets the composition mode like color correction etc */
1260  virtual void SetMode(EDatasmithCompMode Mode) = 0;
1261 
1262  /** Get the number of surfaces. */
1263  virtual int32 GetParamSurfacesCount() const = 0;
1264 
1265  /**
1266  * Gets texture usage.
1267  * If it returns false you should use a value or a color checking GetUseColor(i).
1268  */
1269  virtual bool GetUseTexture(int32 i) = 0;
1270 
1271  /** Get the filename of the i-th texture */
1272  virtual const TCHAR* GetParamTexture(int32 i) = 0;
1273 
1274  /** Sets the new texture for the index-th item */
1275  virtual void SetParamTexture(int32 InIndex, const TCHAR* InTexture) = 0;
1276 
1277  /** Get the i-th uv element */
1278  virtual FDatasmithTextureSampler& GetParamTextureSampler(int32 i) = 0;
1279 
1280  /**
1281  * Gets color usage.
1282  * If true color is used, else a value is used.
1283  */
1284  virtual bool GetUseColor(int32 i) = 0;
1285 
1286  /** Get the i-th color in linear space */
1287  virtual const FLinearColor& GetParamColor(int32 i) = 0;
1288 
1289  /** Returns true if composite texture should be used */
1290  virtual bool GetUseComposite(int32 i) = 0;
1291 
1292  /**
1293  * Get the number of value1 parameters.
1294  * Some composites will use no values, other types could use only one value, and others could use two values.
1295  */
1296  virtual int32 GetParamVal1Count() const = 0;
1297 
1298  /** Get the i-th Value1 parameter */
1299  virtual ParamVal GetParamVal1(int32 i) const = 0;
1300 
1301  /** Add a new Value1 parameter */
1302  virtual void AddParamVal1(ParamVal InParamVal) = 0;
1303 
1304  /**
1305  * Get the number of value2 parameters.
1306  * Some composites will use no values, other types could use only one value, and others could use two values.
1307  */
1308  virtual int32 GetParamVal2Count() const = 0;
1309 
1310  /** Get the Value2 parameter */
1311  virtual ParamVal GetParamVal2(int32 i) const = 0;
1312 
1313  /** Add a new Value2 parameter */
1314  virtual void AddParamVal2(ParamVal InParamVal) = 0;
1315 
1316  /** Get the i-th nested composite texture */
1317  virtual TSharedPtr<IDatasmithCompositeTexture>& GetParamSubComposite(int32 i) = 0;
1318 
1319  /** Adds a new nested composite texture */
1320  virtual void AddSurface(const TSharedPtr<IDatasmithCompositeTexture>& SubComp) = 0;
1321 
1322  /** Get the amount of layer masks */
1323  virtual int32 GetParamMaskSurfacesCount() const = 0;
1324 
1325  /** Get the i-th layer mask's filename */
1326  virtual const TCHAR* GetParamMask(int32 i) = 0;
1327 
1328  /** Adds a new layer mask from its filename */
1329  virtual void AddMaskSurface(const TCHAR* InMask, const FDatasmithTextureSampler InMaskSampler) = 0;
1330 
1331  /** Get the ith layer mask's uv element */
1332  virtual FDatasmithTextureSampler GetParamMaskTextureSampler(int32 i) = 0;
1333 
1334  /** Get the ith composite texture inside this composite used as layer mask */
1335  virtual TSharedPtr<IDatasmithCompositeTexture>& GetParamMaskSubComposite(int32 i) = 0;
1336 
1337  /** Get the i-th color in linear space */
1338  virtual const FLinearColor& GetParamMaskColor(int32 i) const = 0;
1339 
1340  /** Returns true if composite texture mask should be used */
1341  virtual bool GetMaskUseComposite(int32 i) const = 0;
1342 
1343  /** Adds a new composite texture inside this composite used as layer mask */
1344  virtual void AddMaskSurface(const TSharedPtr<IDatasmithCompositeTexture>& MaskSubComp) = 0;
1345 
1346  /** Creates a new surface to be used as mask that will be used as layer inside this composite using a color in linear space. */
1347  virtual void AddMaskSurface(const FLinearColor& Color) = 0;
1348 
1349  /** Returns the string that identifies the texture element */
1350  virtual const TCHAR* GetBaseTextureName() const = 0;
1351 
1352  /** Returns the string that identifies the color element */
1353  virtual const TCHAR* GetBaseColName() const = 0;
1354 
1355  /** Returns the string that identifies the value element */
1356  virtual const TCHAR* GetBaseValName() const = 0;
1357 
1358  /** Returns the string that identifies the composite element */
1359  virtual const TCHAR* GetBaseCompName() const = 0;
1360 
1361  /**
1362  * Sets the strings that identifies the different elements on this composite
1363  *
1364  * @param InTextureName for plain textures
1365  * @param InColorName for color elements
1366  * @param InValueName for regular float values
1367  * @param InCompName for nested composite elements inside this composite
1368  */
1369  virtual void SetBaseNames(const TCHAR* InTextureName, const TCHAR* InColorName, const TCHAR* InValueName, const TCHAR* InCompName) = 0;
1370 
1371  /** Creates a new surface that will be used as layer inside this composite using the texture filename and its uv element. */
1372  virtual void AddSurface(const TCHAR* Texture, FDatasmithTextureSampler TexUV) = 0;
1373 
1374  /** Creates a new surface that will be used as layer inside this composite using a color in linear space. */
1375  virtual void AddSurface(const FLinearColor& Color) = 0;
1376 
1377  /** Purges all the surfaces that could be used as layers inside this composite. */
1378  virtual void ClearSurface() = 0;
1379 };
1380 
1381 class DATASMITHCORE_API IDatasmithMetaDataElement : public IDatasmithElement
1382 {
1383 public:
1384  /** Gets the Datasmith element that is associated with this meta data, if any */
1385  virtual const TSharedPtr< IDatasmithElement >& GetAssociatedElement() const = 0;
1386 
1387  /** Sets the Datasmith element that is associated with this meta data, if any */
1388  virtual void SetAssociatedElement(const TSharedPtr< IDatasmithElement >& Element) = 0;
1389 
1390  /** Get the total amount of properties in this meta data */
1391  virtual int32 GetPropertiesCount() const = 0;
1392 
1393  /** Get the property i-th of this meta data */
1394  virtual const TSharedPtr< IDatasmithKeyValueProperty >& GetProperty(int32 i) const = 0;
1395  virtual TSharedPtr< IDatasmithKeyValueProperty >& GetProperty(int32 i) = 0;
1396 
1397  /** Get a property by its name if it exists */
1398  virtual const TSharedPtr< IDatasmithKeyValueProperty >& GetPropertyByName(const TCHAR* Name) const = 0;
1399  virtual TSharedPtr< IDatasmithKeyValueProperty >& GetPropertyByName(const TCHAR* Name) = 0;
1400 
1401  /** Add a property to this meta data */
1402  virtual void AddProperty( const TSharedPtr< IDatasmithKeyValueProperty >& Property ) = 0;
1403 };
1404 
1405 class DATASMITHCORE_API IDatasmithScene : public IDatasmithElement
1406 {
1407 public:
1408  virtual ~IDatasmithScene() {}
1409 
1410  /** Resets all the settings on the scene */
1411  virtual void Reset() = 0;
1412 
1413  /** Sets the name of the host application which created the scene */
1414  virtual const TCHAR* GetHost() const = 0;
1415 
1416  /**
1417  * Sets the name of the host application from which we're exporting from.
1418  *
1419  * @param InHost The host application name
1420  */
1421  virtual void SetHost(const TCHAR*) = 0;
1422 
1423  /** Returns the Datasmith format version used to export the scene */
1424  virtual const TCHAR* GetExporterVersion() const = 0;
1425 
1426  /**
1427  * Sets the Datasmith version used to export the scene.
1428  * Only needs to be set when parsing the .udatasmith during import
1429  *
1430  * @param InVersion The Datasmith version number as string
1431  */
1432  virtual void SetExporterVersion(const TCHAR*) = 0;
1433 
1434  /** Return the enterprise version of the SDK used by the exporter */
1435  virtual const TCHAR* GetExporterSDKVersion() const = 0;
1436 
1437  /**
1438  * Sets the enterprise SDK version used to export the scene.
1439  * Only needs to be set when parsing the .udatasmith during import
1440  *
1441  * @param InVersion The Datasmith version number as string
1442  */
1443  virtual void SetExporterSDKVersion(const TCHAR*) = 0;
1444 
1445  /** Returns the vendor name of the application used to export the scene */
1446  virtual const TCHAR* GetVendor() const = 0;
1447 
1448  /**
1449  * Sets the vendor name of the application used to export the scene.
1450  *
1451  * @param InVendor The application vendor name
1452  */
1453  virtual void SetVendor(const TCHAR*) = 0;
1454 
1455  /** Returns the product name of the application used to export the scene */
1456  virtual const TCHAR* GetProductName() const = 0;
1457 
1458  /**
1459  * Sets the product name of the application used to export the scene.
1460  *
1461  * @param InProductName The application name
1462  */
1463  virtual void SetProductName(const TCHAR*) = 0;
1464 
1465  /** Returns the product version of the application used to export the scene */
1466  virtual const TCHAR* GetProductVersion() const = 0;
1467 
1468  /**
1469  * Sets the product version of the application used to export the scene.
1470  *
1471  * @param InProductVersion The application version
1472  */
1473  virtual void SetProductVersion(const TCHAR*) = 0;
1474 
1475  /** Returns the user identifier who exported the scene */
1476  virtual const TCHAR* GetUserID() const = 0;
1477 
1478  /**
1479  * Sets the user identifier who exported the scene.
1480  *
1481  * @param InUserID The user identifier
1482  */
1483  virtual void SetUserID(const TCHAR*) = 0;
1484 
1485  /** Returns the OS name used by user who exported the scene */
1486  virtual const TCHAR* GetUserOS() const = 0;
1487 
1488  /**
1489  * Sets the user's OS name.
1490  *
1491  * @param InUserOS The OS name
1492  */
1493  virtual void SetUserOS(const TCHAR*) = 0;
1494 
1495  /** Returns the time taken to export the scene */
1496  virtual int32 GetExportDuration() const = 0;
1497 
1498  /**
1499  * Sets the time taken to export the scene.
1500  *
1501  * @param InExportDuration The export duration (in seconds)
1502  */
1503  virtual void SetExportDuration(int32) = 0;
1504 
1505  /**
1506  * Physical Sky could be generated in a large amount of modes, like material, lights etc
1507  * that's why it has been added as static, just enable it and it is done.
1508  * Notice that if a HDRI environment is used this gets disabled.
1509  */
1510  virtual bool GetUsePhysicalSky() const = 0;
1511 
1512  /**
1513  * Enable or disable the usage of Physical Sky
1514  * Notice that if a HDRI environment is used this gets disabled.
1515  */
1516  virtual void SetUsePhysicalSky(bool bInUsePhysicalSky) = 0;
1517 
1518  /**
1519  * Adds a new Mesh to the scene.
1520  *
1521  * @param InMesh the Mesh that will be added
1522  */
1523  virtual void AddMesh(const TSharedPtr< IDatasmithMeshElement >& InMesh) = 0;
1524 
1525  /** Returns the amount of meshes added to the scene */
1526  virtual int32 GetMeshesCount() const = 0;
1527 
1528  /** Returns the mesh using this index */
1529  virtual TSharedPtr< IDatasmithMeshElement > GetMesh(int32 InIndex) = 0;
1530 
1531  /** Returns the mesh using this index */
1532  virtual const TSharedPtr< IDatasmithMeshElement >& GetMesh(int32 InIndex) const = 0;
1533 
1534  /**
1535  * Remove a Mesh to the scene.
1536  *
1537  * @param InMesh the Mesh that will be removed
1538  */
1539  virtual void RemoveMesh(const TSharedPtr< IDatasmithMeshElement >& InMesh) = 0;
1540 
1541  /**
1542  * Remove all meshes from the scene
1543  */
1544  virtual void EmptyMeshes() = 0;
1545 
1546  /**
1547  * Adds an Actor to the scene.
1548  *
1549  * @param InActor the Actor that will be added
1550  */
1551  virtual void AddActor(const TSharedPtr< IDatasmithActorElement >& InActor) = 0;
1552 
1553  /** Returns the amount of actors added to the scene */
1554  virtual int32 GetActorsCount() const = 0;
1555 
1556  /** Returns the actor using this index */
1557  virtual TSharedPtr< IDatasmithActorElement > GetActor(int32 InIndex) = 0;
1558 
1559  /** Returns the actor using this index */
1560  virtual const TSharedPtr< IDatasmithActorElement >& GetActor(int32 InIndex) const = 0;
1561 
1562  /**
1563  * Remove Actor from the scene.
1564  *
1565  * @param InActor the Actor that will be removed
1566  */
1567  virtual void RemoveActor(const TSharedPtr< IDatasmithActorElement >& InActor, EDatasmithActorRemovalRule RemoveRule) = 0;
1568 
1569  /**
1570  * Adds a new Material to the scene (it won't be applied to any mesh).
1571  *
1572  * @param InMaterial the Material that will be added
1573  */
1574  virtual void AddMaterial(const TSharedPtr< IDatasmithBaseMaterialElement >& InMaterial) = 0;
1575 
1576  /** Returns the amount of materials added to the scene */
1577  virtual int32 GetMaterialsCount() const = 0;
1578  virtual TSharedPtr< IDatasmithBaseMaterialElement > GetMaterial(int32 InIndex) = 0;
1579  virtual const TSharedPtr< IDatasmithBaseMaterialElement >& GetMaterial(int32 InIndex) const = 0;
1580 
1581  /**
1582  * Removes a Material Element from the scene.
1583  *
1584  * @param InMaterial the Material Element to remove
1585  */
1586  virtual void RemoveMaterial(const TSharedPtr< IDatasmithBaseMaterialElement >& InMaterial) = 0;
1587 
1588  /**
1589  * Remove all materials from the scene
1590  */
1591  virtual void EmptyMaterials() = 0;
1592 
1593  /**
1594  * Adds a new Texture Element to the scene (it won't be applied to any material).
1595  *
1596  * @param InTexture the Texture Element that will be added
1597  */
1598  virtual void AddTexture(const TSharedPtr< IDatasmithTextureElement >& InTexture) = 0;
1599 
1600  /** Returns the amount of textures added to the scene */
1601  virtual int32 GetTexturesCount() const = 0;
1602  virtual TSharedPtr< IDatasmithTextureElement > GetTexture(int32 InIndex) = 0;
1603  virtual const TSharedPtr< IDatasmithTextureElement >& GetTexture(int32 InIndex) const = 0;
1604 
1605  /**
1606  * Removes a Texture Element from the scene.
1607  *
1608  * @param InTexture the Texture Element that will be removed
1609  */
1610  virtual void RemoveTexture(const TSharedPtr< IDatasmithTextureElement >& InTexture) = 0;
1611 
1612  /**
1613  * Remove all textures from the scene
1614  */
1615  virtual void EmptyTextures() = 0;
1616 
1617 
1618  /**
1619  * Set a new Postprocess for the scene
1620  *
1621  * @param InPostProcess the Environment that will be added
1622  */
1623  virtual void SetPostProcess(const TSharedPtr< IDatasmithPostProcessElement >& InPostProcess) = 0;
1624  virtual TSharedPtr< IDatasmithPostProcessElement > GetPostProcess() = 0;
1625  virtual const TSharedPtr< IDatasmithPostProcessElement >& GetPostProcess() const = 0;
1626 
1627  /**
1628  * Adds a new LOD screen size setting. The first one added is used for the base LOD, the second one is for LOD1, etc.
1629  *
1630  * @param ScreenSize Ratio of the screen clamped between 0 and 1
1631  */
1632  virtual void AddLODScreenSize( float ScreenSize ) = 0;
1633  virtual int32 GetLODScreenSizesCount() const = 0;
1634  virtual float GetLODScreenSize(int32 InIndex) const = 0;
1635 
1636  /**
1637  * Add a metadata to the scene
1638  * There should be only one metadata per Datasmith element (the element associated with the metadata)
1639  */
1640  virtual void AddMetaData(const TSharedPtr< IDatasmithMetaDataElement >& InMetaData) = 0;
1641 
1642  virtual int32 GetMetaDataCount() const = 0;
1643  virtual TSharedPtr< IDatasmithMetaDataElement > GetMetaData(int32 InIndex) = 0;
1644  virtual const TSharedPtr< IDatasmithMetaDataElement >& GetMetaData(int32 InIndex) const = 0;
1645  virtual TSharedPtr< IDatasmithMetaDataElement > GetMetaData(const TSharedPtr<IDatasmithElement>& Element) = 0;
1646  virtual const TSharedPtr< IDatasmithMetaDataElement >& GetMetaData(const TSharedPtr<IDatasmithElement>& Element) const = 0;
1647 
1648  /**
1649  * Adds a level sequence to the scene.
1650  *
1651  * @param InSequence the level sequence to add
1652  */
1653  virtual void AddLevelSequence(const TSharedRef< IDatasmithLevelSequenceElement >& InSequence) = 0;
1654 
1655  /** Returns the number of level sequences in the scene */
1656  virtual int32 GetLevelSequencesCount() const = 0;
1657 
1658  /** Returns the level sequence using this index */
1659  virtual TSharedPtr< IDatasmithLevelSequenceElement > GetLevelSequence(int32 InIndex) = 0;
1660 
1661  /**
1662  * Removes a level sequence from the scene.
1663  *
1664  * @param InSequence the level sequence to remove
1665  */
1666  virtual void RemoveLevelSequence(const TSharedRef< IDatasmithLevelSequenceElement>& InSequence) = 0;
1667 
1668  /** Attach the actor to his new parent. Detach the actor if he was already attach. */
1669  virtual void AttachActor(const TSharedPtr< IDatasmithActorElement >& NewParent, const TSharedPtr< IDatasmithActorElement >& Child, EDatasmithActorAttachmentRule AttachmentRule) = 0;
1670  /** Attach the actor to the scene root. Detach the actor if he was already attach. */
1671  virtual void AttachActorToSceneRoot(const TSharedPtr< IDatasmithActorElement >& Child, EDatasmithActorAttachmentRule AttachmentRule) = 0;
1672 };
IDatasmithCompositeTexture
Definition: IDatasmithSceneElements.h:1243
IDatasmithMeshElement
IDatasmithMeshElement defines an actual geometry.
Definition: IDatasmithSceneElements.h:168
IDatasmithActorElement
Base definition for Actor Elements like geometry instances, cameras or lights.
Definition: IDatasmithSceneElements.h:72
IDatasmithPointLightElement
Definition: IDatasmithSceneElements.h:404
IDatasmithMasterMaterialElement
Definition: IDatasmithSceneElements.h:620
IDatasmithLightActorElement
Definition: IDatasmithSceneElements.h:329
IDatasmithMetaDataElement
Definition: IDatasmithSceneElements.h:1381
IDatasmithTextureElement
Definition: IDatasmithSceneElements.h:744
IDatasmithLandscapeElement
Definition: IDatasmithSceneElements.h:571
IDatasmithScene
Definition: IDatasmithSceneElements.h:1405
IDatasmithShaderElement::bDisableReflectionFresnel
static bool bDisableReflectionFresnel
If it is set to true no fresnel effect is applied on reflection and just a constant effect is assigne...
Definition: IDatasmithSceneElements.h:823
IDatasmithPostProcessElement
Definition: IDatasmithSceneElements.h:650
IDatasmithElement
Root class for every element in a Datasmith scene.
Definition: IDatasmithSceneElements.h:22
IDatasmithLevelSequenceElement
IDatasmithLevelSequenceElement holds a set of animations.
Definition: DatasmithAnimationElements.h:111
IDatasmithDirectionalLightElement
Definition: IDatasmithSceneElements.h:445
IDatasmithPostProcessVolumeElement
Represents the APostProcessVolume object.
Definition: IDatasmithSceneElements.h:707
IDatasmithKeyValueProperty
Definition: IDatasmithSceneElements.h:53
IDatasmithMeshActorElement
IDatasmithActorElement used in any geometry instance independently if it could be static or movable.
Definition: IDatasmithSceneElements.h:253
IDatasmithShaderElement::bUseRealisticFresnel
static bool bUseRealisticFresnel
Realistic fresnel creates a pretty more complex node tree based on the actual fresnel equation.
Definition: IDatasmithSceneElements.h:820
IDatasmithBaseMaterialElement
Definition: IDatasmithSceneElements.h:592
IDatasmithEnvironmentElement
Definition: IDatasmithSceneElements.h:723
IDatasmithAreaLightElement
An area light is an emissive shape (light shape) with a light component (light type)
Definition: IDatasmithSceneElements.h:452
IDatasmithHierarchicalInstancedStaticMeshActorElement
Definition: IDatasmithSceneElements.h:291
IDatasmithShaderElement
Definition: IDatasmithSceneElements.h:811
FDatasmithTextureSampler
Definition: DatasmithTypes.h:16
IDatasmithCustomActorElement
Definition: IDatasmithSceneElements.h:546
IDatasmithLightmassPortalElement
Represents a ALightmassPortal.
Definition: IDatasmithSceneElements.h:479
IDatasmithMaterialElement
Definition: IDatasmithSceneElements.h:596
IDatasmithMaterialIDElement
Definition: IDatasmithSceneElements.h:583
IDatasmithSpotLightElement
Definition: IDatasmithSceneElements.h:429
IDatasmithCameraActorElement
Definition: IDatasmithSceneElements.h:483