Commit d033a933 by wester

Added Basic Textured materials/TexturedMaterial.uasset

parent 15fb776a
...@@ -20,7 +20,7 @@ public class MasterTestProject : ModuleRules ...@@ -20,7 +20,7 @@ public class MasterTestProject : ModuleRules
public MasterTestProject(TargetInfo Target) public MasterTestProject(TargetInfo Target)
{ {
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "RawMesh", "ProceduralMeshComponent" }); PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore","ImageWrapper", "RawMesh", "ProceduralMeshComponent" });
PrivateDependencyModuleNames.AddRange(new string[] { }); PrivateDependencyModuleNames.AddRange(new string[] { });
......
...@@ -2,10 +2,11 @@ ...@@ -2,10 +2,11 @@
#include "MasterTestProject.h" #include "MasterTestProject.h"
#include <time.h> #include <time.h>
#include "ImageUtils.h"
#include "ImageWrapper.h" //requires "ImageWrapper" in public dependencies in build CS
#include "ProceduralEntity.h" #include "ProceduralEntity.h"
#include "Runtime/Engine/Public/DDSLoader.h" #include "Runtime/Engine/Public/DDSLoader.h"
#include "VictoryBPFunctionLibrary.h"
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include <assimp/Logger.hpp> #include <assimp/Logger.hpp>
...@@ -271,8 +272,10 @@ UMaterialInterface *AProceduralEntity::GetMaterialForIndex(unsigned int index, ...@@ -271,8 +272,10 @@ UMaterialInterface *AProceduralEntity::GetMaterialForIndex(unsigned int index,
UE_LOG(GLTF, Warning, TEXT("Diffuse Texture:\"%s\" \"%s\""), *dirPath, *fileName); UE_LOG(GLTF, Warning, TEXT("Diffuse Texture:\"%s\" \"%s\""), *dirPath, *fileName);
diffTexture = LoadTexture(dirPath, fileName); UTexture2D* diffTexture = LoadTexture(dirPath, fileName);
bool isValid;
int32 width, height;
diffTexture = Victory_LoadTexture2D_FromFile(dirPath + "\\" + fileName, isValid, width, height);
...@@ -395,8 +398,23 @@ UTexture2D* AProceduralEntity::Victory_LoadTexture2D_FromFile(const FString& Ful ...@@ -395,8 +398,23 @@ UTexture2D* AProceduralEntity::Victory_LoadTexture2D_FromFile(const FString& Ful
{ {
IsValid = false; IsValid = false;
UTexture2D* LoadedT2D = NULL; UTexture2D* LoadedT2D = NULL;
EImageFormat::Type format = EImageFormat::PNG; EImageFormat::Type format = EImageFormat::JPEG;
FString extension = FPaths::GetExtension(FullFilePath);
if (extension.EndsWith(TEXT("jpg"), ESearchCase::IgnoreCase)) {
format = EImageFormat::JPEG;
} else if (extension.EndsWith(TEXT("png"), ESearchCase::IgnoreCase)) {
format = EImageFormat::PNG;
} else if (extension.EndsWith(TEXT("bmp"), ESearchCase::IgnoreCase)) {
format = EImageFormat::BMP;
} else if (extension.EndsWith(TEXT("ico"), ESearchCase::IgnoreCase)) {
format = EImageFormat::ICO;
} else if (extension.EndsWith(TEXT("exr"), ESearchCase::IgnoreCase)) {
format = EImageFormat::EXR;
}else if (extension.EndsWith(TEXT("icns"), ESearchCase::IgnoreCase)) {
format = EImageFormat::ICNS;
}
IImageWrapperModule& ImageWrapperModule = FModuleManager::LoadModuleChecked<IImageWrapperModule>(FName("ImageWrapper")); IImageWrapperModule& ImageWrapperModule = FModuleManager::LoadModuleChecked<IImageWrapperModule>(FName("ImageWrapper"));
IImageWrapperPtr ImageWrapper = ImageWrapperModule.CreateImageWrapper(format); IImageWrapperPtr ImageWrapper = ImageWrapperModule.CreateImageWrapper(format);
......
...@@ -43,8 +43,6 @@ public: ...@@ -43,8 +43,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Materials") UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Materials")
TMap<int32, UMaterialInterface *> MaterialMap; TMap<int32, UMaterialInterface *> MaterialMap;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Materials")
UTexture2D* diffTexture;
private: private:
int32 _selectedVertex; int32 _selectedVertex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment