Skip to content

Commit

Permalink
Merge pull request #13 from menshiva/polishing
Browse files Browse the repository at this point in the history
Polishing
  • Loading branch information
menshiva authored Jan 4, 2023
2 parents 08b741d + 8e83ed4 commit 1260437
Show file tree
Hide file tree
Showing 73 changed files with 1,063 additions and 731 deletions.
60 changes: 56 additions & 4 deletions Config/DefaultEngine.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[/Script/Engine.RendererSettings]
r.Mobile.DisableVertexFog=True
r.Shadow.CSM.MaxMobileCascades=2
r.MobileMSAA=4
r.MobileMSAA=1
r.Mobile.AllowDitheredLODTransition=False
r.Mobile.AllowSoftwareOcclusion=False
r.Mobile.VirtualTextures=False
Expand Down Expand Up @@ -54,7 +54,7 @@ r.DefaultFeature.MotionBlur=False
r.DefaultFeature.LensFlare=False
r.TemporalAA.Upsampling=False
r.SSGI.Enable=False
r.DefaultFeature.AntiAliasing=3
r.DefaultFeature.AntiAliasing=0
r.DefaultFeature.LightUnits=1
r.DefaultBackBufferPixelFormat=4
r.Shadow.UnbuiltPreviewInGame=True
Expand Down Expand Up @@ -138,7 +138,7 @@ GlobalDefaultGameMode=/Script/Graphs.VRGameMode
GlobalDefaultServerGameMode=None

[/Script/Slate.SlateSettings]
bExplicitCanvasChildZOrder=True
bExplicitCanvasChildZOrder=False

[/Script/WindowsTargetPlatform.WindowsTargetSettings]
Compiler=VisualStudio2022
Expand Down Expand Up @@ -166,8 +166,35 @@ CompressionQualityModifier=0.000000
AutoStreamingThreshold=0.000000
SoundCueCookQualityIndex=-1

[SystemSettings]
vr.PixelDensity=1
r.SeparateTranslucency=0
r.HZBOcclusion=0
r.MotionBlurQuality=0
r.PostProcessAAQuality=3
r.BloomQuality=1
r.AmbientOcclusionLevels=0
r.SSR.Quality=1
r.DepthOfFieldQuality=0
r.SceneColorFormat=2
r.TranslucencyVolumeBlur=0
r.TranslucencyLightingVolumeDim=4
r.MaxAnisotropy=8
r.LensFlareQuality=0
r.SceneColorFringeQuality=0
r.FastBlurThreshold=0
r.SSR.MaxRoughness=0.55
r.rhicmdbypass=0
sg.EffectsQuality=2
sg.PostProcessQuality=0
r.FinishCurrentFrame=0
r.CustomDepth=0
r.LightShaftDownSampleFactor=4
r.OcclusionQueryLocation=1
r.AmbientOcclusionLevels=0

[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
PackageName=com.epicgames.[PROJECT]
PackageName=com.menshiva.Graphs
StoreVersion=1
StoreVersionOffsetArmV7=0
StoreVersionOffsetArm64=0
Expand Down Expand Up @@ -291,6 +318,8 @@ FFRLevel=FFR_Medium
+ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/Graphs")
+ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/Graphs")
+ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="GraphsGameModeBase")
bSubtitlesEnabled=False
bCanBlueprintsTickByDefault=False

[/Script/AIModule.AISystem]
PerceptionSystemClassName=None
Expand Down Expand Up @@ -355,3 +384,26 @@ PerceptionSystemClassName=None
+CollisionChannelRedirects=(OldName="VehicleMovement",NewName="Vehicle")
+CollisionChannelRedirects=(OldName="PawnMovement",NewName="Pawn")

