0
これは初めて私がurhosharpを使用していて、何か問題があります。私はいくつかのサンプルのサンプルを試してみましたが、私のアプリはクラッシュしています。 Xamarinフォーム - Urho - ページの作成シーン
私はnugetパッケージUrhoSharp.Forms 私はちょうど私が360度回転することができます真ん中のカメラでシーンを作成したいを設置しました。
これは私のページです:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Urho;
using Urho.Forms;
using Urho.Resources;
using Urho.Gui;
using Xamarin.Forms;
namespace testApp.Pages.Urho
{
public partial class urhoPage : ContentPage
{
Scene scene;
Camera camera;
protected Node CameraNode { get; set; }
public urhoPage()
{
InitializeComponent();
scene = new Scene();
scene.CreateComponent<Octree>();
scene.CreateComponent<DebugRenderer>();
var planeNode = scene.CreateChild("Plane");
planeNode.Scale = new Vector3(100, 1, 100);
var planeObject = planeNode.CreateComponent<StaticModel>();
// Create a Zone component for ambient lighting & fog control
var zoneNode = scene.CreateChild("Zone");
var zone = zoneNode.CreateComponent<Zone>();
// Set same volume as the Octree, set a close bluish fog and some ambient light
zone.SetBoundingBox(new BoundingBox(-1000.0f, 1000.0f));
zone.AmbientColor = new Urho.Color(0.15f, 0.15f, 0.15f);
zone.FogColor = new Urho.Color(0.5f, 0.5f, 0.7f);
zone.FogStart = 100;
zone.FogEnd = 300;
// Create the camera. Limit far clip distance to match the fog
CameraNode = scene.CreateChild("Camera");
camera = CameraNode.CreateComponent<Camera>();
camera.FarClip = 300;
// Set an initial position for the camera scene node above the plane
CameraNode.Position = new Vector3(0.0f, 5.0f, 0.0f);
// var renderer = Renderer;
//renderer.SetViewport(0, new Viewport(Context, scene, camera, null));
}
}
}
私はエラーを取得したとして、これらの2行を削除する必要がありました。レンダラーとコンテキストが設定されていませんでした。私はページを使用していないフィーチャサンプルからそれを得た
// var renderer =レンダラー; //renderer.SetViewport(0、新しいビューポート(コンテキスト、シーン、カメラ、null));あなたの飛行機のノード規模のため