From f182886fce31d5aa796578aebc652cfcbfff31ae Mon Sep 17 00:00:00 2001 From: timoore Date: Thu, 29 Nov 2007 23:55:35 +0000 Subject: [PATCH] Start of cleanup of scene graph node masks --- simgear/scene/util/Makefile.am | 1 + simgear/scene/util/RenderConstants.hxx | 38 ++++++++++++++++++++++++++ simgear/scene/util/SGNodeMasks.hxx | 19 ++++++------- 3 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 simgear/scene/util/RenderConstants.hxx diff --git a/simgear/scene/util/Makefile.am b/simgear/scene/util/Makefile.am index 869fc8eb..b223228c 100644 --- a/simgear/scene/util/Makefile.am +++ b/simgear/scene/util/Makefile.am @@ -14,6 +14,7 @@ include_HEADERS = \ SGSceneUserData.hxx \ SGStateAttributeVisitor.hxx \ SGTextureStateAttributeVisitor.hxx \ + RenderConstants.hxx \ VectorArrayAdapter.hxx diff --git a/simgear/scene/util/RenderConstants.hxx b/simgear/scene/util/RenderConstants.hxx new file mode 100644 index 00000000..91ff7721 --- /dev/null +++ b/simgear/scene/util/RenderConstants.hxx @@ -0,0 +1,38 @@ +/* -*-c++-*- + * + * Copyright (C) 2006-2007 Tim Moore + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ + +#ifndef SIMGEAR_RENDER_CONSTANTS_HXX +#define SIMGEAR_RENDER_CONSTANTS_HXX +// Constants used in the scene graph, both node masks and render bins. +namespace simgear { + +enum NodeMask { + TERRAIN_BIT = (1 << 0), + MAINMODEL_BIT = (1 << 1), + CASTSHADOW_BIT = (1 << 2), + RECEIVESHADOW_BIT = (1 << 3), + GUI_BIT = (1 << 4), + PANEL2D_BIT = (1 << 5), + PICK_BIT = (1 << 6) + // Different classes of lights turned on by node masks +}; +} +#endif diff --git a/simgear/scene/util/SGNodeMasks.hxx b/simgear/scene/util/SGNodeMasks.hxx index 79ac6eb9..19520eb6 100644 --- a/simgear/scene/util/SGNodeMasks.hxx +++ b/simgear/scene/util/SGNodeMasks.hxx @@ -22,19 +22,18 @@ #ifndef SG_SCENE_NODEMASKS_HXX #define SG_SCENE_NODEMASKS_HXX +#include "RenderConstants.hxx" + /// If set, do terrain elevation computations with that nodes -#define SG_NODEMASK_TERRAIN_BIT (1<<0) +#define SG_NODEMASK_TERRAIN_BIT simgear::TERRAIN_BIT /// If set, this is the main model of this simulation -#define SG_NODEMASK_MAINMODEL_BIT (1<<1) +#define SG_NODEMASK_MAINMODEL_BIT simgear::MAINMODEL_BIT /// If set, cast shadows -#define SG_NODEMASK_CASTSHADOW_BIT (1<<2) +#define SG_NODEMASK_CASTSHADOW_BIT simgear::CASTSHADOW_BIT /// If set, cast recieves shadows -#define SG_NODEMASK_RECIEVESHADOW_BIT (1<<3) -/// If set, the node is a gui element -#define SG_NODEMASK_GUI_BIT (1<<4) -/// If set, the node is a 2D panel -#define SG_NODEMASK_2DPANEL_BIT (1<<5) +#define SG_NODEMASK_RECIEVESHADOW_BIT simgear::RECEIVESHADOW_BIT +#define SG_NODEMASK_GUI_BIT simgear::GUI_BIT +#define SG_NODEMASK_2DPANEL_BIT simgear::PANEL2D_BIT /// If set, the node is pickable -#define SG_NODEMASK_PICK_BIT (1<<6) - +#define SG_NODEMASK_PICK_BIT simgear::PICK_BIT #endif -- 2.39.5