Open johanlindfors opened 8 years ago
After som refactoring and further testing I now have something rendering solid, but only when enabling the MonoDebugHud...
Here is the refactored code:
public class Game : Application
{
public Game() : base() { }
public Game(ApplicationOptions options) : base(options) { }
protected override void Start()
{
var scene = new Scene();
scene.CreateComponent<Octree>();
// Box
var boxNode = scene.CreateChild();
boxNode.Position = new Vector3(0, 0, 5);
boxNode.Rotation = new Quaternion(60, 0, 30);
boxNode.SetScale(1f);
var modelObject = boxNode.CreateComponent<StaticModel>();
modelObject.Model = ResourceCache.GetModel("Models/Box.mdl");
modelObject.SetMaterial(ResourceCache.GetMaterial("Materials/StoneSmall.xml"));
// Light
var lightNode = scene.CreateChild(name: "light");
lightNode.SetDirection(new Vector3(0.6f, -1.0f, 0.8f));
lightNode.CreateComponent<Light>();
// Camera
var cameraNode = scene.CreateChild(name: "camera");
var camera = cameraNode.CreateComponent<Camera>();
// Viewport
Renderer.SetViewport(0, new Viewport(scene, camera, null));
// DebugHud
var debugHud = new MonoDebugHud(this);
debugHud.Show(); // Stuff gets rendered ONLY when this is shown
}
public sealed partial class MainPage
{
Urho.Application game;
public MainPage()
{
this.InitializeComponent();
Loaded += delegate {
game = urhoSurface.Run
The code I used originally was pretty much pulled from the getting started documentation and hence I'm curious in learning which properties I have forgot to enable to get this simple cube rendered, what does the MonoDebugHud do that I'm not already doing? Is there anything with lighting or camera?
The investigation continues. This issue exists in the Feature Samples as well. If I remove the MonoDebugHud and also removes all the lines that renders 2D content (such as the Input.AddScreenJoystick) the screen renders black.
@johanlindfors could you please try the latest Feature samples? I've updated nuget and fixed some uwp issues, also it's not longer required to store assets in pak files.
Thanks @EgorBo. I tried the latest Feature samples and the issue still remains. I fail to render the scene (unless I resize the window constantly) unless I explicitly add something to the UI.Root.AddChild(...) then everything seems to work. A pure 3d (octree) scene doesn't work...
@johanlindfors interesting, looks like I messed up something.
Any news on this issue?
@johanlindfors was temporarily fixed in https://github.com/xamarin/urho/commit/7152acec5d201ac27862093084bac645e2478e52. See the comment description.
Trying to create minimal app with UrhoSharp to understand the setup and overall architecture, but a simple scene just gets rendered as a black screen, unless I resize the window on my computer, then occasionally the screen flickers and renders the currently spinning cube for one frame, then black again.
This is pretty much all of the code:
Any ideas?
/Johan