• Content count

  • Joined

  • Last visited

Community Reputation

588 Good

About Anddos

  • Rank
  1. open source x file format library

    i remember reading about this
  2. how do i make a save file system for a first person type game?
  3. Problems displaying a mesh

    you will still need lighting regardless if the mesh has no materials or textures
  4. Problems displaying a mesh

    have you added a light source ? // this is the function that sets up the lights and materials void init_light(void) {     D3DLIGHT9 light;    // create the light struct     D3DMATERIAL9 material;    // create the material struct     ZeroMemory(&light, sizeof(light));    // clear out the light struct for use     light.Type = D3DLIGHT_DIRECTIONAL;    // make the light type 'directional light'     light.Diffuse = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f);    // set the light's color     light.Direction = D3DXVECTOR3(-1.0f, -0.3f, -1.0f);     d3ddev->SetLight(0, &light);    // send the light struct properties to light #0     d3ddev->LightEnable(0, TRUE);    // turn on light #0     ZeroMemory(&material, sizeof(D3DMATERIAL9));    // clear out the struct for use     material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);    // set diffuse color to white     material.Ambient = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);    // set ambient color to white     d3ddev->SetMaterial(&material);    // set the globably-used material to &material }   //set these after you make the device   d3ddev->SetRenderState(D3DRS_LIGHTING, TRUE);    // turn on the 3D lighting d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE);    // turn on the z-buffer d3ddev->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(50, 50, 50));    // ambient light  
  5. Basic Terrain editor help

    when i do this   UINT vidx[3]; vidx[0] = ib[ faceIndex*3 + 0 ]; vidx[1] = ib[ faceIndex*3  + 1 ]; vidx[2] = ib[ faceIndex*3 + 2 ];   also where does .position come from?
  6. This is the rendering code to render and do a pick test on the terrain What i want todo next is increase the picked triangles vertices for mouse 1 and decrease for mouse 2 , so that i can sculpt it to how i like I know i have to lock the vertex buffer but i am unsure how to get the positions and adjust them and when todo it // Clear the backbuffer and depth buffer.     HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0));     HR(gd3dDevice->BeginScene());     // Setup the rendering FX     HR(mFX->SetMatrix(mhViewProj, &(mView*mProj)));     HR(mFX->SetTechnique(mhTech));     UINT numPasses = 0;     HR(mFX->Begin(&numPasses, 0));     HR(mFX->BeginPass(0));     HR(gd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME));     HR(mTerrainMesh->DrawSubset(0));     // Switch back to solid mode.     HR(gd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID));     // Did we pick anything?     D3DXVECTOR3 originW(0.0f, 0.0f, 0.0f);     D3DXVECTOR3 dirW(0.0f, 0.0f, 0.0f);     if( gDInput->mouseButtonDown(0) )     {         getWorldPickingRay(originW, dirW);         BOOL hit = 0;         DWORD faceIndex = -1;         float u = 0.0f;         float v = 0.0f;         float dist = 0.0f;         ID3DXBuffer* allhits = 0;         DWORD numHits = 0;         HR(D3DXIntersect(mTerrainMesh, &originW, &dirW, &hit,             &faceIndex, &u, &v, &dist, &allhits, &numHits));         ReleaseCOM(allhits);         // We hit anything?         if( hit )         {             // Yes, draw the picked triangle in solid mode.             IDirect3DVertexBuffer9* vb = 0;             IDirect3DIndexBuffer9* ib = 0;             HR(mTerrainMesh->GetVertexBuffer(&vb));             HR(mTerrainMesh->GetIndexBuffer(&ib));             HR(gd3dDevice->SetIndices(ib));             HR(gd3dDevice->SetVertexDeclaration(VertexPNT::Decl));             HR(gd3dDevice->SetStreamSource(0, vb, 0, sizeof(VertexPNT)));             // faceIndex identifies the picked triangle to draw.             HR(gd3dDevice->DrawIndexedPrimitive(                 D3DPT_TRIANGLELIST, 0, 0, mTerrainMesh->GetNumVertices(), faceIndex*3, 1))                          ReleaseCOM(vb);             ReleaseCOM(ib);         }     }     HR(mFX->EndPass());     HR(mFX->End());          mGfxStats->display();     HR(gd3dDevice->EndScene());     // Present the backbuffer.     HR(gd3dDevice->Present(0, 0, 0, 0));
  7. DX11 should i release my code?

    yes , release it to gitub, ive always had problems with skinned meshs when not using the dx .x helper functions, does it use shaders as well?

    Just letting fellow programmers know about a site to for just coding
  9. Creating Traffic lights (.x)

    sorry Buckeye can you elaborate on that idea
  10. Creating Traffic lights (.x)

    would that work with as an animated x tho?, how would you animate the lights exactly?
  11. I am loading a traffic lights model with the.x functions the problem is i want 3 texture states for the lights etc, red, amba , green , how would i load 3 different textures if the model loading function loads 1 texture?   for(DWORD i = 0; i < numMaterials; i++)    // for each material...     {         material[i] = tempMaterials[i].MatD3D;    // get the material info         material[i].Ambient = material[i].Diffuse;    // make ambient the same as diffuse         // if there is a texture to load, load it         if(FAILED(D3DXCreateTextureFromFileA(d3ddev,                                              tempMaterials[i].pTextureFilename,                                              &texture[i])))         texture[i] = NULL;    // if there is no texture, set the texture to NULL       }   could i not use D3DXCreateTextureFromFileA 3 times on the different texture states and apply the texture this way? because in code i need to set device->SetTexture(&red); , device->SetTexture(&amba); device->SetTexture(&green); thanks if you can help
  12. well the sample works if i use the loaded vectors from the .md5 hence the left screenshot, i dont know what can cause this just having loaded the data from a file i made and reading it in rather than directly parsing the .md5 etc..
  13. yes there the same after writing the read in data to .txt files, ive tried with an obj model and that worked fine