mirror display
From: kitano (anonymous_at_discussions.microsoft.com)
Date: 05/06/04
- Next message: Rich [Microsoft Direct3D MVP]: "Re: grey area behind menus and windows"
- Previous message: Eagle1: "Re: converting 3d in 2d"
- Next in thread: Chuck Gebben: "RE: mirror display"
- Reply: Chuck Gebben: "RE: mirror display"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 6 May 2004 05:51:02 -0700
Recently i made a point cloud viewer and some feature extraction routines that thought thet they worked pretty well. Back i found somewhere a similar project and tried it with some of my point clouds, and i've noticed the mine is displaying mirror images (i've noticed that because of a chair model that had the one leg missing...normally the left leg is missing but in my program you can see that the right left is missing)
i'don't know what might have done wrong or if it is something that i ignore concerning direct x
point clouds are just files with x y z coordinater
here is not the full code, just everything that has to do with the vertex buffer and displaying
.
.
.
CustomVertex::PositionNormalColored tcc1;
Type* tp = __box(tcc1)->GetType();
vbx = new VertexBuffer(tp,linesoffile, ds, Direct3D::Usage::Points, CustomVertex::PositionNormalColored::Format, Pool::Managed);
vbx->Created += (new EventHandler(this, &ImageForm::OnCreateVertexBuffer));
OnCreateVertexBuffer(vbx, NULL);
.
.
.
verts = new CustomVertex::PositionNormalColored[linesoffile];
GraphicsStream* stm = vbx->Lock(0,0,LockFlags());
.
.
.
for (int xcount = 0; xcount < linesoffile ; xcount=xcount+1){
verts[ya].X= x[xcount];
verts[ya].Y= y[xcount];
verts[ya].Z= z[xcount];
verts[ya].Color = System::Drawing::Color::WhiteSmoke.ToArgb();
}
.
.
.
ds->SetStreamSource( 0, vbx, 0);
ds->VertexFormat = CustomVertex::PositionNormalColored::Format;
ds->DrawPrimitives(PrimitiveType::PointList, 0, linesoffile);
.
.
.
and the matrices
.
.
.
Microsoft::DirectX::Vector3 vs1 = Microsoft::DirectX::Vector3( xm1, ym1, zm1 );
Microsoft::DirectX::Vector3 vs2 = Microsoft::DirectX::Vector3( cmtgX, cmtgY, cmtgZ);
Microsoft::DirectX::Vector3 vs3 = Microsoft::DirectX::Vector3( 0, 0, 1);
ds->Transform->View = Microsoft::DirectX::Matrix::LookAtLH(vs1,vs2,vs3);
ds->Transform->Projection = Microsoft::DirectX::Matrix::PerspectiveFovLH((float)Math::PI / 4, 1.0f, 0.001f, 1000 );
.
.
.
cmtgX, cmtgY and cmtgZ are the camera target
xm1,ym1,zm1 are the camera position
if anyone has any idea of what maybe is going wrong, i'll be glad to hear it
Using Managed DirectX in C++.NET
- Next message: Rich [Microsoft Direct3D MVP]: "Re: grey area behind menus and windows"
- Previous message: Eagle1: "Re: converting 3d in 2d"
- Next in thread: Chuck Gebben: "RE: mirror display"
- Reply: Chuck Gebben: "RE: mirror display"
- Messages sorted by: [ date ] [ thread ]