[/Script/Engine.AudioSettings]
DefaultSoundClassName=/Engine/EngineSounds/Master.Master
DefaultMediaSoundClassName=/Engine/EngineSounds/Master.Master
DefaultSoundConcurrencyName=None
DefaultBaseSoundMix=None
VoiPSoundClass=None
MasterSubmix=/Engine/EngineSounds/Submixes/MasterSubmixDefault.MasterSubmixDefault
BaseDefaultSubmix=None
ReverbSubmix=/Engine/EngineSounds/Submixes/MasterReverbSubmixDefault.MasterReverbSubmixDefault
EQSubmix=/Engine/EngineSounds/Submixes/MasterEQSubmixDefault.MasterEQSubmixDefault
VoiPSampleRate=Low16000Hz
MaximumConcurrentStreams=2
GlobalMinPitchScale=0.400000
GlobalMaxPitchScale=2.000000
+QualityLevels=(DisplayName=NSLOCTEXT("AudioSettings", "DefaultSettingsName", "Default"),MaxChannels=32)
bAllowPlayWhenSilent=True
bDisableMasterEQ=False
bAllowCenterChannel3DPanning=False
NumStoppingSources=8
PanningMethod=Linear
MonoChannelUpmixMethod=Linear
DialogueFilenameFormat="{DialogueGuid}_{ContextId}"

10 changes: 0 additions & 10 deletions Config/DefaultInput.ini
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,11 @@ DoubleClickTime=0.200000
+ActionMappings=(ActionName="LeftTrigger",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouch_Left_Trigger_Click)
+ActionMappings=(ActionName="LeftGrip",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouch_Left_Grip_Click)
+ActionMappings=(ActionName="RightGrip",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouch_Right_Grip_Click)
+ActionMappings=(ActionName="RightGrip",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Vive_Right_Grip_Click)
+ActionMappings=(ActionName="RightGrip",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MixedReality_Right_Grip_Click)
+ActionMappings=(ActionName="Esc",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Escape)
+AxisMappings=(AxisName="LeftThumbstickAxisY",Scale=1.000000,Key=OculusTouch_Left_Thumbstick_Y)
+AxisMappings=(AxisName="LeftThumbstickAxisY",Scale=1.000000,Key=Vive_Left_Trackpad_Y)
+AxisMappings=(AxisName="LeftThumbstickAxisY",Scale=1.000000,Key=MixedReality_Left_Thumbstick_Y)
+AxisMappings=(AxisName="LeftThumbstickAxisX",Scale=1.000000,Key=OculusTouch_Left_Thumbstick_X)
+AxisMappings=(AxisName="LeftThumbstickAxisX",Scale=1.000000,Key=Vive_Left_Trackpad_X)
+AxisMappings=(AxisName="LeftThumbstickAxisX",Scale=1.000000,Key=MixedReality_Left_Thumbstick_X)
+AxisMappings=(AxisName="RightThumbstickAxisY",Scale=1.000000,Key=OculusTouch_Right_Thumbstick_Y)
+AxisMappings=(AxisName="RightThumbstickAxisY",Scale=1.000000,Key=Vive_Right_Trackpad_Y)
+AxisMappings=(AxisName="RightThumbstickAxisY",Scale=1.000000,Key=MixedReality_Right_Thumbstick_Y)
+AxisMappings=(AxisName="RightThumbstickAxisX",Scale=1.000000,Key=OculusTouch_Right_Thumbstick_X)
+AxisMappings=(AxisName="RightThumbstickAxisX",Scale=1.000000,Key=Vive_Right_Trackpad_X)
+AxisMappings=(AxisName="RightThumbstickAxisX",Scale=1.000000,Key=MixedReality_Right_Thumbstick_X)
DefaultPlayerInputClass=/Script/Engine.PlayerInput
DefaultInputComponentClass=/Script/Engine.InputComponent
DefaultTouchInterface=None
Expand Down
Binary file modified Content/Graphs/Map/DefaultMap.umap
Binary file not shown.
Binary file modified Content/Graphs/Map/DefaultMap_BuiltData.uasset
Binary file not shown.
Binary file removed Content/Graphs/Materials/EdgesMaterial.uasset
Binary file not shown.
Binary file added Content/Graphs/Materials/GraphMaterial.uasset
Binary file not shown.
Binary file added Content/Graphs/Materials/GraphMaterialInst.uasset
Binary file not shown.
Binary file removed Content/Graphs/Materials/VerticesMaterial.uasset
Binary file not shown.
Binary file modified Content/Graphs/UI/Blueprints/SettingsPanel.uasset
Binary file not shown.
Binary file modified Content/Graphs/UI/Blueprints/Tools/ToolEditorPanel.uasset
Binary file not shown.
Binary file modified Content/Graphs/UI/Blueprints/Tools/ToolExporterPanel.uasset
Binary file not shown.
Binary file not shown.
3 changes: 1 addition & 2 deletions Graphs.uproject
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@
}
],
"TargetPlatforms": [
"WindowsNoEditor",
"Android"
"WindowsNoEditor"
]
}
78 changes: 50 additions & 28 deletions Source/Graphs/EntityStorage/Commands/EdgeCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,29 @@
#include "VertexCommands.h"

