<commit_before>/*
* TimeLineRenderer.cpp
*
* Copyright (C) 2010 by VISUS (Universitaet Stuttgart)
* Alle Rechte vorbehalten.
*/

#include "stdafx.h"
//#define _USE_MATH_DEFINES
#include "TimeLineRenderer.h"
#include "CallCinematicCamera.h"
#include "mmcore/param/IntParam.h"
#include "mmcore/param/ButtonParam.h"
#include "vislib/graphics/gl/SimpleFont.h"
#include "vislib/graphics/BitmapImage.h"
#include "mmcore/utility/ResourceWrapper.h"
#include "vislib/graphics/gl/OpenGLTexture2D.h"
#include "vislib/sys/Log.h"
#include "mmcore/misc/PngBitmapCodec.h"
#include "mmcore/view/Renderer2DModule.h"
#include "mmcore/CoreInstance.h"
#include "mmcore/param/StringParam.h"
#include "mmcore/param/FloatParam.h"
//#include "Keyframe.h"
//#include "vislib/Array.h"
#include "vislib/String.h"

//#include <cmath>

using namespace megamol::core;
using namespace megamol::cinematiccamera;


/*
* cinematiccamera::TimeLineRenderer::TimeLineRenderer
*/
megamol::cinematiccamera::TimeLineRenderer::TimeLineRenderer(void) : view::Renderer2DModule(),
	getDataSlot("getkeyframes", "Connects to the KeyframeKeeper"),
	resolutionParam("resolution", "The plotting resolution of the diagram."),
#ifndef USE_SIMPLE_FONT
	theFont(vislib::graphics::gl::FontInfo_Verdana),
#endif // USE_SIMPLE_FONT
	markerTextures(0)
	{

	this->getDataSlot.SetCompatibleCall<cinematiccamera::CallCinematicCameraDescription>();
	this->MakeSlotAvailable(&this->getDataSlot);

	// set up the resolution param for the texture
	this->resolutionParam.SetParameter(new param::FloatParam(1024, 0, 8192));
	this->MakeSlotAvailable(&this->resolutionParam);
}


/*
* cinematiccamera::TimeLineRenderer::~TimeLineRenderer
*/
megamol::cinematiccamera::TimeLineRenderer::~TimeLineRenderer(void) {
	this->Release();
}


/*
* cinematiccamera::TimeLineRenderer::create
*/
bool megamol::cinematiccamera::TimeLineRenderer::create(void) {
	
	//this->LoadTexture("test.png");
	
	return true;
}


/*
* cinematiccamera::TimeLineRenderer::GetExtents
*/
bool megamol::cinematiccamera::TimeLineRenderer::GetExtents(view::CallRender2D& call) {

	//necessary?
	core::view::CallRender2D *cr = dynamic_cast<core::view::CallRender2D*>(&call);
	if (cr == NULL) return false;

	CallCinematicCamera *ccc = this->getDataSlot.CallAs<CallCinematicCamera>();
	if (ccc != NULL) {
		if (!(*ccc) (CallCinematicCamera::CallForGetKeyframes)){
			ccc = NULL;
		}
	}

	call.SetBoundingBox(cr->GetViewport());
	lineLength = cr->GetViewport().GetSize().GetWidth() - 10.0f;
	lineYPos = cr->GetViewport().GetSize().GetHeight() / 2.0f;
	return true;
}


/*
* cinematiccamera::TimeLineRenderer::release
*/
void megamol::cinematiccamera::TimeLineRenderer::release(void) {
	// intentionally empty
}


// sequenceRenderer protein-plugin anschauen!!!!


