1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-13 16:44:50 +02:00

#15 add CV markers support

This commit is contained in:
XProger
2017-08-10 02:53:24 +03:00
parent 8fc7420737
commit 7149ddfe38
4 changed files with 40 additions and 2 deletions

View File

@@ -593,6 +593,8 @@ struct WaterCache {
}
void renderMask() {
if (!visible) return;
PROFILE_MARKER("WATER_RENDER_MASK");
// mask underwater geometry by zero alpha
game->setShader(Core::passWater, Shader::WATER_MASK);
Core::active.shader->setParam(uTexParam, vec4(1.0f));
@@ -626,6 +628,8 @@ struct WaterCache {
}
void getRefract() {
if (!visible) return;
PROFILE_MARKER("WATER_REFRACT");
int w, h;
getTargetSize(w, h);
// get refraction texture
@@ -637,6 +641,7 @@ struct WaterCache {
}
void simulate() {
PROFILE_MARKER("WATER_SIMULATE");
// simulate water
Core::setDepthTest(false);
Core::setBlending(bmNone);
@@ -657,6 +662,7 @@ struct WaterCache {
void renderReflect() {
if (!visible) return;
PROFILE_MARKER("WATER_REFLECT");
for (int i = 0; i < count; i++) {
Item &item = items[i];
@@ -698,6 +704,8 @@ struct WaterCache {
}
void render() {
if (!visible) return;
PROFILE_MARKER("WATER_RENDER");
for (int i = 0; i < count; i++) {
Item &item = items[i];
if (!item.visible) continue;

View File

@@ -288,13 +288,41 @@ namespace Core {
}
#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 {
#ifdef USE_CV_MARKERS
span *cvSpan;
#endif
Marker(const char *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() {
if (Core::support.profMarker) glPopDebugGroup();
#ifdef USE_CV_MARKERS
delete cvSpan;
seriesIndex--;
#endif
}
static void setLabel(GLenum id, GLuint name, const char *label) {

View File

@@ -67,6 +67,7 @@ namespace Game {
}
void update(float delta) {
PROFILE_MARKER("UPDATE");
Input::update();
if (Input::down[ikV]) { // third <-> first person view
@@ -85,6 +86,7 @@ namespace Game {
}
void render() {
PROFILE_MARKER("RENDER");
PROFILE_TIMING(Core::stats.tFrame);
Core::beginFrame();
level->render();

View File

@@ -372,8 +372,8 @@ int main(int argc, char** argv) {
joyUpdate();
DWORD time = getTime();
if (time <= lastTime)
continue;
//if (time <= lastTime)
// continue;
EnterCriticalSection(&sndCS);
Game::update((time - lastTime) * 0.001f);