/* Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc. All rights reserved. Physics Effects is open software; you can redistribute it and/or modify it under the terms of the BSD License. Physics Effects is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the BSD License for more details. A copy of the BSD License is distributed with Physics Effects under the filename: physics_effects_license.txt */ #include "render_func.h" #include #include "box.h" #include "sphere.h" #include "cylinder.h" // context HDC hDC; HGLRC hRC; // local variables static int screen_width,screen_height; static PfxMatrix4 g_pMat,g_vMat; static PfxVector3 g_viewPos,g_lightPos,g_viewTgt; static float lightRadius,lightRadX,lightRadY; static float viewRadius,viewRadX,viewRadY,viewHeight; static unsigned short *box_wire_idx; static unsigned short *sphere_wire_idx; static unsigned short *cylinder_wire_idx; #define MAX_MESH 5 static struct MeshBuff { float *vtx; float *nml; int numVtx; unsigned short *idx; unsigned short *wire_idx; int numIdx; } meshBuff[MAX_MESH]; int numMesh; void render_init() { screen_width = DISPLAY_WIDTH; screen_height = DISPLAY_HEIGHT; // initalize matrix g_pMat = PfxMatrix4::perspective(3.1415f/4.0f, (float)screen_width/(float)screen_height,0.1f, 1000.0f); // initalize parameters lightRadius = 40.0f; lightRadX = -0.6f; lightRadY = 0.6f; viewRadius = 40.0f; viewRadX = -0.01f; viewRadY = 0.0f; viewHeight = 1.0f; g_viewTgt = PfxVector3(0.0f,viewHeight,0.0f); box_wire_idx = new unsigned short [NUM_BOX_IDX*2]; sphere_wire_idx = new unsigned short [NUM_SPHERE_IDX*2]; cylinder_wire_idx = new unsigned short [NUM_CYLINDER_IDX*2]; for(int i=0;i 0) { for(int i=0;i=0&&meshId