core system

force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
This commit is contained in:
wmayer
2019-09-18 01:01:14 +02:00
parent f4bc889b4d
commit b50b21576e
88 changed files with 466 additions and 463 deletions

View File

@@ -24,19 +24,19 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# ifdef FC_OS_WIN32
# include <windows.h>
# endif
# ifdef FC_OS_MACOSX
# include <OpenGL/gl.h>
# else
# include <GL/gl.h>
# endif
# ifdef FC_OS_WIN32
# include <windows.h>
# endif
# ifdef FC_OS_MACOSX
# include <OpenGL/gl.h>
# else
# include <GL/gl.h>
# endif
# include <Inventor/actions/SoGetBoundingBoxAction.h>
# include <Inventor/actions/SoGLRenderAction.h>
# include <Inventor/bundles/SoMaterialBundle.h>
# include <Inventor/bundles/SoTextureCoordinateBundle.h>
# include <Inventor/elements/SoLazyElement.h>
# include <Inventor/bundles/SoMaterialBundle.h>
# include <Inventor/bundles/SoTextureCoordinateBundle.h>
# include <Inventor/elements/SoLazyElement.h>
# include <Inventor/elements/SoViewportRegionElement.h>
# include <Inventor/elements/SoViewVolumeElement.h>
# include <Inventor/elements/SoModelMatrixElement.h>
@@ -60,7 +60,7 @@
using namespace Gui;
SO_KIT_SOURCE(SoShapeScale);
SO_KIT_SOURCE(SoShapeScale)
// Constructor.
SoShapeScale::SoShapeScale(void)
@@ -116,7 +116,7 @@ SoShapeScale::GLRender(SoGLRenderAction * action)
// --------------------------------------------------------------
SO_KIT_SOURCE(SoAxisCrossKit);
SO_KIT_SOURCE(SoAxisCrossKit)
void
SoAxisCrossKit::initClass()
@@ -213,15 +213,15 @@ SoAxisCrossKit::createAxes()
set("zHead.transform", "rotation 1 0 0 1.5707999");
// Set colors & styles
set("xAxis.appearance.lightModel", "model BASE_COLOR");
set("xHead.appearance.lightModel", "model BASE_COLOR");
set("yAxis.appearance.lightModel", "model BASE_COLOR");
set("yHead.appearance.lightModel", "model BASE_COLOR");
set("zAxis.appearance.lightModel", "model BASE_COLOR");
set("zHead.appearance.lightModel", "model BASE_COLOR");
set("xAxis.appearance.drawStyle", "lineWidth 1");
set("yAxis.appearance.drawStyle", "lineWidth 1");
set("zAxis.appearance.drawStyle", "lineWidth 1");
set("xAxis.appearance.lightModel", "model BASE_COLOR");
set("xHead.appearance.lightModel", "model BASE_COLOR");
set("yAxis.appearance.lightModel", "model BASE_COLOR");
set("yHead.appearance.lightModel", "model BASE_COLOR");
set("zAxis.appearance.lightModel", "model BASE_COLOR");
set("zHead.appearance.lightModel", "model BASE_COLOR");
set("xAxis.appearance.drawStyle", "lineWidth 1");
set("yAxis.appearance.drawStyle", "lineWidth 1");
set("zAxis.appearance.drawStyle", "lineWidth 1");
set("xAxis.appearance.material", "diffuseColor 0.5 0.125 0.125");
set("xHead.appearance.material", "diffuseColor 0.5 0.125 0.125");
set("yAxis.appearance.material", "diffuseColor 0.125 0.5 0.125");
@@ -239,127 +239,127 @@ SoAxisCrossKit::createAxes()
}
// --------------------------------------------------------------
SO_NODE_SOURCE(SoRegPoint);
void SoRegPoint::initClass()
{
SO_NODE_INIT_CLASS(SoRegPoint, SoShape, "Shape");
}
SoRegPoint::SoRegPoint()
{
SO_NODE_CONSTRUCTOR(SoRegPoint);
SO_NODE_ADD_FIELD(base, (SbVec3f(0,0,0)));
SO_NODE_ADD_FIELD(normal, (SbVec3f(1,1,1)));
SO_NODE_ADD_FIELD(length, (3.0));
SO_NODE_ADD_FIELD(color, (1.0f, 0.447059f, 0.337255f));
SO_NODE_ADD_FIELD(text, (""));
root = new SoSeparator();
root->ref();
// translation
SoTranslation* move = new SoTranslation();
move->translation.setValue(base.getValue() + normal.getValue() * length.getValue());
root->addChild(move);
// sub-group
SoBaseColor* col = new SoBaseColor();
col->rgb.setValue(this->color.getValue());
SoFontStyle* font = new SoFontStyle;
font->size = 14;
SoSeparator* sub = new SoSeparator();
sub->addChild(col);
sub->addChild(font);
sub->addChild(new SoText2());
root->addChild(sub);
}
SoRegPoint::~SoRegPoint()
{
root->unref();
}
/**
* Renders the probe with text label and a bullet at the base point.
*/
void SoRegPoint::GLRender(SoGLRenderAction *action)
{
if (shouldGLRender(action))
{
SoState* state = action->getState();
state->push();
SoMaterialBundle mb(action);
SO_NODE_SOURCE(SoRegPoint)
void SoRegPoint::initClass()
{
SO_NODE_INIT_CLASS(SoRegPoint, SoShape, "Shape");
}
SoRegPoint::SoRegPoint()
{
SO_NODE_CONSTRUCTOR(SoRegPoint);
SO_NODE_ADD_FIELD(base, (SbVec3f(0,0,0)));
SO_NODE_ADD_FIELD(normal, (SbVec3f(1,1,1)));
SO_NODE_ADD_FIELD(length, (3.0));
SO_NODE_ADD_FIELD(color, (1.0f, 0.447059f, 0.337255f));
SO_NODE_ADD_FIELD(text, (""));
root = new SoSeparator();
root->ref();
// translation
SoTranslation* move = new SoTranslation();
move->translation.setValue(base.getValue() + normal.getValue() * length.getValue());
root->addChild(move);
// sub-group
SoBaseColor* col = new SoBaseColor();
col->rgb.setValue(this->color.getValue());
SoFontStyle* font = new SoFontStyle;
font->size = 14;
SoSeparator* sub = new SoSeparator();
sub->addChild(col);
sub->addChild(font);
sub->addChild(new SoText2());
root->addChild(sub);
}
SoRegPoint::~SoRegPoint()
{
root->unref();
}
/**
* Renders the probe with text label and a bullet at the base point.
*/
void SoRegPoint::GLRender(SoGLRenderAction *action)
{
if (shouldGLRender(action))
{
SoState* state = action->getState();
state->push();
SoMaterialBundle mb(action);
SoTextureCoordinateBundle tb(action, true, false);
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
mb.sendFirst(); // make sure we have the correct material
SbVec3f p1 = base.getValue();
SbVec3f p2 = p1 + normal.getValue() * length.getValue();
glLineWidth(1.0f);
glColor3fv(color.getValue().getValue());
glBegin(GL_LINE_STRIP);
glVertex3d(p1[0], p1[1], p1[2]);
glVertex3d(p2[0], p2[1], p2[2]);
glEnd();
glPointSize(5.0f);
glBegin(GL_POINTS);
glVertex3fv(p1.getValue());
glEnd();
glPointSize(2.0f);
glBegin(GL_POINTS);
glVertex3fv(p2.getValue());
glEnd();
root->GLRender(action);
state->pop();
}
}
void SoRegPoint::generatePrimitives(SoAction* /*action*/)
{
}
/**
* Sets the bounding box of the probe to \a box and its center to \a center.
*/
void SoRegPoint::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
{
root->doAction(action);
if (action->getTypeId().isDerivedFrom(SoGetBoundingBoxAction::getClassTypeId()))
static_cast<SoGetBoundingBoxAction*>(action)->resetCenter();
SbVec3f p1 = base.getValue();
SbVec3f p2 = p1 + normal.getValue() * length.getValue();
box.extendBy(p1);
box.extendBy(p2);
center = box.getCenter();
}
void SoRegPoint::notify(SoNotList * node)
{
SoField * f = node->getLastField();
if (f == &this->base || f == &this->normal || f == &this->length) {
SoTranslation* move = static_cast<SoTranslation*>(root->getChild(0));
move->translation.setValue(base.getValue() + normal.getValue() * length.getValue());
}
else if (f == &this->color) {
SoSeparator* sub = static_cast<SoSeparator*>(root->getChild(1));
SoBaseColor* col = static_cast<SoBaseColor*>(sub->getChild(0));
col->rgb = this->color.getValue();
}
else if (f == &this->text) {
SoSeparator* sub = static_cast<SoSeparator*>(root->getChild(1));
SoText2* label = static_cast<SoText2*>(sub->getChild(2));
label->string = this->text.getValue();
}
SoShape::notify(node);
}
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
mb.sendFirst(); // make sure we have the correct material
SbVec3f p1 = base.getValue();
SbVec3f p2 = p1 + normal.getValue() * length.getValue();
glLineWidth(1.0f);
glColor3fv(color.getValue().getValue());
glBegin(GL_LINE_STRIP);
glVertex3d(p1[0], p1[1], p1[2]);
glVertex3d(p2[0], p2[1], p2[2]);
glEnd();
glPointSize(5.0f);
glBegin(GL_POINTS);
glVertex3fv(p1.getValue());
glEnd();
glPointSize(2.0f);
glBegin(GL_POINTS);
glVertex3fv(p2.getValue());
glEnd();
root->GLRender(action);
state->pop();
}
}
void SoRegPoint::generatePrimitives(SoAction* /*action*/)
{
}
/**
* Sets the bounding box of the probe to \a box and its center to \a center.
*/
void SoRegPoint::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
{
root->doAction(action);
if (action->getTypeId().isDerivedFrom(SoGetBoundingBoxAction::getClassTypeId()))
static_cast<SoGetBoundingBoxAction*>(action)->resetCenter();
SbVec3f p1 = base.getValue();
SbVec3f p2 = p1 + normal.getValue() * length.getValue();
box.extendBy(p1);
box.extendBy(p2);
center = box.getCenter();
}
void SoRegPoint::notify(SoNotList * node)
{
SoField * f = node->getLastField();
if (f == &this->base || f == &this->normal || f == &this->length) {
SoTranslation* move = static_cast<SoTranslation*>(root->getChild(0));
move->translation.setValue(base.getValue() + normal.getValue() * length.getValue());
}
else if (f == &this->color) {
SoSeparator* sub = static_cast<SoSeparator*>(root->getChild(1));
SoBaseColor* col = static_cast<SoBaseColor*>(sub->getChild(0));
col->rgb = this->color.getValue();
}
else if (f == &this->text) {
SoSeparator* sub = static_cast<SoSeparator*>(root->getChild(1));
SoText2* label = static_cast<SoText2*>(sub->getChild(2));
label->string = this->text.getValue();
}
SoShape::notify(node);
}