public Graphic(IDrawable drawable, Matrix2x3 matrix, Lifespan lifetime) : base(lifetime) { if (drawable == null) { throw new ArgumentNullException("drawable"); } this.drawProperties = new List <IDrawProperty>(); this.drawable = drawable; this.drawableState = drawable.CreateState(); this.isVisible = true; this.matrixArray = new Scalar[16]; Matrix2x3.Copy2DToOpenGlMatrix(ref matrix, this.matrixArray); this.syncRoot = new object(); this.preChildren = new List <Graphic>(); this.isLifetimeOwner = true; }
public OpenGlObject(Body entity) { this.points = new List <Vector2D>(); this.entity = entity; this.entity.PositionChanged += entity_NewState; this.entity.Removed += entity_Removed; Matrix2x3 mat = entity.Matrices.ToWorld; Matrix2x3.Copy2DToOpenGlMatrix(ref mat, matrix); if (entity.Shape is RaySegmentsShape) { /*RaySegmentsShape se = (RaySegmentsShape)entity.Shape; * entity.Collided += new EventHandler<CollisionEventArgs>(entity_Collided); * distances = new Scalar[se.Segments.Length]; * entity.Updated += new EventHandler<UpdatedEventArgs>(entity_Updated);*/ } else if (DrawCollisionPoints && !(entity.Shape is ParticleShape)) { entity.Collided += entity_Collided2; } entity.ApplyPosition(); }
void OnPositionChanged(object sender, EventArgs e) { Matrix2x3.Copy2DToOpenGlMatrix(ref body.Matrices.ToWorld, MatrixArray); }
void entity_NewState(object sender, EventArgs e) { Matrix2x3 mat = entity.Matrices.ToWorld; Matrix2x3.Copy2DToOpenGlMatrix(ref mat, matrix); }
public static void GlMultMatrix(Matrix2x3 matrix) { Scalar[] array = new Scalar[16]; Matrix2x3.Copy2DToOpenGlMatrix(ref matrix, array); GlMultMatrix(array); }