Port to Coin3d 4.x
This commit is contained in:
parent
26d1751aeb
commit
ab012f5bee
|
@ -45,6 +45,7 @@
|
||||||
# include <Inventor/misc/SoState.h>
|
# include <Inventor/misc/SoState.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <Inventor/C/basic.h>
|
||||||
#include <Inventor/draggers/SoTranslate2Dragger.h>
|
#include <Inventor/draggers/SoTranslate2Dragger.h>
|
||||||
#include <Inventor/elements/SoFontNameElement.h>
|
#include <Inventor/elements/SoFontNameElement.h>
|
||||||
#include <Inventor/elements/SoFontSizeElement.h>
|
#include <Inventor/elements/SoFontSizeElement.h>
|
||||||
|
@ -55,7 +56,11 @@
|
||||||
#include <Inventor/elements/SoViewVolumeElement.h>
|
#include <Inventor/elements/SoViewVolumeElement.h>
|
||||||
#include <Inventor/elements/SoViewportRegionElement.h>
|
#include <Inventor/elements/SoViewportRegionElement.h>
|
||||||
#include <Inventor/elements/SoGLTextureEnabledElement.h>
|
#include <Inventor/elements/SoGLTextureEnabledElement.h>
|
||||||
|
#if COIN_MAJOR_VERSION > 3
|
||||||
|
#include <Inventor/elements/SoMultiTextureEnabledElement.h>
|
||||||
|
#else
|
||||||
#include <Inventor/elements/SoGLTexture3EnabledElement.h>
|
#include <Inventor/elements/SoGLTexture3EnabledElement.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "SoTextLabel.h"
|
#include "SoTextLabel.h"
|
||||||
#include "SoFCInteractiveElement.h"
|
#include "SoFCInteractiveElement.h"
|
||||||
|
@ -250,7 +255,11 @@ void SoTextLabel::GLRender(SoGLRenderAction *action)
|
||||||
|
|
||||||
// disable textures for all units
|
// disable textures for all units
|
||||||
SoGLTextureEnabledElement::set(state, this, FALSE);
|
SoGLTextureEnabledElement::set(state, this, FALSE);
|
||||||
|
#if COIN_MAJOR_VERSION > 3
|
||||||
|
SoMultiTextureEnabledElement::set(state, this, FALSE);
|
||||||
|
#else
|
||||||
SoGLTexture3EnabledElement::set(state, this, FALSE);
|
SoGLTexture3EnabledElement::set(state, this, FALSE);
|
||||||
|
#endif
|
||||||
|
|
||||||
glPushAttrib(GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
|
glPushAttrib(GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
||||||
|
@ -285,40 +294,40 @@ void SoTextLabel::GLRender(SoGLRenderAction *action)
|
||||||
|
|
||||||
inherited::GLRender(action);
|
inherited::GLRender(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
|
|
||||||
SO_NODE_SOURCE(SoStringLabel);
|
SO_NODE_SOURCE(SoStringLabel);
|
||||||
|
|
||||||
void SoStringLabel::initClass()
|
void SoStringLabel::initClass()
|
||||||
{
|
{
|
||||||
SO_NODE_INIT_CLASS(SoStringLabel, SoNode, "Node");
|
SO_NODE_INIT_CLASS(SoStringLabel, SoNode, "Node");
|
||||||
}
|
}
|
||||||
|
|
||||||
SoStringLabel::SoStringLabel()
|
SoStringLabel::SoStringLabel()
|
||||||
{
|
{
|
||||||
SO_NODE_CONSTRUCTOR(SoStringLabel);
|
SO_NODE_CONSTRUCTOR(SoStringLabel);
|
||||||
SO_NODE_ADD_FIELD(string, (""));
|
SO_NODE_ADD_FIELD(string, (""));
|
||||||
SO_NODE_ADD_FIELD(textColor, (SbVec3f(1.0f,1.0f,1.0f)));
|
SO_NODE_ADD_FIELD(textColor, (SbVec3f(1.0f,1.0f,1.0f)));
|
||||||
SO_NODE_ADD_FIELD(name, ("Helvetica"));
|
SO_NODE_ADD_FIELD(name, ("Helvetica"));
|
||||||
SO_NODE_ADD_FIELD(size, (12));
|
SO_NODE_ADD_FIELD(size, (12));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the open edges only.
|
* Renders the open edges only.
|
||||||
*/
|
*/
|
||||||
void SoStringLabel::GLRender(SoGLRenderAction *action)
|
void SoStringLabel::GLRender(SoGLRenderAction *action)
|
||||||
{
|
{
|
||||||
QGLWidget* window;
|
QGLWidget* window;
|
||||||
SoState * state = action->getState();
|
SoState * state = action->getState();
|
||||||
state->push();
|
state->push();
|
||||||
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
|
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
|
||||||
SoGLWidgetElement::get(state, window);
|
SoGLWidgetElement::get(state, window);
|
||||||
if (!window) {
|
if (!window) {
|
||||||
state->pop();
|
state->pop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enter in 2D screen mode
|
// Enter in 2D screen mode
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
@ -375,46 +384,46 @@ void SoStringLabel::GLRender(SoGLRenderAction *action)
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
state->pop();
|
state->pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
|
|
||||||
SO_NODE_SOURCE(SoFrameLabel);
|
SO_NODE_SOURCE(SoFrameLabel);
|
||||||
|
|
||||||
void SoFrameLabel::initClass()
|
void SoFrameLabel::initClass()
|
||||||
{
|
{
|
||||||
SO_NODE_INIT_CLASS(SoFrameLabel, SoImage, "Image");
|
SO_NODE_INIT_CLASS(SoFrameLabel, SoImage, "Image");
|
||||||
}
|
}
|
||||||
|
|
||||||
SoFrameLabel::SoFrameLabel()
|
SoFrameLabel::SoFrameLabel()
|
||||||
{
|
{
|
||||||
SO_NODE_CONSTRUCTOR(SoFrameLabel);
|
SO_NODE_CONSTRUCTOR(SoFrameLabel);
|
||||||
SO_NODE_ADD_FIELD(string, (""));
|
SO_NODE_ADD_FIELD(string, (""));
|
||||||
SO_NODE_ADD_FIELD(textColor, (SbVec3f(1.0f,1.0f,1.0f)));
|
SO_NODE_ADD_FIELD(textColor, (SbVec3f(1.0f,1.0f,1.0f)));
|
||||||
SO_NODE_ADD_FIELD(backgroundColor, (SbVec3f(0.0f,0.333f,1.0f)));
|
SO_NODE_ADD_FIELD(backgroundColor, (SbVec3f(0.0f,0.333f,1.0f)));
|
||||||
SO_NODE_ADD_FIELD(justification, (LEFT));
|
SO_NODE_ADD_FIELD(justification, (LEFT));
|
||||||
SO_NODE_ADD_FIELD(name, ("Helvetica"));
|
SO_NODE_ADD_FIELD(name, ("Helvetica"));
|
||||||
SO_NODE_ADD_FIELD(size, (12));
|
SO_NODE_ADD_FIELD(size, (12));
|
||||||
SO_NODE_ADD_FIELD(frame, (TRUE));
|
SO_NODE_ADD_FIELD(frame, (TRUE));
|
||||||
//SO_NODE_ADD_FIELD(image, (SbVec2s(0,0), 0, NULL));
|
//SO_NODE_ADD_FIELD(image, (SbVec2s(0,0), 0, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoFrameLabel::notify(SoNotList * list)
|
void SoFrameLabel::notify(SoNotList * list)
|
||||||
{
|
{
|
||||||
SoField *f = list->getLastField();
|
SoField *f = list->getLastField();
|
||||||
if (f == &this->string ||
|
if (f == &this->string ||
|
||||||
f == &this->textColor ||
|
f == &this->textColor ||
|
||||||
f == &this->backgroundColor ||
|
f == &this->backgroundColor ||
|
||||||
f == &this->justification ||
|
f == &this->justification ||
|
||||||
f == &this->name ||
|
f == &this->name ||
|
||||||
f == &this->size ||
|
f == &this->size ||
|
||||||
f == &this->frame) {
|
f == &this->frame) {
|
||||||
drawImage();
|
drawImage();
|
||||||
}
|
}
|
||||||
inherited::notify(list);
|
inherited::notify(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoFrameLabel::drawImage()
|
void SoFrameLabel::drawImage()
|
||||||
{
|
{
|
||||||
|
@ -475,24 +484,24 @@ void SoFrameLabel::drawImage()
|
||||||
Gui::BitmapFactory().convert(image, sfimage);
|
Gui::BitmapFactory().convert(image, sfimage);
|
||||||
this->image = sfimage;
|
this->image = sfimage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the open edges only.
|
* Renders the open edges only.
|
||||||
*/
|
*/
|
||||||
void SoFrameLabel::GLRender(SoGLRenderAction *action)
|
void SoFrameLabel::GLRender(SoGLRenderAction *action)
|
||||||
{
|
{
|
||||||
inherited::GLRender(action);
|
inherited::GLRender(action);
|
||||||
#if 0
|
#if 0
|
||||||
QGLWidget* window;
|
QGLWidget* window;
|
||||||
SoState * state = action->getState();
|
SoState * state = action->getState();
|
||||||
state->push();
|
state->push();
|
||||||
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
|
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
|
||||||
SoGLWidgetElement::get(state, window);
|
SoGLWidgetElement::get(state, window);
|
||||||
if (!window) {
|
if (!window) {
|
||||||
state->pop();
|
state->pop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enter in 2D screen mode
|
// Enter in 2D screen mode
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
@ -549,12 +558,12 @@ void SoFrameLabel::GLRender(SoGLRenderAction *action)
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
state->pop();
|
state->pop();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
|
|
||||||
SO_NODE_SOURCE(TranslateManip);
|
SO_NODE_SOURCE(TranslateManip);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user