• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About G-Man9566

  • Rank
  1. UV Mapping Algorithms

    [quote name='Ashaman73' timestamp='1328271938' post='4909128'] Max, better most modeling tools, allow to assign more than one uv-coord to a single vertex. In this case, you need to split your vertex and assign the different uv to unique vertices. That is the reason, you see no artifacts beside the expected seams when using max (the border vertices got more then one uv-coord), but got warping artifacts when using shared vertices in your mapping code. [/quote] No but when I use the UV's that were exported WITH Max, I get the same result as in Max (the desired result) on excactly the same mesh. So it is litteraly JUST the UV coordinates ons those edges that differ.
  2. Hi, Is there anyone who can guide me in the right direction (or article [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] ). I want to generate UV mapping coordinates for my objects in code. So I would like to generate Plane, Box, Sphere, Cylinder etc. mapping for my objects in code. I am pretty sure there would be standartd algorithms out there to do this. I implemented my own algorithm for box mapping, but I am getting bad results on "edges" (where one vertex is projecting to one face of the box and the other vertex to the other face). I included two images, one with the my generated mapping ("Incorrect Mapping.PNG") and one which it should look like and was generated by 3dsMax ("Correct Mapping.PNG"). Thanx in advance.
  3. Backbuffer resolution

    [quote name='Hodgman' timestamp='1309760461' post='4830807'] Yes, usually. [/quote] Thx
  4. Backbuffer resolution

    Thanks, but I actually want to know if the game's screen resolution is directly correlated to the backbuffer width and height of the present params?
  5. Backbuffer resolution

    Hi, When one adjusts a game's screen resolution (you know typically in the game's "Options->Graphics"), is it actually the BackBufferWidth and BackBufferHeight of the D3DPRESENT_PARAMETERS (D3D) for a device, that is being set?
  6. Hi, I read up on MSDN how to implement Raw Input handling. I only want to handle the mouse buttons for now, just to get it working. Now, I've done the following... [code] /*********** * Register Mouse as a raw input device **/ RAWINPUTDEVICE l_aRawInputDevices[1]; //only one RID will be registered l_aRawInputDevices[0].usUsagePage = HID_USAGE_PAGE_GENERIC; //0x01 l_aRawInputDevices[0].usUsage = HID_USAGE_GENERIC_MOUSE; //0x02 l_aRawInputDevices[0].dwFlags = RIDEV_NOLEGACY; // i've also tried just specifying RIDEV_INPUTSINK l_aRawInputDevices[0].hwndTarget = 0/*l_hWindow*/; // I've tried with and without specifying the window which is applicable if( RegisterRawInputDevices( l_aRawInputDevices, 1, sizeof(l_aRawInputDevices[0]) ) == false ) { System::Windows::Forms::MessageBox::Show( "Could not Register HID" ); } [/code] Now, for our application, we've registered to the Application::Idle event in which we "Run" and handle our Windows Messaging. Something like this.... [code] void Class::AppIdle( Object^ sender, EventArgs^ e ) { MSG l_Msg; MSG l_MouseMsg; while ( !PeekMessage(&l_Msg, 0, 0, 0, 0) ) // No message is recieved { .... ENGINE->Run(); //updates, culls, draws etc. } if ( ::PeekMessage( &l_MouseMsg, 0/*this->m_hRenderWindowHandle*/, 0, 0, 0/*PM_REMOVE*/ ) ) // here I've also specified with { //and without the window handle switch( l_MouseMsg.message ) { case WM_INPUT: { // it does not go in here System::Diagnostics::Trace::WriteLine( "WM_INPUT" ); break; } } } } [/code] It does not switch into the WM_INPUT case when I to anything with the mouse (clicking away and moving it around the window). This is how I've been handling mouse inputs thus far (within the same AppIdle funtion) which works well enough (although it does not always catch the button up case - which is the reason I'm trying WM_INPUT) [code] if ( ::PeekMessage( &l_MouseMsg, this->m_hRenderWindowHandle, 513, 517, 0/*PM_REMOVE*/ ) ) { switch( l_MouseMsg.message ) { case WM_LBUTTONDOWN : { ENGINEMANAGER->GetInputDevice()->SetMouseButtonDown( 0, true ); break; } case WM_LBUTTONUP : { ENGINEMANAGER->GetInputDevice()->SetMouseButtonDown( 0, false ); ENGINEMANAGER->GetInputDevice()->SetMouseButtonClicked( 0, true ); break; } case WM_RBUTTONUP : { ENGINEMANAGER->GetInputDevice()->SetMouseButtonDown( 1, false ); ENGINEMANAGER->GetInputDevice()->SetMouseButtonClicked( 1, true ); break; } default : { break; } } } [/code] Any advise what I'm doing wrong that the switch does not catch the WM_INPUT case?
  7. Hi, Im drawing everything in my scene using effects (ID3DXEffect) and ID3DXMesh::DrawSubset. There are only one type of object (MeasurementLines) that Im rendering using IDirect3DDevice9::DrawPrimitiveUP. Im drawing these MeasurementLine objects after Im rendering all the others, but I cant seem to set the IDirect3DDevice9::SetTransform and the device does not draw these lines the color that I set them when I create their FVF. Im probably missing something fundamental, but dont know what it is. [code] D3DVertexColor l_aVertexPositionData[2]; l_aVertexPositionData[0].position.x = this->m_pStartPoint->GetWorldTransform()->GetPosition().x; l_aVertexPositionData[0].position.y = this->m_pStartPoint->GetWorldTransform()->GetPosition().y; l_aVertexPositionData[0].position.z = this->m_pStartPoint->GetWorldTransform()->GetPosition().z; l_aVertexPositionData[1].position.x = this->m_pEndPoint->GetWorldTransform()->GetPosition().x; l_aVertexPositionData[1].position.y = this->m_pEndPoint->GetWorldTransform()->GetPosition().y; l_aVertexPositionData[1].position.z = this->m_pEndPoint->GetWorldTransform()->GetPosition().z; l_aVertexPositionData[0].color = 0xff000000; l_aVertexPositionData[1].color = 0xff000000; D3DXMATRIX l_d3dmIdentity; D3DXMatrixIdentity( &l_d3dmIdentity ); HRESULT hr; ENGINEMANAGER->GetGraphicsDevice()->SetFVF( D3DFVF_XYZ | D3DFVF_DIFFUSE ); hr = ENGINEMANAGER->GetGraphicsDevice()->SetTransform( D3DTS_WORLD, &l_d3dmIdentity ); hr = ENGINEMANAGER->GetGraphicsDevice()->SetTransform( D3DTS_VIEW, &D3DCAMERAMANAGER->GetActiveCamera()->GetProjectionMatrix() ); hr = ENGINEMANAGER->GetGraphicsDevice()->SetTransform( D3DTS_PROJECTION, &D3DCAMERAMANAGER->GetActiveCamera()->GetViewMatrix() ); ENGINEMANAGER->GetGraphicsDevice()->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE ); hr = ENGINEMANAGER->GetGraphicsDevice()->DrawPrimitiveUP( D3DPT_LINESTRIP, 1, (void *)l_aVertexPositionData, sizeof( D3DVertexColor ) ); [/code] So in summary, it draws the line primitive, but does not take the color I specify or the Word transform into account. How do I fix this?
  8. I have a problem where, after I rendered the whole scene using shaders a draw lines which I just use DrawPrimitiveUP, but I can for the life of me not set the Device's matrices and the color that I assign to the line. Its as if the Device uses the last shader state that it rendered with. Any pointers?
  9. Thanks for the response! I've gone with the DrawPrimitve approach for now. The draw back to this approach is that one can not set a line width. If I want thicker line later on, I'll then maybe try drawing quads, or trying to solve my original problem I had (at the beginning of this post) using the feedback I got from you guys. Thanks.
  10. DrawPrimitiveUP line width

    [quote name='Tom KQT' timestamp='1299744384' post='4783891'] Sorry, you cannot. It's always "1 pixel". (If you're talking about DX9 because I don't know how is it in DX10/11). [/quote] That's a pity! and yes, im using DX9 [quote name='Tom KQT' timestamp='1299744384' post='4783891'] You can render quads instead of lines, that will give you much better control over the result. [/quote] I'll give that a go! G
  11. Hi, I want to set the line width when drawing with DrawPrimitiveUP. Is this possible? NOTE: im just drawing line primitives, but I want them "thicker" G
  12. Cool it worked (after setting the primitive count to 1). Thanks for the help. Can you tell me if I can set the width of the line being drawn?
  13. [code] struct MyVertex { float x,y,z; } MyVertex Line[2]; Line[0].x = ... Line[1].x = ... DrawPrimitiveUP(D3DPT_LINE_STRIP,2,(void *)Line,sizeof(MyVertex)); [/code] pVertexStreamZeroData is the pointer to the vertex data. So the code goes something like as above. Please check for the primitive type since I wrote that from my memory. Also you'll need to set SetFVF or SetVertexDeclaration (or so) and the correct SetTransforms etc etc. Cheers! [/quote] Shouldn't PrimitiveCount be 1 since I want only 1 line betweet 2 points?
  14. What is the difference between the LineList and LineStrip, since I'm getting different results but not sure why.
  15. Great stuff! thanks alot. I'll have a go with it.
  • Advertisement