include ofxProfiler
This commit is contained in:
parent
297542abc9
commit
7ef6d13c93
4 changed files with 9 additions and 0 deletions
|
@ -51,6 +51,7 @@ void GPUFontAtlasLayerCombo::setup(const ComboIdentifier & identifier,
|
||||||
cout << "Render type " << r->getType() << endl;
|
cout << "Render type " << r->getType() << endl;
|
||||||
}
|
}
|
||||||
void GPUFontAtlasLayerCombo::update(){
|
void GPUFontAtlasLayerCombo::update(){
|
||||||
|
OFX_PROFILER_FUNCTION();
|
||||||
for(const auto & layer : layers){
|
for(const auto & layer : layers){
|
||||||
layer->update();
|
layer->update();
|
||||||
if(layer->isDirtyDirty()){
|
if(layer->isDirtyDirty()){
|
||||||
|
@ -133,6 +134,7 @@ const vector <shared_ptr <GPUFontLayer> > & GPUFontAtlasLayerCombo::getLayers(){
|
||||||
return layers;
|
return layers;
|
||||||
}
|
}
|
||||||
void GPUFontAtlasLayerCombo::draw(){
|
void GPUFontAtlasLayerCombo::draw(){
|
||||||
|
OFX_PROFILER_FUNCTION();
|
||||||
GLuint location;
|
GLuint location;
|
||||||
|
|
||||||
int width = ofGetWidth();
|
int width = ofGetWidth();
|
||||||
|
@ -159,6 +161,7 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
|
|
||||||
float superLineHeight = 0;
|
float superLineHeight = 0;
|
||||||
if(font){
|
if(font){
|
||||||
|
OFX_PROFILER_SCOPE("draw font");
|
||||||
fontShaderProgram = fontShader->program;
|
fontShaderProgram = fontShader->program;
|
||||||
glUseProgram(fontShaderProgram);
|
glUseProgram(fontShaderProgram);
|
||||||
|
|
||||||
|
@ -192,6 +195,7 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
|
|
||||||
std::vector <ofVboMesh> outerBoundingBoxes;
|
std::vector <ofVboMesh> outerBoundingBoxes;
|
||||||
for(const auto & layer : layers){
|
for(const auto & layer : layers){
|
||||||
|
OFX_PROFILER_SCOPE("draw layer");
|
||||||
float lineHeight = font->getLineHeight(layer->getProps().fontSize_px);
|
float lineHeight = font->getLineHeight(layer->getProps().fontSize_px);
|
||||||
float ascender = font->getAscender(layer->getProps().fontSize_px);
|
float ascender = font->getAscender(layer->getProps().fontSize_px);
|
||||||
superLineHeight = lineHeight;
|
superLineHeight = lineHeight;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
#include "AtlasLayerCombo.h"
|
#include "AtlasLayerCombo.h"
|
||||||
#include "GPUFontLayer.h"
|
#include "GPUFontLayer.h"
|
||||||
|
#include "ofxProfiler.h"
|
||||||
#ifdef TARGET_EMSCRIPTEN
|
#ifdef TARGET_EMSCRIPTEN
|
||||||
#include <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
|
|
|
@ -65,13 +65,16 @@ void GPUFontLayer::setMomsComboIdentifier(const ComboIdentifier & identifier){
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPUFontLayer::setProps(const Props & props){
|
void GPUFontLayer::setProps(const Props & props){
|
||||||
|
OFX_PROFILER_FUNCTION();
|
||||||
if(propsBuffer.size() == 0 || props.text != propsBuffer[0].text
|
if(propsBuffer.size() == 0 || props.text != propsBuffer[0].text
|
||||||
|| propsBuffer[0].fontVariations != props.fontVariations){
|
|| propsBuffer[0].fontVariations != props.fontVariations){
|
||||||
|
OFX_PROFILER_SCOPE("variations");
|
||||||
setDirtyDirty(true);
|
setDirtyDirty(true);
|
||||||
variationText.clear();
|
variationText.clear();
|
||||||
variationText.resize(props.text.size());
|
variationText.resize(props.text.size());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(const char c : props.text){
|
for(const char c : props.text){
|
||||||
|
OFX_PROFILER_SCOPE("char");
|
||||||
ofxGPUFont::GlyphIdentity glyphIdentity;
|
ofxGPUFont::GlyphIdentity glyphIdentity;
|
||||||
glyphIdentity.charcode = ofxGPUFont::decodeCharcode(&c);
|
glyphIdentity.charcode = ofxGPUFont::decodeCharcode(&c);
|
||||||
const Props & vProps = getProps(i * props.letterDelay);
|
const Props & vProps = getProps(i * props.letterDelay);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "ofxProfiler.h"
|
||||||
#include "AtlasLayerCombo.h"
|
#include "AtlasLayerCombo.h"
|
||||||
#include "font.hpp"
|
#include "font.hpp"
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
Loading…
Reference in a new issue