forked from cgvr/DeltaVR
use voice transcription box and model gen box in archery range
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
using Unity.XR.CoreUtils;
|
||||
using UnityEngine;
|
||||
|
||||
public class ModelGenerationTestBox : MonoBehaviour
|
||||
public class ModelGenerationBox : MonoBehaviour
|
||||
{
|
||||
public Material inactiveMaterial;
|
||||
public Material loadingMaterial;
|
||||
|
||||
public Transform modelSpawnPoint;
|
||||
public VoiceTranscriptionTestBox voiceTranscriptionTestBox;
|
||||
public VoiceTranscriptionBox voiceTranscriptionTestBox;
|
||||
|
||||
private MeshRenderer meshRenderer;
|
||||
private bool isLoading;
|
||||
|
||||
private string lastModelPath;
|
||||
public string LastModelPath
|
||||
{
|
||||
get {
|
||||
return lastModelPath;
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@@ -33,13 +40,14 @@ public class ModelGenerationTestBox : MonoBehaviour
|
||||
XROrigin playerOrigin = other.GetComponent<XROrigin>();
|
||||
if (controller != null || playerOrigin != null)
|
||||
{
|
||||
string inputPrompt = voiceTranscriptionTestBox.currentTextOutput;
|
||||
string inputPrompt = voiceTranscriptionTestBox.LastTextOutput;
|
||||
|
||||
isLoading = true;
|
||||
meshRenderer.material = loadingMaterial;
|
||||
|
||||
string modelPath = await PipelineManager.Instance.GenerateModelAsync(inputPrompt);
|
||||
//LoadModel("D:\\henrisel\\DeltaVR3DModelGeneration\\3d-generation-pipeline\\models\\2025-11-17-16-13-33\\mesh.glb");
|
||||
lastModelPath = modelPath;
|
||||
|
||||
GameObject spawnedObject = await PipelineManager.Instance.SpawnModel(modelPath);
|
||||
spawnedObject.transform.parent = modelSpawnPoint;
|
||||
spawnedObject.transform.position = modelSpawnPoint.position;
|
||||
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
using Whisper;
|
||||
using Whisper.Utils;
|
||||
|
||||
public class VoiceTranscriptionTestBox : MonoBehaviour
|
||||
public class VoiceTranscriptionBox : MonoBehaviour
|
||||
{
|
||||
public Material activeMaterial;
|
||||
public Material inactiveMaterial;
|
||||
@@ -20,7 +20,15 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
|
||||
public TextMeshProUGUI outputText;
|
||||
|
||||
private string _buffer;
|
||||
public string currentTextOutput;
|
||||
|
||||
private string lastTextOutput;
|
||||
public string LastTextOutput
|
||||
{
|
||||
get
|
||||
{
|
||||
return lastTextOutput;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -90,7 +98,7 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
|
||||
|
||||
var text = res.Result;
|
||||
|
||||
currentTextOutput = text;
|
||||
lastTextOutput = text;
|
||||
outputText.text = text;
|
||||
|
||||
meshRenderer.material = inactiveMaterial;
|
||||
Reference in New Issue
Block a user