/*
* cinematiccamera::TimeLineRenderer::Render
*/
bool megamol::cinematiccamera::TimeLineRenderer::Render(view::CallRender2D& call) {
	updateParameters();
	view::CallRender2D *cr = dynamic_cast<view::CallRender2D*>(&call);
	if (cr == NULL) return false;
	

	vislib::Array<Keyframe> *keyframes;
	
	cinematiccamera::CallCinematicCamera *kfc = this->getDataSlot.CallAs<cinematiccamera::CallCinematicCamera>();
	if (kfc == NULL) return false;
	if (!(*kfc)(CallCinematicCamera::CallForGetKeyframes)) return false;
	
	keyframes = kfc->getKeyframes();
		 
	glDisable(GL_CULL_FACE);
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

	// get the diagram color (inverse background color)
	float bgColor[4];
	float fgColor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
	glGetFloatv(GL_COLOR_CLEAR_VALUE, bgColor);
	for (unsigned int i = 0; i < 4; i++) {
		fgColor[i] -= bgColor[i];
	}
<commit_msg>keyframe markers in release now magically working(hopefully)<commit_after>/*
* TimeLineRenderer.cpp
*
* Copyright (C) 2010 by VISUS (Universitaet Stuttgart)
* Alle Rechte vorbehalten.
*/

#include "stdafx.h"
//#define _USE_MATH_DEFINES
#include "TimeLineRenderer.h"
#include "CallCinematicCamera.h"
#include "mmcore/param/IntParam.h"
#include "mmcore/param/ButtonParam.h"
#include "vislib/graphics/gl/SimpleFont.h"
#include "vislib/graphics/BitmapImage.h"
#include "mmcore/utility/ResourceWrapper.h"
#include "vislib/graphics/gl/OpenGLTexture2D.h"
#include "vislib/sys/Log.h"
#include "mmcore/misc/PngBitmapCodec.h"
#include "mmcore/view/Renderer2DModule.h"
#include "mmcore/CoreInstance.h"
#include "mmcore/param/StringParam.h"
#include "mmcore/param/FloatParam.h"
//#include "Keyframe.h"
//#include "vislib/Array.h"
#include "vislib/String.h"

//#include <cmath>

using namespace megamol::core;
using namespace megamol::cinematiccamera;


/*
* cinematiccamera::TimeLineRenderer::TimeLineRenderer
*/
megamol::cinematiccamera::TimeLineRenderer::TimeLineRenderer(void) : view::Renderer2DModule(),
	getDataSlot("getkeyframes", "Connects to the KeyframeKeeper"),
	resolutionParam("resolution", "The plotting resolution of the diagram."),
#ifndef USE_SIMPLE_FONT
	theFont(vislib::graphics::gl::FontInfo_Verdana),
#endif // USE_SIMPLE_FONT
	markerTextures(0)
	{

	this->getDataSlot.SetCompatibleCall<cinematiccamera::CallCinematicCameraDescription>();
	this->MakeSlotAvailable(&this->getDataSlot);

	// set up the resolution param for the texture
	this->resolutionParam.SetParameter(new param::FloatParam(1024, 0, 8192));
	this->MakeSlotAvailable(&this->resolutionParam);
}


/*
* cinematiccamera::TimeLineRenderer::~TimeLineRenderer
*/
megamol::cinematiccamera::TimeLineRenderer::~TimeLineRenderer(void) {
	this->Release();
}


/*
* cinematiccamera::TimeLineRenderer::create
*/
bool megamol::cinematiccamera::TimeLineRenderer::create(void) {
	
	//this->LoadTexture("test.png");
	
	return true;
}


/*
* cinematiccamera::TimeLineRenderer::GetExtents
*/
bool megamol::cinematiccamera::TimeLineRenderer::GetExtents(view::CallRender2D& call) {

	//necessary?
	core::view::CallRender2D *cr = dynamic_cast<core::view::CallRender2D*>(&call);
	if (cr == NULL) return false;

	CallCinematicCamera *ccc = this->getDataSlot.CallAs<CallCinematicCamera>();
	if (ccc != NULL) {
		if (!(*ccc) (CallCinematicCamera::CallForGetKeyframes)){
			ccc = NULL;
		}
	}

	call.SetBoundingBox(cr->GetViewport());
	lineLength = cr->GetViewport().GetSize().GetWidth() - 10.0f;
	lineYPos = cr->GetViewport().GetSize().GetHeight() / 2.0f;
	return true;
}


/*
* cinematiccamera::TimeLineRenderer::release
*/
void megamol::cinematiccamera::TimeLineRenderer::release(void) {
	// intentionally empty
}


/*
* cinematiccamera::TimeLineRenderer::Render
*/
bool megamol::cinematiccamera::TimeLineRenderer::Render(view::CallRender2D& call) {
	updateParameters();
	view::CallRender2D *cr = dynamic_cast<view::CallRender2D*>(&call);
	if (cr == NULL) return false;
	

	vislib::Array<Keyframe> *keyframes;
	
	cinematiccamera::CallCinematicCamera *kfc = this->getDataSlot.CallAs<cinematiccamera::CallCinematicCamera>();
	if (kfc == NULL) return false;
	if (!(*kfc)(CallCinematicCamera::CallForGetKeyframes)) return false;
	
	keyframes = kfc->getKeyframes();
		 
	glDisable(GL_CULL_FACE);
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

	// get the diagram color (inverse background color)
	float bgColor[4];
	float fgColor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
	glGetFloatv(GL_COLOR_CLEAR_VALUE, bgColor);
	for (unsigned int i = 0; i < 4; i++) {
		fgColor[i] -= bgColor[i];
	}

{'fraction_non_alphanumeric': 0.1540689655172414, 'fraction_numerical': 0.011034482758620689, 'mean_word_length': 6.68114406779661, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7625994', 'n_tokens_mistral': 2677, 'n_tokens_neox': 2504, 'n_words': 409}