From Ruben, addition of osg::PointSprite and osgpointsprite example.
This commit is contained in:
@@ -152,6 +152,7 @@ EXAMPLE_DIRS = \
|
||||
osgparticle\
|
||||
osgpick\
|
||||
osgpoints\
|
||||
osgpointsprite\
|
||||
osgprerender\
|
||||
osgprerendercubemap\
|
||||
osgreflect\
|
||||
|
||||
@@ -726,6 +726,33 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Example osgpointsprite"=.\examples\osgpointsprite\osgpointsprite.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osg
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgDB
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgGA
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgProducer
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name Core osgUtil
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Example osgscalarbar"=.\examples\osgscalarbar\osgscalarbar.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
||||
97
VisualStudio/examples/osgpointsprite/osgpointsprite.dsp
Normal file
97
VisualStudio/examples/osgpointsprite/osgpointsprite.dsp
Normal file
@@ -0,0 +1,97 @@
|
||||
# Microsoft Developer Studio Project File - Name="Example osgpointsprite" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=Example osgpointsprite - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "osgpointsprite.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "osgpointsprite.mak" CFG="Example osgpointsprite - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Example osgpointsprite - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "Example osgpointsprite - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Example osgpointsprite - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm200 /c
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 /nologo /subsystem:console /pdb:none /machine:I386 /out:"../../../bin/osgpointsprite.exe" /libpath:"../../../lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Example osgpointsprite - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /vd0 /GR /GX /Zi /Od /I "../../../include" /D "_CONSOLE" /D "_MBCS" /D "FL_DLL" /D "WIN32" /D "_DEBUG" /FR /YX /FD /Zm200 /c
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 glu32.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/osgpointsprited.exe" /pdbtype:sept /libpath:"../../../lib"
|
||||
# SUBTRACT LINK32 /incremental:no
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Example osgpointsprite - Win32 Release"
|
||||
# Name "Example osgpointsprite - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\examples\osgpointsprite\osgpointsprite.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Project
|
||||
@@ -327,6 +327,10 @@ SOURCE=..\..\src\osg\Point.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\osg\PointSprite.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\osg\PolygonMode.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -739,6 +743,10 @@ SOURCE=..\..\Include\Osg\Point
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Include\Osg\PointSprite
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Include\Osg\PolygonMode
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -226,6 +226,10 @@ SOURCE=..\..\..\src\osgPlugins\osg\Point.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\osg\PointSprite.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\osg\PolygonMode.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
55
include/osg/PointSprite
Normal file
55
include/osg/PointSprite
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSG_POINT_SPRITE
|
||||
#define OSG_POINT_SPRITE 1
|
||||
|
||||
#include <osg/GL>
|
||||
#include <osg/StateAttribute>
|
||||
|
||||
#ifndef GL_ARB_point_sprite
|
||||
#define GL_POINT_SPRITE_ARB 0x8861
|
||||
#define GL_COORD_REPLACE_ARB 0x8862
|
||||
#endif
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** PointSprite base class which encapsulates enabling of point sprites .*/
|
||||
class SG_EXPORT PointSprite : public osg::StateAttribute {
|
||||
public:
|
||||
|
||||
PointSprite() {}
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
PointSprite(const PointSprite& texenv,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
||||
StateAttribute(texenv,copyop) {}
|
||||
|
||||
|
||||
META_StateAttribute(osg, PointSprite, GL_POINT_SPRITE_ARB);
|
||||
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
virtual int compare(const StateAttribute& sa) const;
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const;
|
||||
|
||||
virtual bool isTextureAttribute() const { return true; }
|
||||
|
||||
virtual void apply(osg::State& state) const;
|
||||
|
||||
protected:
|
||||
virtual ~PointSprite( void ) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -60,6 +60,7 @@ CXXFILES =\
|
||||
OccluderNode.cpp\
|
||||
PagedLOD.cpp\
|
||||
Point.cpp\
|
||||
PointSprite.cpp\
|
||||
PolygonMode.cpp\
|
||||
PolygonOffset.cpp\
|
||||
PolygonStipple.cpp\
|
||||
|
||||
36
src/osg/PointSprite.cpp
Normal file
36
src/osg/PointSprite.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osg/GLExtensions>
|
||||
#include <osg/GL>
|
||||
#include <osg/PointSprite>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
int PointSprite::compare(const StateAttribute& sa) const
|
||||
{
|
||||
// check the types are equal and then create the rhs variable
|
||||
// used by the COMPARE_StateAttribute_Paramter macro's below.
|
||||
COMPARE_StateAttribute_Types(PointSprite,sa)
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
void PointSprite::getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
{
|
||||
modes.push_back(GL_POINT_SPRITE_ARB);
|
||||
}
|
||||
|
||||
void PointSprite::apply(osg::State&) const
|
||||
{
|
||||
glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, 1);
|
||||
}
|
||||
@@ -36,6 +36,7 @@ CXXFILES =\
|
||||
OccluderNode.cpp\
|
||||
PagedLOD.cpp\
|
||||
Point.cpp\
|
||||
PointSprite.cpp\
|
||||
PolygonMode.cpp\
|
||||
PolygonOffset.cpp\
|
||||
PositionAttitudeTransform.cpp\
|
||||
|
||||
38
src/osgPlugins/osg/PointSprite.cpp
Normal file
38
src/osgPlugins/osg/PointSprite.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include "osg/PointSprite"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool PointSprite_readLocalData(Object& obj, Input& fr);
|
||||
bool PointSprite_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_PointSpriteProxy
|
||||
(
|
||||
new osg::PointSprite,
|
||||
"PointSprite",
|
||||
"Object StateAttribute PointSprite",
|
||||
&PointSprite_readLocalData,
|
||||
&PointSprite_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool PointSprite_readLocalData(Object&, Input&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool PointSprite_writeLocalData(const Object&,Output&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user