Jump to content
  • Advertisement

??????? ?????

  • Content Count

  • Joined

  • Last visited

Community Reputation

143 Neutral

About ??????? ?????

  • Rank
  1. Long post ahead(you should probably ignore the last 2 code snippets) I searched trough the forums and noticed some old threads about people having troubles with ditching the D3DXVECTOR# values and working with the XMFLOAT# ones and there I saw a bunch of links with explanations from MSDN and the likes,so I got the basics of how to work around with them(using XMVECTOR for the intristic XM functions and XMFLOAT# for storage/same w/ XMMATRIX and XMFLOAT4X4).The problem is whenever I do anything with it I get a break point at some place in the xnamath header that doesn't really tell me anything.For instance when I just use a test variable like this: XMFLOAT4X4 test = XMFLOAT4X4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f, 0.0f, 1.0f, 2.0f, 3.0f, 1.0f); XMMATRIX I = XMMatrixIdentity(); XMStoreFloat4x4(test, I); It triggers a break point and the top 3 lines of the call stack are the calling of XMStoreFloat4x4(test,I); ,the next one is some "XMASSERT(pDestination);"line in xnamathconvert.inl: XMFINLINE VOID XMStoreFloat4x4 ( XMFLOAT4X4* pDestination, CXMMATRIX M ) { #if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) XMStoreFloat4x4NC(pDestination, M); #elif defined(_XM_SSE_INTRINSICS_) XMASSERT(pDestination); // <<<<<<<THIS ONE _mm_storeu_ps( &pDestination->_11, M.r[0] ); _mm_storeu_ps( &pDestination->_21, M.r[1] ); _mm_storeu_ps( &pDestination->_31, M.r[2] ); _mm_storeu_ps( &pDestination->_41, M.r[3] ); #else // _XM_VMX128_INTRINSICS_ #endif // _XM_VMX128_INTRINSICS_ } The third and top call is at xnamathmisc.inl at ''__debugbreak();'' : XMINLINE VOID XMAssert ( CONST CHAR* pExpression, CONST CHAR* pFileName, UINT LineNumber ) { CHAR aLineString[XMASSERT_LINE_STRING_SIZE]; CHAR* pLineString; UINT Line; aLineString[XMASSERT_LINE_STRING_SIZE - 2] = '0'; aLineString[XMASSERT_LINE_STRING_SIZE - 1] = '\0'; for (Line = LineNumber, pLineString = aLineString + XMASSERT_LINE_STRING_SIZE - 2; Line != 0 && pLineString >= aLineString; Line /= 10, pLineString--) { *pLineString = (CHAR)('0' + (Line % 10)); } #ifndef NO_OUTPUT_DEBUG_STRING OutputDebugStringA("Assertion failed: "); OutputDebugStringA(pExpression); OutputDebugStringA(", file "); OutputDebugStringA(pFileName); OutputDebugStringA(", line "); OutputDebugStringA(pLineString + 1); OutputDebugStringA("\r\n"); #else DbgPrint("Assertion failed: %s, file %s, line %d\r\n", pExpression, pFileName, LineNumber); #endif __debugbreak(); // <<<<<<THIS ONE } (Same thing happens with vectors and xmfloats) So XMStoreFloat4x4 calls XMASSERT,which somehow fails to execute,so it calls __debugbreak(); to trigger a break point?(excuse my ignorance here).But that doesn't really tell me why xnamath isn't working in my code.My CPU has xna math support for sure,since I can compile and run Frank Luna's XMMATRIX code without a problem and yet the same things he does crash when I try them in my code.The d3dx10math and the rest of the framework worked perfectly before I tried using xnamath.Here is Frank Luna's tutorial code: XMMATRIX: #include <windows.h> // for FLOAT definition #include <xnamath.h> #include <iostream> using namespace std; // Overload the "<<" operators so that we can use cout to // output XMVECTOR and XMMATRIX objects. ostream& operator<<(ostream& os, FXMVECTOR v) { XMFLOAT4 dest; XMStoreFloat4(&dest, v); os << "(" << dest.x << ", " << dest.y << ", " << dest.z << ", " << dest.w << ")"; return os; } ostream& operator<<(ostream& os, CXMMATRIX m) { for(int i = 0; i < 4; ++i) { for(int j = 0; j < 4; ++j) os << m(i, j) << "\t"; os << endl; } return os; } int main() { // Check support for SSE2 (Pentium4, AMD K8, and above). if( !XMVerifyCPUSupport() ) { cout << "xna math not supported" << endl; return 0; } XMMATRIX A(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f, 0.0f, 1.0f, 2.0f, 3.0f, 1.0f); XMMATRIX B = XMMatrixIdentity(); XMMATRIX C = A * B; XMMATRIX D = XMMatrixTranspose(A); XMVECTOR det = XMMatrixDeterminant(A); XMMATRIX E = XMMatrixInverse(&det, A); XMMATRIX F = A * E; cout << "A = " << endl << A << endl; cout << "B = " << endl << B << endl; cout << "C = A*B = " << endl << C << endl; cout << "D = transpose(A) = " << endl << D << endl; cout << "det = determinant(A) = " << det << endl << endl; cout << "E = inverse(A) = " << endl << E << endl; cout << "F = A*E = " << endl << F << endl; system("pause"); return 0; } XMVECTOR: #include <windows.h> // for FLOAT definition #include <xnamath.h> #include <iostream> using namespace std; // Overload the "<<" operators so that we can use cout to // output XMVECTOR objects. ostream& operator<<(ostream& os, FXMVECTOR v) { XMFLOAT4 dest; XMStoreFloat4(&dest, v); os << "(" << dest.x << ", " << dest.y << ", " << dest.z << ", " << dest.w << ")"; return os; } int main() { cout.setf(ios_base::boolalpha); // Check support for SSE2 (Pentium4, AMD K8, and above). if( !XMVerifyCPUSupport() ) { cout << "xna math not supported" << endl; return 0; } XMVECTOR p = XMVectorSet(2.0f, 2.0f, 1.0f, 0.0f); XMVECTOR q = XMVectorSet(2.0f, -0.5f, 0.5f, 0.1f); XMVECTOR u = XMVectorSet(1.0f, 2.0f, 4.0f, 8.0f); XMVECTOR v = XMVectorSet(-2.0f, 1.0f, -3.0f, 2.5f); XMVECTOR w = XMVectorSet(0.0f, XM_PIDIV4, XM_PIDIV2, XM_PI); cout << "XMVectorAbs(v) = " << XMVectorAbs(v) << endl; cout << "XMVectorCos(w) = " << XMVectorCos(w) << endl; cout << "XMVectorLog(u) = " << XMVectorLog(u) << endl; cout << "XMVectorExp(p) = " << XMVectorExp(p) << endl; cout << "XMVectorPow(u, p) = " << XMVectorPow(u, p) << endl; cout << "XMVectorSqrt(u) = " << XMVectorSqrt(u) << endl; cout << "XMVectorSwizzle(u, 2, 2, 1, 3) = " << XMVectorSwizzle(u, 2, 2, 1, 3) << endl; cout << "XMVectorSwizzle(u, 2, 1, 0, 3) = " << XMVectorSwizzle(u, 2, 1, 0, 3) << endl; cout << "XMVectorMultiply(u, v) = " << XMVectorMultiply(u, v) << endl; cout << "XMVectorSaturate(q) = " << XMVectorSaturate(q) << endl; cout << "XMVectorMin(p, v = " << XMVectorMin(p, v) << endl; cout << "XMVectorMax(p, v) = " << XMVectorMax(p, v) << endl; system("pause"); return 0; } And one last thing just to make sure I got this straight - for shaders when you want to pass say..a constant buffer with a matrix in it,you use XMFLOAT4X4 and not XMMATRIX,right?
  2. I'll be working on a game this summer and I need to be able to fly a spaceship into a huge planet and land on the surface.Now I got the ''fly space ship'' part,but I have no idea how to generate a planet.As far as I know procedural planets are way too heavy to be used in a game.For instance I get stable frame rates on the new Alien vs Predator game on highest setting,but every ''Procedural Planet Engine'' I've tried has FPS drops and yet the terrain just doesn't look all that good.Are there any other good methods on simulating a planet?Like maybe having different zones/levels for each height level from the atmosphere to the surface and while in space the planet being a premade 3d model?Or maybe I haven't stumbled on a good procedural planet example.I'm not really sure how to write one tho,so I can't judge.
  3. I'm using Frank Luna's directx11 sample: http://www.d3dcoder.net/d3d11.html Pretty much all of them give me this error,I'm trying to compile the GeometryShader example right now in Part1.
  4. [color=#000000][font=arial, helvetica, sans-serif]When I played around with sample Directx9 projects from tutorial sites,they would run with no problem,but whenever I try to compile a Directx11 project,I get [/font] error MSB6006: "cmd.exe" exited with code 9009[/quote] Is there a way to fix this?Do I need some kind of patch for VS? (I'm using Visual Studio 2010 on Windows 7 64 bit.)
  5. ??????? ?????

    Creating Terrain

    Well how close or far the mountains are depends on how you've drawn your heightmap.You shouldn't use pure white as primary color at the Clouds filter(I assume you made the heightmap in photoshop),as white means maximum height,which will make them look pointy.Try applying some grey here and there with a soft brush.Also it's a good idea to split the terrain into chunks and render only the ones that are actually going to be close to the camera and for the farther ones use a low poly version and some fog/blur to make the transition smoothe[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]r,otherwise you're rendering millions of vertices just for the terrain.For the texture to look realistic in 3DSMAX click the model,open modifiers and select UVW Map,then make it Planar and give it a scale 5-6 times smaller than the actual size of the model,so it would tile 5-6 times along the surface.You would need a seamless texture for that,tho. Edit:I've attached a heightmap that you might want to try:[/font] [attachment=9201:heightmap.bmp]
  6. The thing is,the terrain must be persistent and stay on the server and during the game players can affect and change it from time to time,but it's not really a problem - each zone has a tileset and each tileset has 8 different terrain types,so that's 0-7(3 bits for the tile type) and same for the tileset - 8 tileset types. The point is I have to get the client to turn this received info into a blendmap pixel by pixel when receiving the terrain chunk data.
  7. Well,I have a server program that sends to the client a data struct with info for the current terrain piece.The info is generated randomly by the server and sent to the client,so I want the client to draw a terrain blendmap with the info from the received struct and then use the blendmap in the shader.This only happens when the client receives a new terrain piece(the player walks into a new zone)or when he burns the ground or something.Still it's not every frame,so I suppose it shouldn't cause a noticeable slowdown?
  8. wait will this work on directx 9? edit:IDirect3DTexture9 has LockRect() method,but I'm not sure exactly how to use it,could someone explain it's arguments: [in] UINT Level, [out] D3DLOCKED_RECT *pLockedRect, [in] const RECT *pRect, [in] DWORD Flags
  9. I know that in Allegro it's BITMAP* tex[10]; int& pixel(BITMAP* bmp, int x, int y) { return ((int**)(bmp->line))[y][x]; } but what's the syntax for this in DirectX?
  10. Ok I got it: The trigonometric functions I tile the squares with + Smear + Blur
  11. I am trying to create a blendmap on the CPU once at program start and then used it in the shader.So far I've done the first(left) picture,however I need to smear and blur it like the second(right) picture.The program basically makes a 2d array of random square types(red,green,blue) and paints the 1st picture.Now I have to make it smear and blur,so when used as a blendmap in the game,it would look more smooth and realistic,since squares look ugly. [attachment=9146:example.jpg]
  12. ??????? ?????

    Direct3D 9 First Person Camera help?

    I can give you a sample where the camera is pretty much FPS(controlled by mouse,locked to terrain height).If you are using Visual Studio 2010 when you convert it,find any reference of dxerr9 and change it to just dxerr and also in the Linker->Input change dxerr9.lib to just dxerr.lib The camera class in that sample is pretty clean and simple - http://www.2shared.com/file/lW3WhoUH/Walk_Terrain_Demo.html
  13. Exactly what I was looking for,thanks.I was planning to use a parallax normal mapping on every object in my game,so I was curious at how heavy the technique actually is.
  14. For instance,without any shaders passing,I can render models made of thousands of polys at 800 fps and maybe of millions at 200-300 FPS,but if I use a simple shader of any kind on a simple mesh,it causes a noticeable FPS drop(from 1000 to 700).Then if I use a more complex shader,like one that calculates multiple lights,the framerate drops to 500,so it's not a linear decrease,but is there a way to exactly compare shader performances without having to compile the whole solution?Like maybe an HSLS -> ASM converter that would allow me to see the instruction counts?
  15. Yeah,I figured it out - I'll generate 2 blendmaps(for 2xRGBA (8 terrain textures total)) on the CPU and each time a piece of the terrain is changed,I'll lock the blendmaps and change them in the cpu,then unlock again.It shoudln't cause a slowdown,since the terrain won't change more often than once every 5-10 seconds.
  • 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!