2017-05-01 01:33:33 +02:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using OpenTK;
|
|
|
|
|
|
|
|
using org.niclasundharald.engine.graphics;
|
|
|
|
|
|
|
|
namespace org.niclasundharald.engine
|
|
|
|
{
|
|
|
|
public abstract class WorldObject
|
|
|
|
{
|
|
|
|
private List<WorldObject> children;
|
|
|
|
|
|
|
|
public WorldObject()
|
|
|
|
{
|
|
|
|
children = new List<WorldObject>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual Model3D getModel3D(){
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2017-05-04 23:57:00 +02:00
|
|
|
public Vector3 Position{ get; set; } = new Vector3();
|
|
|
|
public Matrix4 Rotation { get; set; } = Matrix4.Identity;
|
|
|
|
public Matrix4 Scale { get; set; } = Matrix4.Identity;
|
2017-05-01 01:33:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
public Matrix4 Transformation {
|
2017-05-04 23:57:00 +02:00
|
|
|
get { return (Scale * Rotation) * Matrix4.CreateTranslation( Position ) ; }
|
2017-05-01 01:33:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void addChild(WorldObject wo){
|
|
|
|
if (!children.Contains(wo)){
|
|
|
|
children.Add(wo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void removeChild(WorldObject wo){
|
|
|
|
if (children.Contains(wo)){
|
|
|
|
children.Remove(wo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public WorldObject[] Children{
|
|
|
|
get { return this.children.ToArray(); }
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public class ObjectGroup : WorldObject {
|
|
|
|
|
|
|
|
}
|
2017-05-04 23:57:00 +02:00
|
|
|
|
|
|
|
public class DumpObject : WorldObject {
|
|
|
|
|
|
|
|
Model3D model3d;
|
|
|
|
|
|
|
|
public Model3D Model3D {
|
|
|
|
get { return this.model3d; }
|
|
|
|
set { this.model3d = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public override Model3D getModel3D()
|
|
|
|
{
|
|
|
|
return model3d;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-05-01 01:33:33 +02:00
|
|
|
}
|