1
0
forked from cgvr/DeltaVR

test boxes change colours based on progress

This commit is contained in:
2025-12-16 10:43:58 +02:00
parent 5956b9508d
commit 32a5e4f332
5 changed files with 166 additions and 16 deletions

View File

@@ -33,7 +33,7 @@ async def main():
input_prompt = args.prompt input_prompt = args.prompt
print(f"Input prompt: {input_prompt}") print(f"Input prompt: {input_prompt}")
image_generation_prompt = input_prompt + ", realistic style, single object, front and side fully visible, plain neutral background, clear details, soft studio lighting, true-to-scale" image_generation_prompt = input_prompt + ", single object, front and side fully visible, realistic style, plain neutral background, clear details, soft studio lighting, true-to-scale"
pipeline_folder = Path(__file__).resolve().parent pipeline_folder = Path(__file__).resolve().parent
timestamp = get_timestamp() timestamp = get_timestamp()

View File

@@ -0,0 +1,133 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Yellow
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 0.70276463, b: 0, a: 1}
- _Color: {r: 1, g: 0.70276463, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
--- !u!114 &6221994712197478572
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 33390c6f2eb32df47809c60975868a0c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3,12 +3,14 @@ using UnityEngine;
public class ModelGenerationTestBox : MonoBehaviour public class ModelGenerationTestBox : MonoBehaviour
{ {
public Material activeMaterial;
public Material inactiveMaterial; public Material inactiveMaterial;
public Material loadingMaterial;
public Transform modelSpawnPoint; public Transform modelSpawnPoint;
public VoiceTranscriptionTestBox voiceTranscriptionTestBox; public VoiceTranscriptionTestBox voiceTranscriptionTestBox;
private MeshRenderer meshRenderer; private MeshRenderer meshRenderer;
private bool isLoading;
// Start is called before the first frame update // Start is called before the first frame update
@@ -25,31 +27,25 @@ public class ModelGenerationTestBox : MonoBehaviour
async void OnTriggerEnter(Collider other) async void OnTriggerEnter(Collider other)
{ {
if (isLoading) return;
KbmController controller = other.GetComponent<KbmController>(); KbmController controller = other.GetComponent<KbmController>();
XROrigin playerOrigin = other.GetComponent<XROrigin>(); XROrigin playerOrigin = other.GetComponent<XROrigin>();
if (controller != null || playerOrigin != null) if (controller != null || playerOrigin != null)
{ {
meshRenderer.material = activeMaterial;
string inputPrompt = voiceTranscriptionTestBox.currentTextOutput; string inputPrompt = voiceTranscriptionTestBox.currentTextOutput;
isLoading = true;
meshRenderer.material = loadingMaterial;
string modelPath = await PipelineManager.Instance.GenerateModelAsync(inputPrompt); string modelPath = await PipelineManager.Instance.GenerateModelAsync(inputPrompt);
//LoadModel("D:\\henrisel\\DeltaVR3DModelGeneration\\3d-generation-pipeline\\models\\2025-11-17-16-13-33\\mesh.glb"); //LoadModel("D:\\henrisel\\DeltaVR3DModelGeneration\\3d-generation-pipeline\\models\\2025-11-17-16-13-33\\mesh.glb");
GameObject spawnedObject = await PipelineManager.Instance.SpawnModel(modelPath); GameObject spawnedObject = await PipelineManager.Instance.SpawnModel(modelPath);
spawnedObject.transform.parent = modelSpawnPoint; spawnedObject.transform.parent = modelSpawnPoint;
spawnedObject.transform.position = modelSpawnPoint.position; spawnedObject.transform.position = modelSpawnPoint.position;
}
}
private void OnTriggerExit(Collider other) isLoading = false;
{
KbmController controller = other.GetComponent<KbmController>();
XROrigin playerOrigin = other.GetComponent<XROrigin>();
if (controller != null || playerOrigin != null)
{
meshRenderer.material = inactiveMaterial; meshRenderer.material = inactiveMaterial;
} }
} }
} }

View File

@@ -9,8 +9,10 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
{ {
public Material activeMaterial; public Material activeMaterial;
public Material inactiveMaterial; public Material inactiveMaterial;
public Material loadingMaterial;
private MeshRenderer meshRenderer; private MeshRenderer meshRenderer;
private bool isLoading;
public WhisperManager whisper; public WhisperManager whisper;
@@ -22,6 +24,8 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
private void Awake() private void Awake()
{ {
isLoading = false;
whisper.OnNewSegment += OnNewSegment; whisper.OnNewSegment += OnNewSegment;
whisper.OnProgress += OnProgressHandler; whisper.OnProgress += OnProgressHandler;
@@ -42,6 +46,11 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
void OnTriggerEnter(Collider other) void OnTriggerEnter(Collider other)
{ {
if (isLoading)
{
return;
}
KbmController controller = other.GetComponent<KbmController>(); KbmController controller = other.GetComponent<KbmController>();
XROrigin playerOrigin = other.GetComponent<XROrigin>(); XROrigin playerOrigin = other.GetComponent<XROrigin>();
if (controller != null || playerOrigin != null) if (controller != null || playerOrigin != null)
@@ -57,8 +66,9 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
XROrigin playerOrigin = other.GetComponent<XROrigin>(); XROrigin playerOrigin = other.GetComponent<XROrigin>();
if (controller != null | playerOrigin != null) if (controller != null | playerOrigin != null)
{ {
meshRenderer.material = inactiveMaterial;
microphoneRecord.StopRecord(); microphoneRecord.StopRecord();
meshRenderer.material = loadingMaterial;
isLoading = true;
} }
} }
@@ -82,6 +92,9 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
currentTextOutput = text; currentTextOutput = text;
outputText.text = text; outputText.text = text;
meshRenderer.material = inactiveMaterial;
isLoading = false;
} }
private void OnProgressHandler(int progress) private void OnProgressHandler(int progress)