added method overloading and custom models

This commit is contained in:
shinichi
2020-09-18 14:23:43 +02:00
parent 8fd3322c63
commit 6e09b87f60
2 changed files with 28 additions and 6 deletions

View File

@@ -61,9 +61,25 @@ namespace RH_Engine
} }
public string ModelCommand() public string AddBikeModel()
{ {
string namename = "bike"; return AddModel("bike", "data\\NetworkEngine\\models\\bike\\bike.fbx", null);
}
public string AddModel(string nodeName, string fileLocation)
{
return AddModel(nodeName, fileLocation, null);
}
public string AddModel(string nodeName, string fileLocation, string animationLocation)
{
string namename = nodeName;
bool animatedBool = false;
if (animationLocation != null)
{
animatedBool = true;
}
dynamic payload = new dynamic payload = new
{ {
id = "scene/node/add", id = "scene/node/add",
@@ -74,10 +90,10 @@ namespace RH_Engine
{ {
model = new model = new
{ {
file = "data\\NetworkEngine\\models\\bike\\bike.fbx", file = fileLocation,
cullbackfaces = true, cullbackfaces = true,
animated = false, animated = animatedBool,
animation = "data\\NetworkEngine\\models\\bike\\bike_anim.fbx" animation = animationLocation
}, },
} }
} }

View File

@@ -108,7 +108,13 @@ namespace RH_Engine
Console.WriteLine(ReadPrefMessage(stream)); Console.WriteLine(ReadPrefMessage(stream));
command = createGraphics.ModelCommand(); command = createGraphics.AddBikeModel();
WriteTextMessage(stream, command);
Console.WriteLine(ReadPrefMessage(stream));
command = createGraphics.AddModel("car", "data\\customModels\\TeslaRoadster.fbx");
WriteTextMessage(stream, command); WriteTextMessage(stream, command);