Commit 92bf458f by wester

rabbit mq

parent b2501a77
......@@ -64,7 +64,7 @@ bUseSplitscreen=False
TwoPlayerSplitscreenLayout=Horizontal
ThreePlayerSplitscreenLayout=FavorTop
bOffsetPlayerGamepadIds=False
GameInstanceClass=/Script/Engine.GameInstance
GameInstanceClass=/Script/MasterTestProject.MyGameInstance
GameDefaultMap=/Game/DefaultVRMap.DefaultVRMap
ServerDefaultMap=/Engine/Maps/Entry.Entry
GlobalDefaultGameMode=/Game/VR_GameMode.VR_GameMode_C
......@@ -96,6 +96,7 @@ TriangleMeshTriangleMinAreaThreshold=5.000000
bEnableAsyncScene=False
bEnableShapeSharing=False
bEnablePCM=False
bEnableStabilization=False
bWarnMissingLocks=True
bEnable2DPhysics=False
LockedAxis=Invalid
......@@ -115,6 +116,7 @@ bSuppressFaceRemapTable=False
bSupportUVFromHitResults=False
bDisableActiveActors=False
bDisableCCD=False
bEnableEnhancedDeterminism=False
MaxPhysicsDeltaTime=0.033333
bSubstepping=False
bSubsteppingAsync=False
......@@ -123,5 +125,5 @@ MaxSubsteps=6
SyncSceneSmoothingFactor=0.000000
AsyncSceneSmoothingFactor=0.990000
InitialAverageFrameRate=0.016667
PhysXTreeRebuildRate=10
No preview for this file type
......@@ -5,21 +5,10 @@ using System.Collections.Generic;
public class MasterTestProjectTarget : TargetRules
{
public MasterTestProjectTarget(TargetInfo Target)
public MasterTestProjectTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.Add("MasterTestProject");
}
//
// TargetRules interface.
//
public override void SetupBinaries(
TargetInfo Target,
ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
ref List<string> OutExtraModuleNames
)
{
OutExtraModuleNames.AddRange( new string[] { "MasterTestProject" } );
}
}
// Fill out your copyright notice in the Description page of Project Settings.
#include "MasterTestProject.h"
#include <locale>
#include <codecvt>
#define TINYGLTF_LOADER_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#include "tiny_gltf_loader.h"
#include "Developer/RawMesh/Public/RawMesh.h"
#include "StaticGLTFComponent.h"
UStaticGLTFComponent::UStaticGLTFComponent()
{
GLTFPath = TEXT("H:/Repositories/MasterArbeit/glTF-Sample-Models/1.0/Duck/glTF/Duck.gltf");
Loader = new tinygltf::TinyGLTFLoader;
Scene = new tinygltf::Scene;
}
UStaticGLTFComponent::~UStaticGLTFComponent() {
delete Loader;
delete Scene;
}
void UStaticGLTFComponent::OnRegister()
{
Super::OnRegister();
std::string temperror;
tinygltfLoadSuccess = Loader->LoadFromFile((*Scene), temperror, ToStdString(GLTFPath));
tinygltfError = ToFString(temperror);
if(!tinygltfLoadSuccess){
UE_LOG(GLTF, Error, TEXT("gltf loading error: %s"), *tinygltfError);
return;
}
UE_LOG(GLTF, Log, TEXT("gltf parsed %s"), *tinygltfError);
FRawMesh newrawmesh;
//get default scene and root nodes
if (Scene->defaultScene.empty()) {
UE_LOG(GLTF, Error, TEXT("default scene empty "));
}
else {
ImportNodes( Scene->scenes[Scene->defaultScene], newrawmesh, FMatrix());
}
}
void UStaticGLTFComponent::ImportNodes( std::vector<std::string> nodes, FRawMesh& RawMesh, FMatrix ModelTransform)
{
for (auto CurrentNodeName : nodes) {
UE_LOG(GLTF, Log, TEXT("parsed Node %s"), *ToFString(CurrentNodeName));
tinygltf::Node CurrentNode = Scene->nodes[CurrentNodeName];
for (std::string meshName : CurrentNode.meshes) {
tinygltf::Mesh mesh = Scene->meshes[meshName];
for (tinygltf::Primitive primitive : mesh.primitives) {
if (primitive.mode != TINYGLTF_MODE_TRIANGLES) {
UE_LOG(GLTF, Error, TEXT("Unsupported Mesh Primitive Mode %d "), primitive.mode);
}
//TODO parse or link Material if necesssary
//primitive.material;
ModelTransform = ModelTransform * GetNodeTransform(&CurrentNode);
//TODO CorrectUp Direction
//FTransform Temp(FRotator(0.0f, 0.0f, -90.0f));
//TotalMatrix = TotalMatrix * Temp.ToMatrixWithScale();
//GetBufferData(OutArray, Scene->accessors[primitive.attributes["POSITION"]]);
}
}
ImportNodes( CurrentNode.children, RawMesh, ModelTransform);
}
}
FString UStaticGLTFComponent::ToFString(std::string InString)
{
return FString(InString.c_str());
}
std::string UStaticGLTFComponent::ToStdString(FString InString)
{
auto CharArray = InString.GetCharArray();
std::wstring WideString(&CharArray[0]);
std::wstring_convert< std::codecvt_utf8<wchar_t> > Convert;
return Convert.to_bytes(WideString);
}
FMatrix UStaticGLTFComponent::GetNodeTransform(tinygltf::Node* Node)
{
if (Node->matrix.size() == 16)
{
FMatrix Ret;
for (int32 i = 0; i < 4; ++i)
{
for (int32 j = 0; j < 4; ++j)
{
// Reverse order since glTF is column major and FMatrix is row major
Ret.M[j][i] = Node->matrix[(4 * i) + j];
}
}
return Ret;
}
else if (Node->rotation.size() == 4 && Node->scale.size() == 3 && Node->translation.size() == 3)
{
FQuat Rotation((float)Node->rotation[0], (float)Node->rotation[1], (float)Node->rotation[2], (float)Node->rotation[3]);
FVector Scale((float)Node->scale[0], (float)Node->scale[1], (float)Node->scale[2]);
FVector Translation((float)Node->translation[0], (float)Node->translation[1], (float)Node->translation[2]);
return FTransform(Rotation, Translation, Scale).ToMatrixWithScale();
}
else
{
return FMatrix::Identity;
}
}
//Buffer Copy Methods:
// Retrieve a value from the buffer, implicitly accounting for endianness
// Adapted from http://stackoverflow.com/questions/13001183/how-to-read-little-endian-integers-from-file-in-c
template <typename T> T UStaticGLTFComponent::BufferValue(void* Data/*, uint8 Size*/)
{
T Ret = T(0);
auto NewData = reinterpret_cast<unsigned char*>(Data);
for (int i = 0; i < sizeof(T); ++i)
{
Ret |= (T)(NewData[i]) << (8 * i);
}
return Ret;
}
// Use unions for floats and doubles since they don't have a bitwise OR operator
template <> float UStaticGLTFComponent::BufferValue(void* Data)
{
assert(sizeof(float) == sizeof(int32));
union
{
float Ret;
int32 IntRet;
};
Ret = 0.0f;
auto NewData = reinterpret_cast<unsigned char*>(Data);
for (int i = 0; i < sizeof(int32); ++i)
{
IntRet |= (int32)(NewData[i]) << (8 * i);
}
return Ret;
}
template <> double UStaticGLTFComponent::BufferValue(void* Data)
{
assert(sizeof(float) == sizeof(int64));
union
{
double Ret;
int64 IntRet;
};
Ret = 0.0;
auto NewData = reinterpret_cast<unsigned char*>(Data);
for (int i = 0; i < sizeof(int64); ++i)
{
IntRet |= (int64)(NewData[i]) << (8 * i);
}
return Ret;
}
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Components/StaticMeshComponent.h"
#include <string>
#include <vector>
#include "StaticGLTFComponent.generated.h"
struct FRawMesh;
/// Forward-declared TinyGLTF types since its header can only be #included in one source file.
/// This also means that we must use pointers to these types outside of GLTFMeshBuilder.cpp.
namespace tinygltf
{
class TinyGLTFLoader;
class Scene;
class Node;
struct ACCESSOR;
typedef struct ACCESSOR Accessor;
struct PRIMITIVE;
typedef struct PRIMITIVE Primitive;
struct MESH;
typedef struct MESH Mesh;
struct MATERIAL;
typedef struct MATERIAL Material;
}
/**
*
*/
UCLASS()
class MASTERTESTPROJECT_API UStaticGLTFComponent : public UStaticMeshComponent
{
GENERATED_BODY()
public:
UStaticGLTFComponent();
~UStaticGLTFComponent();
UPROPERTY(Category = GLTF, EditAnywhere, BlueprintReadWrite)
FString GLTFPath;
virtual void OnRegister() override;
private:
tinygltf::TinyGLTFLoader* Loader;
tinygltf::Scene* Scene;
bool tinygltfLoadSuccess;
FString tinygltfError;
void ImportNodes(std::vector<std::string> nodes, FRawMesh& RawMesh, FMatrix ModelTransform);
/// @name String Conversion
///@{
/// Helper functions for converting between Unreal's and STL's strings.
static FString ToFString(std::string InString);
static std::string ToStdString(FString InString);
///@}
/// Returns the transform of a node relative to its parent.
FMatrix GetNodeTransform(tinygltf::Node* Node);
//Copy methods
/// @name Level 1: BufferValue
///@{
/// Obtains a single value from the geometry data buffer, accounting for endianness.
/// Adapted from http://stackoverflow.com/questions/13001183/how-to-read-little-endian-integers-from-file-in-c
/// @param Data A pointer to the raw data to cast to the desired type.
/// @return The typed data value.
template <typename T> T BufferValue(void* Data);
///@}
};
This source diff could not be displayed because it is too large. You can view the blob instead.
Copyright (c) 2016, Syoyo Fujita
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
// Fill out your copyright notice in the Description page of Project Settings.
#include "MasterTestProject.h"
#include "GLTFDisplay.h"
// Sets default values
AGLTFDisplay::AGLTFDisplay()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
static ConstructorHelpers::FObjectFinder<UStaticMeshComponent> StaticMeshComp(TEXT("/Game/Content/Duck"));
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
//CreateDefaultSubobject<StaticMesComponent>()
//StaticMeshComponent = CreateDefaultSubobject<StaticMeshComp.Object->StaticClass()>(RootComponent, NAME_None);
//StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("GLTFComponent"));
//newObject, duplicateObject
//if (StaticMeshComp.Succeeded()) {
//}
UE_LOG(LogTemp, Warning, TEXT("Object is %d"), StaticMeshComp.Object);
originalGLTFImport = StaticMeshComp.Object;
if(originalGLTFImport != nullptr)
originalGLTFImport->SetupAttachment(RootComponent);
// StaticMeshComponent->SetVisibility(true);
// StaticMeshComponent->SetHiddenInGame(false);
StaticGLTFComponent = CreateDefaultSubobject<UStaticGLTFComponent>(TEXT("GLTFComponent"));
StaticGLTFComponent->SetupAttachment(RootComponent);
}
// Called when the game starts or when spawned
void AGLTFDisplay::BeginPlay()
{
Super::BeginPlay();
FVector zero = FVector(0);
//StaticMeshComponent->RegisterComponent();
//StaticMeshComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
//StaticMeshComponent->SetupAttachment(RootComponent);
if (!originalGLTFImport->IsRegistered()) {
//originalGLTFImport->RegisterComponent();
}
originalGLTFImport->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
StaticMeshComponentCopy = DuplicateObject<UStaticMeshComponent>(originalGLTFImport, this);
if (!StaticMeshComponentCopy->IsRegistered()) {
StaticMeshComponentCopy->RegisterComponent();
}
StaticMeshComponentCopy->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
StaticMeshComponentCopy->SetRelativeLocation(FVector(100.f));
StaticGLTFComponent->SetRelativeLocation(FVector(-100.f));
SetActorLocation(zero, false);
}
// Called every frame
void AGLTFDisplay::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "GLTF/StaticGLTFComponent.h"
#include "GLTFDisplay.generated.h"
UCLASS()
class MASTERTESTPROJECT_API AGLTFDisplay : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AGLTFDisplay();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
UPROPERTY(Category = StaticMeshActor, VisibleAnywhere, BlueprintReadOnly)
UStaticMeshComponent *originalGLTFImport;
UPROPERTY(Category = StaticMeshActor, VisibleAnywhere, BlueprintReadOnly)
UStaticMeshComponent *StaticMeshComponentCopy;
UPROPERTY(Category = StaticMeshActor, VisibleAnywhere, BlueprintReadOnly)
UStaticGLTFComponent *StaticGLTFComponent;
};
......@@ -17,15 +17,15 @@ public class MasterTestProject : ModuleRules
}
public MasterTestProject(TargetInfo Target)
public MasterTestProject(ReadOnlyTargetRules Target) : base (Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "ImageWrapper", "RawMesh", "HTTP", "Json", "JsonUtilities", "ProceduralMeshComponent", "RHI", "RenderCore" });
PrivateDependencyModuleNames.AddRange(new string[] { });
LoadAssimp(Target);
LoadAMQP(Target);
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
......@@ -36,7 +36,7 @@ public class MasterTestProject : ModuleRules
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
public bool LoadAssimp(TargetInfo Target)
public bool LoadAssimp(ReadOnlyTargetRules Target)
{
bool isLibrarySupported = false;
......@@ -74,6 +74,46 @@ public class MasterTestProject : ModuleRules
return isLibrarySupported;
}
public bool LoadAMQP(ReadOnlyTargetRules Target)
{
bool isLibrarySupported = false;
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
{
isLibrarySupported = true;
// string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
string LibrariesPath = Path.Combine("H:\\Repositories\\rabbitmq-c\\vs17\\librabbitmq\\Debug");
// string dllPath = Path.Combine(ThirdPartyPath, "assimp", "bin", "Debug");
//test your path with:
//using System; Console.WriteLine("");
Console.WriteLine(".. Target {0}", Target.Platform);
Console.WriteLine("... LibrariesPath -> " + LibrariesPath);
// Console.WriteLine("... DLLPath -> " + dllPath);
PublicLibraryPaths.Add(LibrariesPath);
//PublicLibraryPaths.Add(dllPath);
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "rabbitmq.4.lib"));// + PlatformString + ".lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "librabbitmq.4.lib"));// + PlatformString + ".lib"));
//sPublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "zlibstaticd.lib"));
// PublicDelayLoadDLLs.Add(Path.Combine(dllPath, "assimp-vc140-mt.dll"));
}
if (isLibrarySupported)
{
// Include path
PublicIncludePaths.Add(Path.Combine("H:\\Repositories\\rabbitmq-c\\librabbitmq"));
}
Definitions.Add(string.Format("WITH_RABBITMQ_BINDING={0}", isLibrarySupported ? 1 : 0));
return isLibrarySupported;
}
public bool LoadAssimp2(TargetInfo Target)
{
bool isLibrarySupported = false;
......
// Fill out your copyright notice in the Description page of Project Settings.
#include "MasterTestProject.h"
#include "MyGameInstance.h"
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Engine/GameInstance.h"
#include "RabbitMQConnection.h"
#include "MyGameInstance.generated.h"
/**
*
*/
UCLASS()
class MASTERTESTPROJECT_API UMyGameInstance : public UGameInstance
{
GENERATED_BODY()
public:
URabbitMQConnection* connection = nullptr;
};
......@@ -48,9 +48,9 @@ void APointCloudActor::setPoints(UTexture2D* PointCloud, FVector pos, FVector sc
}
void APointCloudActor::setColors(UTexture2D* Colors) {
Material->SetTextureParameterValue(FName("Colors"), Colors);
this->Colors = Colors;
void APointCloudActor::setColors(UTexture2D* ColorsTexture) {
Material->SetTextureParameterValue(FName("Colors"), ColorsTexture);
this->Colors = ColorsTexture;
StaticMeshComponent->SetMaterial(0, Material);
}
......
// Fill out your copyright notice in the Description page of Project Settings.
#include "MasterTestProject.h"
#include "RabbitMQConnection.h"
URabbitMQConnection::URabbitMQConnection(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) {
char const *hostname = "10.1.7.49";
int port = 5672;
conn = amqp_new_connection();
socket = amqp_tcp_socket_new(conn);
if (!socket) {
UE_LOG(TILES, Error, TEXT("No RabbitMQ Socket"));
}
int status = amqp_socket_open(socket, hostname, port);
if (status) {
UE_LOG(TILES, Error, TEXT("Cann not Open Socket"));
}
amqp_rpc_reply_t returncode = amqp_login(conn, "/", 0, 131072, 0, AMQP_SASL_METHOD_PLAIN, "guest", "guest");
if (AMQP_RESPONSE_NORMAL != returncode.reply_type) {
UE_LOG(TILES, Error, TEXT("Unable to Login"));
}
amqp_channel_open(conn, 1);
returncode = amqp_get_rpc_reply(conn);
if (AMQP_RESPONSE_NORMAL != returncode.reply_type) {
UE_LOG(TILES, Error, TEXT("Opening channel error"));
}
success = true;
}
URabbitMQConnection::~URabbitMQConnection()
{
if (!success) {
return;
}
amqp_rpc_reply_t returncode = amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS);
if (AMQP_RESPONSE_NORMAL != returncode.reply_type) {
UE_LOG(TILES, Error, TEXT("Closing channel error"));
}
returncode = amqp_connection_close(conn, AMQP_REPLY_SUCCESS);
if (AMQP_RESPONSE_NORMAL != returncode.reply_type) {
UE_LOG(TILES, Error, TEXT("Closing connection error"));
}
int errorcode = amqp_destroy_connection(conn);
if (errorcode != 0) {
UE_LOG(TILES, Error, TEXT("Ending AMQP error"));
}
}
bool URabbitMQConnection::publishMessage(char const * Message)
{
if (!success){
UE_LOG(TILES, Warning, TEXT("Cant send Messsage, no Connection"));
return false;
}
char const *exchange = "";
char const *routingkey = "to_hololense";
// char const *messagebody = "{\"timestamp\":15.600000381469727,\"start\":{\"x\":0.0,\"y\":0.0,\"z\":0.0},\"end\":{\"x\":1.0,\"y\":5.0,\"z\":16.0}}";
amqp_basic_properties_t props;
props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG;
props.content_type = amqp_cstring_bytes("text/plain");
props.delivery_mode = 2; /* persistent delivery mode */
int errorcode = amqp_basic_publish(conn,
1,
amqp_cstring_bytes(exchange),
amqp_cstring_bytes(routingkey),
0,
0,
&props,
amqp_cstring_bytes(Message));
if (errorcode != 0) {
UE_LOG(TILES, Error, TEXT("Publishing error"));
}
//UE_LOG(TILES, Warning, TEXT("Published Message %s"), Message);
return true;
}
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include <amqp_tcp_socket.h>
#include <amqp.h>
#include <amqp_framing.h>
#include "RabbitMQConnection.generated.h"
/**
*
*/
UCLASS()
class MASTERTESTPROJECT_API URabbitMQConnection : public UObject
{
GENERATED_BODY()
public:
bool success = false;
amqp_socket_t *socket = NULL;
amqp_connection_state_t conn;
URabbitMQConnection(const FObjectInitializer& ObjectInitializer);
~URabbitMQConnection();
bool publishMessage(char const * Message);
protected:
};
......@@ -426,14 +426,14 @@ void ATilesetActor::parsePointCloudTile(const TArray<uint8> data, FTile * tile)
UTexture2D* ColorTexture = nullptr;
if (FeatureTableJSON->HasField("RGB")) {
// RGB = uint8[3]
uint32 featureTableBinaryOffset = pntheader->getFeatureStart() + pntheader->featureTable.featureTableJSONByteLength;
TSharedPtr<FJsonObject> binaryBodyReference = FeatureTableJSON->GetObjectField("RGB");
int32 byteOffset = binaryBodyReference->GetIntegerField("byteOffset");
uint8* start = (uint8*)(data.GetData() + pntheader->getFeatureBinaryStart() + byteOffset);
featureTableBinaryOffset = pntheader->getFeatureStart() + pntheader->featureTable.featureTableJSONByteLength;
binaryBodyReference = FeatureTableJSON->GetObjectField("RGB");
byteOffset = binaryBodyReference->GetIntegerField("byteOffset");
start = (uint8*)(data.GetData() + pntheader->getFeatureBinaryStart() + byteOffset);
// creat pooint texture
TArray<FLinearColor> *ColorRGB = new TArray<FLinearColor>();
uint8* pos = start;
pos = start;
for (size_t i = 0; i < instances_length; i += 1)
{
FLinearColor temp = FLinearColor((*pos) / 255.0, (*(pos + 1)) / 255.0, (*(pos + 2)) / 255.0, 1.0F);
......
// Fill out your copyright notice in the Description page of Project Settings.
#include "MasterTestProject.h"
#include "MyGameInstance.h"
#include "VRPawnCode.h"
// Sets default values
AVRPawnCode::AVRPawnCode()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AVRPawnCode::BeginPlay()
{
Super::BeginPlay();
UMyGameInstance *gameinstance = Cast<UMyGameInstance>(GetGameInstance());
if (gameinstance != nullptr && !gameinstance->connection) {
gameinstance->connection = NewObject<URabbitMQConnection>();
}
char const *messagebody = "{\"timestamp\":15.600000381469727,\"start\":{\"x\":0.0,\"y\":0.0,\"z\":0.0},\"end\":{\"x\":1.0,\"y\":5.0,\"z\":16.0}}";
}
// Called every frame
void AVRPawnCode::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void AVRPawnCode::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
void AVRPawnCode::PublishMessage(FVector start, FVector end)
{
UMyGameInstance *gameinstance = Cast<UMyGameInstance>(GetGameInstance());
FString Message = FString::Printf(TEXT("{\"timestamp\":%d,\"start\":{\"x\":%f,\"y\":%f,\"z\":%f},\"end\":{\"x\":%f,\"y\":%f,\"z\":%f}}"), 0.0f, start.X, start.Y, start.Z, end.X, end.Y, end.Z);
UE_LOG(TILES, Warning, TEXT("Published Message %s"), *Message);
gameinstance->connection->publishMessage(TCHAR_TO_ANSI(*Message));
}
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "RabbitMQConnection.h"
#include "VRPawnCode.generated.h"
UCLASS()
class MASTERTESTPROJECT_API AVRPawnCode : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
AVRPawnCode();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
UFUNCTION(BlueprintCallable, Category = "RabbitMQ")
void PublishMessage(FVector start, FVector end);
};
......@@ -5,21 +5,10 @@ using System.Collections.Generic;
public class MasterTestProjectEditorTarget : TargetRules
{
public MasterTestProjectEditorTarget(TargetInfo Target)
public MasterTestProjectEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
ExtraModuleNames.Add("MasterTestProject");
}
//
// TargetRules interface.
//
public override void SetupBinaries(
TargetInfo Target,
ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
ref List<string> OutExtraModuleNames
)
{
OutExtraModuleNames.AddRange( new string[] { "MasterTestProject" } );
}
}
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