Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About Kiryn

  • Rank
  1. Kiryn

    Barcelona Released?

    Check here Barcelona Benchmarks
  2. Does anyone have an example or know a site that shows how to use DirectX with wxWidgets?
  3. Kiryn

    PhysX Issues

    I freaking swear PhysX API hates me. I can only get it working right if I don't use it in a class. But if I try to wrap it in its own class. It doesn't show me no love. The ball drops then the Box drops and doesn't move or bounce. And I have the default material all set to 0.5f. Doesn't help. PhysX wrapper #include "CPhysX.h" CPhysX::CPhysX() { m_nxPhysXSDK = NULL; m_nxScene = NULL; } CPhysX::~CPhysX() { if(!m_nxPhysXSDK) { if(!m_nxScene) { m_nxPhysXSDK->releaseScene(*m_nxScene); } m_nxPhysXSDK->release(); } } bool CPhysX::Initialize(NxVec3 gravity, NxReal dynamicFriction, NxReal restitution, NxReal staticFriction ) { m_nxPhysXSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION); if(!m_nxPhysXSDK) return false; m_nxPhysXSDK->setParameter(NX_SKIN_WIDTH, 0.05f); NxSceneDesc nxSceneDesc; nxSceneDesc.gravity = gravity; nxSceneDesc.simType = NX_SIMULATION_HW; m_nxScene = m_nxPhysXSDK->createScene(nxSceneDesc); if(!m_nxScene) { nxSceneDesc.gravity = gravity; nxSceneDesc.simType = NX_SIMULATION_SW; m_nxScene = m_nxPhysXSDK->createScene(nxSceneDesc); if(m_nxScene) return false; } NxMaterial *nxDefault = m_nxScene->getMaterialFromIndex(0); nxDefault->setRestitution(restitution); nxDefault->setDynamicFriction(dynamicFriction); nxDefault->setStaticFriction(staticFriction); return true; } void CPhysX::StartPhysX(float elapsedTime) { m_nxScene->simulate(elapsedTime); } void CPhysX::EndPhysX() { m_nxScene->flushStream(); m_nxScene->fetchResults(NX_RIGID_BODY_FINISHED, true); } NxActor *CPhysX::CreatePhysXBox(NxVec3 linearVelocity, NxVec3 size, NxVec3 position) { NxBodyDesc nxBoxBodyDesc; nxBoxBodyDesc.angularDamping = 0.5f; nxBoxBodyDesc.linearVelocity = linearVelocity; NxBoxShapeDesc nxBoxShapeDesc; nxBoxShapeDesc.dimensions = size; NxActorDesc nxBoxActorDesc; nxBoxActorDesc.shapes.pushBack(&nxBoxShapeDesc); nxBoxActorDesc.body = &nxBoxBodyDesc; nxBoxActorDesc.density = 10.0f; nxBoxActorDesc.globalPose.t = position; return m_nxScene->createActor(nxBoxActorDesc); } NxActor *CPhysX::CreatePhysXPlane(NxVec3 size) { NxPlaneShapeDesc nxPlaneShapeDesc; NxActorDesc nxPlaneActorDesc; nxPlaneActorDesc.shapes.pushBack(&nxPlaneShapeDesc); return m_nxScene->createActor(nxPlaneActorDesc); } NxActor *CPhysX::CreatePhysXSphere(NxVec3 linearVelocity, float radius, NxVec3 position) { NxBodyDesc nxSphereBodyDesc; nxSphereBodyDesc.angularDamping = 0.5f; nxSphereBodyDesc.linearVelocity = linearVelocity; NxSphereShapeDesc nxSphereShapeDesc; nxSphereShapeDesc.radius = radius; NxActorDesc nxSphereActorDesc; nxSphereActorDesc.body = &nxSphereBodyDesc; nxSphereActorDesc.density = 10.0f; nxSphereActorDesc.globalPose.t = position; nxSphereActorDesc.shapes.pushBack(&nxSphereShapeDesc); return m_nxScene->createActor(nxSphereActorDesc); } Main code #include "CFX.h" CFX::CFX() { m_window = NULL; m_showInstructions = false; m_physX = new CPhysX; m_nxSphere = NULL; m_nxBall = NULL; m_planeMesh = NULL; m_sphereMesh = NULL; m_ballMesh = NULL; } CFX::~CFX() { delete m_physX; delete m_window; } void CFX::SetFramework(CWindow* window) { m_window = window; } bool CFX::Initialize() { return true; } void CFX::OnCreateDevice(Direct3DDevice9 d3ddev) { m_fpsFont.Initialize(d3ddev, "Arial", 12, true, false); m_instructionsFont.Initialize(d3ddev, "Arial", 12, true, false); m_physX->Initialize(NxVec3(0.0f, -20.0f, 0.0f), 0.5f, 0.5f, 0.5f); D3DXCreateBox(d3ddev, 40.0f, 1.0f, 40.0f, &m_planeMesh, NULL); D3DXCreateSphere(d3ddev, 1.0f, 20, 20, &m_sphereMesh, NULL); D3DXCreateBox(d3ddev, 1.0f, 1.0f, 1.0f, &m_ballMesh, NULL); } void CFX::OnResetDevice(Direct3DDevice9 d3ddev) { m_fpsFont.OnResetDevice(); m_instructionsFont.OnResetDevice(); D3DLIGHT9 light; ZeroMemory(&light, sizeof(light)); light.Type = D3DLIGHT_DIRECTIONAL; light.Direction = D3DXVECTOR3(0.5f, -0.8f, 0.7f); light.Diffuse.r = 0.0f; light.Diffuse.g = 0.5f; light.Diffuse.b = 1.0f; light.Diffuse.a = 1.0f; d3ddev->SetLight(0, &light); d3ddev->LightEnable(0, true); D3DMATERIAL9 material; ZeroMemory(&material, sizeof(D3DMATERIAL9)); material.Diffuse.r = material.Ambient.r = 1.0f; material.Diffuse.g = material.Ambient.g = 1.0f; material.Diffuse.b = material.Ambient.b = 1.0f; material.Diffuse.a = material.Ambient.a = 1.0f; d3ddev->SetMaterial(&material); d3ddev->SetRenderState(D3DRS_LIGHTING, true); d3ddev->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(30, 30, 30)); D3DXVECTOR3 Look(-20.0f, 15.0f, 30.0f); D3DXVECTOR3 At(0.0f, 0.0f, 0.0f); D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f); D3DXMATRIXA16 view; D3DXMatrixLookAtLH(&view, &Look, &At, &Up); d3ddev->SetTransform(D3DTS_VIEW, &view); D3DXMATRIXA16 projection; float aspect = static_cast<float>(m_window->GetWidth()) / static_cast<float>(m_window->GetHeight()); D3DXMatrixPerspectiveFovLH(&projection, static_cast<float>(D3DX_PI / 4.0f), aspect, 0.1f, 1000.0f); d3ddev->SetTransform(D3DTS_PROJECTION, &projection); d3ddev->SetRenderState(D3DRS_FILLMODE, m_window->GetFillMode()); d3ddev->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD); m_physX->CreatePhysXPlane(NxVec3(40.0f, 1.0f, 40.0f)); m_nxSphere = m_physX->CreatePhysXSphere(NxVec3(0.0f, 0.0f, 0.0f), 1.0f, NxVec3(0.0f, 5.0f, 0.0f)); m_nxBall = m_physX->CreatePhysXBox(NxVec3(0.0f, 0.0f, 0.0f), NxVec3(1.0f, 1.0f, 1.0f), NxVec3(0.0f, 10.0f, 0.0f)); } void CFX::OnLostDevice() { m_fpsFont.OnLostDevice(); m_instructionsFont.OnLostDevice(); } void CFX::OnDestroyDevice() { } void CFX::OnUpdateFrame(Direct3DDevice9 d3ddev, float elapsedTime) { UNREFERENCED_PARAMETER(d3ddev); UNREFERENCED_PARAMETER(elapsedTime); } void CFX::OnRenderFrame(Direct3DDevice9 d3ddev, float elapsedTime) { m_physX->StartPhysX(elapsedTime); stringstream temp; temp << "FPS: " << int(m_window->GetFPS()) << "\nWindowWidth: " << m_window->GetWidth() << "\nWindowHeight: " << m_window->GetHeight(); d3ddev->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); d3ddev->BeginScene(); D3DXMATRIX world; D3DXMatrixIdentity(&world); world._42 = -0.5f; d3ddev->SetTransform(D3DTS_WORLD, &world); m_planeMesh->DrawSubset(0); m_nxSphere->getCMassGlobalPose().getColumnMajor44(world); d3ddev->SetTransform(D3DTS_WORLD, &world); m_sphereMesh->DrawSubset(0); m_nxBall->getCMassGlobalPose().getColumnMajor44(world); d3ddev->SetTransform(D3DTS_WORLD, &world); m_ballMesh->DrawSubset(0); m_fpsFont.PrintString(temp.str(), 0, 0, D3DCOLOR_XRGB(255, 0, 0), NULL, 40, 40); if(m_showInstructions) m_instructionsFont.PrintString("Quit: ESC\nWireframe: F1", 0, 45, D3DCOLOR_XRGB(255, 255, 0), NULL, 50, 50); else m_instructionsFont.PrintString("Press F2 for instructions", 0, 45, D3DCOLOR_XRGB(255, 255, 0), NULL, 50, 50); d3ddev->EndScene(); #if _ISVISTA d3ddev->PresentEx(NULL, NULL, NULL, NULL, 0); #else d3ddev->Present(NULL, NULL, NULL, NULL); #endif m_physX->EndPhysX(); } void CFX::OnKeyDown(WPARAM wParam) { switch(wParam) { case VK_ESCAPE: PostQuitMessage(0); break; case VK_F1: if(m_window != NULL) m_window->ToggleWireframe(); break; case VK_F2: if(!m_showInstructions) m_showInstructions = true; else m_showInstructions = false; break; } } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(nCmdShow); CFX* fx = new CFX; CWindow* window = new CWindow(fx); fx->SetFramework(window); if(!fx->Initialize()) { LogInfo("Failed to initialize FX.") return 0; } #if _ISVISTA if(!window->Initialize("D3D9Ex By Kiryn \"Mode: Windows Vista\"", hInstance, 640, 480)) #else if(!window->Initialize("D3D9 By Kiryn \"Mode: Windows XP SP2\"", hInstance, 640, 480)) #endif { LogInfo("Failed to intialize window.") return 0; } window->Run(); delete fx; return 0; }
  4. Kiryn

    DirectX 8 SDK Link

    why do you need DirectX 8 SDK for?
  5. Go to your project properties cause your using unicode and all. And I can assume your using Unicode L"" or something like that on a function that doesn't use wide characters. Use TEXT(""). And you didn't link to the Win32 API. So I can assume your using the Express Edition or some offbrand IDE. Follow these instructions. PSDK Setup
  6. Well take your macro and trim it down. Macros are support to be a quick and easy access. Your probably making it big, fat and juicy. I cannot tell really by no code being posted. So just use it as a regular function andd you'll be fine.
  7. I have this console for testing purposes and I have my python script but I can't figure out how to call the python function :\. #include <iostream> #include <boost/python.hpp> #include <Python.h> #include <string> int main(int argc, char *argv[]) { using namespace boost::python; try { Py_Initialize(); PySys_SetArgv(argc, argv); Py_Initialize(); object main_module = import("__main__").attr("__dict__"); std::string file = "omfgwtfbbq.py"; exec_file(file.c_str(), main_module, main_module); } catch(error_already_set const &) { PyErr_Print(); } return 0; } def foo(): print 'omg' print 'wtf' print 'bbq' def bar(): print 'rofl' But I can't figure how to do it. :\. Any help be appricated :)
  8. Kiryn

    fullscreen to windowed focus issue

    Heres some of my code that I use to toggle between the two. void CFramework::ToggleFullscreen() { if ( m_pGraphics == NULL || !m_active ) { return; } m_pGraphics->Windowed = !m_pGraphics->Windowed; // Set new window style if ( m_pGraphics->Windowed ) { // Going to windowed mode SetWindowLongPtr( m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW ); } else { // Save current location/size ZeroMemory( &m_wp, sizeof( WINDOWPLACEMENT ) ); m_wp.length = sizeof( WINDOWPLACEMENT ); GetWindowPlacement( m_hWnd, &m_wp ); // Going to fullscreen mode SetWindowLongPtr( m_hWnd, GWL_STYLE, WS_EX_TOPMOST ); // Hide the window to avoid animation of blank windows ShowWindow( m_hWnd, SW_HIDE ); } // Reset the Device OnLostDevice(); m_pGraphics->Reset(); OnResetDevice(); if ( m_pGraphics->Windowed ) { // Going to windowed mode // Restore the window location/size SetWindowPlacement( m_hWnd, &m_wp ); } // Make the window visible if ( !IsWindowVisible( m_hWnd ) ) { ShowWindow( m_hWnd, SW_SHOW ); } }
  9. Theres Python and C#. C# is alot better than Java. And simplier to use.
  10. Kiryn

    shadow mapping - PLEASE HELP

    Well I know a tutorial for Shadow Mapping for C# but I have converted it to C++. If you want the code I'll upload it somewhere. But yeah heres the link to the tutorial. Hope it helps. Shadow Mapping
  11. Kiryn

    RenderMonkey Install Problem

    well you didn't really explain your problem.
  12. Kiryn

    Drawing Polygon with DirectX9

    D3DPT_TRIANGLELIST and its in DrawUserPrimitives, DrawPrimitivesUP, DrawIndexPrimitives.
  13. Kiryn

    What Is The Next Stage of Game Graphics?

    Video game graphics are really getting more advance lately and with the newer technology I wouldn't be surprised within the next 15-30 years you start seeing graphics where its like virtual reality or so realistic that it seems like your in the actual world. But thats my theory it will not be correct so don't flame me *hides* :P
  14. Kiryn

    Post VS2K5 Schemes

    We'll this thread is to post your visual studios 2005 color text editor scheme. And share it with others. Cause theres not really any on the web hardly decent. And some people have a hard time coming up with a good scheme. And we wanna see you share it and also to show it off. Just thought it would be cool :D. [Edited by - Kiryn on July 17, 2007 1:50:15 PM]
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!