mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-12-15 22:59:39 +00:00
Test
This commit is contained in:
parent
a8a2349f68
commit
6ae0b4bfe8
1 changed files with 16 additions and 15 deletions
|
|
@ -16,9 +16,9 @@ namespace AideDeJeu.Views
|
||||||
public class Charts : Application
|
public class Charts : Application
|
||||||
{
|
{
|
||||||
bool movementsEnabled;
|
bool movementsEnabled;
|
||||||
Scene scene;
|
//Scene scene;
|
||||||
Node plotNode;
|
Node plotNode;
|
||||||
Camera camera;
|
//Camera camera;
|
||||||
Octree octree;
|
Octree octree;
|
||||||
List<Bar> bars;
|
List<Bar> bars;
|
||||||
Viewport vp;
|
Viewport vp;
|
||||||
|
|
@ -44,10 +44,11 @@ namespace AideDeJeu.Views
|
||||||
protected override void Start()
|
protected override void Start()
|
||||||
{
|
{
|
||||||
base.Start();
|
base.Start();
|
||||||
|
vp = new Viewport(Context, null, null, null);
|
||||||
|
vp.SetClearColor(new Color(1, 1, 1, 1));
|
||||||
|
Renderer.SetViewport(0, vp);
|
||||||
|
//SetupViewport();
|
||||||
CreateScene();
|
CreateScene();
|
||||||
SetupViewport();
|
|
||||||
vp.Scene = scene;
|
|
||||||
vp.Camera = camera;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async void CreateScene()
|
async void CreateScene()
|
||||||
|
|
@ -55,17 +56,17 @@ namespace AideDeJeu.Views
|
||||||
Input.TouchEnd += OnTouched;
|
Input.TouchEnd += OnTouched;
|
||||||
//Input.SubscribeToTouchEnd(OnTouched);
|
//Input.SubscribeToTouchEnd(OnTouched);
|
||||||
|
|
||||||
scene = new Scene();
|
vp.Scene = new Scene();
|
||||||
octree = scene.CreateComponent<Octree>();
|
octree = vp.Scene.CreateComponent<Octree>();
|
||||||
|
|
||||||
plotNode = scene.CreateChild();
|
plotNode = vp.Scene.CreateChild();
|
||||||
var baseNode = plotNode.CreateChild().CreateChild();
|
var baseNode = plotNode.CreateChild().CreateChild();
|
||||||
//var plane = baseNode.CreateComponent<StaticModel>();
|
//var plane = baseNode.CreateComponent<StaticModel>();
|
||||||
//plane.Model = CoreAssets.Models.Plane;
|
//plane.Model = CoreAssets.Models.Plane;
|
||||||
//plane.Material = Material.FromColor(new Color(0, 0, 0, 1));
|
//plane.Material = Material.FromColor(new Color(0, 0, 0, 1));
|
||||||
|
|
||||||
var cameraNode = scene.CreateChild();
|
var cameraNode = vp.Scene.CreateChild();
|
||||||
camera = cameraNode.CreateComponent<Camera>();
|
vp.Camera = cameraNode.CreateComponent<Camera>();
|
||||||
cameraNode.Position = new Vector3(10, 15, 10) / (1f);
|
cameraNode.Position = new Vector3(10, 15, 10) / (1f);
|
||||||
cameraNode.Rotation = new Quaternion(-0.121f, 0.878f, -0.305f, -0.35f);
|
cameraNode.Rotation = new Quaternion(-0.121f, 0.878f, -0.305f, -0.35f);
|
||||||
|
|
||||||
|
|
@ -122,7 +123,7 @@ namespace AideDeJeu.Views
|
||||||
|
|
||||||
void OnTouched(TouchEndEventArgs e)
|
void OnTouched(TouchEndEventArgs e)
|
||||||
{
|
{
|
||||||
Ray cameraRay = camera.GetScreenRay((float)e.X / Graphics.Width, (float)e.Y / Graphics.Height);
|
Ray cameraRay = vp.Camera.GetScreenRay((float)e.X / Graphics.Width, (float)e.Y / Graphics.Height);
|
||||||
var results = octree.RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry);
|
var results = octree.RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry);
|
||||||
if (results != null)
|
if (results != null)
|
||||||
{
|
{
|
||||||
|
|
@ -153,10 +154,10 @@ namespace AideDeJeu.Views
|
||||||
|
|
||||||
void SetupViewport()
|
void SetupViewport()
|
||||||
{
|
{
|
||||||
renderer = Renderer;
|
//renderer = Renderer;
|
||||||
vp = new Viewport(Context, scene, camera, null);
|
//vp = new Viewport(Context, scene, camera, null);
|
||||||
vp.SetClearColor(new Color(1, 1, 1, 1));
|
//vp.SetClearColor(new Color(1, 1, 1, 1));
|
||||||
renderer.SetViewport(0, vp);
|
//renderer.SetViewport(0, vp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue