Jump to content
  • Advertisement

terryeverlast

Member
  • Content Count

    106
  • Joined

  • Last visited

Community Reputation

277 Neutral

About terryeverlast

  • Rank
    Member
  1. terryeverlast

    Loading Models With Assimp Directx 11

    But what are these then.("mTextureCoords") vec.x = mesh->mTextureCoords[0][i].x; vec.y = mesh->mTextureCoords[0][i].y; I'm loading a .OBJ. So are these "mTextureCoords" are "vt" values?   I tested the mTextureCoords values in my debugger and they were different so just wondering.
  2. terryeverlast

    Loading Models With Assimp Directx 11

    I can pretty much load any model. But cant find code to load textures.??
  3. terryeverlast

    Loading Models With Assimp Directx 11

         std::vector<Vertex::Basic32> vertices(8); Assimp::Importer importer; const aiScene * scene = importer.ReadFile("untitled.obj", aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType); aiMesh *mesh = scene->mMeshes[0]; for(int i = 0;i<8;i++) { { aiVector3D pos = mesh->mVertices[i]; vertices[i].Pos.x = pos.x; vertices[i].Pos.y = pos.y; vertices[i].Pos.z = pos.z; } } std::vector<UINT> indices; for (int i = 0; i < mesh->mNumFaces; i++) { const aiFace& Face = mesh->mFaces[i]; if(Face.mNumIndices == 3) { indices.push_back(Face.mIndices[0]); indices.push_back(Face.mIndices[1]); indices.push_back(Face.mIndices[2]); } } My code now loads the cube and now need to load normal and texture....  
  4. terryeverlast

    Loading Models With Assimp Directx 11

    So far, i have: Assimp::Importer importer; const aiScene * scene = importer.ReadFile("untitled.obj", aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType); Next steps?
  5. Are there any tutorials to load models with assimp in c++ directx 11? I searched, could not find anything. Mostly opengl stuff.   thx
  6. terryeverlast

    Quaternion Interpolation weighted values.

    i think that the c1 and c2 are just the quaternion vectors..am i right?
  7.   In the image above, this would be the first rotation which is cos(t*theta). What are the values of c1 and c2 which are *weighted values then what are the values of c1 c2 in the second rotation, cos(1-t)theta? conditions....(image not to scale)   a = 0 or [1,0,0] b = 90 or [0,1,0] p =  45         So final question is what are the values of c1 and c2 with the conditons above? thxn you
  8. terryeverlast

    .obj MESH loader

    Im back. Anyways I have a problem with the TEXTURE u,v loading right.   I drew a simple quad in blender and exported to .obj. I can see the quad but the texture is messed up. My obj is v -6.167033 0.000000 6.167033 v 6.167033 0.000000 6.167033 v -6.167033 0.000000 -6.167033 v 6.167033 0.000000 -6.167033 vt 1.0 0.0 vt 0.0 1.0 vt 0.0 0.0 vt 1.0 1.0 vn 0.0000 1.0000 0.0000 f 2/1/1 3/2/1 1/3/1 f 2/1/1 4/4/1 3/2/1 Im suppose to get a image that looks similar to   My image is looking like       Im loading the U,Vs of the texture in the right way by subtracting one from it. Ive tried all kinds of different settings in blender, like vertex order and stuff with no luck   Is there a way to get the right order of uvs ?   my c++ code is for(int i = 0;i<6;i++) { int rx = textureV[i]; //this is the texture value in the face part ie..f 2/1/1 4/4/1 3/2/1 float t = uu[rx-1]; //subtracting one because of obj format float t2 = vv[rx-1]; vertices[i].Tex.x = t; vertices[i].Tex.y = t2; } i need to get it right because when loading bigger objects like spheres. i cant manually fix the texture part.
  9. terryeverlast

    .obj MESH loader

    Alright thx. Got it working. Instead of doing below, I just loaded the Positions normally... vertices[i].Pos.x = vertices[indices[i]].sPos.x vertices[i].Pos.y = vertices[indices[i]].sPos.y; vertices[i].Pos.z = vertices[indices[i]].sPos.z;
  10. terryeverlast

    .obj MESH loader

    bad mistake when cleaning up code to readable. but still not working
  11. terryeverlast

    .obj MESH loader

    for(;;) { fin >> strCommand; if(!fin) break; strcpy(str1v1, "v"); strcpy(str2v1, strCommand); ret = strcmp(str1v1, str2v1); if(ret == 0) { fin >> vertices[test].sPos.x >> vertices[test].sPos.y >> vertices[test].sPos.z; test++; } strcpy(str1v2, "vn"); strcpy(str2v2, strCommand); ret4 = strcmp(str2v2, str2v2); if(ret4 == 0) { fin >> vertices[test2].sNor.x >> vertices[test2].sNor.y >> vertices[test2].sNor.z; test2++; } strcpy(str1v3, "f"); strcpy(str2v3, strCommand); ret5 = strcmp(str1v3, str2v3); if(ret5 == 0) { for(int i = 0;i<3;i++) { fin >> ind[in]; if( '/' == fin.peek() ) { fin.ignore(); if( '/' != fin.peek() ) { fin.ignore(); } if( '/' == fin.peek() ) { fin.ignore(); } if( '/' != fin.peek() ) { fin >> nor2[in]; } } in++; } } } for(int i = 0;i<36;i++) { indices[i] = (ind[i] - 1); } for(int i = 0;i<36;i++) { vertices[i].Pos.x = vertices[indices[i]].sPos.x; vertices[i].Pos.y = vertices[indices[i]].sPos.y; vertices[i].Pos.z = vertices[indices[i]].sPos.z; }
  12. terryeverlast

    .obj MESH loader

    Yeah i know that .obj start at 1 for their indices/texture/normal in the face area I subtracted 1 from every value and loaded those into the Position and normals
  13. terryeverlast

    .obj MESH loader

    Im programming in C++ Directx 11 win32 and was trying to make a mesh loader from a .OBJ file. My .obj looks like v 1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000 v -1.000000 -1.000000 -1.000000 v 1.000000 1.000000 -0.999999 v 0.999999 1.000000 1.000001 v -1.000000 1.000000 1.000000 v -1.000000 1.000000 -1.000000 vn 0.0000 -1.0000 0.0000 vn 0.0000 1.0000 0.0000 vn 1.0000 -0.0000 0.0000 vn 0.0000 -0.0000 1.0000 vn -1.0000 -0.0000 -0.0000 vn 0.0000 0.0000 -1.0000 f 2//1 4//1 1//1 f 8//2 6//2 5//2 f 5//3 2//3 1//3 f 6//4 3//4 2//4 f 3//5 8//5 4//5 f 1//6 8//6 5//6 f 2//1 3//1 4//1 f 8//2 7//2 6//2 f 5//3 6//3 2//3 f 6//4 7//4 3//4 f 3//5 7//5 8//5 f 1//6 4//6 8//6 *was done in blender.   For each indices, I'm making a Vertice. So I have 36 total vertices with 36 normal that I'm generating from the faces part "f". My mesh is not coming out right and I wanted to know is this the proper way? creating 36 verticies? need some advice..    
  14. terryeverlast

    Projective Texturing?

    Theres a box, theres a flat grid. The texture getting projected is doubling. My Settings are   SamplerState SampleTypeWrap {     Filter   = COMPARISON_MIN_MAG_LINEAR_MIP_POINT;  AddressU = BORDER;  AddressV = BORDER;  AddressW = BORDER;  BorderColor = float4(0.0f, 0.0f, 0.0f, 0.0f);     ComparisonFunc = LESS; }; I don't know if the code above is wrong.?
  15. terryeverlast

    Moving camera along tangent

    I found this code right here that ill dissect and implement in my code.   void Camera::update(float dt, Terrain* terrain, float offsetHeight) { // Find the net direction the camera is traveling in (since the // camera could be running and strafing). D3DXVECTOR3 dir(0.0f, 0.0f, 0.0f); if( gDInput->keyDown(DIK_W) )   dir += mLookW; if( gDInput->keyDown(DIK_S) )   dir -= mLookW; if( gDInput->keyDown(DIK_D) )   dir += mRightW; if( gDInput->keyDown(DIK_A) )   dir -= mRightW;   // Move at mSpeed along net direction. D3DXVec3Normalize(&dir, &dir); D3DXVECTOR3 newPos = mPosW + dir*mSpeed*dt;   if( terrain != 0) {   // New position might not be on terrain, so project the   // point onto the terrain.   newPos.y = terrain->getHeight(newPos.x, newPos.z) + offsetHeight;     // Now the difference of the new position and old (current)   // position approximates a tangent vector on the terrain.   D3DXVECTOR3 tangent = newPos - mPosW;   D3DXVec3Normalize(&tangent, &tangent);   // Now move camera along tangent vector.   mPosW += tangent*mSpeed*dt;     // After update, there may be errors in the camera height since our   // tangent is only an approximation.  So force camera to correct height,   // and offset by the specified amount so that camera does not sit   // exactly on terrain, but instead, slightly above it.   mPosW.y = terrain->getHeight(mPosW.x, mPosW.z) + offsetHeight; } else {   mPosW = newPos; }   // We rotate at a fixed speed. float pitch  = gDInput->mouseDY() / 150.0f; float yAngle = gDInput->mouseDX() / 150.0f;   // Rotate camera's look and up vectors around the camera's right vector. D3DXMATRIX R; D3DXMatrixRotationAxis(&R, &mRightW, pitch); D3DXVec3TransformCoord(&mLookW, &mLookW, &R); D3DXVec3TransformCoord(&mUpW, &mUpW, &R);   // Rotate camera axes about the world's y-axis. D3DXMatrixRotationY(&R, yAngle); D3DXVec3TransformCoord(&mRightW, &mRightW, &R); D3DXVec3TransformCoord(&mUpW, &mUpW, &R); D3DXVec3TransformCoord(&mLookW, &mLookW, &R);   // Rebuild the view matrix to reflect changes. buildView();   mViewProj = mView * mProj; }
  • 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!