pour moi la caméra est positionnée selon le repère de la main gauche non?
this.device.Transform.View = Matrix.LookAtLH( new Vector3(0, pointA1.Y - 50f, -50f), new Vector3(0, pointA1.Y, 0), new Vector3(0f, 1f, 0f));
Quelques mots de remerciements seront grandement appréciés. Ajouter un commentaire
121 internautes nous ont dit merci ce mois-ci
public void Render(Vector2 robotPos,Vector2 trans, float angle, Vector2 posA1, Vector2 dPosA1, float angPhi1, Vector2 posA2, Vector2 dPosA2, float angPhi2, Vector2 posA3, Vector2 dPosA3, float angPhi3) { this.device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.White, 1.0f, 0); this.device.BeginScene(); //this.device.RenderState.Lighting = false; this.device.SetStreamSource(0, this.vBuffer, 0); // on prends les données du buffer this.device.VertexFormat = CustomVertex.PositionNormalTextured.Format; // on redonne le format du vertex //-------------------------- Passage aux textures ------------------- this.device.TextureState[0].ColorOperation = TextureOperation.Modulate; this.device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor; this.device.TextureState[0].ColorArgument2 = TextureArgument.Diffuse; this.device.TextureState[0].AlphaOperation = TextureOperation.Disable; //-------------------------------------------------------------------//*/ if (this.debutOperation == 0) // condition sur l'initialisation du début des opérationS this.debutOperation = Environment.TickCount; Vector2 scalCent = new Vector2(0,0); float scalRot = 0; Vector2 scaling = new Vector2(1,1); // dessin sur le label1 des deux premiers triangle float startTime = Environment.TickCount; this.device.SetTexture(0, texture0); this.device.Transform.World = Matrix.Translation(new Vector3(5,5,0)) ; // MessageBox.Show("gravity.X " + this.gravity.X + "garvity.Y " + this.gravity.Y); this.device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2);//*/ // transformation of the wheel one look the transformation of the point A2 this.device.SetTexture(0, texture1); this.device.Transform.World = Matrix.Transformation2D(scalCent, scalRot, scaling, this.pointA2, angPhi2, new Vector2(0f, 0f)); this.device.DrawPrimitives(PrimitiveType.TriangleList, 6, 2); // transformation of the wheel two look the transformation of the point A1 this.device.SetTexture(0, texture2); this.device.Transform.World = Matrix.Transformation2D(scalCent, scalRot, scaling, this.pointA1, angPhi1, new Vector2(0f, 0f)); this.device.DrawPrimitives(PrimitiveType.TriangleList, 12, 2); //transformation of the wheel three look the transformation of the point A3 this.device.SetTexture(0, texture3); this.device.Transform.World = Matrix.Transformation2D(scalCent, scalRot, scaling, this.pointA3, angPhi3, new Vector2(0f, 0f)); this.device.DrawPrimitives(PrimitiveType.TriangleList, 18, 2);//*/ // On précise comment est ce que la caméra (la matrice view) regarde la scène this.device.Transform.View = Matrix.LookAtLH( new Vector3(0, -pointA1.Y, -50f), // position de la caméra new Vector3(0, -pointA1.Y,0), // la direction du regard (l'origine où est centré le rectangle) new Vector3(0f, 1f, 0f)); // le vecteur directeur du regard (en face de soi) // application de la perspective pour avoir le rendu 2D this.device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4, 1.0f, 1.0f, 100.0f); this.device.EndScene(); // fin de la définition this.device.Present(); // lancer l'affichage } // Render (arguments)
this.device.Transform.View = Matrix.LookAtLH( new Vector3(0, pointA1.Y, -50f), new Vector3(0, pointA1.Y, 0), new Vector3(0f, 1f, 0f));
Quelques mots de remerciements seront grandement appréciés. Ajouter un commentaire
121 internautes nous ont dit merci ce mois-ci
this.device.Transform.View = Matrix.LookAtLH( new Vector3(0, -pointA1.Y/50, -50f), // position de la caméra new Vector3(0,0,0), // la direction du regard (l'origine où est centré le rectangle) new Vector3(0f, 1f, 0f)); // le vecteur directeur du regard (en face de soi)
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.