DECLARE_CYCLE_STAT(TEXT("EdgeCommands::Mutable::Create"), STAT_EdgeCommands_Mutable_Create, STATGROUP_GRAPHS_PERF_COMMANDS);
EntityId EdgeCommands::Mutable::Create(const EntityId GraphId, const EntityId FromVertexId, const EntityId ToVertexId) {
EntityId EdgeCommands::Mutable::Create(
const EntityId GraphId,
const EntityId FromVertexId, const EntityId ToVertexId,
const float Weight
) {
SCOPE_CYCLE_COUNTER(STAT_EdgeCommands_Mutable_Create);

// create new edge entity
const auto EdgeId = ES::NewEntity<EdgeEntity>();

// fill new entity with given properties
// fill new entity with default and given properties
auto &Edge = ES::GetEntityMut<EdgeEntity>(EdgeId);
Edge.GraphId = GraphId;
Edge.IsHit = false;
Edge.OverrideColor = ColorConsts::OverrideColorNone;
Edge.ConnectedVertices[0] = FromVertexId;
Edge.ConnectedVertices[1] = ToVertexId;
Edge.Weight = Weight;

// add new entity to parent graph
auto &Graph = ES::GetEntityMut<GraphEntity>(GraphId);
bool AlreadyInSet = false;
// store its hash so that we can fastly determine if undirected (FromVertexId, ToVertexId) edge is already in the graph
Graph.EdgesHashes.Add(Const::ComputeHash(Edge, false), &AlreadyInSet);
check(!AlreadyInSet);
check(!Graph.EdgesHashes.Contains(Const::ComputeHash(Edge, true)));
Expand All @@ -28,11 +34,11 @@ EntityId EdgeCommands::Mutable::Create(const EntityId GraphId, const EntityId Fr
// add to connected vertices
auto &FirstVertex = ES::GetEntityMut<VertexEntity>(FromVertexId);
auto &SecondVertex = ES::GetEntityMut<VertexEntity>(ToVertexId);
check(FirstVertex.GraphId == SecondVertex.GraphId); // check so that the 2 given vertices are from the same graph
FirstVertex.ConnectedEdges.Add(EdgeId, &AlreadyInSet);
check(!AlreadyInSet);
SecondVertex.ConnectedEdges.Add(EdgeId, &AlreadyInSet);
check(!AlreadyInSet);
check(FirstVertex.GraphId == SecondVertex.GraphId);

return EdgeId;
}
Expand All @@ -42,15 +48,15 @@ void EdgeCommands::Mutable::Remove(const EntityId EdgeId) {
SCOPE_CYCLE_COUNTER(STAT_EdgeCommands_Mutable_Remove);
const auto &Edge = ES::GetEntity<EdgeEntity>(EdgeId);

// remove from associated parent graph
// remove from the associated parent graph
auto &Graph = ES::GetEntityMut<GraphEntity>(Edge.GraphId);
auto CheckNum = Graph.EdgesHashes.Remove(Const::ComputeHash(Edge, false));
check(CheckNum == 1);
check(!Graph.EdgesHashes.Contains(Const::ComputeHash(Edge, true)));
CheckNum = Graph.Edges.Remove(EdgeId);
check(CheckNum == 1);

// remove from connected vertices
// remove from the connected vertices
for (const auto VertexId : Edge.ConnectedVertices)
ES::GetEntityMut<VertexEntity>(VertexId).ConnectedEdges.Remove(EdgeId);

Expand All @@ -70,55 +76,66 @@ bool EdgeCommands::Mutable::Deserialize(const rapidjson::Value &DomEdge, const E
SCOPE_CYCLE_COUNTER(STAT_EdgeCommands_Mutable_Deserialize);

if (!DomEdge.IsObject()) {
ErrorMessage = "Should be an object.";
ErrorMessage = "Should be a JSON object.";
return false;
}

const auto &Graph = ES::GetEntity<GraphEntity>(GraphId);

const auto &Graph = ES::GetEntity<GraphEntity>(GraphId);
EdgeEntity NewEdge;

// from vertex id
// from vertex
{
const auto &FromIdMember = DomEdge.FindMember("from_id");
if (FromIdMember == DomEdge.MemberEnd() || !FromIdMember->value.IsUint()) {
ErrorMessage = "Object should have \"from_id\" integer number.";
const auto &FromMember = DomEdge.FindMember("from");
if (FromMember == DomEdge.MemberEnd() || !FromMember->value.IsUint()) {
ErrorMessage = "Object's \"from\" attribute should exist and have an integer number.";
return false;
}
const uint32_t FromVertexCustomId = FromIdMember->value.GetUint();
const auto FromVertexId = Graph.VerticesCustomIdToEntityId.Find(FromVertexCustomId);
const uint32_t FromVertexLabel = FromMember->value.GetUint();
const auto FromVertexId = Graph.VerticesLabelToEntityId.Find(FromVertexLabel);
if (!FromVertexId) {
ErrorMessage = "Vertex with \"id\" " + FString::FromInt(FromVertexCustomId) + "not found.";
ErrorMessage = "Vertex with \"label\" " + FString::FromInt(FromVertexLabel) + "not found.";
return false;
}
NewEdge.ConnectedVertices[0] = *FromVertexId;
}

// to vertex id
{
const auto &ToIdMember = DomEdge.FindMember("to_id");
if (ToIdMember == DomEdge.MemberEnd() || !ToIdMember->value.IsUint()) {
ErrorMessage = "Object should have \"to_id\" integer number.";
const auto &ToMember = DomEdge.FindMember("to");
if (ToMember == DomEdge.MemberEnd() || !ToMember->value.IsUint()) {
ErrorMessage = "Object's \"to\" attribute should exist and have an integer number.";
return false;
}
const uint32_t ToVertexCustomId = ToIdMember->value.GetUint();
const auto ToVertexId = Graph.VerticesCustomIdToEntityId.Find(ToVertexCustomId);
const uint32_t ToVertexLabel = ToMember->value.GetUint();
const auto ToVertexId = Graph.VerticesLabelToEntityId.Find(ToVertexLabel);
if (!ToVertexId) {
ErrorMessage = "Vertex with \"id\" " + FString::FromInt(ToVertexCustomId) + "not found.";
ErrorMessage = "Vertex with \"label\" " + FString::FromInt(ToVertexLabel) + "not found.";
return false;
}
NewEdge.ConnectedVertices[1] = *ToVertexId;
}

// check if edge is not unique
// weight
{
const auto &WeightMember = DomEdge.FindMember("weight");
if (WeightMember != DomEdge.MemberEnd()) {
if (!WeightMember->value.IsFloat()) {
ErrorMessage = "Object's \"weight\" value should be a floating-point number.";
return false;
}
NewEdge.Weight = WeightMember->value.GetFloat();
}
}

// check if edge is unique
if (Graph.EdgesHashes.Contains(Const::ComputeHash(NewEdge, false))
|| Graph.EdgesHashes.Contains(Const::ComputeHash(NewEdge, true)))
{
ErrorMessage = "Object is not unique.";
return false;
}

Create(GraphId, NewEdge.ConnectedVertices[0], NewEdge.ConnectedVertices[1]);
Create(GraphId, NewEdge.ConnectedVertices[0], NewEdge.ConnectedVertices[1], NewEdge.Weight);
return true;
}

Expand All @@ -130,12 +147,18 @@ void EdgeCommands::Const::Serialize(const EntityId EdgeId, rapidjson::PrettyWrit
Writer.StartObject();

// from vertex custom id
Writer.Key("from_id");
Writer.Uint(ES::GetEntity<VertexEntity>(Edge.ConnectedVertices[0]).CustomId);
Writer.Key("from");
Writer.Uint(ES::GetEntity<VertexEntity>(Edge.ConnectedVertices[0]).Label);

// to vertex custom id
Writer.Key("to_id");
Writer.Uint(ES::GetEntity<VertexEntity>(Edge.ConnectedVertices[1]).CustomId);
Writer.Key("to");
Writer.Uint(ES::GetEntity<VertexEntity>(Edge.ConnectedVertices[1]).Label);

// weight
if (Edge.Weight != 0.0f) {
Writer.Key("weight");
Writer.Double(Edge.Weight);
}

Writer.EndObject();
}
Expand All @@ -149,6 +172,5 @@ uint32_t EdgeCommands::Const::ComputeHash(const EdgeEntity &Edge, const bool Rev

if (!ReverseVerticesIds)
return Utils::CantorPair(EntityId::Hash(FromVertexId), EntityId::Hash(ToVertexId));

return Utils::CantorPair(EntityId::Hash(ToVertexId), EntityId::Hash(FromVertexId));
}
59 changes: 53 additions & 6 deletions Source/Graphs/EntityStorage/Commands/EdgeCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,25 @@

namespace EdgeCommands {
namespace Mutable {
EntityId Create(EntityId GraphId, EntityId FromVertexId, EntityId ToVertexId);
/**
* Creates a new edge entity connecting the two given vertex entities, and adds it to the given graph.
*
* @param GraphId The ID of the graph to which the new edge should be added.
* @param FromVertexId The ID of the vertex at one end of the new edge.
* @param ToVertexId The ID of the vertex at the other end of the new edge.
* @param Weight The weight of the new edge. Default is 0.0.
* @return The ID of the new edge.
*/
EntityId Create(EntityId GraphId, EntityId FromVertexId, EntityId ToVertexId, float Weight = 0.0f);

/**
* Removes the edge with the given ID from its associated graph and connected vertices, and deletes it.
*
* @param EdgeId The ID of the edge to be removed.
*/
void Remove(EntityId EdgeId);


FORCEINLINE void SetHit(const EntityId EdgeId, const bool IsHit) {
ES::GetEntityMut<EdgeEntity>(EdgeId).IsHit = IsHit;
}
Expand All @@ -18,18 +33,50 @@ namespace EdgeCommands {
ES::GetEntityMut<EdgeEntity>(EdgeId).OverrideColor = OverrideColor;
}

FORCEINLINE void SetWeight(const EntityId EdgeId, const float Weight) {
ES::GetEntityMut<EdgeEntity>(EdgeId).Weight = Weight;
}

/**
* Moves the edge with the given ID by moving its connected vertices by the given delta.
*
* @param EdgeId The ID of the edge to be moved.
* @param Delta The displacement vector by which the edge should be moved.
*/
void Move(EntityId EdgeId, const FVector &Delta);

bool Deserialize(
const rapidjson::Value &DomEdge,
EntityId GraphId,
FString &ErrorMessage
);
/**
* Deserializes an edge from a JSON object and creates it in the given graph.
*
* The JSON object should contain the "from" and "to" integer numbers, and may contain the "weight" floating-point number.
*
* @param DomEdge The JSON object to be deserialized.
* @param GraphId The ID of the graph to which the new edge should be added.
* @param[out] ErrorMessage Output string that will contain an error message in case of failure.
* @return True on success, false on failure.
*/
bool Deserialize(const rapidjson::Value &DomEdge, EntityId GraphId, FString &ErrorMessage);
}

namespace Const {
/**
* Serializes the edge with the given ID to a JSON object.
*
* The resulting JSON object will have the "from" and "to" integer numbers representing the labels of the
* connected vertices, and may have the "weight" floating-point number if the edge has a non-zero weight.
*
* @param EdgeId The ID of the edge to be serialized.
* @param Writer The RapidJSON writer to which the serialized edge should be written.
*/
void Serialize(EntityId EdgeId, rapidjson::PrettyWriter<rapidjson::StringBuffer> &Writer);

/**
* Computes a hash value for the given edge.
*
* @param Edge The edge for which to compute the hash.
* @param ReverseVerticesIds If true, the hash value will be computed for the edge with the vertices IDs reversed.
* @return The computed hash value.
*/
uint32_t ComputeHash(const EdgeEntity &Edge, bool ReverseVerticesIds);
}
}
Loading

0 comments on commit 1260437

Please sign in to comment.