public void Content() { bool hasChanged = false; if (ImGuiEx.Hyperlink("Model", SceneModel.filename)) { var fullPath = new FilePath("resources/models/models").Combine(SceneModel.filename + ".dff"); diContainer.GetTag <OpenDocumentSet>().OpenWith <ModelViewer>(fullPath); } var color = SceneModel.color.ToFColor(); ColorEdit4("Color", ref color, ImGuiColorEditFlags.NoPicker); NewLine(); var pos = Location.LocalPosition; var rotEuler = Location.LocalRotation.ToEuler() * 180.0f / MathF.PI; hasChanged |= DragFloat3("Position", ref pos); hasChanged |= DragFloat3("Rotation", ref rotEuler); NewLine(); SliderFloat("Ambient", ref SceneModel.surfaceProps.ambient, -1f, 1f); SliderFloat("Specular", ref SceneModel.surfaceProps.specular, -1f, 1f); SliderFloat("Diffuse", ref SceneModel.surfaceProps.diffuse, -1f, 1f); Checkbox("Use cached models", ref SceneModel.useCachedModels); SliderInt("Wiggle Speed", ref SceneModel.wiggleAmpl, 0, 4); Checkbox("Is only visual", ref SceneModel.isVisualOnly); NewLine(); var behaviorType = SceneBehaviour?.type ?? BehaviourType.Unknown; ImGuiEx.EnumCombo("Behavior", ref behaviorType); if (hasChanged) { rotEuler = (rotEuler * MathF.PI / 180.0f) - Location.LocalRotation.ToEuler(); Location.LocalPosition = pos; Location.LocalRotation *= Quaternion.CreateFromYawPitchRoll(rotEuler.Y, rotEuler.X, rotEuler.Z); diContainer.GetTag <FramebufferArea>().IsDirty = true; } }
private void HandleRaycast() { if (worldCollider == null) { Text("No world or collider loaded"); return; } if (Button("Shoot ray")) { ShootRay(); } Spacing(); Text("Intersections"); var shouldUpdate = ImGuiEx.EnumCombo("Primitive", ref intersectionPrimitive); shouldUpdate |= SliderFloat("Size", ref intersectionSize, 0.01f, 20f); shouldUpdate |= Checkbox("Update location", ref updateIntersectionPrimitive); if (shouldUpdate) { UpdateIntersectionPrimitive(); } }