1
0
forked from cgvr/DeltaVR

4 Commits

Author SHA1 Message Date
48b9f12802 make copy of main scene 2026-01-25 12:11:53 +02:00
ad6954884b trellis and invokeAI urls configurable in config 2026-01-19 18:55:25 +02:00
4292750b65 update TODO 2026-01-17 08:30:25 +00:00
b3073e66df update TODO 2026-01-16 18:33:48 +00:00
11 changed files with 88 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
### TODO
* glTF loading: vahetada ära shader Universal render pipelin Lit, mitte panna buildi kaasa glTf oma
* shape scanner initialisation correct number of confs
* user flow: grab item? mida krabada
* user prefs: settinguid meelde jätta

Binary file not shown.

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8a90a45cf0824d14fb5a2b9f59951013
guid: 9e16c783900f92a4c8942f7d34faa968
DefaultImporter:
externalObjects: {}
userData:

View File

@@ -0,0 +1,39 @@
using System.IO;
using UnityEngine;
public class ConfigManager : MonoBehaviour
{
public GameConfig Config { get; private set; }
public static ConfigManager Instance { get; private set; }
private static string configPath => Path.Combine(Application.persistentDataPath, "config.json");
private void Awake()
{
Instance = this;
LoadConfig();
}
public void LoadConfig()
{
if (File.Exists(configPath))
{
string json = File.ReadAllText(configPath);
Config = JsonUtility.FromJson<GameConfig>(json);
}
else
{
// Create config with default values
Config = new GameConfig();
SaveConfig();
}
Debug.Log("Loaded config from: " + configPath);
}
public void SaveConfig()
{
string json = JsonUtility.ToJson(Config, true);
File.WriteAllText(configPath, json);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6a9ed26713a3c4c4f8f6be3bbd4af5c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
[System.Serializable]
public class GameConfig
{
public string invokeAIUrl = "http://192.168.0.53:9090";
public string invokeAIModelKey = "81d45960-08a0-4b8c-a48b-e7d73b21bfe2";
public string TrellisUrl = "http://192.168.0.53:7960";
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5412d5465648e6c40bfe932c9098194b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -14,9 +14,7 @@ public class InvokeAiClient : MonoBehaviour
{
public static InvokeAiClient Instance { get; private set; }
public string INVOKEAI_BASE_URL;
public string DEFAULT_QUEUE_ID = "default";
public string MODEL_KEY;
public string promptSuffix = ", single object, front and side fully visible, realistic style, plain neutral background, clear details, soft studio lighting, true-to-scale";
private HttpClient httpClient;
@@ -27,7 +25,7 @@ public class InvokeAiClient : MonoBehaviour
{
Timeout = TimeSpan.FromSeconds(120)
};
httpClient.BaseAddress = new Uri(INVOKEAI_BASE_URL);
httpClient.BaseAddress = new Uri(ConfigManager.Instance.Config.invokeAIUrl);
Instance = this;
}
@@ -520,13 +518,14 @@ public class InvokeAiClient : MonoBehaviour
public async Task<byte[]> GenerateImage(string prompt)
{
string modelKey = ConfigManager.Instance.Config.invokeAIModelKey;
string refinedPrompt = prompt + promptSuffix;
JObject args = new JObject()
{
["prompt"] = refinedPrompt,
["width"] = 512,
["height"] = 512,
["model_key"] = MODEL_KEY,
["model_key"] = modelKey,
};
UnityEngine.Debug.Log("Starting image generation...");

View File

@@ -9,16 +9,16 @@ public class TrellisClient : MonoBehaviour
{
public static TrellisClient Instance { get; private set; }
public string TRELLIS_BASE_URL;
private HttpClient httpClient;
private void Awake()
{
httpClient = new HttpClient();
httpClient.BaseAddress = new Uri(TRELLIS_BASE_URL);
httpClient.BaseAddress = new Uri(ConfigManager.Instance.Config.TrellisUrl);
Instance = this;
TestConnection();
}
// Start is called before the first frame update
@@ -33,6 +33,12 @@ public class TrellisClient : MonoBehaviour
}
private async void TestConnection()
{
var statusResp = await httpClient.GetAsync("status");
Debug.Log("Trellis status: " + statusResp.StatusCode);
}
public async Task<byte[]> GenerateModel(
string imageBase64,