Jcoose

Member
  • Content count

    11
  • Joined

  • Last visited

Community Reputation

127 Neutral

About Jcoose

  • Rank
    Member
  1. Dot Product Confusion

    It's my understand that given two vectors (A & B ) the dot product should be equal to the magnitude of the project of A onto B... However in this example (and any other I can find): [url="http://www.falstad.com/dotproduct/"]http://www.falstad.com/dotproduct/[/url] The dot product is double what I would expect it to be. The magnitude of the projection of A onto B (yellow line) in this example is 0.5, but its reported as 1 What am I missing?
  2. I figured it out. My normal's weren't normalized. I did some math to check when I import them and it works now.
  3. [img]http://oi46.tinypic.com/t8m2rc.jpg[/img] I can't figure out why my specular is so blown out. I can't seam to adjust the color or the power in the material either. When I change the value they do nothing. I'm using a directional light with the Specular color turned to white. [source lang="cpp"] gDxDevice->SetFVF(D3DFVF_XYZ|D3DFVF_NORMAL); ZeroMemory(&material, sizeof(D3DMATERIAL9)); material.Diffuse = D3DXCOLOR(0.2f, 0.5f, 0.7f, 0.5f); // set diffuse color to white material.Ambient = D3DXCOLOR(0.5f, 0.5f, 0.5, 0.5); // set ambient color to white material.Specular.r = 0.5f; material.Specular.g = 0.5f; material.Specular.b = 0.5f; material.Specular.a = 0.5f; material.Power = 100; gDxDevice->SetRenderState( D3DRS_SPECULARENABLE, FALSE ); gDxDevice->SetMaterial(&material); //gDxDevice->SetRenderState(D3DRS_AMBIENT, D3DXCOLOR(0.1f, 0.1f, 0.1f, 0.1f)); gDxDevice->SetRenderState( D3DRS_LIGHTING, TRUE ); gDxDevice->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL); gDxDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); //gDxDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME); gDxDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 25996); [/source]
  4. I was finally able to find an answer. I didn't realize that texture coordinates could also have indices. That doesn't make a lot of sense to me, but anways there is an offset specified. So every 4th number is vertics indicie in this case.
  5. [img]http://oi45.tinypic.com/35iagqd.jpg[/img] <float_array id="Geometry-mesh016-normals-array" count="9"> -0.947236 0.315745 -0.0552245 -0.867472 0.289157 -0.404821 -0.904534 0.301511 0.301511 </float_array> <vcount>3 3</vcount> <p>2 0 0 0 0 0 1 1 0 0 3 0 2 0 0 3 0 2 0 0 1 2 3 1 0 2 0 0 0 0</p> I have a really simple mesh that looks something like what you see above. I exported it as a colloda file and started looking with the format (my aim is to write an importer for my model viewer). Everything makes sense, but I can not for the life of me figure out what is going on with the indices (<vcount>). First of there are a lot more than there should be for just two triangles, and none of them really make any sense to me. The "3 3" makes sense as its saying there are two 3 sided polygons but the rest baffles me. Does anyone know whats going on?
  6. Dynamic Vertex Declartion

    Ahhh, that makes sense. I hate to keep asking for hand holding on this but what exactly is the best way to go about that. If I have a 3 floats (position, 1 DWORD (color), and a 3 floats (a normal). That would be 28 bytes. So how do I allocate and populate the raw memory?
  7. Dynamic Vertex Declartion

    The part I am confused about is how to store the vertex data. [source lang="cpp"] struct MYVERTS { float x,y,z,u,v; DWORD colr; float nx,ny,nz; };[/source] That's the struct I am using right now. I create an array of those, each holding a single vert. My problem is that the mesh I am loading may not have color, or it may have a weight. That would mean I would need a unique struct for every possible arrangement. How can I dynamically allocate the memory while the program is running? The user will input while the application is running so I will have no idea what format needs to be created until the file is parsed in.
  8. I'm writing a model viewer that needs to accept a wide vareity of potential vertex formats. Models may or may not have color, texturecoords, normals, weights, and so on. I'm trying to figure out how I can dynamically allocate memory and then create a [font=Consolas, Menlo, Monaco,][background=transparent]D3DVERTEXELEMENT9 that has the correct offsets and usage declarations.[/background][/font] [left][font="Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif"][color="#000000"]I'm sort of at a loss as to how I might go about doing this. Does anyone have any advice, or ideas to get me started?[/color][/font][/left]
  9. I have a simple orbit camera set up that that uses a D3DXMatrixLookAtLH matrix in DirectX. Right now it just orbits around the origin. I am building a screen space axis orientaton gizmo located in the corner of the screen. The problem is since all the rotation calculations are being done for me, I can't figure out how to get the rotation of the camera. I only pass it a position and a target. I need the rotation values so I can visualize them with my on screen gizmo. Does anyone know how I can get those?
  10. Thanks i'll post there.
  11. I installed the latest SDK (June 2010). When I got into the control panel and got to the Directx9 tab all the options are disabled. I'm running windows 8. Does anyone know why this might be? I'm trying to enable the Debug DLL.