mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-15 01:24:35 +02:00
#15 add CV markers support
This commit is contained in:
@@ -593,6 +593,8 @@ struct WaterCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void renderMask() {
|
void renderMask() {
|
||||||
|
if (!visible) return;
|
||||||
|
PROFILE_MARKER("WATER_RENDER_MASK");
|
||||||
// mask underwater geometry by zero alpha
|
// mask underwater geometry by zero alpha
|
||||||
game->setShader(Core::passWater, Shader::WATER_MASK);
|
game->setShader(Core::passWater, Shader::WATER_MASK);
|
||||||
Core::active.shader->setParam(uTexParam, vec4(1.0f));
|
Core::active.shader->setParam(uTexParam, vec4(1.0f));
|
||||||
@@ -626,6 +628,8 @@ struct WaterCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void getRefract() {
|
void getRefract() {
|
||||||
|
if (!visible) return;
|
||||||
|
PROFILE_MARKER("WATER_REFRACT");
|
||||||
int w, h;
|
int w, h;
|
||||||
getTargetSize(w, h);
|
getTargetSize(w, h);
|
||||||
// get refraction texture
|
// get refraction texture
|
||||||
@@ -637,6 +641,7 @@ struct WaterCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void simulate() {
|
void simulate() {
|
||||||
|
PROFILE_MARKER("WATER_SIMULATE");
|
||||||
// simulate water
|
// simulate water
|
||||||
Core::setDepthTest(false);
|
Core::setDepthTest(false);
|
||||||
Core::setBlending(bmNone);
|
Core::setBlending(bmNone);
|
||||||
@@ -657,6 +662,7 @@ struct WaterCache {
|
|||||||
|
|
||||||
void renderReflect() {
|
void renderReflect() {
|
||||||
if (!visible) return;
|
if (!visible) return;
|
||||||
|
PROFILE_MARKER("WATER_REFLECT");
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
Item &item = items[i];
|
Item &item = items[i];
|
||||||
@@ -698,6 +704,8 @@ struct WaterCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void render() {
|
void render() {
|
||||||
|
if (!visible) return;
|
||||||
|
PROFILE_MARKER("WATER_RENDER");
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
Item &item = items[i];
|
Item &item = items[i];
|
||||||
if (!item.visible) continue;
|
if (!item.visible) continue;
|
||||||
|
28
src/core.h
28
src/core.h
@@ -288,13 +288,41 @@ namespace Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
|
#define USE_CV_MARKERS
|
||||||
|
|
||||||
|
#ifdef USE_CV_MARKERS
|
||||||
|
#include <libs/cvmarkers/cvmarkersobj.h>
|
||||||
|
using namespace Concurrency::diagnostic;
|
||||||
|
|
||||||
|
marker_series *series[256];
|
||||||
|
int seriesIndex;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct Marker {
|
struct Marker {
|
||||||
|
#ifdef USE_CV_MARKERS
|
||||||
|
span *cvSpan;
|
||||||
|
#endif
|
||||||
|
|
||||||
Marker(const char *title) {
|
Marker(const char *title) {
|
||||||
if (Core::support.profMarker) glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, title);
|
if (Core::support.profMarker) glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, title);
|
||||||
|
#ifdef USE_CV_MARKERS
|
||||||
|
marker_series *&s = series[seriesIndex];
|
||||||
|
if (s == NULL) {
|
||||||
|
char seriesTitle[64];
|
||||||
|
sprintf(seriesTitle, "events - %d", seriesIndex);
|
||||||
|
s = new marker_series(seriesTitle);
|
||||||
|
}
|
||||||
|
cvSpan = new span(*s, normal_importance, _T(title));
|
||||||
|
seriesIndex++;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~Marker() {
|
~Marker() {
|
||||||
if (Core::support.profMarker) glPopDebugGroup();
|
if (Core::support.profMarker) glPopDebugGroup();
|
||||||
|
#ifdef USE_CV_MARKERS
|
||||||
|
delete cvSpan;
|
||||||
|
seriesIndex--;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setLabel(GLenum id, GLuint name, const char *label) {
|
static void setLabel(GLenum id, GLuint name, const char *label) {
|
||||||
|
@@ -67,6 +67,7 @@ namespace Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void update(float delta) {
|
void update(float delta) {
|
||||||
|
PROFILE_MARKER("UPDATE");
|
||||||
Input::update();
|
Input::update();
|
||||||
|
|
||||||
if (Input::down[ikV]) { // third <-> first person view
|
if (Input::down[ikV]) { // third <-> first person view
|
||||||
@@ -85,6 +86,7 @@ namespace Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void render() {
|
void render() {
|
||||||
|
PROFILE_MARKER("RENDER");
|
||||||
PROFILE_TIMING(Core::stats.tFrame);
|
PROFILE_TIMING(Core::stats.tFrame);
|
||||||
Core::beginFrame();
|
Core::beginFrame();
|
||||||
level->render();
|
level->render();
|
||||||
|
@@ -372,8 +372,8 @@ int main(int argc, char** argv) {
|
|||||||
joyUpdate();
|
joyUpdate();
|
||||||
|
|
||||||
DWORD time = getTime();
|
DWORD time = getTime();
|
||||||
if (time <= lastTime)
|
//if (time <= lastTime)
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
EnterCriticalSection(&sndCS);
|
EnterCriticalSection(&sndCS);
|
||||||
Game::update((time - lastTime) * 0.001f);
|
Game::update((time - lastTime) * 0.001f);
|
||||||
|
Reference in New Issue
Block a user