This is pretty much straight out of the WPF code sample but when I tumble around with my mouse the scene doesn't get re-rendered. I can only get it to update by resizing the window.
Is there something I'm doing wrong or do I just need to manage my own render loop?
Is there something I'm doing wrong or do I just need to manage my own render loop?
Code:
sealed class SharpView : UserControl, IDisposable
{
readonly SharpEngineSceneView _view = new();
readonly MouseCameraController _camController;
public SharpView()
{
_view.Initialize();
var scene = _view.Scene;
var sceneView = _view.SceneView;
// init scene
scene.RootNode.Add(new BoxModelNode(
new Vector3(0, 0, 0),
new Vector3(80, 40, 60),
StandardMaterials.Gold,
"billy"));
// init lights
scene.Lights.Clear();
scene.Lights.Add(new DirectionalLight(new Vector3(-1, -0.3f, 0)));
scene.Lights.Add(new PointLight(new Vector3(500, 200, 100), range: 10000));
scene.SetAmbientLight(intensity: 0.3f);
// init camera
sceneView.BackgroundColor = Colors.Black;
sceneView.Camera = new TargetPositionCamera()
{
Heading = -40,
Attitude = -25,
Distance = 300,
TargetPosition = new Vector3(0, 0, 0),
// If there are no other light in the Scene, then add a camera light that illuminates the scene from the camera's position
ShowCameraLight = ShowCameraLightType.Auto
};
_camController = new MouseCameraController(_view)
{
RotateAroundMousePosition = false,
ZoomMode = CameraZoomMode.ViewCenter,
};
Content = _view;
}
public void Dispose()
{
_view.Dispose();
}
}