diff --git a/panda/metalibs/panda/Sources.pp b/panda/metalibs/panda/Sources.pp index 0d5df2dc05..4dab6829a0 100644 --- a/panda/metalibs/panda/Sources.pp +++ b/panda/metalibs/panda/Sources.pp @@ -9,7 +9,7 @@ #define USE_PACKAGES net #define COMPONENT_LIBS \ - recorder pgraph pipeline \ + recorder pgraph pgraphnodes pipeline \ pvrpn grutil chan pstatclient \ char chat collide cull device \ dgraph display event gobj graph gsgbase \ diff --git a/panda/src/display/Sources.pp b/panda/src/display/Sources.pp index 0552f16edd..c1488fac69 100644 --- a/panda/src/display/Sources.pp +++ b/panda/src/display/Sources.pp @@ -5,7 +5,7 @@ #begin lib_target #define TARGET display #define LOCAL_LIBS \ - pgraph cull putil gsgbase gobj linmath mathutil \ + pgraph pgraphnodes cull putil gsgbase gobj linmath mathutil \ pstatclient #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx diff --git a/panda/src/pandabase/pandasymbols.h b/panda/src/pandabase/pandasymbols.h index 55ae747b8a..71ce3470f9 100644 --- a/panda/src/pandabase/pandasymbols.h +++ b/panda/src/pandabase/pandasymbols.h @@ -318,6 +318,9 @@ #define EXPCL_PANDA_PGRAPH EXPCL_PANDA #define EXPTP_PANDA_PGRAPH EXPTP_PANDA +#define EXPCL_PANDA_PGRAPHNODES EXPCL_PANDA +#define EXPTP_PANDA_PGRAPHNODES EXPTP_PANDA + #define EXPCL_PANDA_RECORDER EXPCL_PANDA #define EXPTP_PANDA_RECORDER EXPTP_PANDA diff --git a/panda/src/pgraph/Sources.pp b/panda/src/pgraph/Sources.pp index 82591aa979..046d4e2386 100644 --- a/panda/src/pgraph/Sources.pp +++ b/panda/src/pgraph/Sources.pp @@ -15,7 +15,6 @@ #define SOURCES \ accumulatedAttribs.I accumulatedAttribs.h \ alphaTestAttrib.I alphaTestAttrib.h \ - ambientLight.I ambientLight.h \ antialiasAttrib.I antialiasAttrib.h \ attribNodeRegistry.I attribNodeRegistry.h \ attribSlots.h attribSlots.I \ @@ -48,10 +47,10 @@ depthOffsetAttrib.I depthOffsetAttrib.h \ depthTestAttrib.I depthTestAttrib.h \ depthWriteAttrib.I depthWriteAttrib.h \ - directionalLight.I directionalLight.h \ drawMaskAttrib.I drawMaskAttrib.h \ eventStorePandaNode.I eventStorePandaNode.h \ - fadeLodNode.I fadeLodNode.h fadeLodNodeData.h \ + fadeLodNode.I fadeLodNode.h \ + fadeLodNodeData.h \ findApproxLevelEntry.I findApproxLevelEntry.h \ findApproxPath.I findApproxPath.h \ fog.I fog.h \ @@ -63,8 +62,6 @@ light.I light.h \ lightAttrib.I lightAttrib.h \ lightRampAttrib.I lightRampAttrib.h \ - lightLensNode.I lightLensNode.h \ - lightNode.I lightNode.h \ loader.I loader.h \ loaderFileType.h \ loaderFileTypeBam.h \ @@ -85,9 +82,8 @@ pandaNode.I pandaNode.h \ pandaNodeChain.I pandaNodeChain.h \ planeNode.I planeNode.h \ - pointLight.I pointLight.h \ - polylightNode.I polylightNode.h \ polylightEffect.I polylightEffect.h \ + polylightNode.I polylightNode.h \ portalNode.I portalNode.h \ portalClipper.I portalClipper.h \ renderAttrib.I renderAttrib.h \ @@ -101,18 +97,14 @@ sceneSetup.I sceneSetup.h \ scissorAttrib.I scissorAttrib.h \ scissorEffect.I scissorEffect.h \ - selectiveChildNode.I selectiveChildNode.h \ - sequenceNode.I sequenceNode.h \ shadeModelAttrib.I shadeModelAttrib.h \ shaderAttrib.I shaderAttrib.h \ - shaderGenerator.I shaderGenerator.h \ + shaderGeneratorBase.I shaderGeneratorBase.h \ shaderInput.I shaderInput.h \ shaderPool.I shaderPool.h \ showBoundsEffect.I showBoundsEffect.h \ - spotlight.I spotlight.h \ stateMunger.I stateMunger.h \ stencilAttrib.I stencilAttrib.h \ - switchNode.I switchNode.h \ texMatrixAttrib.I texMatrixAttrib.h \ texProjectorEffect.I texProjectorEffect.h \ textureAttrib.I textureAttrib.h \ @@ -130,7 +122,6 @@ #define INCLUDED_SOURCES \ accumulatedAttribs.cxx \ alphaTestAttrib.cxx \ - ambientLight.cxx \ antialiasAttrib.cxx \ attribNodeRegistry.cxx \ attribSlots.cxx \ @@ -161,10 +152,10 @@ depthOffsetAttrib.cxx \ depthTestAttrib.cxx \ depthWriteAttrib.cxx \ - directionalLight.cxx \ drawMaskAttrib.cxx \ eventStorePandaNode.cxx \ - fadeLodNode.cxx fadeLodNodeData.cxx \ + fadeLodNode.cxx \ + fadeLodNodeData.cxx \ findApproxLevelEntry.cxx \ findApproxPath.cxx \ fog.cxx \ @@ -176,8 +167,6 @@ light.cxx \ lightAttrib.cxx \ lightRampAttrib.cxx \ - lightLensNode.cxx \ - lightNode.cxx \ loader.cxx \ loaderFileType.cxx \ loaderFileTypeBam.cxx \ @@ -197,9 +186,8 @@ pandaNode.cxx \ pandaNodeChain.cxx \ planeNode.cxx \ - pointLight.cxx \ - polylightNode.cxx \ polylightEffect.cxx \ + polylightNode.cxx \ portalNode.cxx \ portalClipper.cxx \ renderAttrib.cxx \ @@ -213,18 +201,14 @@ sceneSetup.cxx \ scissorAttrib.cxx \ scissorEffect.cxx \ - selectiveChildNode.cxx \ - sequenceNode.cxx \ shadeModelAttrib.cxx \ shaderAttrib.cxx \ - shaderGenerator.cxx \ + shaderGeneratorBase.cxx \ shaderInput.cxx \ shaderPool.cxx \ showBoundsEffect.cxx \ - spotlight.cxx \ stateMunger.cxx \ stencilAttrib.cxx \ - switchNode.cxx \ texMatrixAttrib.cxx \ texProjectorEffect.cxx \ textureAttrib.cxx \ @@ -239,7 +223,6 @@ #define INSTALL_HEADERS \ accumulatedAttribs.I accumulatedAttribs.h \ alphaTestAttrib.I alphaTestAttrib.h \ - ambientLight.I ambientLight.h \ antialiasAttrib.I antialiasAttrib.h \ attribNodeRegistry.I attribNodeRegistry.h \ attribSlots.h attribSlots.I \ @@ -272,10 +255,10 @@ depthOffsetAttrib.I depthOffsetAttrib.h \ depthTestAttrib.I depthTestAttrib.h \ depthWriteAttrib.I depthWriteAttrib.h \ - directionalLight.I directionalLight.h \ drawMaskAttrib.I drawMaskAttrib.h \ eventStorePandaNode.I eventStorePandaNode.h \ - fadeLodNode.I fadeLodNode.h fadeLodNodeData.h \ + fadeLodNode.I fadeLodNode.h \ + fadeLodNodeData.h \ fog.I fog.h \ fogAttrib.I fogAttrib.h \ geomNode.I geomNode.h \ @@ -285,8 +268,6 @@ light.I light.h \ lightAttrib.I lightAttrib.h \ lightRampAttrib.I lightRampAttrib.h \ - lightLensNode.I lightLensNode.h \ - lightNode.I lightNode.h \ loader.I loader.h \ loaderFileType.h \ loaderFileTypeBam.h \ @@ -307,9 +288,8 @@ pandaNode.I pandaNode.h \ pandaNodeChain.I pandaNodeChain.h \ planeNode.I planeNode.h \ - pointLight.I pointLight.h \ - polylightNode.I polylightNode.h \ polylightEffect.I polylightEffect.h \ + polylightNode.I polylightNode.h \ portalNode.I portalNode.h \ portalClipper.I portalClipper.h \ renderAttrib.I renderAttrib.h \ @@ -323,18 +303,14 @@ sceneSetup.I sceneSetup.h \ scissorAttrib.I scissorAttrib.h \ scissorEffect.I scissorEffect.h \ - selectiveChildNode.I selectiveChildNode.h \ - sequenceNode.I sequenceNode.h \ shadeModelAttrib.I shadeModelAttrib.h \ shaderAttrib.I shaderAttrib.h \ - shaderGenerator.I shaderGenerator.h \ + shaderGeneratorBase.I shaderGeneratorBase.h \ shaderInput.I shaderInput.h \ shaderPool.I shaderPool.h \ showBoundsEffect.I showBoundsEffect.h \ - spotlight.I spotlight.h \ stateMunger.I stateMunger.h \ stencilAttrib.I stencilAttrib.h \ - switchNode.I switchNode.h \ texMatrixAttrib.I texMatrixAttrib.h \ texProjectorEffect.I texProjectorEffect.h \ textureAttrib.I textureAttrib.h \ diff --git a/panda/src/pgraph/config_pgraph.cxx b/panda/src/pgraph/config_pgraph.cxx index de232b9e68..1a56c53fe9 100644 --- a/panda/src/pgraph/config_pgraph.cxx +++ b/panda/src/pgraph/config_pgraph.cxx @@ -17,7 +17,6 @@ #include "alphaTestAttrib.h" #include "audioVolumeAttrib.h" #include "auxBitplaneAttrib.h" -#include "ambientLight.h" #include "antialiasAttrib.h" #include "auxSceneData.h" #include "billboardEffect.h" @@ -37,12 +36,11 @@ #include "depthOffsetAttrib.h" #include "depthTestAttrib.h" #include "depthWriteAttrib.h" -#include "directionalLight.h" #include "drawMaskAttrib.h" #include "eventStorePandaNode.h" +#include "findApproxLevelEntry.h" #include "fadeLodNode.h" #include "fadeLodNodeData.h" -#include "findApproxLevelEntry.h" #include "fog.h" #include "fogAttrib.h" #include "geomNode.h" @@ -51,8 +49,6 @@ #include "light.h" #include "lightAttrib.h" #include "lightRampAttrib.h" -#include "lightLensNode.h" -#include "lightNode.h" #include "loader.h" #include "loaderFileType.h" #include "loaderFileTypeBam.h" @@ -67,9 +63,8 @@ #include "nodePathComponent.h" #include "pandaNode.h" #include "planeNode.h" -#include "pointLight.h" -#include "polylightNode.h" #include "polylightEffect.h" +#include "polylightNode.h" #include "portalNode.h" #include "portalClipper.h" #include "renderAttrib.h" @@ -78,8 +73,6 @@ #include "renderModeAttrib.h" #include "renderState.h" #include "rescaleNormalAttrib.h" -#include "selectiveChildNode.h" -#include "sequenceNode.h" #include "scissorAttrib.h" #include "scissorEffect.h" #include "shadeModelAttrib.h" @@ -88,9 +81,7 @@ #include "shader.h" #include "showBoundsEffect.h" #include "stencilAttrib.h" -#include "spotlight.h" #include "stateMunger.h" -#include "switchNode.h" #include "texMatrixAttrib.h" #include "texProjectorEffect.h" #include "textureAttrib.h" @@ -98,7 +89,7 @@ #include "transformState.h" #include "transparencyAttrib.h" #include "nodePathLerps.h" -#include "shaderGenerator.h" +#include "shaderGeneratorBase.h" #include "dconfig.h" @@ -379,7 +370,6 @@ init_libpgraph() { initialized = true; AlphaTestAttrib::init_type(); - AmbientLight::init_type(); AntialiasAttrib::init_type(); AudioVolumeAttrib::init_type(); AuxBitplaneAttrib::init_type(); @@ -401,7 +391,6 @@ init_libpgraph() { DepthOffsetAttrib::init_type(); DepthTestAttrib::init_type(); DepthWriteAttrib::init_type(); - DirectionalLight::init_type(); DrawMaskAttrib::init_type(); EventStorePandaNode::init_type(); FadeLODNode::init_type(); @@ -415,8 +404,6 @@ init_libpgraph() { Light::init_type(); LightAttrib::init_type(); LightRampAttrib::init_type(); - LightLensNode::init_type(); - LightNode::init_type(); Loader::init_type(); LODNode::init_type(); LoaderFileType::init_type(); @@ -431,7 +418,6 @@ init_libpgraph() { PandaNode::init_type(); PandaNodePipelineReader::init_type(); PlaneNode::init_type(); - PointLight::init_type(); PolylightNode::init_type(); PolylightEffect::init_type(); PortalNode::init_type(); @@ -442,19 +428,15 @@ init_libpgraph() { RenderModeAttrib::init_type(); RenderState::init_type(); RescaleNormalAttrib::init_type(); - SelectiveChildNode::init_type(); - SequenceNode::init_type(); ScissorAttrib::init_type(); ScissorEffect::init_type(); ShadeModelAttrib::init_type(); ShaderInput::init_type(); ShaderAttrib::init_type(); - ShaderGenerator::init_type(); + ShaderGeneratorBase::init_type(); ShowBoundsEffect::init_type(); - Spotlight::init_type(); StateMunger::init_type(); StencilAttrib::init_type(); - SwitchNode::init_type(); TexMatrixAttrib::init_type(); TexProjectorEffect::init_type(); TextureAttrib::init_type(); @@ -471,7 +453,6 @@ init_libpgraph() { ColorScaleLerpFunctor::init_type(); AlphaTestAttrib::register_with_read_factory(); - AmbientLight::register_with_read_factory(); AntialiasAttrib::register_with_read_factory(); AudioVolumeAttrib::register_with_read_factory(); AuxBitplaneAttrib::register_with_read_factory(); @@ -489,7 +470,6 @@ init_libpgraph() { DepthOffsetAttrib::register_with_read_factory(); DepthTestAttrib::register_with_read_factory(); DepthWriteAttrib::register_with_read_factory(); - DirectionalLight::register_with_read_factory(); DrawMaskAttrib::register_with_read_factory(); FadeLODNode::register_with_read_factory(); Fog::register_with_read_factory(); @@ -504,14 +484,12 @@ init_libpgraph() { ModelRoot::register_with_read_factory(); PandaNode::register_with_read_factory(); PlaneNode::register_with_read_factory(); - PointLight::register_with_read_factory(); PolylightNode::register_with_read_factory(); PortalNode::register_with_read_factory(); RenderEffects::register_with_read_factory(); RenderModeAttrib::register_with_read_factory(); RenderState::register_with_read_factory(); RescaleNormalAttrib::register_with_read_factory(); - SequenceNode::register_with_read_factory(); ScissorAttrib::register_with_read_factory(); ScissorEffect::register_with_read_factory(); ShadeModelAttrib::register_with_read_factory(); @@ -519,8 +497,6 @@ init_libpgraph() { ShaderAttrib::register_with_read_factory(); Shader::register_with_read_factory(); ShowBoundsEffect::register_with_read_factory(); - Spotlight::register_with_read_factory(); - SwitchNode::register_with_read_factory(); TexMatrixAttrib::register_with_read_factory(); TexProjectorEffect::register_with_read_factory(); TextureAttrib::register_with_read_factory(); diff --git a/panda/src/pgraph/cullableObject.cxx b/panda/src/pgraph/cullableObject.cxx index cbbc0b9b2b..47d6972912 100644 --- a/panda/src/pgraph/cullableObject.cxx +++ b/panda/src/pgraph/cullableObject.cxx @@ -13,11 +13,8 @@ //////////////////////////////////////////////////////////////////// #include "cullableObject.h" -#include "ambientLight.h" #include "lightAttrib.h" #include "nodePath.h" -#include "material.h" -#include "materialAttrib.h" #include "texGenAttrib.h" #include "renderState.h" #include "clockObject.h" @@ -701,20 +698,10 @@ get_flash_cpu_state() { // and never free it. static CPT(RenderState) flash_cpu_state = (const RenderState *)NULL; if (flash_cpu_state == (const RenderState *)NULL) { - PT(AmbientLight) ambient_light = new AmbientLight("alight"); - ambient_light->set_color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)); - NodePath alight(ambient_light); - - CPT(LightAttrib) light_attrib = DCAST(LightAttrib, LightAttrib::make_all_off()); - light_attrib = DCAST(LightAttrib, light_attrib->add_on_light(alight)); - - PT(Material) material = new Material; - material->set_ambient(flash_cpu_color); - material->set_diffuse(flash_cpu_color); - flash_cpu_state = RenderState::make - (light_attrib, - MaterialAttrib::make(material)); + (LightAttrib::make_all_off(), + TextureAttrib::make_off(), + ColorAttrib::make_flat(flash_cpu_color)); } return flash_cpu_state; @@ -735,20 +722,10 @@ get_flash_hardware_state() { // and never free it. static CPT(RenderState) flash_hardware_state = (const RenderState *)NULL; if (flash_hardware_state == (const RenderState *)NULL) { - PT(AmbientLight) ambient_light = new AmbientLight("alight"); - ambient_light->set_color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)); - NodePath alight(ambient_light); - - CPT(LightAttrib) light_attrib = DCAST(LightAttrib, LightAttrib::make_all_off()); - light_attrib = DCAST(LightAttrib, light_attrib->add_on_light(alight)); - - PT(Material) material = new Material; - material->set_ambient(flash_hardware_color); - material->set_diffuse(flash_hardware_color); - flash_hardware_state = RenderState::make - (light_attrib, - MaterialAttrib::make(material)); + (LightAttrib::make_all_off(), + TextureAttrib::make_off(), + ColorAttrib::make_flat(flash_hardware_color)); } return flash_hardware_state; diff --git a/panda/src/pgraph/light.cxx b/panda/src/pgraph/light.cxx index da939e1996..ff72bd55ea 100644 --- a/panda/src/pgraph/light.cxx +++ b/panda/src/pgraph/light.cxx @@ -65,6 +65,17 @@ Light:: ~Light() { } +//////////////////////////////////////////////////////////////////// +// Function: Light::is_ambient_light +// Access: Published, Virtual +// Description: Returns true if this is an AmbientLight, false if it +// is some other kind of light. +//////////////////////////////////////////////////////////////////// +bool Light:: +is_ambient_light() const { + return false; +} + //////////////////////////////////////////////////////////////////// // Function: Light::get_vector_to_light // Access: Public, Virtual diff --git a/panda/src/pgraph/light.h b/panda/src/pgraph/light.h index 61f0169363..a6131761b5 100644 --- a/panda/src/pgraph/light.h +++ b/panda/src/pgraph/light.h @@ -50,6 +50,7 @@ PUBLISHED: virtual ~Light(); virtual PandaNode *as_node()=0; + virtual bool is_ambient_light() const; INLINE const Colorf &get_color() const; INLINE void set_color(const Colorf &color); diff --git a/panda/src/pgraph/lightAttrib.cxx b/panda/src/pgraph/lightAttrib.cxx index 53db288bf2..8aa5a2324a 100644 --- a/panda/src/pgraph/lightAttrib.cxx +++ b/panda/src/pgraph/lightAttrib.cxx @@ -14,7 +14,6 @@ #include "lightAttrib.h" #include "attribSlots.h" -#include "ambientLight.h" #include "pandaNode.h" #include "nodePath.h" #include "graphicsStateGuardianBase.h" @@ -506,7 +505,7 @@ filter_to_max(int max_lights) const { for (li = _on_lights.begin(); li != _on_lights.end(); ++li) { const NodePath &np = (*li); nassertr(!np.is_empty() && np.node()->as_light() != (Light *)NULL, this); - if (np.node()->is_exact_type(AmbientLight::get_class_type())) { + if (np.node()->is_ambient_light()) { ambient_lights.push_back(np); } else { priority_lights.push_back(np); @@ -562,7 +561,7 @@ get_most_important_light() const { for (li = _on_lights.begin(); li != _on_lights.end(); ++li) { const NodePath &np = (*li); nassertr(!np.is_empty() && np.node()->as_light() != (Light *)NULL, NodePath()); - if (!np.node()->is_exact_type(AmbientLight::get_class_type())) { + if (!np.node()->is_ambient_light()) { if (best.is_empty() || compare(np, best)) { best = np; } diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index 91a20602d0..341648e086 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -2464,6 +2464,17 @@ as_light() { return NULL; } +//////////////////////////////////////////////////////////////////// +// Function: PandaNode::is_ambient_light +// Access: Published, Virtual +// Description: Returns true if this is an AmbientLight, false if it +// is not a light, or it is some other kind of light. +//////////////////////////////////////////////////////////////////// +bool PandaNode:: +is_ambient_light() const { + return false; +} + //////////////////////////////////////////////////////////////////// // Function: PandaNode::get_internal_bounds // Access: Protected diff --git a/panda/src/pgraph/pandaNode.h b/panda/src/pgraph/pandaNode.h index be12d43dbb..c2802045d8 100644 --- a/panda/src/pgraph/pandaNode.h +++ b/panda/src/pgraph/pandaNode.h @@ -280,6 +280,7 @@ PUBLISHED: virtual bool is_geom_node() const; virtual bool is_lod_node() const; virtual Light *as_light(); + virtual bool is_ambient_light() const; enum FancyBits { FB_transform = 0x0001, diff --git a/panda/src/pgraph/pgraph_composite1.cxx b/panda/src/pgraph/pgraph_composite1.cxx index 9b9f67fe0c..aff97112b3 100644 --- a/panda/src/pgraph/pgraph_composite1.cxx +++ b/panda/src/pgraph/pgraph_composite1.cxx @@ -1,5 +1,4 @@ #include "accumulatedAttribs.cxx" -#include "ambientLight.cxx" #include "antialiasAttrib.cxx" #include "attribNodeRegistry.cxx" #include "audioVolumeAttrib.cxx" diff --git a/panda/src/pgraph/pgraph_composite2.cxx b/panda/src/pgraph/pgraph_composite2.cxx index 24cbdaf64e..2d9ce24203 100644 --- a/panda/src/pgraph/pgraph_composite2.cxx +++ b/panda/src/pgraph/pgraph_composite2.cxx @@ -13,7 +13,6 @@ #include "depthTestAttrib.cxx" #include "depthWriteAttrib.cxx" #include "alphaTestAttrib.cxx" -#include "directionalLight.cxx" #include "drawMaskAttrib.cxx" #include "eventStorePandaNode.cxx" #include "fadeLodNode.cxx" diff --git a/panda/src/pgraph/pgraph_composite3.cxx b/panda/src/pgraph/pgraph_composite3.cxx index f1345472dc..2d219ce87f 100644 --- a/panda/src/pgraph/pgraph_composite3.cxx +++ b/panda/src/pgraph/pgraph_composite3.cxx @@ -3,8 +3,6 @@ #include "light.cxx" #include "lightAttrib.cxx" #include "lightRampAttrib.cxx" -#include "lightLensNode.cxx" -#include "lightNode.cxx" #include "loader.cxx" #include "loaderFileType.cxx" #include "loaderFileTypeBam.cxx" @@ -24,8 +22,7 @@ #include "pandaNode.cxx" #include "pandaNodeChain.cxx" #include "planeNode.cxx" -#include "pointLight.cxx" -#include "polylightNode.cxx" #include "polylightEffect.cxx" +#include "polylightNode.cxx" #include "portalNode.cxx" #include "portalClipper.cxx" diff --git a/panda/src/pgraph/pgraph_composite4.cxx b/panda/src/pgraph/pgraph_composite4.cxx index 683667bc54..8f83815608 100644 --- a/panda/src/pgraph/pgraph_composite4.cxx +++ b/panda/src/pgraph/pgraph_composite4.cxx @@ -6,20 +6,16 @@ #include "rescaleNormalAttrib.cxx" #include "sceneGraphAnalyzer.cxx" #include "sceneGraphReducer.cxx" -#include "selectiveChildNode.cxx" -#include "sequenceNode.cxx" #include "scissorAttrib.cxx" #include "scissorEffect.cxx" #include "shadeModelAttrib.cxx" #include "shaderInput.cxx" #include "shaderAttrib.cxx" #include "shaderPool.cxx" -#include "shaderGenerator.cxx" +#include "shaderGeneratorBase.cxx" #include "showBoundsEffect.cxx" -#include "spotlight.cxx" #include "stateMunger.cxx" #include "stencilAttrib.cxx" -#include "switchNode.cxx" #include "texMatrixAttrib.cxx" #include "texProjectorEffect.cxx" #include "textureAttrib.cxx" diff --git a/panda/src/pgraph/renderState.cxx b/panda/src/pgraph/renderState.cxx index 424cd755af..01a2b71dbb 100644 --- a/panda/src/pgraph/renderState.cxx +++ b/panda/src/pgraph/renderState.cxx @@ -36,7 +36,7 @@ #include "lightMutexHolder.h" #include "thread.h" #include "attribSlots.h" -#include "shaderGenerator.h" +#include "shaderGeneratorBase.h" LightReMutex *RenderState::_states_lock = NULL; RenderState::States *RenderState::_states = NULL; @@ -1258,7 +1258,7 @@ get_generated_shader() const { if (_generated_shader != (RenderAttrib*)NULL) { return DCAST(ShaderAttrib, _generated_shader); } - ShaderGenerator *gen = ShaderGenerator::get_default(); + ShaderGeneratorBase *gen = ShaderGeneratorBase::get_default(); ((RenderState*)this)->_generated_shader = gen->synthesize_shader(this); return DCAST(ShaderAttrib, _generated_shader); diff --git a/panda/src/pgraph/shaderGeneratorBase.I b/panda/src/pgraph/shaderGeneratorBase.I new file mode 100644 index 0000000000..df5f6bb6eb --- /dev/null +++ b/panda/src/pgraph/shaderGeneratorBase.I @@ -0,0 +1,14 @@ +// Filename: shaderGeneratorBase.I +// Created by: drose (05Nov08) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + diff --git a/panda/src/pgraph/shaderGeneratorBase.cxx b/panda/src/pgraph/shaderGeneratorBase.cxx new file mode 100644 index 0000000000..08d2d81063 --- /dev/null +++ b/panda/src/pgraph/shaderGeneratorBase.cxx @@ -0,0 +1,56 @@ +// Filename: shaderGeneratorBase.cxx +// Created by: drose (05Nov08) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#include "shaderGeneratorBase.h" + +TypeHandle ShaderGeneratorBase::_type_handle; +PT(ShaderGeneratorBase) ShaderGeneratorBase::_default_generator; + +//////////////////////////////////////////////////////////////////// +// Function: ShaderGeneratorBase::Constructor +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +ShaderGeneratorBase:: +ShaderGeneratorBase() { +} + +//////////////////////////////////////////////////////////////////// +// Function: ShaderGeneratorBase::Destructor +// Access: Published, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +ShaderGeneratorBase:: +~ShaderGeneratorBase() { +} + +//////////////////////////////////////////////////////////////////// +// Function: ShaderGeneratorBase::get_default +// Access: Published, Static +// Description: Get a pointer to the default shader generator. +//////////////////////////////////////////////////////////////////// +ShaderGeneratorBase *ShaderGeneratorBase:: +get_default() { + return _default_generator; +} + +//////////////////////////////////////////////////////////////////// +// Function: ShaderGeneratorBase::set_default +// Access: Published, Static +// Description: Set the default shader generator. +//////////////////////////////////////////////////////////////////// +void ShaderGeneratorBase:: +set_default(ShaderGeneratorBase *generator) { + _default_generator = generator; +} diff --git a/panda/src/pgraph/shaderGeneratorBase.h b/panda/src/pgraph/shaderGeneratorBase.h new file mode 100644 index 0000000000..56dd81bc0e --- /dev/null +++ b/panda/src/pgraph/shaderGeneratorBase.h @@ -0,0 +1,59 @@ +// Filename: shaderGeneratorBase.h +// Created by: drose (05Nov08) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#ifndef SHADERGENERATORBASE_H +#define SHADERGENERATORBASE_H + +#include "pandabase.h" +#include "typedWritableReferenceCount.h" + +//////////////////////////////////////////////////////////////////// +// Class : ShaderGeneratorBase +// Description : This is the abstract base class for ShaderGenerator. +//////////////////////////////////////////////////////////////////// +class EXPCL_PANDA_PGRAPH ShaderGeneratorBase : public TypedWritableReferenceCount { +private: + static PT(ShaderGeneratorBase) _default_generator; + +protected: + ShaderGeneratorBase(); + +PUBLISHED: + virtual ~ShaderGeneratorBase(); + static ShaderGeneratorBase *get_default(); + static void set_default(ShaderGeneratorBase *generator); + virtual CPT(RenderAttrib) synthesize_shader(const RenderState *rs)=0; + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + TypedWritableReferenceCount::init_type(); + register_type(_type_handle, "ShaderGeneratorBase", + TypedWritableReferenceCount::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + + private: + static TypeHandle _type_handle; +}; + +#include "shaderGeneratorBase.I" + +#endif // SHADERGENERATORBASE_H + diff --git a/panda/src/pgraphnodes/Sources.pp b/panda/src/pgraphnodes/Sources.pp new file mode 100644 index 0000000000..506ab803eb --- /dev/null +++ b/panda/src/pgraphnodes/Sources.pp @@ -0,0 +1,55 @@ +#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \ + dtoolutil:c dtoolbase:c dtool:m prc:c +#define LOCAL_LIBS \ + lerp event gsgbase gobj putil linmath \ + downloader express pandabase pstatclient pgraph +#define USE_PACKAGES python + +#begin lib_target + #define TARGET pgraphnodes + + #define COMBINED_SOURCES \ + $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx + + #define SOURCES \ + ambientLight.h ambientLight.I \ + config_pgraphnodes.h \ + directionalLight.h directionalLight.I \ + lightLensNode.h lightLensNode.I \ + lightNode.h lightNode.I \ + pointLight.h pointLight.I \ + selectiveChildNode.h selectiveChildNode.I \ + sequenceNode.h sequenceNode.I \ + shaderGenerator.h shaderGenerator.I \ + spotlight.h spotlight.I \ + switchNode.h switchNode.I + + #define INCLUDED_SOURCES \ + ambientLight.cxx \ + config_pgraphnodes.cxx \ + directionalLight.cxx \ + lightLensNode.cxx \ + lightNode.cxx \ + pointLight.cxx \ + selectiveChildNode.cxx \ + sequenceNode.cxx \ + shaderGenerator.cxx \ + spotlight.cxx \ + switchNode.cxx + + #define INSTALL_HEADERS \ + ambientLight.h ambientLight.I \ + config_pgraphnodes.h \ + directionalLight.h directionalLight.I \ + lightLensNode.h lightLensNode.I \ + lightNode.h lightNode.I \ + pointLight.h pointLight.I \ + selectiveChildNode.h selectiveChildNode.I \ + sequenceNode.h sequenceNode.I \ + shaderGenerator.h shaderGenerator.I \ + spotlight.h spotlight.I \ + switchNode.h switchNode.I + + #define IGATESCAN all + +#end lib_target diff --git a/panda/src/pgraph/ambientLight.I b/panda/src/pgraphnodes/ambientLight.I similarity index 100% rename from panda/src/pgraph/ambientLight.I rename to panda/src/pgraphnodes/ambientLight.I diff --git a/panda/src/pgraph/ambientLight.cxx b/panda/src/pgraphnodes/ambientLight.cxx similarity index 93% rename from panda/src/pgraph/ambientLight.cxx rename to panda/src/pgraphnodes/ambientLight.cxx index d610729196..f4301b68c6 100644 --- a/panda/src/pgraph/ambientLight.cxx +++ b/panda/src/pgraphnodes/ambientLight.cxx @@ -85,6 +85,17 @@ write(ostream &out, int indent_level) const { << "color " << get_color() << "\n"; } +//////////////////////////////////////////////////////////////////// +// Function: AmbientLight::is_ambient_light +// Access: Published, Virtual +// Description: Returns true if this is an AmbientLight, false if it +// is some other kind of light. +//////////////////////////////////////////////////////////////////// +bool AmbientLight:: +is_ambient_light() const { + return true; +} + //////////////////////////////////////////////////////////////////// // Function: AmbientLight::bind // Access: Public, Virtual diff --git a/panda/src/pgraph/ambientLight.h b/panda/src/pgraphnodes/ambientLight.h similarity index 95% rename from panda/src/pgraph/ambientLight.h rename to panda/src/pgraphnodes/ambientLight.h index b8cd60291a..5083ce00af 100644 --- a/panda/src/pgraph/ambientLight.h +++ b/panda/src/pgraphnodes/ambientLight.h @@ -26,7 +26,7 @@ // be part of the scene graph, since it has no meaningful // position. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH AmbientLight : public LightNode { +class EXPCL_PANDA_PGRAPHNODES AmbientLight : public LightNode { PUBLISHED: AmbientLight(const string &name); @@ -36,6 +36,7 @@ protected: public: virtual PandaNode *make_copy() const; virtual void write(ostream &out, int indent_level) const; + virtual bool is_ambient_light() const; PUBLISHED: virtual int get_class_priority() const; diff --git a/panda/src/pgraphnodes/config_pgraphnodes.cxx b/panda/src/pgraphnodes/config_pgraphnodes.cxx new file mode 100644 index 0000000000..1b76b3f1cc --- /dev/null +++ b/panda/src/pgraphnodes/config_pgraphnodes.cxx @@ -0,0 +1,75 @@ +// Filename: config_pgraphnodes.cxx +// Created by: drose (05Nov08) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#include "config_pgraphnodes.h" + +#include "ambientLight.h" +#include "directionalLight.h" +#include "lightLensNode.h" +#include "lightNode.h" +#include "pointLight.h" +#include "selectiveChildNode.h" +#include "sequenceNode.h" +#include "shaderGenerator.h" +#include "spotlight.h" +#include "switchNode.h" + +#include "dconfig.h" + +ConfigureDef(config_pgraphnodes); +NotifyCategoryDef(pgraphnodes, ""); + +ConfigureFn(config_pgraphnodes) { + init_libpgraphnodes(); +} + +//////////////////////////////////////////////////////////////////// +// Function: init_libpgraphnodes +// Description: Initializes the library. This must be called at +// least once before any of the functions or classes in +// this library can be used. Normally it will be +// called by the static initializers and need not be +// called explicitly, but special cases exist. +//////////////////////////////////////////////////////////////////// +void +init_libpgraphnodes() { + static bool initialized = false; + if (initialized) { + return; + } + initialized = true; + + AmbientLight::init_type(); + DirectionalLight::init_type(); + LightLensNode::init_type(); + LightNode::init_type(); + PointLight::init_type(); + SelectiveChildNode::init_type(); + SequenceNode::init_type(); + ShaderGenerator::init_type(); + Spotlight::init_type(); + SwitchNode::init_type(); + + AmbientLight::register_with_read_factory(); + DirectionalLight::register_with_read_factory(); + LightLensNode::register_with_read_factory(); + LightNode::register_with_read_factory(); + PointLight::register_with_read_factory(); + SelectiveChildNode::register_with_read_factory(); + SequenceNode::register_with_read_factory(); + Spotlight::register_with_read_factory(); + SwitchNode::register_with_read_factory(); + + ShaderGenerator::set_default(new ShaderGenerator()); +} diff --git a/panda/src/pgraphnodes/config_pgraphnodes.h b/panda/src/pgraphnodes/config_pgraphnodes.h new file mode 100644 index 0000000000..e3f926976c --- /dev/null +++ b/panda/src/pgraphnodes/config_pgraphnodes.h @@ -0,0 +1,27 @@ +// Filename: config_pgraphnodes.h +// Created by: drose (05Nov08) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#ifndef CONFIG_PGRAPHNODES_H +#define CONFIG_PGRAPHNODES_H + +#include "pandabase.h" + +class DSearchPath; + +ConfigureDecl(config_pgraphnodes, EXPCL_PANDA_PGRAPHNODES, EXPTP_PANDA_PGRAPHNODES); +NotifyCategoryDecl(pgraphnodes, EXPCL_PANDA_PGRAPHNODES, EXPTP_PANDA_PGRAPHNODES); + +extern EXPCL_PANDA_PGRAPHNODES void init_libpgraphnodes(); + +#endif diff --git a/panda/src/pgraph/directionalLight.I b/panda/src/pgraphnodes/directionalLight.I similarity index 100% rename from panda/src/pgraph/directionalLight.I rename to panda/src/pgraphnodes/directionalLight.I diff --git a/panda/src/pgraph/directionalLight.cxx b/panda/src/pgraphnodes/directionalLight.cxx similarity index 100% rename from panda/src/pgraph/directionalLight.cxx rename to panda/src/pgraphnodes/directionalLight.cxx diff --git a/panda/src/pgraph/directionalLight.h b/panda/src/pgraphnodes/directionalLight.h similarity index 96% rename from panda/src/pgraph/directionalLight.h rename to panda/src/pgraphnodes/directionalLight.h index febde23dc4..a8a3bfe25b 100644 --- a/panda/src/pgraph/directionalLight.h +++ b/panda/src/pgraphnodes/directionalLight.h @@ -24,7 +24,7 @@ // Description : A light shining from infinitely far away in a // particular direction, like sunlight. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH DirectionalLight : public LightNode { +class EXPCL_PANDA_PGRAPHNODES DirectionalLight : public LightNode { PUBLISHED: DirectionalLight(const string &name); @@ -58,7 +58,7 @@ public: private: // This is the data that must be cycled between pipeline stages. - class EXPCL_PANDA_PGRAPH CData : public CycleData { + class EXPCL_PANDA_PGRAPHNODES CData : public CycleData { public: INLINE CData(); INLINE CData(const CData ©); diff --git a/panda/src/pgraph/lightLensNode.I b/panda/src/pgraphnodes/lightLensNode.I similarity index 100% rename from panda/src/pgraph/lightLensNode.I rename to panda/src/pgraphnodes/lightLensNode.I diff --git a/panda/src/pgraph/lightLensNode.cxx b/panda/src/pgraphnodes/lightLensNode.cxx similarity index 100% rename from panda/src/pgraph/lightLensNode.cxx rename to panda/src/pgraphnodes/lightLensNode.cxx diff --git a/panda/src/pgraph/lightLensNode.h b/panda/src/pgraphnodes/lightLensNode.h similarity index 96% rename from panda/src/pgraph/lightLensNode.h rename to panda/src/pgraphnodes/lightLensNode.h index 7ed226fa05..082fe9d013 100644 --- a/panda/src/pgraph/lightLensNode.h +++ b/panda/src/pgraphnodes/lightLensNode.h @@ -24,7 +24,7 @@ // Class : LightLensNode // Description : A derivative of Light and of LensNode. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH LightLensNode : public Light, public LensNode { +class EXPCL_PANDA_PGRAPHNODES LightLensNode : public Light, public LensNode { PUBLISHED: LightLensNode(const string &name); diff --git a/panda/src/pgraph/lightNode.I b/panda/src/pgraphnodes/lightNode.I similarity index 100% rename from panda/src/pgraph/lightNode.I rename to panda/src/pgraphnodes/lightNode.I diff --git a/panda/src/pgraph/lightNode.cxx b/panda/src/pgraphnodes/lightNode.cxx similarity index 100% rename from panda/src/pgraph/lightNode.cxx rename to panda/src/pgraphnodes/lightNode.cxx diff --git a/panda/src/pgraph/lightNode.h b/panda/src/pgraphnodes/lightNode.h similarity index 96% rename from panda/src/pgraph/lightNode.h rename to panda/src/pgraphnodes/lightNode.h index d1fff6cc16..e55ff88223 100644 --- a/panda/src/pgraph/lightNode.h +++ b/panda/src/pgraphnodes/lightNode.h @@ -26,7 +26,7 @@ // Light except Spotlight (which must inherit from // LensNode instead) inherit from this class. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH LightNode : public Light, public PandaNode { +class EXPCL_PANDA_PGRAPHNODES LightNode : public Light, public PandaNode { PUBLISHED: LightNode(const string &name); diff --git a/panda/src/pgraphnodes/pgraphnodes_composite1.cxx b/panda/src/pgraphnodes/pgraphnodes_composite1.cxx new file mode 100644 index 0000000000..27f734e589 --- /dev/null +++ b/panda/src/pgraphnodes/pgraphnodes_composite1.cxx @@ -0,0 +1,6 @@ +#include "ambientLight.cxx" +#include "config_pgraphnodes.cxx" +#include "directionalLight.cxx" +#include "lightLensNode.cxx" +#include "lightNode.cxx" +#include "pointLight.cxx" diff --git a/panda/src/pgraphnodes/pgraphnodes_composite2.cxx b/panda/src/pgraphnodes/pgraphnodes_composite2.cxx new file mode 100644 index 0000000000..453d9e4a3f --- /dev/null +++ b/panda/src/pgraphnodes/pgraphnodes_composite2.cxx @@ -0,0 +1,5 @@ +#include "selectiveChildNode.cxx" +#include "sequenceNode.cxx" +#include "shaderGenerator.cxx" +#include "spotlight.cxx" +#include "switchNode.cxx" diff --git a/panda/src/pgraph/pointLight.I b/panda/src/pgraphnodes/pointLight.I similarity index 100% rename from panda/src/pgraph/pointLight.I rename to panda/src/pgraphnodes/pointLight.I diff --git a/panda/src/pgraph/pointLight.cxx b/panda/src/pgraphnodes/pointLight.cxx similarity index 100% rename from panda/src/pgraph/pointLight.cxx rename to panda/src/pgraphnodes/pointLight.cxx diff --git a/panda/src/pgraph/pointLight.h b/panda/src/pgraphnodes/pointLight.h similarity index 96% rename from panda/src/pgraph/pointLight.h rename to panda/src/pgraphnodes/pointLight.h index 6b35c68a1e..7478677cce 100644 --- a/panda/src/pgraph/pointLight.h +++ b/panda/src/pgraphnodes/pointLight.h @@ -24,7 +24,7 @@ // Description : A light originating from a single point in space, and // shining in all directions. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH PointLight : public LightNode { +class EXPCL_PANDA_PGRAPHNODES PointLight : public LightNode { PUBLISHED: PointLight(const string &name); @@ -58,7 +58,7 @@ public: private: // This is the data that must be cycled between pipeline stages. - class EXPCL_PANDA_PGRAPH CData : public CycleData { + class EXPCL_PANDA_PGRAPHNODES CData : public CycleData { public: INLINE CData(); INLINE CData(const CData ©); diff --git a/panda/src/pgraph/selectiveChildNode.I b/panda/src/pgraphnodes/selectiveChildNode.I similarity index 100% rename from panda/src/pgraph/selectiveChildNode.I rename to panda/src/pgraphnodes/selectiveChildNode.I diff --git a/panda/src/pgraph/selectiveChildNode.cxx b/panda/src/pgraphnodes/selectiveChildNode.cxx similarity index 100% rename from panda/src/pgraph/selectiveChildNode.cxx rename to panda/src/pgraphnodes/selectiveChildNode.cxx diff --git a/panda/src/pgraph/selectiveChildNode.h b/panda/src/pgraphnodes/selectiveChildNode.h similarity index 96% rename from panda/src/pgraph/selectiveChildNode.h rename to panda/src/pgraphnodes/selectiveChildNode.h index 244c1e9999..352dfe5289 100644 --- a/panda/src/pgraph/selectiveChildNode.h +++ b/panda/src/pgraphnodes/selectiveChildNode.h @@ -24,7 +24,7 @@ // Description : A base class for nodes like LODNode and SequenceNode // that select only one visible child at a time. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH SelectiveChildNode : public PandaNode { +class EXPCL_PANDA_PGRAPHNODES SelectiveChildNode : public PandaNode { PUBLISHED: INLINE SelectiveChildNode(const string &name); diff --git a/panda/src/pgraph/sequenceNode.I b/panda/src/pgraphnodes/sequenceNode.I similarity index 100% rename from panda/src/pgraph/sequenceNode.I rename to panda/src/pgraphnodes/sequenceNode.I diff --git a/panda/src/pgraph/sequenceNode.cxx b/panda/src/pgraphnodes/sequenceNode.cxx similarity index 100% rename from panda/src/pgraph/sequenceNode.cxx rename to panda/src/pgraphnodes/sequenceNode.cxx diff --git a/panda/src/pgraph/sequenceNode.h b/panda/src/pgraphnodes/sequenceNode.h similarity index 96% rename from panda/src/pgraph/sequenceNode.h rename to panda/src/pgraphnodes/sequenceNode.h index a6580a9093..a393cef478 100644 --- a/panda/src/pgraph/sequenceNode.h +++ b/panda/src/pgraphnodes/sequenceNode.h @@ -26,7 +26,7 @@ // Description : A node that automatically cycles through rendering // each one of its children according to its frame rate. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH SequenceNode : public SelectiveChildNode, public AnimInterface { +class EXPCL_PANDA_PGRAPHNODES SequenceNode : public SelectiveChildNode, public AnimInterface { PUBLISHED: INLINE SequenceNode(const string &name); diff --git a/panda/src/pgraph/shaderGenerator.I b/panda/src/pgraphnodes/shaderGenerator.I similarity index 100% rename from panda/src/pgraph/shaderGenerator.I rename to panda/src/pgraphnodes/shaderGenerator.I diff --git a/panda/src/pgraph/shaderGenerator.cxx b/panda/src/pgraphnodes/shaderGenerator.cxx similarity index 97% rename from panda/src/pgraph/shaderGenerator.cxx rename to panda/src/pgraphnodes/shaderGenerator.cxx index 23fbaf6e85..3163c80139 100644 --- a/panda/src/pgraph/shaderGenerator.cxx +++ b/panda/src/pgraphnodes/shaderGenerator.cxx @@ -22,7 +22,6 @@ #include "spotlight.h" TypeHandle ShaderGenerator::_type_handle; -PT(ShaderGenerator) ShaderGenerator::_default_generator; //////////////////////////////////////////////////////////////////// // Function: ShaderGenerator::Constructor @@ -106,29 +105,6 @@ alloc_freg() { return "UNKNOWN"; } -//////////////////////////////////////////////////////////////////// -// Function: ShaderGenerator::get_default -// Access: Published, Static -// Description: Get a pointer to the default shader generator. -//////////////////////////////////////////////////////////////////// -ShaderGenerator *ShaderGenerator:: -get_default() { - if (_default_generator == (ShaderGenerator *)NULL) { - _default_generator = new ShaderGenerator; - } - return _default_generator; -} - -//////////////////////////////////////////////////////////////////// -// Function: ShaderGenerator::set_default -// Access: Published, Static -// Description: Set the default shader generator. -//////////////////////////////////////////////////////////////////// -void ShaderGenerator:: -set_default(ShaderGenerator *generator) { - _default_generator = generator; -} - //////////////////////////////////////////////////////////////////// // Function: ShaderGenerator::analyze_renderstate // Access: Protected diff --git a/panda/src/pgraph/shaderGenerator.h b/panda/src/pgraphnodes/shaderGenerator.h similarity index 91% rename from panda/src/pgraph/shaderGenerator.h rename to panda/src/pgraphnodes/shaderGenerator.h index c43d5048c8..fb0f2955b4 100644 --- a/panda/src/pgraph/shaderGenerator.h +++ b/panda/src/pgraphnodes/shaderGenerator.h @@ -16,8 +16,10 @@ #define SHADERGENERATOR_H #include "pandabase.h" -#include "typedWritableReferenceCount.h" +#include "shaderGeneratorBase.h" +#include "attribSlots.h" #include "nodePath.h" + class AmbientLight; class DirectionalLight; class PointLight; @@ -58,15 +60,10 @@ class ShaderAttrib; // //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH ShaderGenerator : public TypedWritableReferenceCount { -private: - static PT(ShaderGenerator) _default_generator; - +class EXPCL_PANDA_PGRAPHNODES ShaderGenerator : public ShaderGeneratorBase { PUBLISHED: ShaderGenerator(); virtual ~ShaderGenerator(); - static ShaderGenerator *get_default(); - static void set_default(ShaderGenerator *generator); virtual CPT(RenderAttrib) synthesize_shader(const RenderState *rs); protected: @@ -135,9 +132,9 @@ public: return _type_handle; } static void init_type() { - TypedReferenceCount::init_type(); + ShaderGeneratorBase::init_type(); register_type(_type_handle, "ShaderGenerator", - TypedReferenceCount::get_class_type()); + ShaderGeneratorBase::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/pgraph/spotlight.I b/panda/src/pgraphnodes/spotlight.I similarity index 100% rename from panda/src/pgraph/spotlight.I rename to panda/src/pgraphnodes/spotlight.I diff --git a/panda/src/pgraph/spotlight.cxx b/panda/src/pgraphnodes/spotlight.cxx similarity index 100% rename from panda/src/pgraph/spotlight.cxx rename to panda/src/pgraphnodes/spotlight.cxx diff --git a/panda/src/pgraph/spotlight.h b/panda/src/pgraphnodes/spotlight.h similarity index 96% rename from panda/src/pgraph/spotlight.h rename to panda/src/pgraphnodes/spotlight.h index 8b3891af14..4a995c587a 100644 --- a/panda/src/pgraph/spotlight.h +++ b/panda/src/pgraphnodes/spotlight.h @@ -35,7 +35,7 @@ class Texture; // SpotLight, because "spotlight" is a single English // word, instead of two words. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH Spotlight : public LightLensNode { +class EXPCL_PANDA_PGRAPHNODES Spotlight : public LightLensNode { PUBLISHED: Spotlight(const string &name); @@ -78,7 +78,7 @@ private: private: // This is the data that must be cycled between pipeline stages. - class EXPCL_PANDA_PGRAPH CData : public CycleData { + class EXPCL_PANDA_PGRAPHNODES CData : public CycleData { public: INLINE CData(); INLINE CData(const CData ©); diff --git a/panda/src/pgraph/switchNode.I b/panda/src/pgraphnodes/switchNode.I similarity index 100% rename from panda/src/pgraph/switchNode.I rename to panda/src/pgraphnodes/switchNode.I diff --git a/panda/src/pgraph/switchNode.cxx b/panda/src/pgraphnodes/switchNode.cxx similarity index 100% rename from panda/src/pgraph/switchNode.cxx rename to panda/src/pgraphnodes/switchNode.cxx diff --git a/panda/src/pgraph/switchNode.h b/panda/src/pgraphnodes/switchNode.h similarity index 95% rename from panda/src/pgraph/switchNode.h rename to panda/src/pgraphnodes/switchNode.h index 307472ae87..327dd2f0ee 100644 --- a/panda/src/pgraph/switchNode.h +++ b/panda/src/pgraphnodes/switchNode.h @@ -24,7 +24,7 @@ // Description : A node that renders only one of its children, // according to the user's indication. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PGRAPH SwitchNode : public SelectiveChildNode { +class EXPCL_PANDA_PGRAPHNODES SwitchNode : public SelectiveChildNode { PUBLISHED: INLINE SwitchNode(const string &name); @@ -43,7 +43,7 @@ PUBLISHED: virtual int get_visible_child() const; private: - class EXPCL_PANDA_PGRAPH CData : public CycleData { + class EXPCL_PANDA_PGRAPHNODES CData : public CycleData { public: INLINE CData(); INLINE CData(const CData ©);