public MainForm() { InitializeComponent(); p = new Player(); Application.Idle += InvalidateRenderer; this.MouseWheel += HandleMouseWheel; }
void BtnCompileClick( object sender, EventArgs e ) { IPlayer p = ModelParser.MakeFrom( rtfCode.Text ); if( p != null ) { this.p = p; p.Initalise(); } }
protected override void DrawPlayerModel( IPlayer p ) { graphics.Texturing = true; graphics.BindTexture( texId ); ModelSet model = Set; DrawRotate( 0, 24/16f, 0, -p.PitchRadians, 0, 0, model.Head ); DrawPart( model.Torso ); DrawRotate( 0, 12/16f, 0, p.leftLegXRot, 0, 0, model.LeftLeg ); DrawRotate( 0, 12/16f, 0, p.rightLegXRot, 0, 0, model.RightLeg ); DrawRotate( -6/16f, 22/16f, 0, p.leftArmXRot, 0, p.leftArmZRot, model.LeftArm ); DrawRotate( 6/16f, 22/16f, 0, p.rightArmXRot, 0, p.rightArmZRot, model.RightArm ); graphics.AlphaTest = true; DrawRotate( 0, 24f/16f, 0, -p.PitchRadians, 0, 0, model.Hat ); }
protected abstract void DrawPlayerModel( IPlayer p );
/// <summary> Renders the model based on the given entity's position and orientation. </summary> public void RenderModel( IPlayer p ) { index = 0; pos = p.Position; cosA = (float)Math.Cos( p.YawRadians ); sinA = (float)Math.Sin( p.YawRadians ); DrawPlayerModel( p ); }