Jump to content
  • Advertisement

D3F84U

Member
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

121 Neutral

About D3F84U

  • Rank
    Member
  1. D3F84U

    Plane inside view frustum

      D3DXMatrixPerspectiveFovLH(&Proj, angle, aspect, 1.0f, 100.0f); or D3DXMatrixPerspectiveFovLH(&Proj, angle, aspect, 1.0f, 10000.0f); will draw same quad that might be an error, but as I see it it just sets clipping.   I changed WVP = View*Proj; to WVP = Proj; and only change is a bit larger quad but still not close to full screen.   Whole point is to have full screen quad at any distance withing clip planes.
  2. D3F84U

    Plane inside view frustum

    Your solution to my original question was on spot. It lead me to conclusion that my assumption that if it is on the edge of view frustum it will be on the edge of the screen was wrong.
  3. D3F84U

    Plane inside view frustum

    I ended up leaving everything as is and calculating fixed virtual pixel size factor by trial and error. It is calculated using x dimension if x >= y or using y dimension otherwise multiplied by virtual pixel size factor. viewport and other matrices do the scaling that is always as close to the edge as virtual pixel size is accurate.
  4. D3F84U

    Plane inside view frustum

    I'll try this as soon as I can. DX is still quite new to me...
  5. D3F84U

    Plane inside view frustum

    scaling would work if everything was fixed, but both 2D buffer and DX screen change their properties.
  6. D3F84U

    Plane inside view frustum

    This is an application that renders from 2D buffer on to DirectX. I want to be able to adjust size of the virtual 3D screen showing 2D content to fit DX viewport, maintaining aspect ratio and therefore not always fitting both dimensions. Virtual screen is at fixed xyz and so far I don't need any other transformations for world expect view and projection
  7. D3F84U

    Plane inside view frustum

    Hello, I am glad you took some time.   EDITED: Square increases as distance increases. I kind of don't expect it to work without at least one more transformation to transform it to world space. What I need is local space coordinates that will be transformed to world space. I need those local space coordinates to create object that will always fit in to users screen.   For now my model transformations are non existent, if nothing to make things easier. Here is more of my code: OnResize() WM_SIZE     D3D10_VIEWPORT vp;     vp.TopLeftX = 0;     vp.TopLeftY = 0;     vp.Width    = LOWORD(lParam);     vp.Height   = HIWORD(lParam);     vp.MinDepth = 0.0f;     vp.MaxDepth = 1.0f;     RSSetViewports(1, &vp); float aspect = (float)lparams from size w/h; float angle = 0.25*M_PI; D3DXMatrixPerspectiveFovLH(&Proj, angle, aspect, 1.0f, 100.0f); float w, h, zp; zp = 50.0; h = tan(angle/2.0) * zp; w = h * aspect; Box.MakeBox(w, h, zp); } MakeBox(width, height, z_position) Vertex Vertices[] = { { D3DXVECTOR3(-_width, -_height, _z_position), WHITE }, { D3DXVECTOR3(-_width, +_height, _z_position), WHITE }, { D3DXVECTOR3(+_width, +_height, _z_position), WHITE }, { D3DXVECTOR3(+_width, -_height, _z_position), WHITE }, }; D3D10_BIND_VERTEX_BUFFER DWORD Indices[] = { // front face 0, 1, 2, 0, 2, 3, }; D3D10_BIND_INDEX_BUFFER } // Build the view matrix.     float x = 0.0;      float z = -5.0;      float y = 0.0; D3DXVECTOR3 pos(x, y, z); D3DXVECTOR3 target(0.0f, 0.0f, 0.0f); D3DXVECTOR3 up(0.0f, 1.0f, 0.0f); D3DXMatrixLookAtLH(&View, &pos, &target, &up); WVP = View*Proj; fx->SetMatrix((float*)&WVP); D3D10_TECHNIQUE_DESC TechDesc; Tech->GetDesc(&TechDesc); for (UINT p = 0; p < TechDesc.Passes; ++p) { Tech->GetPassByIndex(p)->Apply(0); Box.Draw(); }
  8. D3F84U

    Plane inside view frustum

    @Burnt_Fyr   First of all tanks for the reply. I am little lost on transformations part. For rendering this quad, I calc. world by multiplying view and projection matrices in that order, no model transformations. After rendering I get a quad in the middle of the screen that will grow if z grows and is smaller than render window.   If I want to consider model, view and projection transform., how do I get quad dimensions that will after all three transformations are done "touch" view frustum edges?     This is how I calc. half width and height: float w, h, zpos; zpos = 100.0; h = tan(angle/2.0) * zpos; w = h * aspect; MakeQuad(w, h, zp);
  9. D3F84U

    Plane inside view frustum

    Thanks for the reply, yet my math is quite basic so I'm hoping for more detailed explanation.
  10. Hello,      I have a following problem: after defining view frustum with D3DXMatrixPerspectiveFovLH and D3DXMatrixLookAtLH I want to draw 2D rectangle on arbitrary z cooridante, parralel with view frustum. Dimesnions should be such that rectangle edges are on the edges of a 2D screen (or window) like a frame.   My app is DX10, using C++.
  11.   Yes! Thanks for quick reply!
  12. Hello, I am new to DX10 and I am porting an DX9 app to DX10. I am using VS2013 and native C++. Problem is: when pressing + WM_SIZE will return smaller resolution than LCD screen resolution, while it is suppose to go full resolution. I have written test DX10 app that works, so system is 0K., I also tested both on two systems. I am sure I am doing something wrong, but what? Hope someone could point me in right direction to solve this issue. D3F84U
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!