*** empty log message ***
This commit is contained in:
parent
c47f63952c
commit
c7a50a0fa7
|
|
@ -302,7 +302,7 @@ class ShowBase:
|
|||
# traverse the data graph. This reads all the control
|
||||
# inputs (from the mouse and keyboard, for instance) and also
|
||||
# directly acts upon them (for instance, to move the avatar).
|
||||
directTraverseDataGraph(self.dataRoot.node())
|
||||
traverseDataGraph(self.dataRoot.node())
|
||||
|
||||
return Task.cont
|
||||
|
||||
|
|
|
|||
|
|
@ -204,15 +204,6 @@ add_render_layer(GraphicsWindow *win, Node *render_top, Camera *camera) {
|
|||
}
|
||||
|
||||
|
||||
// This function is just a simple wrapper around traverse_data_graph()
|
||||
// in Panda. It's just here for the very short term, until everyone
|
||||
// can build a fresh Panda with traverse_data_graph() properly
|
||||
// exposed.
|
||||
void
|
||||
direct_traverse_data_graph(Node *node) {
|
||||
traverse_data_graph(node);
|
||||
}
|
||||
|
||||
void
|
||||
toggle_wireframe(NodeAttributes &initial_state) {
|
||||
static bool wireframe_mode = false;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ def make_loop(taskList):
|
|||
return cont
|
||||
else:
|
||||
task = self.taskList[self.index]
|
||||
# If this is a new task, set it's start time and frame
|
||||
# If this is a new task, set its start time and frame
|
||||
if (self.index > self.prevIndex):
|
||||
task.setStartTimeFrame(self.time, self.frame)
|
||||
self.prevIndex = self.index
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@
|
|||
|
||||
TypeHandle Character::_type_handle;
|
||||
|
||||
PStatCollector Character::_anim_pcollector =
|
||||
PStatCollector("Animation", RGBColorf(1,0,1), 30);
|
||||
#ifndef CPPPARSER
|
||||
PStatCollector Character::_anim_pcollector("App:Animation", RGBColorf(1,0,1), 30);
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Character::Copy Constructor
|
||||
|
|
|
|||
|
|
@ -16,12 +16,10 @@
|
|||
#include <geomNode.h>
|
||||
#include <geom.h>
|
||||
#include <nodePath.h>
|
||||
|
||||
#ifdef DO_PSTATS
|
||||
#include <pStatTimer.h>
|
||||
|
||||
PStatCollector CollisionTraverser::_collisions_pcollector =
|
||||
PStatCollector("Collisions", RGBColorf(1,0.5,0), 40);
|
||||
#ifndef CPPPARSER
|
||||
PStatCollector CollisionTraverser::_collisions_pcollector("App:Collisions", RGBColorf(1,0.5,0), 40);
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -231,10 +229,7 @@ traverse(Node *root) {
|
|||
void CollisionTraverser::
|
||||
traverse(const NodePath &root) {
|
||||
nassertv(root.get_graph_type() == _graph_type);
|
||||
|
||||
#ifdef DO_PSTATS
|
||||
PStatTimer timer(_collisions_pcollector);
|
||||
#endif
|
||||
|
||||
CollisionLevelState level_state(root);
|
||||
prepare_colliders(level_state);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#begin lib_target
|
||||
#define TARGET dgraph
|
||||
#define LOCAL_LIBS \
|
||||
sgraph graph putil sgattrib mathutil
|
||||
pstatclient sgraph graph putil sgattrib mathutil
|
||||
|
||||
#define SOURCES \
|
||||
buttonEventDataAttribute.I buttonEventDataAttribute.cxx \
|
||||
|
|
|
|||
|
|
@ -5,7 +5,12 @@
|
|||
|
||||
#include "dataGraphTraversal.h"
|
||||
#include "dataGraphTraverser.h"
|
||||
#include <pStatTimer.h>
|
||||
#include <pStatCollector.h>
|
||||
|
||||
#ifndef CPPPARSER
|
||||
PStatCollector _dgraph_pcollector("App:Data Graph", RGBColorf(0.5,0.8,0.4), 30);
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: traverse_data_graph
|
||||
|
|
@ -15,6 +20,9 @@
|
|||
// downwards.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void traverse_data_graph(Node *root) {
|
||||
DataGraphTraverser dgt;
|
||||
dgt.traverse(root);
|
||||
PStatTimer timer(_dgraph_pcollector);
|
||||
{
|
||||
DataGraphTraverser dgt;
|
||||
dgt.traverse(root);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,15 +24,13 @@ TypeHandle GraphicsWindow::WindowPipe::_type_handle;
|
|||
|
||||
GraphicsWindow::WindowFactory *GraphicsWindow::_factory = NULL;
|
||||
|
||||
#ifdef DO_PSTATS
|
||||
PStatCollector GraphicsWindow::_app_pcollector =
|
||||
PStatCollector("App", RGBColorf(0,1,1));
|
||||
PStatCollector GraphicsWindow::_show_code_pcollector =
|
||||
PStatCollector("App:Show Code", RGBColorf(0.8,0.2,1));
|
||||
PStatCollector GraphicsWindow::_swap_pcollector =
|
||||
PStatCollector("Draw:Swap Buffers", RGBColorf(0.5,1,0.8));
|
||||
PStatCollector GraphicsWindow::_make_current_pcollector =
|
||||
PStatCollector("Draw:Make Current", RGBColorf(1,0.6,0.3));
|
||||
#ifndef CPPPARSER
|
||||
PStatCollector GraphicsWindow::_app_pcollector("App", RGBColorf(0,1,1));
|
||||
PStatCollector GraphicsWindow::_show_code_pcollector("App:Show Code", RGBColorf(0.8,0.2,1));
|
||||
PStatCollector GraphicsWindow::_swap_pcollector("Draw:Swap Buffers", RGBColorf(0.5,1,0.8));
|
||||
PStatCollector GraphicsWindow::_clear_pcollector("Draw:Clear", RGBColorf(0.5,0.7,0.7));
|
||||
PStatCollector GraphicsWindow::_show_fps_pcollector("Draw:Show fps", RGBColorf(0.5,0.8,1));
|
||||
PStatCollector GraphicsWindow::_make_current_pcollector("Draw:Make Current", RGBColorf(1,0.6,0.3));
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -24,10 +24,7 @@
|
|||
#include <buttonEvent.h>
|
||||
#include <iterator_types.h>
|
||||
#include <factory.h>
|
||||
|
||||
#ifdef DO_PSTATS
|
||||
#include <pStatCollector.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
@ -158,13 +155,13 @@ public:
|
|||
virtual void begin_frame();
|
||||
virtual void end_frame();
|
||||
|
||||
#ifdef DO_PSTATS
|
||||
// Statistics
|
||||
static PStatCollector _app_pcollector;
|
||||
static PStatCollector _show_code_pcollector;
|
||||
static PStatCollector _swap_pcollector; // dxgsg needs access so this is public
|
||||
static PStatCollector _make_current_pcollector;
|
||||
#endif
|
||||
// Statistics
|
||||
static PStatCollector _app_pcollector;
|
||||
static PStatCollector _show_code_pcollector;
|
||||
static PStatCollector _swap_pcollector; // dxgsg needs access so this is public
|
||||
static PStatCollector _clear_pcollector;
|
||||
static PStatCollector _show_fps_pcollector;
|
||||
static PStatCollector _make_current_pcollector;
|
||||
|
||||
protected:
|
||||
void make_gsg();
|
||||
|
|
|
|||
|
|
@ -66,10 +66,7 @@
|
|||
#include <stencilTransition.h>
|
||||
#include <throw_event.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#ifdef DO_PSTATS
|
||||
#include <pStatTimer.h>
|
||||
#endif
|
||||
|
||||
#define DISABLE_POLYGON_OFFSET_DECALING
|
||||
// currently doesnt work well enough in toontown models for us to use
|
||||
|
|
@ -483,6 +480,7 @@ init_dx( LPDIRECTDRAW7 context,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void DXGraphicsStateGuardian::
|
||||
clear(const RenderBuffer &buffer) {
|
||||
// PStatTimer timer(_win->_clear_pcollector);
|
||||
|
||||
activate();
|
||||
|
||||
|
|
@ -726,6 +724,7 @@ render_frame(const AllAttributesWrapper &initial_state) {
|
|||
}
|
||||
|
||||
if(dx_show_fps_meter) {
|
||||
PStatTimer timer(_win->_show_fps_pcollector);
|
||||
|
||||
DWORD now = timeGetTime(); // this is win32 fn
|
||||
|
||||
|
|
@ -5485,9 +5484,7 @@ HRESULT DXGraphicsStateGuardian::RestoreAllVideoSurfaces(void) {
|
|||
// Description: Repaint primary buffer from back buffer (windowed mode only)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DXGraphicsStateGuardian::show_frame(void) {
|
||||
#ifdef DO_PSTATS
|
||||
PStatTimer timer(_win->_swap_pcollector); // this times just the flip, so it must go here in dxgsg, instead of wdxdisplay, which would time the whole frame
|
||||
#endif
|
||||
|
||||
if(_pri==NULL)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@
|
|||
#include <polygonOffsetTransition.h>
|
||||
#include <polygonOffsetAttribute.h>
|
||||
#include <clockObject.h>
|
||||
#include <pStatTimer.h>
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
|
|
@ -343,6 +344,7 @@ reset() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void GLGraphicsStateGuardian::
|
||||
clear(const RenderBuffer &buffer) {
|
||||
// PStatTimer timer(_win->_clear_pcollector);
|
||||
activate();
|
||||
|
||||
nassertv(buffer._gsg == this);
|
||||
|
|
@ -352,11 +354,11 @@ clear(const RenderBuffer &buffer) {
|
|||
|
||||
if (buffer_type & RenderBuffer::T_color) {
|
||||
call_glClearColor(_color_clear_value[0],
|
||||
_color_clear_value[1],
|
||||
_color_clear_value[2],
|
||||
_color_clear_value[3]);
|
||||
_color_clear_value[1],
|
||||
_color_clear_value[2],
|
||||
_color_clear_value[3]);
|
||||
state.set_attribute(ColorMaskTransition::get_class_type(),
|
||||
new ColorMaskAttribute);
|
||||
new ColorMaskAttribute);
|
||||
mask |= GL_COLOR_BUFFER_BIT;
|
||||
|
||||
set_draw_buffer(buffer);
|
||||
|
|
@ -370,7 +372,7 @@ clear(const RenderBuffer &buffer) {
|
|||
// writing to the depth buffer.
|
||||
if (!_depth_mask) {
|
||||
state.set_attribute(DepthWriteTransition::get_class_type(),
|
||||
new DepthWriteAttribute);
|
||||
new DepthWriteAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -381,9 +383,9 @@ clear(const RenderBuffer &buffer) {
|
|||
|
||||
if (buffer_type & RenderBuffer::T_accum) {
|
||||
call_glClearAccum(_accum_clear_value[0],
|
||||
_accum_clear_value[1],
|
||||
_accum_clear_value[2],
|
||||
_accum_clear_value[3]);
|
||||
_accum_clear_value[1],
|
||||
_accum_clear_value[2],
|
||||
_accum_clear_value[3]);
|
||||
mask |= GL_ACCUM_BUFFER_BIT;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -616,6 +616,7 @@ void glxGraphicsWindow::setup_properties(void)
|
|||
void glxGraphicsWindow::end_frame( void )
|
||||
{
|
||||
if (gl_show_fps_meter) {
|
||||
PStatTimer timer(_show_fps_pcollector);
|
||||
ClockObject* co = ClockObject::get_global_clock();
|
||||
double now = co->get_real_time();
|
||||
double time_delta = now - _start_time;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,7 @@
|
|||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#ifdef DO_PSTATS
|
||||
#include <pStatTimer.h>
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Static variables
|
||||
|
|
@ -868,69 +865,69 @@ void wglGraphicsWindow::setup_colormap(void) {
|
|||
// Description: Swaps the front and back buffers.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void wglGraphicsWindow::end_frame(void) {
|
||||
|
||||
if(gl_show_fps_meter) {
|
||||
DWORD now = timeGetTime(); // this is win32 fn
|
||||
|
||||
float time_delta = (now - _start_time) * 0.001f;
|
||||
|
||||
if(time_delta > gl_fps_meter_update_interval) {
|
||||
// didnt use global clock object, it wasnt working properly when I tried,
|
||||
// its probably slower due to cache faults, and I can easily track all the
|
||||
// info I need in dxgsg
|
||||
DWORD num_frames = _cur_frame_count - _start_frame_count;
|
||||
|
||||
_current_fps = num_frames / time_delta;
|
||||
_start_time = now;
|
||||
_start_frame_count = _cur_frame_count;
|
||||
}
|
||||
|
||||
char fps_msg[15];
|
||||
sprintf(fps_msg, "%.02f fps", _current_fps);
|
||||
|
||||
// Note: we cant use simple GDI TextOut calls to draw FPS meter chars (like DX fps meter)
|
||||
// because WGL doesnt support GDI in double-buffered mode. Instead we have to
|
||||
// use glBitMap display lists created by wglUseFontBitmaps
|
||||
|
||||
glColor3f(0.0,1.0,1.0);
|
||||
|
||||
GLboolean tex_was_on = glIsEnabled(GL_TEXTURE_2D);
|
||||
|
||||
if(tex_was_on)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(LMatrix4f::ident_mat().get_data());
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(LMatrix4f::ident_mat().get_data());
|
||||
|
||||
glOrtho(_props._xorg,_props._xorg+_props._xsize,
|
||||
_props._yorg,_props._yorg+_props._ysize,-1.0,1.0);
|
||||
|
||||
glRasterPos2f(_props._xsize-70,_props._ysize-20); // these seem to be good for default font
|
||||
|
||||
// set up for a string-drawing display list call
|
||||
glListBase(FONT_BITMAP_OGLDISPLAYLISTNUM);
|
||||
|
||||
// draw a string using font display lists. chars index their corresponding displist name
|
||||
glCallLists(strlen(fps_msg), GL_UNSIGNED_BYTE, fps_msg);
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
if(tex_was_on)
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
_cur_frame_count++; // only used by fps meter right now
|
||||
}
|
||||
|
||||
if (gl_show_fps_meter) {
|
||||
PStatTimer timer(_show_fps_pcollector);
|
||||
DWORD now = timeGetTime(); // this is win32 fn
|
||||
|
||||
float time_delta = (now - _start_time) * 0.001f;
|
||||
|
||||
if(time_delta > gl_fps_meter_update_interval) {
|
||||
// didnt use global clock object, it wasnt working properly when
|
||||
// I tried, its probably slower due to cache faults, and I can
|
||||
// easily track all the info I need in dxgsg
|
||||
DWORD num_frames = _cur_frame_count - _start_frame_count;
|
||||
|
||||
_current_fps = num_frames / time_delta;
|
||||
_start_time = now;
|
||||
_start_frame_count = _cur_frame_count;
|
||||
}
|
||||
|
||||
char fps_msg[15];
|
||||
sprintf(fps_msg, "%.02f fps", _current_fps);
|
||||
|
||||
// Note: we cant use simple GDI TextOut calls to draw FPS meter
|
||||
// chars (like DX fps meter) because WGL doesnt support GDI in
|
||||
// double-buffered mode. Instead we have to use glBitMap display
|
||||
// lists created by wglUseFontBitmaps
|
||||
|
||||
glColor3f(0.0,1.0,1.0);
|
||||
|
||||
GLboolean tex_was_on = glIsEnabled(GL_TEXTURE_2D);
|
||||
|
||||
if(tex_was_on)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(LMatrix4f::ident_mat().get_data());
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(LMatrix4f::ident_mat().get_data());
|
||||
|
||||
glOrtho(_props._xorg,_props._xorg+_props._xsize,
|
||||
_props._yorg,_props._yorg+_props._ysize,-1.0,1.0);
|
||||
|
||||
glRasterPos2f(_props._xsize-70,_props._ysize-20); // these seem to be good for default font
|
||||
|
||||
// set up for a string-drawing display list call
|
||||
glListBase(FONT_BITMAP_OGLDISPLAYLISTNUM);
|
||||
|
||||
// draw a string using font display lists. chars index their
|
||||
// corresponding displist name
|
||||
glCallLists(strlen(fps_msg), GL_UNSIGNED_BYTE, fps_msg);
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
if(tex_was_on)
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
_cur_frame_count++; // only used by fps meter right now
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef DO_PSTATS
|
||||
PStatTimer timer(_swap_pcollector);
|
||||
#endif
|
||||
SwapBuffers(_hdc);
|
||||
}
|
||||
GraphicsWindow::end_frame();
|
||||
|
|
@ -1079,10 +1076,8 @@ supports_update() const {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void wglGraphicsWindow::update(void) {
|
||||
#ifdef DO_PSTATS
|
||||
_show_code_pcollector.stop();
|
||||
PStatClient::main_tick();
|
||||
#endif
|
||||
|
||||
if (_change_mask)
|
||||
handle_changes();
|
||||
|
|
@ -1095,9 +1090,7 @@ void wglGraphicsWindow::update(void) {
|
|||
idle_wait();
|
||||
else
|
||||
process_events();
|
||||
#ifdef DO_PSTATS
|
||||
_show_code_pcollector.start();
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1133,9 +1126,8 @@ void wglGraphicsWindow::enable_mouse_passive_motion(bool val) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void wglGraphicsWindow::make_current(void) {
|
||||
#ifdef DO_PSTATS
|
||||
PStatTimer timer(_make_current_pcollector);
|
||||
#endif
|
||||
|
||||
HGLRC current_context = wglGetCurrentContext();
|
||||
HDC current_dc = wglGetCurrentDC();
|
||||
if (current_context != _context || current_dc != _hdc)
|
||||
|
|
|
|||
Loading…
Reference in New Issue