commit
b3249c7893
@ -0,0 +1,217 @@
|
|||||||
|
# - Try to find GLib2
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# GLIB2_FOUND - system has GLib2
|
||||||
|
# GLIB2_INCLUDE_DIRS - the GLib2 include directory
|
||||||
|
# GLIB2_LIBRARIES - Link these to use GLib2
|
||||||
|
#
|
||||||
|
# HAVE_GLIB_GREGEX_H glib has gregex.h header and
|
||||||
|
# supports g_regex_match_simple
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
|
||||||
|
# Copyright (c) 2006 Philippe Bernery <philippe.bernery@gmail.com>
|
||||||
|
# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
|
||||||
|
# Copyright (c) 2007 Alban Browaeys <prahal@yahoo.com>
|
||||||
|
# Copyright (c) 2008 Michael Bell <michael.bell@web.de>
|
||||||
|
# Copyright (c) 2008 Bjoern Ricks <bjoern.ricks@googlemail.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
|
||||||
|
# in cache already
|
||||||
|
SET(GLIB2_FOUND TRUE)
|
||||||
|
ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
|
||||||
|
|
||||||
|
INCLUDE(FindPkgConfig)
|
||||||
|
|
||||||
|
## Glib
|
||||||
|
IF ( GLIB2_FIND_REQUIRED )
|
||||||
|
SET( _pkgconfig_REQUIRED "REQUIRED" )
|
||||||
|
ELSE ( GLIB2_FIND_REQUIRED )
|
||||||
|
SET( _pkgconfig_REQUIRED "" )
|
||||||
|
ENDIF ( GLIB2_FIND_REQUIRED )
|
||||||
|
|
||||||
|
IF ( GLIB2_MIN_VERSION )
|
||||||
|
PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} )
|
||||||
|
ELSE ( GLIB2_MIN_VERSION )
|
||||||
|
PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 )
|
||||||
|
ENDIF ( GLIB2_MIN_VERSION )
|
||||||
|
IF ( PKG_CONFIG_FOUND )
|
||||||
|
IF ( GLIB2_FOUND )
|
||||||
|
SET ( GLIB2_CORE_FOUND TRUE )
|
||||||
|
ELSE ( GLIB2_FOUND )
|
||||||
|
SET ( GLIB2_CORE_FOUND FALSE )
|
||||||
|
ENDIF ( GLIB2_FOUND )
|
||||||
|
ENDIF ( PKG_CONFIG_FOUND )
|
||||||
|
|
||||||
|
# Look for glib2 include dir and libraries w/o pkgconfig
|
||||||
|
IF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND )
|
||||||
|
FIND_PATH(
|
||||||
|
_glibconfig_include_DIR
|
||||||
|
NAMES
|
||||||
|
glibconfig.h
|
||||||
|
PATHS
|
||||||
|
/opt/gnome/lib64
|
||||||
|
/opt/gnome/lib
|
||||||
|
/opt/lib/
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib/
|
||||||
|
/usr/lib64
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/include
|
||||||
|
${CMAKE_LIBRARY_PATH}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
glib-2.0/include
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_PATH(
|
||||||
|
_glib2_include_DIR
|
||||||
|
NAMES
|
||||||
|
glib.h
|
||||||
|
PATHS
|
||||||
|
/opt/gnome/include
|
||||||
|
/opt/local/include
|
||||||
|
/sw/include
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
PATH_SUFFIXES
|
||||||
|
glib-2.0
|
||||||
|
)
|
||||||
|
|
||||||
|
#MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}")
|
||||||
|
|
||||||
|
FIND_LIBRARY(
|
||||||
|
_glib2_link_DIR
|
||||||
|
NAMES
|
||||||
|
glib-2.0
|
||||||
|
glib
|
||||||
|
PATHS
|
||||||
|
/opt/gnome/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
)
|
||||||
|
IF ( _glib2_include_DIR AND _glib2_link_DIR )
|
||||||
|
SET ( _glib2_FOUND TRUE )
|
||||||
|
ENDIF ( _glib2_include_DIR AND _glib2_link_DIR )
|
||||||
|
|
||||||
|
|
||||||
|
IF ( _glib2_FOUND )
|
||||||
|
SET ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} )
|
||||||
|
SET ( GLIB2_LIBRARIES ${_glib2_link_DIR} )
|
||||||
|
SET ( GLIB2_CORE_FOUND TRUE )
|
||||||
|
ELSE ( _glib2_FOUND )
|
||||||
|
SET ( GLIB2_CORE_FOUND FALSE )
|
||||||
|
ENDIF ( _glib2_FOUND )
|
||||||
|
|
||||||
|
# Handle dependencies
|
||||||
|
# libintl
|
||||||
|
IF ( NOT LIBINTL_FOUND )
|
||||||
|
FIND_PATH(LIBINTL_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
libintl.h
|
||||||
|
PATHS
|
||||||
|
/opt/gnome/include
|
||||||
|
/opt/local/include
|
||||||
|
/sw/include
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(LIBINTL_LIBRARY
|
||||||
|
NAMES
|
||||||
|
intl
|
||||||
|
PATHS
|
||||||
|
/opt/gnome/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
IF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
|
||||||
|
SET (LIBINTL_FOUND TRUE)
|
||||||
|
ENDIF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
|
||||||
|
ENDIF ( NOT LIBINTL_FOUND )
|
||||||
|
|
||||||
|
# libiconv
|
||||||
|
IF ( NOT LIBICONV_FOUND )
|
||||||
|
FIND_PATH(LIBICONV_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
iconv.h
|
||||||
|
PATHS
|
||||||
|
/opt/gnome/include
|
||||||
|
/opt/local/include
|
||||||
|
/opt/local/include
|
||||||
|
/sw/include
|
||||||
|
/sw/include
|
||||||
|
/usr/local/include
|
||||||
|
/usr/include
|
||||||
|
PATH_SUFFIXES
|
||||||
|
glib-2.0
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(LIBICONV_LIBRARY
|
||||||
|
NAMES
|
||||||
|
iconv
|
||||||
|
PATHS
|
||||||
|
/opt/gnome/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
|
||||||
|
SET (LIBICONV_FOUND TRUE)
|
||||||
|
ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
|
||||||
|
ENDIF ( NOT LIBICONV_FOUND )
|
||||||
|
|
||||||
|
IF (LIBINTL_FOUND)
|
||||||
|
SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY})
|
||||||
|
SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR})
|
||||||
|
ENDIF (LIBINTL_FOUND)
|
||||||
|
|
||||||
|
IF (LIBICONV_FOUND)
|
||||||
|
SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY})
|
||||||
|
SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR})
|
||||||
|
ENDIF (LIBICONV_FOUND)
|
||||||
|
|
||||||
|
ENDIF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND )
|
||||||
|
##
|
||||||
|
|
||||||
|
IF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
|
||||||
|
SET (GLIB2_FOUND TRUE)
|
||||||
|
ENDIF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
|
||||||
|
|
||||||
|
IF (GLIB2_FOUND)
|
||||||
|
IF (NOT GLIB2_FIND_QUIETLY)
|
||||||
|
MESSAGE (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}")
|
||||||
|
ENDIF (NOT GLIB2_FIND_QUIETLY)
|
||||||
|
ELSE (GLIB2_FOUND)
|
||||||
|
IF (GLIB2_FIND_REQUIRED)
|
||||||
|
MESSAGE (SEND_ERROR "Could not find GLib2")
|
||||||
|
ENDIF (GLIB2_FIND_REQUIRED)
|
||||||
|
ENDIF (GLIB2_FOUND)
|
||||||
|
|
||||||
|
# show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view
|
||||||
|
MARK_AS_ADVANCED(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES)
|
||||||
|
MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY)
|
||||||
|
MARK_AS_ADVANCED(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY)
|
||||||
|
|
||||||
|
ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
IF ( GLIB2_FOUND )
|
||||||
|
# Check if system has a newer version of glib
|
||||||
|
# which supports g_regex_match_simple
|
||||||
|
INCLUDE( CheckIncludeFiles )
|
||||||
|
SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} )
|
||||||
|
CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H )
|
||||||
|
# Reset CMAKE_REQUIRED_INCLUDES
|
||||||
|
SET( CMAKE_REQUIRED_INCLUDES "" )
|
||||||
|
ENDIF( GLIB2_FOUND )
|
@ -0,0 +1,51 @@
|
|||||||
|
# - Try to find GObject2
|
||||||
|
# Find GObject2 headers, libraries and the answer to all questions.
|
||||||
|
#
|
||||||
|
# GOBJECT2_FOUND True if GOBJECT2 got found
|
||||||
|
# GOBJECT2_INCLUDE_DIRS Location of GOBJECT2 headers
|
||||||
|
# GOBJECT2_LIBRARIES List of libraries to use GOBJECT2
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Bjoern Ricks <bjoern.ricks@googlemail.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
INCLUDE( FindPkgConfig )
|
||||||
|
|
||||||
|
IF ( GOBJECT2_FIND_REQUIRED )
|
||||||
|
SET( _pkgconfig_REQUIRED "REQUIRED" )
|
||||||
|
ELSE( GOBJECT2_FIND_REQUIRED )
|
||||||
|
SET( _pkgconfig_REQUIRED "" )
|
||||||
|
ENDIF ( GOBJECT2_FIND_REQUIRED )
|
||||||
|
|
||||||
|
IF ( GOBJECT2_MIN_VERSION )
|
||||||
|
PKG_SEARCH_MODULE( GOBJECT2 ${_pkgconfig_REQUIRED} gobject-2.0>=${GOBJECT2_MIN_VERSION} )
|
||||||
|
ELSE ( GOBJECT2_MIN_VERSION )
|
||||||
|
PKG_SEARCH_MODULE( GOBJECT2 ${_pkgconfig_REQUIRED} gobject-2.0 )
|
||||||
|
ENDIF ( GOBJECT2_MIN_VERSION )
|
||||||
|
|
||||||
|
|
||||||
|
IF( NOT GOBJECT2_FOUND AND NOT PKG_CONFIG_FOUND )
|
||||||
|
FIND_PATH( GOBJECT2_INCLUDE_DIRS gobject/gobject.h PATH_SUFFIXES glib-2.0)
|
||||||
|
FIND_LIBRARY( GOBJECT2_LIBRARIES gobject-2.0 )
|
||||||
|
|
||||||
|
# Report results
|
||||||
|
IF ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS )
|
||||||
|
SET( GOBJECT2_FOUND 1 )
|
||||||
|
IF ( NOT GOBJECT2_FIND_QUIETLY )
|
||||||
|
MESSAGE( STATUS "Found GOBJECT2: ${GOBJECT2_LIBRARIES}" )
|
||||||
|
ENDIF ( NOT GOBJECT2_FIND_QUIETLY )
|
||||||
|
ELSE ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS )
|
||||||
|
IF ( GOBJECT2_FIND_REQUIRED )
|
||||||
|
MESSAGE( SEND_ERROR "Could NOT find GOBJECT2" )
|
||||||
|
ELSE ( GOBJECT2_FIND_REQUIRED )
|
||||||
|
IF ( NOT GOBJECT2_FIND_QUIETLY )
|
||||||
|
MESSAGE( STATUS "Could NOT find GOBJECT2" )
|
||||||
|
ENDIF ( NOT GOBJECT2_FIND_QUIETLY )
|
||||||
|
ENDIF ( GOBJECT2_FIND_REQUIRED )
|
||||||
|
ENDIF ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS )
|
||||||
|
ENDIF( NOT GOBJECT2_FOUND AND NOT PKG_CONFIG_FOUND )
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED( GOBJECT2_LIBRARIES GOBJECT2_INCLUDE_DIRS )
|
@ -0,0 +1,57 @@
|
|||||||
|
# - Try to find libGSF
|
||||||
|
#
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# LIBGSF_FOUND - System has LibGSF
|
||||||
|
# LIBGSF_INCLUDE_DIR - The LibGSF include directory
|
||||||
|
# LIBGSF_LIBRARIES - The libraries needed to use LibGSF
|
||||||
|
# LIBGSF_DEFINITIONS - Compiler switches required for using LibGSF
|
||||||
|
# LIBGSF_GSF_EXECUTABLE - The archive utility
|
||||||
|
# LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE - The office files thumbnailer for the GNOME desktop
|
||||||
|
# LIBGSF_GSFVBADUMP_EXECUTABLE - The utility to extract Visual Basic for Applications macros
|
||||||
|
|
||||||
|
# Copyright (c) 2009, Pau Garcia i Quiles <pgquiles@elpauer.org>
|
||||||
|
# Based off FindLibXml2.cmake from CMake 2.6.4 by Alexander Neundorf <neundorf@kde.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
|
||||||
|
IF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES)
|
||||||
|
# in cache already
|
||||||
|
SET(LIBGSF_FIND_QUIETLY TRUE)
|
||||||
|
ENDIF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES)
|
||||||
|
|
||||||
|
IF (NOT WIN32)
|
||||||
|
# use pkg-config to get the directories and then use these values
|
||||||
|
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||||
|
FIND_PACKAGE(PkgConfig)
|
||||||
|
PKG_CHECK_MODULES(PC_LIBGSF libgsf-1)
|
||||||
|
SET(LIBGSF_DEFINITIONS ${PC_LIBGSF_CFLAGS_OTHER})
|
||||||
|
ENDIF (NOT WIN32)
|
||||||
|
|
||||||
|
FIND_PATH(LIBGSF_INCLUDE_DIR gsf/gsf.h
|
||||||
|
HINTS
|
||||||
|
${PC_LIBGSF_INCLUDEDIR}
|
||||||
|
${PC_LIBGSF_INCLUDE_DIRS}
|
||||||
|
PATH_SUFFIXES libgsf-1
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(LIBGSF_LIBRARIES NAMES gsf-1 libgsf-1
|
||||||
|
HINTS
|
||||||
|
${PC_LIBGSF_LIBDIR}
|
||||||
|
${PC_LIBGSF_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_PROGRAM(LIBGSF_GSF_EXECUTABLE gsf)
|
||||||
|
FIND_PROGRAM(LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE gsf-office-thumbnailer)
|
||||||
|
FIND_PROGRAM(LIBGSF_GSFVBADUMP_EXECUTABLE gsf-vba-dump)
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set LIBGSF_FOUND to TRUE if
|
||||||
|
# all listed variables are TRUE
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGSF DEFAULT_MSG LIBGSF_LIBRARIES LIBGSF_INCLUDE_DIR)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(LIBGSF_INCLUDE_DIR LIBGSF_LIBRARIES LIBGSF_GSF_EXECUTABLE LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE LIBGSF_GSFVBADUMP_EXECUTABLE )
|
||||||
|
|
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
FIND_PACKAGE(LIBGSF)
|
||||||
|
|
||||||
|
IF (NOT (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES))
|
||||||
|
MESSAGE(FATAL_ERROR "LIBGSF not found!")
|
||||||
|
ENDIF (NOT (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES))
|
||||||
|
|
||||||
|
FIND_PACKAGE(GOBJECT2)
|
||||||
|
|
||||||
|
if (NOT GOBJECT2_FOUND)
|
||||||
|
MESSAGE(FATAL_ERROR "GOBJECT2 not found!")
|
||||||
|
ENDIF (NOT GOBJECT2_FOUND)
|
||||||
|
|
||||||
|
FIND_PACKAGE(GLIB2)
|
||||||
|
|
||||||
|
if (NOT GLIB2_FOUND)
|
||||||
|
MESSAGE(FATAL_ERROR "GLIB2 not found!")
|
||||||
|
ENDIF (NOT GLIB2_FOUND)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS})
|
||||||
|
INCLUDE_DIRECTORIES(${LIBGSF_INCLUDE_DIR})
|
||||||
|
|
||||||
|
FILE(GLOB SRCS *.cpp builtin/*.cpp builtin/storage/*.cpp update1/*.cpp epoly/*.cpp)
|
||||||
|
FILE(GLOB HDRS *.h builtin/*.h builtin/storage/*.h update1/*.h epoly/*.h)
|
||||||
|
|
||||||
|
NL_TARGET_LIB(pipeline_max
|
||||||
|
${SRCS}
|
||||||
|
${HDRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(pipeline_max
|
||||||
|
${LIBGSF_LIBRARIES}
|
||||||
|
${GLIB2_LIBRARIES}
|
||||||
|
${GOBJECT2_LIBRARIES}
|
||||||
|
nelmisc
|
||||||
|
)
|
||||||
|
|
||||||
|
SET_TARGET_PROPERTIES(pipeline_max PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
|
|
||||||
|
NL_DEFAULT_PROPS(pipeline_max "NeL, Tools, 3D: Pipeline Max (Library)")
|
||||||
|
NL_ADD_LIB_SUFFIX(pipeline_max)
|
||||||
|
NL_ADD_RUNTIME_FLAGS(pipeline_max)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
|
INSTALL(TARGETS pipeline_max LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
@ -0,0 +1,173 @@
|
|||||||
|
/**
|
||||||
|
* \file animatable.cpp
|
||||||
|
* \brief CAnimatable
|
||||||
|
* \date 2012-08-22 08:52GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CAnimatable
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "animatable.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "storage/app_data.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
#define PBM_ANIMATABLE_UNKNOWN2140_CHUNK_ID 0x2140
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CAnimatable::CAnimatable(CScene *scene) : CSceneClass(scene), m_AppData(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CAnimatable::~CAnimatable()
|
||||||
|
{
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
delete m_Unknown2140;
|
||||||
|
m_Unknown2140 = NULL;
|
||||||
|
delete m_AppData;
|
||||||
|
m_AppData = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CAnimatable::DisplayName = ucstring("Animatable");
|
||||||
|
const char *CAnimatable::InternalName = "Animatable";
|
||||||
|
const char *CAnimatable::InternalNameUnknown = "AnimatableUnknown";
|
||||||
|
const NLMISC::CClassId CAnimatable::ClassId = NLMISC::CClassId(0x3101497b, 0x24af711b); /* Not official, please correct */
|
||||||
|
const TSClassId CAnimatable::SuperClassId = 0x77a60fbd; /* Not official, please correct */
|
||||||
|
const CAnimatableClassDesc AnimatableClassDesc(&DllPluginDescBuiltin);
|
||||||
|
const CAnimatableSuperClassDesc AnimatableSuperClassDesc(&AnimatableClassDesc);
|
||||||
|
|
||||||
|
void CAnimatable::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CSceneClass::parse(version);
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
m_Unknown2140 = getChunk(PBM_ANIMATABLE_UNKNOWN2140_CHUNK_ID);
|
||||||
|
if (m_Unknown2140)
|
||||||
|
{
|
||||||
|
// nldebug("Found unknown 0x2140");
|
||||||
|
// TODO: Put std::cout code here
|
||||||
|
}
|
||||||
|
m_AppData = static_cast<STORAGE::CAppData *>(getChunk(PMBS_APP_DATA_CHUNK_ID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimatable::clean()
|
||||||
|
{
|
||||||
|
CSceneClass::clean();
|
||||||
|
if (m_AppData) m_AppData->clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimatable::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CSceneClass::build(version);
|
||||||
|
if (m_Unknown2140)
|
||||||
|
{
|
||||||
|
putChunk(PBM_ANIMATABLE_UNKNOWN2140_CHUNK_ID, m_Unknown2140);
|
||||||
|
}
|
||||||
|
if (m_AppData)
|
||||||
|
{
|
||||||
|
if (m_AppData->entries().size() == 0)
|
||||||
|
{
|
||||||
|
// Discard appdata if it has no entries
|
||||||
|
delete m_AppData;
|
||||||
|
m_AppData = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
putChunk(PMBS_APP_DATA_CHUNK_ID, m_AppData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimatable::disown()
|
||||||
|
{
|
||||||
|
m_Unknown2140 = NULL;
|
||||||
|
m_AppData = NULL;
|
||||||
|
CSceneClass::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimatable::init()
|
||||||
|
{
|
||||||
|
CSceneClass::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CAnimatable::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CSceneClass::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CAnimatable::classDesc() const
|
||||||
|
{
|
||||||
|
return &AnimatableClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimatable::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CSceneClass::toStringLocal(ostream, pad);
|
||||||
|
if (m_AppData && m_AppData->entries().size() != 0)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "AppData: ";
|
||||||
|
m_AppData->toString(ostream, pad + "\t");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
STORAGE::CAppData *CAnimatable::appData()
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers) { nlerror("Not parsed"); return NULL; }
|
||||||
|
if (!m_AppData)
|
||||||
|
{
|
||||||
|
m_AppData = new STORAGE::CAppData();
|
||||||
|
m_AppData->init();
|
||||||
|
}
|
||||||
|
return m_AppData;
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CAnimatable::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case PMBS_APP_DATA_CHUNK_ID:
|
||||||
|
return new STORAGE::CAppData;
|
||||||
|
}
|
||||||
|
return CSceneClass::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
* \file animatable.h
|
||||||
|
* \brief CAnimatable
|
||||||
|
* \date 2012-08-22 08:52GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CAnimatable
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_ANIMATABLE_H
|
||||||
|
#define PIPELINE_ANIMATABLE_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../scene.h"
|
||||||
|
#include "../scene_class.h"
|
||||||
|
#include "../super_class_desc.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
namespace STORAGE {
|
||||||
|
|
||||||
|
class CAppData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CAnimatable
|
||||||
|
* \date 2012-08-22 08:52GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* This scene class owns the AppData chunk
|
||||||
|
*/
|
||||||
|
class CAnimatable : public CSceneClass
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAnimatable(CScene *scene);
|
||||||
|
virtual ~CAnimatable();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const char *InternalNameUnknown;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
// public
|
||||||
|
STORAGE::CAppData *appData();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
IStorageObject *m_Unknown2140;
|
||||||
|
STORAGE::CAppData *m_AppData;
|
||||||
|
|
||||||
|
}; /* class CAnimatable */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CAnimatable> CAnimatableClassDesc;
|
||||||
|
extern const CAnimatableClassDesc AnimatableClassDesc;
|
||||||
|
typedef CSuperClassDesc<CAnimatable> CAnimatableSuperClassDesc;
|
||||||
|
extern const CAnimatableSuperClassDesc AnimatableSuperClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_ANIMATABLE_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,113 @@
|
|||||||
|
/**
|
||||||
|
* \file base_object.cpp
|
||||||
|
* \brief CBaseObject
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CBaseObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "base_object.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CBaseObject::CBaseObject(CScene *scene) : CReferenceTarget(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseObject::~CBaseObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CBaseObject::DisplayName = ucstring("BaseObject");
|
||||||
|
const char *CBaseObject::InternalName = "BaseObject";
|
||||||
|
// const char *CBaseObject::InternalNameUnknown = "BaseObjectUnknown";
|
||||||
|
const NLMISC::CClassId CBaseObject::ClassId = NLMISC::CClassId(0x71c8167a, 0x5a9f57b2); /* Not official, please correct */
|
||||||
|
const TSClassId CBaseObject::SuperClassId = CReferenceTarget::SuperClassId;
|
||||||
|
const CBaseObjectClassDesc BaseObjectClassDesc(&DllPluginDescBuiltin);
|
||||||
|
// const CBaseObjectSuperClassDesc BaseObjectSuperClassDesc(&BaseObjectClassDesc);
|
||||||
|
|
||||||
|
void CBaseObject::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceTarget::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBaseObject::clean()
|
||||||
|
{
|
||||||
|
CReferenceTarget::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBaseObject::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceTarget::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBaseObject::disown()
|
||||||
|
{
|
||||||
|
CReferenceTarget::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBaseObject::init()
|
||||||
|
{
|
||||||
|
CReferenceTarget::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CBaseObject::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CReferenceTarget::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CBaseObject::classDesc() const
|
||||||
|
{
|
||||||
|
return &BaseObjectClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBaseObject::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CReferenceTarget::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CBaseObject::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CReferenceTarget::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* \file base_object.h
|
||||||
|
* \brief CBaseObject
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CBaseObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_BASE_OBJECT_H
|
||||||
|
#define PIPELINE_BASE_OBJECT_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "reference_target.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CBaseObject
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CBaseObject
|
||||||
|
*/
|
||||||
|
class CBaseObject : public CReferenceTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CBaseObject(CScene *scene);
|
||||||
|
virtual ~CBaseObject();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
// static const char *InternalNameUnknown;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CBaseObject */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CBaseObject> CBaseObjectClassDesc;
|
||||||
|
extern const CBaseObjectClassDesc BaseObjectClassDesc;
|
||||||
|
// typedef CSuperClassDesc<CBaseObject> CBaseObjectSuperClassDesc;
|
||||||
|
// extern const CBaseObjectSuperClassDesc BaseObjectSuperClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_BASE_OBJECT_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file bitmap_tex.cpp
|
||||||
|
* \brief CBitmapTex
|
||||||
|
* \date 2012-08-22 08:56GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CBitmapTex
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "bitmap_tex.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CBitmapTex::CBitmapTex(CScene *scene) : CTexmap(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CBitmapTex::~CBitmapTex()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file bitmap_tex.h
|
||||||
|
* \brief CBitmapTex
|
||||||
|
* \date 2012-08-22 08:56GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CBitmapTex
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_BITMAP_TEX_H
|
||||||
|
#define PIPELINE_BITMAP_TEX_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "texmap.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CBitmapTex
|
||||||
|
* \date 2012-08-22 08:56GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CBitmapTex
|
||||||
|
*/
|
||||||
|
class CBitmapTex : public CTexmap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CBitmapTex(CScene *scene);
|
||||||
|
virtual ~CBitmapTex();
|
||||||
|
|
||||||
|
}; /* class CBitmapTex */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_BITMAP_TEX_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,338 @@
|
|||||||
|
/**
|
||||||
|
* \file builtin.cpp
|
||||||
|
* \brief CBuiltin
|
||||||
|
* \date 2012-08-22 09:42GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CBuiltin
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "builtin.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../scene_class_registry.h"
|
||||||
|
|
||||||
|
#include "animatable.h"
|
||||||
|
#include "reference_maker.h"
|
||||||
|
#include "reference_target.h"
|
||||||
|
|
||||||
|
#include "scene_impl.h"
|
||||||
|
|
||||||
|
#include "i_node.h"
|
||||||
|
#include "node_impl.h"
|
||||||
|
#include "root_node.h"
|
||||||
|
|
||||||
|
#include "track_view_node.h"
|
||||||
|
|
||||||
|
#include "base_object.h"
|
||||||
|
#include "object.h"
|
||||||
|
#include "geom_object.h"
|
||||||
|
#include "tri_object.h"
|
||||||
|
#include "poly_object.h"
|
||||||
|
#include "patch_object.h"
|
||||||
|
#include "editable_patch.h"
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// 0x0 - invalid, default to reftarget
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000000> CNullSuperClassDesc;
|
||||||
|
const CNullSuperClassDesc NullSuperClassDesc(&ReferenceTargetClassDesc, "NullSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x9003 bezier float control, subclass under control???; control is under reftarget
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009003> CControlFloatSuperClassDesc;
|
||||||
|
const CControlFloatSuperClassDesc ControlFloatSuperClassDesc(&ReferenceTargetClassDesc, "ControlFloatSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x8 param block, under reftarget directly
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000008> CParamBlockSuperClassDesc;
|
||||||
|
const CParamBlockSuperClassDesc ParamBlockSuperClassDesc(&ReferenceTargetClassDesc, "ParamBlockSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0xc20 uv gen, sub of mtlbase
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000c20> CUVGenSuperClassDesc;
|
||||||
|
const CUVGenSuperClassDesc UVGenSuperClassDesc(&ReferenceTargetClassDesc, "UVGenSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x82 param block 2, under reftarget directly
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000082> CParamBlock2SuperClassDesc;
|
||||||
|
const CParamBlock2SuperClassDesc ParamBlock2SuperClassDesc(&ReferenceTargetClassDesc, "ParamBlock2SuperClassUnknown");
|
||||||
|
|
||||||
|
// 0xc40 output, textureoutput???, under mtlbase
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000c40> CTextureOutputSuperClassDesc;
|
||||||
|
const CTextureOutputSuperClassDesc TextureOutputSuperClassDesc(&ReferenceTargetClassDesc, "TextureOutputSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0xc10 texmap, under mtlbase
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000c10> CTexmapSuperClassDesc;
|
||||||
|
const CTexmapSuperClassDesc TexmapSuperClassDesc(&ReferenceTargetClassDesc, "TexmapSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x1080 texmap_container, 'Texmaps' under reftarget directly
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00001080> CTexmapContainerSuperClassDesc;
|
||||||
|
const CTexmapContainerSuperClassDesc TexmapContainerSuperClassDesc(&ReferenceTargetClassDesc, "TexmapContainerSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x10b0, shader, under baseshader, under special_Fx
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x000010b0> CShaderSuperClassDesc;
|
||||||
|
const CShaderSuperClassDesc ShaderSuperClassDesc(&ReferenceTargetClassDesc, "ShaderSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x1110, sampler, under special_fx
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00001110> CSamplerSuperClassDesc;
|
||||||
|
const CSamplerSuperClassDesc SamplerSuperClassDesc(&ReferenceTargetClassDesc, "SamplerSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0xc00, mtl 'materials', under mtlbase
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000c00> CMtlSuperClassDesc;
|
||||||
|
const CMtlSuperClassDesc MtlSuperClassDesc(&ReferenceTargetClassDesc, "MtlSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0xd00, soundobj, under reftarget directly
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000d00> CSoundObjSuperClassDesc;
|
||||||
|
const CSoundObjSuperClassDesc SoundObjSuperClassDesc(&ReferenceTargetClassDesc, "SoundObjSuperClassUnknown");
|
||||||
|
/*
|
||||||
|
// 0x1, node; under reftarget directly; classid 1 is node, 2 is rootnode
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, > CNodeSuperClassDesc;
|
||||||
|
const CNodeSuperClassDesc NodeSuperClassDesc(&ReferenceTargetClassDesc, "NodeSuperClassUnknown");
|
||||||
|
*/
|
||||||
|
// 0x900b, controlposition, under control???
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x0000900b> CControlPositionSuperClassDesc;
|
||||||
|
const CControlPositionSuperClassDesc ControlPositionSuperClassDesc(&ReferenceTargetClassDesc, "ControlPositionSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x900c, controlrotation, under control???
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x0000900c> CControlRotationSuperClassDesc;
|
||||||
|
const CControlRotationSuperClassDesc ControlRotationSuperClassDesc(&ReferenceTargetClassDesc, "ControlRotationSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x900d, control_scale, under control???
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x0000900d> CControlScaleSuperClassDesc;
|
||||||
|
const CControlScaleSuperClassDesc ControlScaleSuperClassDesc(&ReferenceTargetClassDesc, "ControlScaleSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x9008, pos/rot/scale; controltransform; matrix3; under control???
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009008> CControlTransformSuperClassDesc;
|
||||||
|
const CControlTransformSuperClassDesc ControlTransformSuperClassDesc(&ReferenceTargetClassDesc, "ControlTransformSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x810 - osmodifier, under modifier (physique etc, necessary for skinning)
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000810> COSModifierSuperClassDesc;
|
||||||
|
const COSModifierSuperClassDesc OSModifierSuperClassDesc(&ReferenceTargetClassDesc, "OSModifierSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x9010 - master point controller
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009010> CMasterPointControllerSuperClassDesc;
|
||||||
|
const CMasterPointControllerSuperClassDesc MasterPointControllerSuperClassDesc(&ReferenceTargetClassDesc, "MasterPointControllerSuperClassUnknown");
|
||||||
|
/*
|
||||||
|
// 0x10 - geom object
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000010> CGeomObjectSuperClassDesc;
|
||||||
|
const CGeomObjectSuperClassDesc GeomObjectSuperClassDesc(&ReferenceTargetClassDesc, "GeomObjectSuperClassUnknown");
|
||||||
|
*/
|
||||||
|
// 0x10f0 - layer, under reftarget directly
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x000010f0> CLayerSuperClassDesc;
|
||||||
|
const CLayerSuperClassDesc LayerSuperClassDesc(&ReferenceTargetClassDesc, "LayerSuperClassUnknown");
|
||||||
|
/*
|
||||||
|
// 0x60 - object???, under base object
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000060> CObjectSuperClassDesc;
|
||||||
|
const CObjectSuperClassDesc ObjectSuperClassDesc(&ReferenceTargetClassDesc, "ObjectSuperClassUnknown");
|
||||||
|
*/
|
||||||
|
// 0x50 helperobject, under object...
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000050> CHelperObjectSuperClassDesc;
|
||||||
|
const CHelperObjectSuperClassDesc HelperObjectSuperClassDesc(&ReferenceTargetClassDesc, "HelperObjectSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x10a0 filterkernel, under specialfx (example: area filter)
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x000010a0> CFilterKernelSuperClassDesc;
|
||||||
|
const CFilterKernelSuperClassDesc FilterKernelSuperClassDesc(&ReferenceTargetClassDesc, "FilterKernelSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0xf00 - renderer ,direct sub of reftarget
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000f00> CRendererSuperClassDesc;
|
||||||
|
const CRendererSuperClassDesc RendererSuperClassDesc(&ReferenceTargetClassDesc, "RendererSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x9005 - control point3 (also color), under control???
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009005> CControlPoint3SuperClassDesc;
|
||||||
|
const CControlPoint3SuperClassDesc ControlPoint3SuperClassDesc(&ReferenceTargetClassDesc, "ControlPoint3SuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x1010 - atmospheric, under special effects
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00001010> CAtmosphericSuperClassDesc;
|
||||||
|
const CAtmosphericSuperClassDesc AtmosphericSuperClassDesc(&ReferenceTargetClassDesc, "AtmosphericSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x9011 - control master block 'block control', under control???
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009011> CControlMasterBlockSuperClassDesc;
|
||||||
|
const CControlMasterBlockSuperClassDesc ControlMasterBlockSuperClassDesc(&ReferenceTargetClassDesc, "ControlMasterBlockSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0xfffffe00 - grid reference, not sure where, probably directly under reftarget
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0xfffffe00> CGridReferenceSuperClassDesc;
|
||||||
|
const CGridReferenceSuperClassDesc GridReferenceSuperClassDesc(&ReferenceTargetClassDesc, "GridReferenceSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x1090 - render effect, possibly under special fx
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00001090> CRenderEffectSuperClassDesc;
|
||||||
|
const CRenderEffectSuperClassDesc RenderEffectSuperClassDesc(&ReferenceTargetClassDesc, "RenderEffectSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x10d0 - shadow type, directly under ref target
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x000010d0> CShadowTypeSuperClassDesc;
|
||||||
|
const CShadowTypeSuperClassDesc ShadowTypeSuperClassDesc(&ReferenceTargetClassDesc, "ShadowTypeSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x1160 - CustAttrib, directly under ref target
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00001160> CCustAttribSuperClassDesc;
|
||||||
|
const CCustAttribSuperClassDesc CustAttribSuperClassDesc(&ReferenceTargetClassDesc, "CustAttribSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x9012 - point4list, controlpoint4, also rgba, under controll???
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00009012> CControlPoint4SuperClassDesc;
|
||||||
|
const CControlPoint4SuperClassDesc ControlPoint4SuperClassDesc(&ReferenceTargetClassDesc, "ControlPoint4SuperClassUnknown");
|
||||||
|
|
||||||
|
// 0xb60 - userdatatype, deprecated, don't care
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000b60> CUserDataTypeSuperClassDesc;
|
||||||
|
const CUserDataTypeSuperClassDesc UserDataTypeSuperClassDesc(&ReferenceTargetClassDesc, "UserDataTypeSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x900f - usertype, don't care
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x0000900f> CUserTypeSuperClassDesc;
|
||||||
|
const CUserTypeSuperClassDesc UserTypeSuperClassDesc(&ReferenceTargetClassDesc, "UserTypeSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x40 - shape object (text, ...)
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000040> CShapeObjectSuperClassDesc;
|
||||||
|
const CShapeObjectSuperClassDesc ShapeObjectSuperClassDesc(&GeomObjectClassDesc, "ShapeObjectSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x30 - light object (omni, ...)
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000030> CLightObjectSuperClassDesc;
|
||||||
|
const CLightObjectSuperClassDesc LightObjectSuperClassDesc(&ObjectClassDesc, "LightObjectSuperClassUnknown");
|
||||||
|
|
||||||
|
// 0x20 camera - (target, ...)
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000020> CCameraObjectSuperClassDesc;
|
||||||
|
const CCameraObjectSuperClassDesc CameraObjectSuperClassDesc(&ObjectClassDesc, "CameraObjectSuperClassUnknown");
|
||||||
|
|
||||||
|
// Creating superclass 0x820 (FFD Binding) (0xd6636ea2, 0x9aa42bf3) that does not exist = WSM, sub of modifier (under baseobj)
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000820> CWSModifierSuperClassDesc;
|
||||||
|
const CWSModifierSuperClassDesc WSModifierSuperClassDesc(&BaseObjectClassDesc, "WSModifierSuperClassUnknown");
|
||||||
|
|
||||||
|
// Creating superclass 0x830 (FFD(Cyl)) (0xfa4700be, 0xbbe85051) that does not exist = WSMObject, sub of object
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000830> CWSMObjectSuperClassDesc;
|
||||||
|
const CWSMObjectSuperClassDesc WSMObjectSuperClassDesc(&ObjectClassDesc, "WSMObjectSuperClassUnknown");
|
||||||
|
|
||||||
|
// Creating superclass 0xc30 (Placement) (0x00000100, 0x00000000) that does not exist | xyzgen, sub of mtlbase
|
||||||
|
typedef CSuperClassDescUnknown<CReferenceTarget, 0x00000c30> CXYZGenSuperClassDesc;
|
||||||
|
const CXYZGenSuperClassDesc XYZGenSuperClassDesc(&ReferenceTargetClassDesc, "XYZGenSuperClassUnknown");
|
||||||
|
|
||||||
|
} /* anonymous namespace */
|
||||||
|
|
||||||
|
CBuiltin::CBuiltin()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CBuiltin::~CBuiltin()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CBuiltin::registerClasses(CSceneClassRegistry *registry)
|
||||||
|
{
|
||||||
|
// invalid
|
||||||
|
registry->add(&NullSuperClassDesc);
|
||||||
|
|
||||||
|
// available
|
||||||
|
registry->add(&AnimatableClassDesc);
|
||||||
|
registry->add(&AnimatableSuperClassDesc);
|
||||||
|
registry->add(&ReferenceMakerClassDesc);
|
||||||
|
registry->add(&ReferenceMakerSuperClassDesc);
|
||||||
|
registry->add(&ReferenceTargetClassDesc);
|
||||||
|
registry->add(&ReferenceTargetSuperClassDesc);
|
||||||
|
|
||||||
|
// scene (inh ReferenceMaker)
|
||||||
|
registry->add(&SceneImplClassDesc);
|
||||||
|
|
||||||
|
// node (inh ReferenceTarget)
|
||||||
|
registry->add(&NodeSuperClassDesc);
|
||||||
|
registry->add(&NodeClassDesc);
|
||||||
|
{
|
||||||
|
registry->add(&NodeImplClassDesc);
|
||||||
|
registry->add(&RootNodeClassDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// tvnode (inh ReferenceTarget)
|
||||||
|
registry->add(&TrackViewNodeClassDesc);
|
||||||
|
|
||||||
|
// object (inh ReferenceMaker)
|
||||||
|
registry->add(&BaseObjectClassDesc);
|
||||||
|
{
|
||||||
|
registry->add(&ObjectSuperClassDesc);
|
||||||
|
registry->add(&ObjectClassDesc);
|
||||||
|
{
|
||||||
|
registry->add(&GeomObjectSuperClassDesc);
|
||||||
|
registry->add(&GeomObjectClassDesc);
|
||||||
|
{
|
||||||
|
registry->add(&TriObjectClassDesc);
|
||||||
|
registry->add(&PolyObjectClassDesc);
|
||||||
|
registry->add(&PatchObjectClassDesc);
|
||||||
|
{
|
||||||
|
registry->add(&EditablePatchClassDesc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// unimplemented
|
||||||
|
registry->add(&ControlFloatSuperClassDesc);
|
||||||
|
registry->add(&ParamBlockSuperClassDesc);
|
||||||
|
registry->add(&UVGenSuperClassDesc);
|
||||||
|
registry->add(&ParamBlock2SuperClassDesc);
|
||||||
|
registry->add(&TextureOutputSuperClassDesc);
|
||||||
|
registry->add(&TexmapSuperClassDesc);
|
||||||
|
registry->add(&TexmapContainerSuperClassDesc);
|
||||||
|
registry->add(&ShaderSuperClassDesc);
|
||||||
|
registry->add(&SamplerSuperClassDesc);
|
||||||
|
registry->add(&MtlSuperClassDesc);
|
||||||
|
registry->add(&SoundObjSuperClassDesc);
|
||||||
|
// registry->add(&NodeSuperClassDesc);
|
||||||
|
registry->add(&ControlPositionSuperClassDesc);
|
||||||
|
registry->add(&ControlRotationSuperClassDesc);
|
||||||
|
registry->add(&ControlScaleSuperClassDesc);
|
||||||
|
registry->add(&ControlTransformSuperClassDesc);
|
||||||
|
registry->add(&OSModifierSuperClassDesc);
|
||||||
|
registry->add(&MasterPointControllerSuperClassDesc);
|
||||||
|
//registry->add(&GeomObjectSuperClassDesc);
|
||||||
|
registry->add(&LayerSuperClassDesc);
|
||||||
|
//registry->add(&ObjectSuperClassDesc);
|
||||||
|
registry->add(&HelperObjectSuperClassDesc);
|
||||||
|
registry->add(&FilterKernelSuperClassDesc);
|
||||||
|
registry->add(&RendererSuperClassDesc);
|
||||||
|
registry->add(&ControlPoint3SuperClassDesc);
|
||||||
|
registry->add(&AtmosphericSuperClassDesc);
|
||||||
|
registry->add(&ControlMasterBlockSuperClassDesc);
|
||||||
|
registry->add(&GridReferenceSuperClassDesc);
|
||||||
|
registry->add(&RenderEffectSuperClassDesc);
|
||||||
|
registry->add(&ShadowTypeSuperClassDesc);
|
||||||
|
registry->add(&CustAttribSuperClassDesc);
|
||||||
|
registry->add(&ControlPoint4SuperClassDesc);
|
||||||
|
registry->add(&UserDataTypeSuperClassDesc);
|
||||||
|
registry->add(&UserTypeSuperClassDesc);
|
||||||
|
registry->add(&ShapeObjectSuperClassDesc);
|
||||||
|
registry->add(&LightObjectSuperClassDesc);
|
||||||
|
registry->add(&CameraObjectSuperClassDesc);
|
||||||
|
registry->add(&WSModifierSuperClassDesc);
|
||||||
|
registry->add(&WSMObjectSuperClassDesc);
|
||||||
|
registry->add(&XYZGenSuperClassDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
* \file builtin.h
|
||||||
|
* \brief CBuiltin
|
||||||
|
* \date 2012-08-22 09:42GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CBuiltin
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_BUILTIN_H
|
||||||
|
#define PIPELINE_BUILTIN_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
class CSceneClassRegistry;
|
||||||
|
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CBuiltin
|
||||||
|
* \date 2012-08-22 09:42GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CBuiltin
|
||||||
|
*/
|
||||||
|
class CBuiltin
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void registerClasses(CSceneClassRegistry *registry);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CBuiltin();
|
||||||
|
virtual ~CBuiltin();
|
||||||
|
|
||||||
|
}; /* class CBuiltin */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_BUILTIN_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,111 @@
|
|||||||
|
/**
|
||||||
|
* \file editable_patch.cpp
|
||||||
|
* \brief CEditablePatch
|
||||||
|
* \date 2012-08-26 12:12GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CEditablePatch
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "editable_patch.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CEditablePatch::CEditablePatch(CScene *scene) : CPatchObject(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CEditablePatch::~CEditablePatch()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CEditablePatch::DisplayName = ucstring("EditablePatch");
|
||||||
|
const char *CEditablePatch::InternalName = "EditablePatch";
|
||||||
|
const NLMISC::CClassId CEditablePatch::ClassId = NLMISC::CClassId(0x00001030, 0x00000000);
|
||||||
|
const TSClassId CEditablePatch::SuperClassId = CPatchObject::SuperClassId;
|
||||||
|
const CEditablePatchClassDesc EditablePatchClassDesc(&DllPluginDescBuiltin);
|
||||||
|
|
||||||
|
void CEditablePatch::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CPatchObject::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePatch::clean()
|
||||||
|
{
|
||||||
|
CPatchObject::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePatch::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CPatchObject::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePatch::disown()
|
||||||
|
{
|
||||||
|
CPatchObject::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePatch::init()
|
||||||
|
{
|
||||||
|
CPatchObject::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEditablePatch::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CPatchObject::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CEditablePatch::classDesc() const
|
||||||
|
{
|
||||||
|
return &EditablePatchClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePatch::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CPatchObject::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CEditablePatch::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CPatchObject::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,86 @@
|
|||||||
|
/**
|
||||||
|
* \file editable_patch.h
|
||||||
|
* \brief CEditablePatch
|
||||||
|
* \date 2012-08-26 12:12GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CEditablePatch
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_EDITABLE_PATCH_H
|
||||||
|
#define PIPELINE_EDITABLE_PATCH_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "patch_object.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CEditablePatch
|
||||||
|
* \date 2012-08-26 12:12GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CEditablePatch
|
||||||
|
*/
|
||||||
|
class CEditablePatch : public CPatchObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CEditablePatch(CScene *scene);
|
||||||
|
virtual ~CEditablePatch();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CEditablePatch */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CEditablePatch> CEditablePatchClassDesc;
|
||||||
|
extern const CEditablePatchClassDesc EditablePatchClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_EDITABLE_PATCH_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,269 @@
|
|||||||
|
/**
|
||||||
|
* \file geom_object.cpp
|
||||||
|
* \brief CGeomGeomObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CGeomGeomObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "geom_object.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
#define PMB_GEOM_UNKNOWN0900_CHUNK_ID 0x0900
|
||||||
|
#define PMB_GEOM_BUFFERS_CHUNK_ID 0x08fe
|
||||||
|
|
||||||
|
CGeomObject::CGeomObject(CScene *scene) : CObject(scene), m_Unknown0900(NULL), m_GeomBuffers(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CGeomObject::~CGeomObject()
|
||||||
|
{
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
m_Unknown0900 = NULL;
|
||||||
|
m_GeomBuffers = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CGeomObject::DisplayName = ucstring("GeomObject");
|
||||||
|
const char *CGeomObject::InternalName = "GeomObject";
|
||||||
|
const char *CGeomObject::InternalNameUnknown = "GeomObjectUnknown";
|
||||||
|
const NLMISC::CClassId CGeomObject::ClassId = NLMISC::CClassId(0x37097c44, 0x38aa3f24); /* Not official, please correct */
|
||||||
|
const TSClassId CGeomObject::SuperClassId = 0x00000010;
|
||||||
|
const CGeomObjectClassDesc GeomObjectClassDesc(&DllPluginDescBuiltin);
|
||||||
|
const CGeomObjectSuperClassDesc GeomObjectSuperClassDesc(&GeomObjectClassDesc);
|
||||||
|
|
||||||
|
void CGeomObject::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
if (filter == 0)
|
||||||
|
{
|
||||||
|
CObject::parse(version);
|
||||||
|
}
|
||||||
|
else if (filter == PMB_GEOM_OBJECT_PARSE_FILTER)
|
||||||
|
{
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
m_Unknown0900 = getChunk(PMB_GEOM_UNKNOWN0900_CHUNK_ID);
|
||||||
|
m_GeomBuffers = static_cast<STORAGE::CGeomBuffers *>(getChunk(PMB_GEOM_BUFFERS_CHUNK_ID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomObject::clean()
|
||||||
|
{
|
||||||
|
CObject::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomObject::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
if (filter == 0)
|
||||||
|
{
|
||||||
|
CObject::build(version);
|
||||||
|
}
|
||||||
|
else if (filter == PMB_GEOM_OBJECT_PARSE_FILTER)
|
||||||
|
{
|
||||||
|
if (m_Unknown0900) putChunk(PMB_GEOM_UNKNOWN0900_CHUNK_ID, m_Unknown0900);
|
||||||
|
if (m_GeomBuffers) putChunk(PMB_GEOM_BUFFERS_CHUNK_ID, m_GeomBuffers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomObject::disown()
|
||||||
|
{
|
||||||
|
m_Unknown0900 = NULL;
|
||||||
|
m_GeomBuffers = NULL;
|
||||||
|
CObject::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomObject::init()
|
||||||
|
{
|
||||||
|
CObject::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGeomObject::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CObject::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CGeomObject::classDesc() const
|
||||||
|
{
|
||||||
|
return &GeomObjectClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomObject::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
if (filter == 0)
|
||||||
|
{
|
||||||
|
CObject::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
else if (filter == PMB_GEOM_OBJECT_PARSE_FILTER)
|
||||||
|
{
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
if (m_Unknown0900)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "GeomObject Unknown 0x0900: ";
|
||||||
|
m_Unknown0900->toString(ostream, padpad);
|
||||||
|
}
|
||||||
|
if (m_GeomBuffers)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "GeomBuffers: ";
|
||||||
|
m_GeomBuffers->toString(ostream, padpad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint32 rrsub(uint32 v, uint32 size)
|
||||||
|
{
|
||||||
|
if (v) return v - 1;
|
||||||
|
return size - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint32 rradd(uint32 v, uint32 size)
|
||||||
|
{
|
||||||
|
uint32 vp = v + 1;
|
||||||
|
if (vp != size) return vp;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomObject::triangulatePolyFace(std::vector<STORAGE::CGeomTriIndex> &triangles, const STORAGE::CGeomPolyFaceInfo &polyFace)
|
||||||
|
{
|
||||||
|
nlassert(polyFace.Vertices.size() >= 3);
|
||||||
|
nlassert(polyFace.Triangulation.size() == polyFace.Vertices.size() - 3);
|
||||||
|
uint nbVert = polyFace.Vertices.size();
|
||||||
|
uint nbCuts = polyFace.Triangulation.size();
|
||||||
|
uint nbTriangles = 0;
|
||||||
|
|
||||||
|
// This code creates a matrix, aka a table, of all possible paths
|
||||||
|
// that can be traveled to get directly from one vertex to another
|
||||||
|
// over an egde.
|
||||||
|
// Outer edges of the polygon are one-way, backwards.
|
||||||
|
// Cut edges can be traveled both ways.
|
||||||
|
// Each edge direction can only be traveled by one triangle.
|
||||||
|
// Ingenious, if I may say so myself.
|
||||||
|
// Bad performance by std::vector, though.
|
||||||
|
std::vector<std::vector<bool> > from_to;
|
||||||
|
from_to.resize(nbVert);
|
||||||
|
for (uint i = 0; i < nbVert; ++i)
|
||||||
|
{
|
||||||
|
from_to[i].resize(nbVert);
|
||||||
|
for (uint j = 0; j < nbVert; ++j)
|
||||||
|
{
|
||||||
|
from_to[i][j] = false;
|
||||||
|
}
|
||||||
|
// Can travel backwards over the outer edge
|
||||||
|
from_to[i][rrsub(i, nbVert)] = true;
|
||||||
|
}
|
||||||
|
for (uint i = 0; i < nbCuts; ++i)
|
||||||
|
{
|
||||||
|
// Can travel both ways over cuts, but the first direction is handled directly!
|
||||||
|
// from_to[polyFace.Triangulation[i].first][polyFace.Triangulation[i].second] = true;
|
||||||
|
from_to[polyFace.Triangulation[i].second][polyFace.Triangulation[i].first] = true;
|
||||||
|
}
|
||||||
|
// Triangulate all cuts, this assumes cuts are in the direction
|
||||||
|
// of a triangle that is not already handled by another cut...
|
||||||
|
for (uint i = 0; i < nbCuts; ++i)
|
||||||
|
{
|
||||||
|
uint32 a = polyFace.Triangulation[i].first;
|
||||||
|
uint32 b = polyFace.Triangulation[i].second;
|
||||||
|
// from_to[polyFace.Triangulation[i].first][polyFace.Triangulation[i].second] = false; // handled!
|
||||||
|
// Try to find a path that works
|
||||||
|
for (uint c = 0; c < nbVert; ++c)
|
||||||
|
{
|
||||||
|
// Can we make a triangle
|
||||||
|
if (from_to[b][c] && from_to[c][a])
|
||||||
|
{
|
||||||
|
STORAGE::CGeomTriIndex tri;
|
||||||
|
tri.a = polyFace.Vertices[c];
|
||||||
|
tri.b = polyFace.Vertices[b];
|
||||||
|
tri.c = polyFace.Vertices[a];
|
||||||
|
triangles.push_back(tri);
|
||||||
|
++nbTriangles;
|
||||||
|
// nldebug("add tri from cut");
|
||||||
|
from_to[b][c] = false;
|
||||||
|
from_to[c][a] = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Find... The Last Triangle
|
||||||
|
for (uint a = 0; a < nbVert; ++a)
|
||||||
|
{
|
||||||
|
uint b = rrsub(a, nbVert);
|
||||||
|
// Can we still travel backwards over the outer edge?
|
||||||
|
if (from_to[a][b])
|
||||||
|
{
|
||||||
|
for (uint c = 0; c < nbVert; ++c)
|
||||||
|
{
|
||||||
|
// Can we make a triangle
|
||||||
|
if (from_to[b][c] && from_to[c][a])
|
||||||
|
{
|
||||||
|
STORAGE::CGeomTriIndex tri;
|
||||||
|
tri.a = polyFace.Vertices[c];
|
||||||
|
tri.b = polyFace.Vertices[b];
|
||||||
|
tri.c = polyFace.Vertices[a];
|
||||||
|
triangles.push_back(tri);
|
||||||
|
++nbTriangles;
|
||||||
|
// nldebug("add final tri");
|
||||||
|
from_to[b][c] = false;
|
||||||
|
from_to[c][a] = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// nldebug("triangles: %i", nbTriangles);
|
||||||
|
// nldebug("cuts: %i", nbCuts);
|
||||||
|
nlassert(nbTriangles == nbCuts + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CGeomObject::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case PMB_GEOM_UNKNOWN0900_CHUNK_ID:
|
||||||
|
return new CStorageArray<sint32>();
|
||||||
|
case PMB_GEOM_BUFFERS_CHUNK_ID:
|
||||||
|
return new STORAGE::CGeomBuffers();
|
||||||
|
}
|
||||||
|
return CObject::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
* \file geom_object.h
|
||||||
|
* \brief CGeomGeomObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CGeomGeomObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_GEOM_OBJECT_H
|
||||||
|
#define PIPELINE_GEOM_OBJECT_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "object.h"
|
||||||
|
#include "storage/geom_buffers.h"
|
||||||
|
|
||||||
|
/// Must be passed to the parse and build functions by
|
||||||
|
/// inheriting classes to parse the actual geom object.
|
||||||
|
#define PMB_GEOM_OBJECT_PARSE_FILTER 0x432a4da6
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CGeomGeomObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CGeomGeomObject
|
||||||
|
*/
|
||||||
|
class CGeomObject : public CObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CGeomObject(CScene *scene);
|
||||||
|
virtual ~CGeomObject();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const char *InternalNameUnknown;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
static void triangulatePolyFace(std::vector<STORAGE::CGeomTriIndex> &triangles, const STORAGE::CGeomPolyFaceInfo &polyFace);
|
||||||
|
|
||||||
|
// read access
|
||||||
|
inline STORAGE::CGeomBuffers *geomBuffers() const { return m_GeomBuffers; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
IStorageObject *m_Unknown0900;
|
||||||
|
STORAGE::CGeomBuffers *m_GeomBuffers;
|
||||||
|
|
||||||
|
}; /* class CGeomObject */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CGeomObject> CGeomObjectClassDesc;
|
||||||
|
extern const CGeomObjectClassDesc GeomObjectClassDesc;
|
||||||
|
typedef CSuperClassDesc<CGeomObject> CGeomObjectSuperClassDesc;
|
||||||
|
extern const CGeomObjectSuperClassDesc GeomObjectSuperClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_GEOM_OBJECT_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,218 @@
|
|||||||
|
/**
|
||||||
|
* \file i_node.cpp
|
||||||
|
* \brief INode
|
||||||
|
* \date 2012-08-22 19:45GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* INode
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "i_node.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
INode::INode(CScene *scene) : CReferenceTarget(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
INode::~INode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring INode::DisplayName = ucstring("Node Interface");
|
||||||
|
const char *INode::InternalName = "Node";
|
||||||
|
const char *INode::InternalNameUnknown = "NodeUnknown";
|
||||||
|
const NLMISC::CClassId INode::ClassId = NLMISC::CClassId(0x8f5b13, 0x624d477d); /* Not official, please correct */
|
||||||
|
const TSClassId INode::SuperClassId = 0x00000001;
|
||||||
|
const CNodeClassDesc NodeClassDesc(&DllPluginDescBuiltin);
|
||||||
|
const CNodeSuperClassDesc NodeSuperClassDesc(&NodeClassDesc);
|
||||||
|
|
||||||
|
void INode::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceTarget::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void INode::clean()
|
||||||
|
{
|
||||||
|
CReferenceTarget::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void INode::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceTarget::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void INode::disown()
|
||||||
|
{
|
||||||
|
CReferenceTarget::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void INode::init()
|
||||||
|
{
|
||||||
|
CReferenceTarget::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool INode::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CReferenceTarget::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *INode::classDesc() const
|
||||||
|
{
|
||||||
|
return &NodeClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void INode::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CReferenceTarget::toStringLocal(ostream, pad);
|
||||||
|
// Print the implied connected children
|
||||||
|
ostream << "\n" << pad << "Children: IMPLICIT { ";
|
||||||
|
uint i = 0;
|
||||||
|
for (std::set<NLMISC::CRefPtr<INode> >::iterator it = m_Children.begin(), end = m_Children.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
INode *node = (*it);
|
||||||
|
nlassert(node);
|
||||||
|
if (node)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "\t" << i << ": <ptr=0x";
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(16) << (uint64)(void *)node;
|
||||||
|
ostream << ss.str();
|
||||||
|
}
|
||||||
|
ostream << "> ";
|
||||||
|
ostream << "(" << ucstring(node->classDesc()->displayName()).toUtf8() << ", " << node->classDesc()->classId().toString() << ") ";
|
||||||
|
ostream << node->userName().toUtf8() << " ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "\t" << i << ": NULL ";
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
|
||||||
|
INode *INode::parent()
|
||||||
|
{
|
||||||
|
nlerror("Unkown node class, cannot get parent node");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void INode::setParent(INode *node)
|
||||||
|
{
|
||||||
|
nlerror("Unkown node class, cannot set parent node");
|
||||||
|
}
|
||||||
|
|
||||||
|
void INode::addChild(INode *node)
|
||||||
|
{
|
||||||
|
m_Children.insert(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
void INode::removeChild(INode *node)
|
||||||
|
{
|
||||||
|
m_Children.erase(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring &INode::userName() const
|
||||||
|
{
|
||||||
|
static const ucstring v = ucstring("Invalid INode");
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
INode *INode::find(const ucstring &userName) const
|
||||||
|
{
|
||||||
|
ucstring unl = NLMISC::toLower(userName);
|
||||||
|
for (std::set<NLMISC::CRefPtr<INode> >::iterator it = m_Children.begin(), end = m_Children.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
INode *node = (*it);
|
||||||
|
nlassert(node);
|
||||||
|
if (NLMISC::toLower(node->userName()) == unl)
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void INode::dumpNodes(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
ostream << "<ptr=0x";
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(16) << (uint64)(void *)this;
|
||||||
|
ostream << ss.str();
|
||||||
|
}
|
||||||
|
ostream << "> " << userName().toUtf8() << " [" << m_Children.size() << "] { ";
|
||||||
|
CReferenceMaker *object = getReference(1);
|
||||||
|
if (object) // TODO: Implement!
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "Object: ";
|
||||||
|
ostream << "<ptr=0x";
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(16) << (uint64)(void *)object;
|
||||||
|
ostream << ss.str();
|
||||||
|
}
|
||||||
|
ostream << "> ";
|
||||||
|
ostream << ucstring(object->classDesc()->displayName()).toUtf8() << " ";
|
||||||
|
}
|
||||||
|
uint i = 0 ;
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
for (std::set<NLMISC::CRefPtr<INode> >::iterator it = m_Children.begin(), end = m_Children.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
INode *node = (*it);
|
||||||
|
nlassert(node);
|
||||||
|
ostream << "\n" << pad << i << ": ";
|
||||||
|
node->dumpNodes(ostream, padpad);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *INode::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CReferenceTarget::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,107 @@
|
|||||||
|
/**
|
||||||
|
* \file i_node.h
|
||||||
|
* \brief INode
|
||||||
|
* \date 2012-08-22 19:45GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* INode
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_I_NODE_H
|
||||||
|
#define PIPELINE_I_NODE_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "reference_target.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief INode
|
||||||
|
* \date 2012-08-22 19:45GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* INode
|
||||||
|
*/
|
||||||
|
class INode : public CReferenceTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
INode(CScene *scene);
|
||||||
|
virtual ~INode();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const char *InternalNameUnknown;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
// node interface
|
||||||
|
virtual INode *parent();
|
||||||
|
virtual void setParent(INode *node);
|
||||||
|
virtual void addChild(INode *node);
|
||||||
|
virtual void removeChild(INode *node); // does not delete
|
||||||
|
virtual const ucstring &userName() const;
|
||||||
|
INode *find(const ucstring &userName) const;
|
||||||
|
|
||||||
|
// dump
|
||||||
|
void dumpNodes(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
|
||||||
|
// read access
|
||||||
|
/// The children that are linked to this node by the parent tag
|
||||||
|
inline const std::set<NLMISC::CRefPtr<INode> > &children() const { return m_Children; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::set<NLMISC::CRefPtr<INode> > m_Children;
|
||||||
|
|
||||||
|
}; /* class INode */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<INode> CNodeClassDesc;
|
||||||
|
extern const CNodeClassDesc NodeClassDesc;
|
||||||
|
typedef CSuperClassDesc<INode> CNodeSuperClassDesc;
|
||||||
|
extern const CNodeSuperClassDesc NodeSuperClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_I_NODE_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file modifier.cpp
|
||||||
|
* \brief CModifier
|
||||||
|
* \date 2012-08-22 08:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CModifier
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "modifier.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CModifier::CModifier(CScene *scene) : CBaseObject(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CModifier::~CModifier()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file modifier.h
|
||||||
|
* \brief CModifier
|
||||||
|
* \date 2012-08-22 08:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CModifier
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_MODIFIER_H
|
||||||
|
#define PIPELINE_MODIFIER_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "base_object.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CModifier
|
||||||
|
* \date 2012-08-22 08:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CModifier
|
||||||
|
*/
|
||||||
|
class CModifier : public CBaseObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CModifier(CScene *scene);
|
||||||
|
virtual ~CModifier();
|
||||||
|
|
||||||
|
}; /* class CModifier */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_MODIFIER_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file mtl.cpp
|
||||||
|
* \brief CMtl
|
||||||
|
* \date 2012-08-22 08:54GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CMtl
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "mtl.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CMtl::CMtl(CScene *scene) : CMtlBase(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMtl::~CMtl()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file mtl.h
|
||||||
|
* \brief CMtl
|
||||||
|
* \date 2012-08-22 08:54GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CMtl
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_MTL_H
|
||||||
|
#define PIPELINE_MTL_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "mtl_base.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CMtl
|
||||||
|
* \date 2012-08-22 08:54GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CMtl
|
||||||
|
*/
|
||||||
|
class CMtl : public CMtlBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMtl(CScene *scene);
|
||||||
|
virtual ~CMtl();
|
||||||
|
|
||||||
|
}; /* class CMtl */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_MTL_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file mtl_base.cpp
|
||||||
|
* \brief CMtlBase
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CMtlBase
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "mtl_base.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CMtlBase::CMtlBase(CScene *scene) : CReferenceTarget(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMtlBase::~CMtlBase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file mtl_base.h
|
||||||
|
* \brief CMtlBase
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CMtlBase
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_MTL_BASE_H
|
||||||
|
#define PIPELINE_MTL_BASE_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "reference_target.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CMtlBase
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CMtlBase
|
||||||
|
*/
|
||||||
|
class CMtlBase : public CReferenceTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMtlBase(CScene *scene);
|
||||||
|
virtual ~CMtlBase();
|
||||||
|
|
||||||
|
}; /* class CMtlBase */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_MTL_BASE_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file multi_mtl.cpp
|
||||||
|
* \brief CMultiMtl
|
||||||
|
* \date 2012-08-22 08:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CMultiMtl
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "multi_mtl.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CMultiMtl::CMultiMtl()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMultiMtl::~CMultiMtl()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* \file multi_mtl.h
|
||||||
|
* \brief CMultiMtl
|
||||||
|
* \date 2012-08-22 08:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CMultiMtl
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_MULTI_MTL_H
|
||||||
|
#define PIPELINE_MULTI_MTL_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CMultiMtl
|
||||||
|
* \date 2012-08-22 08:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CMultiMtl
|
||||||
|
*/
|
||||||
|
class CMultiMtl
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
// pointers
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// instances
|
||||||
|
// ...
|
||||||
|
public:
|
||||||
|
CMultiMtl();
|
||||||
|
virtual ~CMultiMtl();
|
||||||
|
}; /* class CMultiMtl */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_MULTI_MTL_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,195 @@
|
|||||||
|
/**
|
||||||
|
* \file node_impl.cpp
|
||||||
|
* \brief CNodeImpl
|
||||||
|
* \date 2012-08-22 20:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CNodeImpl
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "node_impl.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
#define PMB_NODE_VERSION_CHUNK_ID 0x09ce
|
||||||
|
#define PMB_NODE_PARENT_CHUNK_ID 0x0960
|
||||||
|
#define PMB_NODE_NAME_CHUNK_ID 0x0962
|
||||||
|
|
||||||
|
CNodeImpl::CNodeImpl(CScene *scene) : INode(scene), m_NodeVersion(0), m_ParentFlags(0), m_UserName(ucstring("Untitled Node"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CNodeImpl::~CNodeImpl()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CNodeImpl::DisplayName = ucstring("Node");
|
||||||
|
const char *CNodeImpl::InternalName = "NodeImpl";
|
||||||
|
const NLMISC::CClassId CNodeImpl::ClassId = NLMISC::CClassId(0x00000001, 0x00000000);
|
||||||
|
const TSClassId CNodeImpl::SuperClassId = INode::SuperClassId;
|
||||||
|
const CNodeImplClassDesc NodeImplClassDesc(&DllPluginDescBuiltin);
|
||||||
|
|
||||||
|
void CNodeImpl::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
INode::parse(version);
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
m_NodeVersion = getChunkValue<uint32>(PMB_NODE_VERSION_CHUNK_ID);
|
||||||
|
|
||||||
|
CStorageArray<uint32> *parent = static_cast<CStorageArray<uint32> *>(getChunk(PMB_NODE_PARENT_CHUNK_ID));
|
||||||
|
nlassert(parent);
|
||||||
|
nlassert(parent->Value.size() == 2);
|
||||||
|
setParent(dynamic_cast<INode *>(container()->getByStorageIndex((sint32)parent->Value[0])));
|
||||||
|
nlassert(m_Parent);
|
||||||
|
m_ParentFlags = parent->Value[1];
|
||||||
|
m_ArchivedChunks.push_back(parent);
|
||||||
|
|
||||||
|
m_UserName = getChunkValue<ucstring>(PMB_NODE_NAME_CHUNK_ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNodeImpl::clean()
|
||||||
|
{
|
||||||
|
INode::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNodeImpl::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
INode::build(version);
|
||||||
|
|
||||||
|
putChunkValue(PMB_NODE_VERSION_CHUNK_ID, m_NodeVersion);
|
||||||
|
|
||||||
|
CStorageArray<uint32> *parent = new CStorageArray<uint32>();
|
||||||
|
parent->Value.resize(2);
|
||||||
|
parent->Value[0] = container()->getOrCreateStorageIndex(m_Parent);
|
||||||
|
parent->Value[1] = m_ParentFlags;
|
||||||
|
m_ArchivedChunks.push_back(parent);
|
||||||
|
putChunk(PMB_NODE_PARENT_CHUNK_ID, parent);
|
||||||
|
|
||||||
|
putChunkValue(PMB_NODE_NAME_CHUNK_ID, m_UserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNodeImpl::disown()
|
||||||
|
{
|
||||||
|
m_NodeVersion = 0;
|
||||||
|
setParent(NULL);
|
||||||
|
m_ParentFlags = 0;
|
||||||
|
m_UserName = ucstring("Untitled Node");
|
||||||
|
|
||||||
|
INode::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNodeImpl::init()
|
||||||
|
{
|
||||||
|
INode::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CNodeImpl::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return INode::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CNodeImpl::classDesc() const
|
||||||
|
{
|
||||||
|
return &NodeImplClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNodeImpl::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
INode::toStringLocal(ostream, pad);
|
||||||
|
ostream << "\n" << pad << "NodeVersion: " << m_NodeVersion;
|
||||||
|
ostream << "\n" << pad << "Parent: ";
|
||||||
|
INode *parent = m_Parent;
|
||||||
|
nlassert(parent);
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
|
ostream << "<ptr=0x";
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(16) << (uint64)(void *)parent;
|
||||||
|
ostream << ss.str();
|
||||||
|
}
|
||||||
|
ostream << "> ";
|
||||||
|
ostream << "(" << ucstring(parent->classDesc()->displayName()).toUtf8() << ", " << parent->classDesc()->classId().toString() << ") ";
|
||||||
|
ostream << parent->userName().toUtf8();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ostream << "NULL";
|
||||||
|
}
|
||||||
|
ostream << "\n" << pad << "ParentFlags: " << m_ParentFlags;
|
||||||
|
ostream << "\n" << pad << "UserName: " << m_UserName.toUtf8() << " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
INode *CNodeImpl::parent()
|
||||||
|
{
|
||||||
|
return m_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNodeImpl::setParent(INode *node)
|
||||||
|
{
|
||||||
|
if (m_Parent) m_Parent->removeChild(this);
|
||||||
|
m_Parent = node;
|
||||||
|
if (node) node->addChild(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring &CNodeImpl::userName() const
|
||||||
|
{
|
||||||
|
return m_UserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CNodeImpl::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case PMB_NODE_VERSION_CHUNK_ID:
|
||||||
|
return new CStorageValue<uint32>();
|
||||||
|
case PMB_NODE_PARENT_CHUNK_ID:
|
||||||
|
return new CStorageArray<uint32>();
|
||||||
|
case PMB_NODE_NAME_CHUNK_ID:
|
||||||
|
return new CStorageValue<ucstring>();
|
||||||
|
}
|
||||||
|
return INode::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,102 @@
|
|||||||
|
/**
|
||||||
|
* \file node_impl.h
|
||||||
|
* \brief CNodeImpl
|
||||||
|
* \date 2012-08-22 20:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CNodeImpl
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_NODE_IMPL_H
|
||||||
|
#define PIPELINE_NODE_IMPL_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "i_node.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CNodeImpl
|
||||||
|
* \date 2012-08-22 20:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CNodeImpl
|
||||||
|
*/
|
||||||
|
class CNodeImpl : public INode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CNodeImpl(CScene *scene);
|
||||||
|
virtual ~CNodeImpl();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
// node interface
|
||||||
|
virtual INode *parent();
|
||||||
|
virtual void setParent(INode *node);
|
||||||
|
// virtual void addChild(INode *node);
|
||||||
|
// virtual void removeChild(INode *node); // does not delete
|
||||||
|
virtual const ucstring &userName() const;
|
||||||
|
|
||||||
|
// read access
|
||||||
|
inline uint32 nodeVersion() const { return m_NodeVersion; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32 m_NodeVersion;
|
||||||
|
NLMISC::CRefPtr<INode> m_Parent;
|
||||||
|
uint32 m_ParentFlags;
|
||||||
|
ucstring m_UserName;
|
||||||
|
|
||||||
|
}; /* class CNodeImpl */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CNodeImpl> CNodeImplClassDesc;
|
||||||
|
extern const CNodeImplClassDesc NodeImplClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_NODE_IMPL_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,113 @@
|
|||||||
|
/**
|
||||||
|
* \file object.cpp
|
||||||
|
* \brief CObject
|
||||||
|
* \date 2012-08-22 09:13GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "object.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CObject::CObject(CScene *scene) : CBaseObject(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CObject::~CObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CObject::DisplayName = ucstring("Object");
|
||||||
|
const char *CObject::InternalName = "Object";
|
||||||
|
const char *CObject::InternalNameUnknown = "ObjectUnknown";
|
||||||
|
const NLMISC::CClassId CObject::ClassId = NLMISC::CClassId(0x14021ed1, 0x33837a80); /* Not official, please correct */
|
||||||
|
const TSClassId CObject::SuperClassId = 0x00000060;
|
||||||
|
const CObjectClassDesc ObjectClassDesc(&DllPluginDescBuiltin);
|
||||||
|
const CObjectSuperClassDesc ObjectSuperClassDesc(&ObjectClassDesc);
|
||||||
|
|
||||||
|
void CObject::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CBaseObject::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CObject::clean()
|
||||||
|
{
|
||||||
|
CBaseObject::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CObject::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CBaseObject::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CObject::disown()
|
||||||
|
{
|
||||||
|
CBaseObject::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CObject::init()
|
||||||
|
{
|
||||||
|
CBaseObject::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CObject::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CBaseObject::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CObject::classDesc() const
|
||||||
|
{
|
||||||
|
return &ObjectClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CObject::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CBaseObject::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CObject::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CBaseObject::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* \file object.h
|
||||||
|
* \brief CObject
|
||||||
|
* \date 2012-08-22 09:13GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_OBJECT_H
|
||||||
|
#define PIPELINE_OBJECT_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "base_object.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CObject
|
||||||
|
* \date 2012-08-22 09:13GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CObject
|
||||||
|
*/
|
||||||
|
class CObject : public CBaseObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CObject(CScene *scene);
|
||||||
|
virtual ~CObject();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const char *InternalNameUnknown;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CObject */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CObject> CObjectClassDesc;
|
||||||
|
extern const CObjectClassDesc ObjectClassDesc;
|
||||||
|
typedef CSuperClassDesc<CObject> CObjectSuperClassDesc;
|
||||||
|
extern const CObjectSuperClassDesc ObjectSuperClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_OBJECT_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file param_block.cpp
|
||||||
|
* \brief CParamBlock
|
||||||
|
* \date 2012-08-22 08:57GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CParamBlock
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "param_block.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CParamBlock::CParamBlock(CScene *scene) : CReferenceTarget(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CParamBlock::~CParamBlock()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file param_block.h
|
||||||
|
* \brief CParamBlock
|
||||||
|
* \date 2012-08-22 08:57GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CParamBlock
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_PARAM_BLOCK_H
|
||||||
|
#define PIPELINE_PARAM_BLOCK_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "reference_target.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CParamBlock
|
||||||
|
* \date 2012-08-22 08:57GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CParamBlock
|
||||||
|
*/
|
||||||
|
class CParamBlock : public CReferenceTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CParamBlock(CScene *scene);
|
||||||
|
virtual ~CParamBlock();
|
||||||
|
|
||||||
|
}; /* class CParamBlock */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_PARAM_BLOCK_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file param_block_2.cpp
|
||||||
|
* \brief CParamBlock2
|
||||||
|
* \date 2012-08-22 08:57GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CParamBlock2
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "param_block_2.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CParamBlock2::CParamBlock2(CScene *scene) : CReferenceTarget(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CParamBlock2::~CParamBlock2()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file param_block_2.h
|
||||||
|
* \brief CParamBlock2
|
||||||
|
* \date 2012-08-22 08:57GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CParamBlock2
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_PARAM_BLOCK_2_H
|
||||||
|
#define PIPELINE_PARAM_BLOCK_2_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "reference_target.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CParamBlock2
|
||||||
|
* \date 2012-08-22 08:57GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CParamBlock2
|
||||||
|
*/
|
||||||
|
class CParamBlock2 : public CReferenceTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CParamBlock2(CScene *scene);
|
||||||
|
virtual ~CParamBlock2();
|
||||||
|
|
||||||
|
}; /* class CParamBlock2 */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_PARAM_BLOCK_2_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,111 @@
|
|||||||
|
/**
|
||||||
|
* \file patch_object.cpp
|
||||||
|
* \brief CPatchObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CPatchObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "patch_object.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CPatchObject::CPatchObject(CScene *scene) : CGeomObject(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CPatchObject::~CPatchObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CPatchObject::DisplayName = ucstring("PatchObject");
|
||||||
|
const char *CPatchObject::InternalName = "PatchObject";
|
||||||
|
const NLMISC::CClassId CPatchObject::ClassId = NLMISC::CClassId(0xd0a6b36, 0x7dce4b64); /* Not official, please correct */
|
||||||
|
const TSClassId CPatchObject::SuperClassId = CGeomObject::SuperClassId;
|
||||||
|
const CPatchObjectClassDesc PatchObjectClassDesc(&DllPluginDescBuiltin);
|
||||||
|
|
||||||
|
void CPatchObject::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CGeomObject::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPatchObject::clean()
|
||||||
|
{
|
||||||
|
CGeomObject::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPatchObject::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CGeomObject::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPatchObject::disown()
|
||||||
|
{
|
||||||
|
CGeomObject::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPatchObject::init()
|
||||||
|
{
|
||||||
|
CGeomObject::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPatchObject::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CGeomObject::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CPatchObject::classDesc() const
|
||||||
|
{
|
||||||
|
return &PatchObjectClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPatchObject::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CGeomObject::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CPatchObject::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CGeomObject::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,90 @@
|
|||||||
|
/**
|
||||||
|
* \file patch_object.h
|
||||||
|
* \brief CPatchObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CPatchObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_PATCH_OBJECT_H
|
||||||
|
#define PIPELINE_PATCH_OBJECT_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "geom_object.h"
|
||||||
|
|
||||||
|
/// Must be passed to the parse and build functions by
|
||||||
|
/// inheriting classes to parse the actual patch object.
|
||||||
|
#define PMB_PATCH_OBJECT_PARSE_FILTER 0x2a611c9
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CPatchObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CPatchObject
|
||||||
|
*/
|
||||||
|
class CPatchObject : public CGeomObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CPatchObject(CScene *scene);
|
||||||
|
virtual ~CPatchObject();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CPatchObject */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CPatchObject> CPatchObjectClassDesc;
|
||||||
|
extern const CPatchObjectClassDesc PatchObjectClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_PATCH_OBJECT_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,147 @@
|
|||||||
|
/**
|
||||||
|
* \file poly_object.cpp
|
||||||
|
* \brief CPolyObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CPolyObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "poly_object.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CPolyObject::CPolyObject(CScene *scene) : CGeomObject(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CPolyObject::~CPolyObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CPolyObject::DisplayName = ucstring("PolyObject");
|
||||||
|
const char *CPolyObject::InternalName = "PolyObject";
|
||||||
|
const NLMISC::CClassId CPolyObject::ClassId = NLMISC::CClassId(0x59772461, 0x6e1141e8); /* Not official, please correct */
|
||||||
|
const TSClassId CPolyObject::SuperClassId = CGeomObject::SuperClassId;
|
||||||
|
const CPolyObjectClassDesc PolyObjectClassDesc(&DllPluginDescBuiltin);
|
||||||
|
|
||||||
|
void CPolyObject::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
if (filter == 0)
|
||||||
|
{
|
||||||
|
CGeomObject::parse(version);
|
||||||
|
}
|
||||||
|
else if (filter == PMB_POLY_OBJECT_PARSE_FILTER)
|
||||||
|
{
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
CGeomObject::parse(version, PMB_GEOM_OBJECT_PARSE_FILTER);
|
||||||
|
// 0x0906
|
||||||
|
// 0x0908
|
||||||
|
// 0x090a
|
||||||
|
// 0x090c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPolyObject::clean()
|
||||||
|
{
|
||||||
|
CGeomObject::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPolyObject::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
if (filter == 0)
|
||||||
|
{
|
||||||
|
CGeomObject::build(version);
|
||||||
|
}
|
||||||
|
else if (filter == PMB_POLY_OBJECT_PARSE_FILTER)
|
||||||
|
{
|
||||||
|
CGeomObject::build(version, PMB_GEOM_OBJECT_PARSE_FILTER);
|
||||||
|
// 0x0906
|
||||||
|
// 0x0908
|
||||||
|
// 0x090a
|
||||||
|
// 0x090c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPolyObject::disown()
|
||||||
|
{
|
||||||
|
CGeomObject::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPolyObject::init()
|
||||||
|
{
|
||||||
|
CGeomObject::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPolyObject::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CGeomObject::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CPolyObject::classDesc() const
|
||||||
|
{
|
||||||
|
return &PolyObjectClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPolyObject::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
if (filter == 0)
|
||||||
|
{
|
||||||
|
CGeomObject::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
else if (filter == PMB_POLY_OBJECT_PARSE_FILTER)
|
||||||
|
{
|
||||||
|
CGeomObject::toStringLocal(ostream, pad, PMB_GEOM_OBJECT_PARSE_FILTER);
|
||||||
|
// 0x0906
|
||||||
|
// 0x0908
|
||||||
|
// 0x090a
|
||||||
|
// 0x090c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CPolyObject::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CGeomObject::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,90 @@
|
|||||||
|
/**
|
||||||
|
* \file poly_object.h
|
||||||
|
* \brief CPolyObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CPolyObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_POLY_OBJECT_H
|
||||||
|
#define PIPELINE_POLY_OBJECT_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "geom_object.h"
|
||||||
|
|
||||||
|
/// Must be passed to the parse and build functions by
|
||||||
|
/// inheriting classes to parse the actual poly object.
|
||||||
|
#define PMB_POLY_OBJECT_PARSE_FILTER 0x127d3a04
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CPolyObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CPolyObject
|
||||||
|
*/
|
||||||
|
class CPolyObject : public CGeomObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CPolyObject(CScene *scene);
|
||||||
|
virtual ~CPolyObject();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CPolyObject */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CPolyObject> CPolyObjectClassDesc;
|
||||||
|
extern const CPolyObjectClassDesc PolyObjectClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_POLY_OBJECT_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,320 @@
|
|||||||
|
/**
|
||||||
|
* \file reference_maker.cpp
|
||||||
|
* \brief CReferenceMaker
|
||||||
|
* \date 2012-08-22 08:52GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CReferenceMaker
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "reference_maker.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Elevate warnings to errors in this file for stricter reading
|
||||||
|
#undef nlwarning
|
||||||
|
#define nlwarning nlerror
|
||||||
|
|
||||||
|
// Elevate debug to error in this file for debugging
|
||||||
|
// #undef nldebug
|
||||||
|
// #define nldebug nlerror
|
||||||
|
|
||||||
|
// Chunk identifiers
|
||||||
|
#define PMB_REFERENCES_2034_CHUNK_ID 0x2034
|
||||||
|
#define PMB_REFERENCES_2035_CHUNK_ID 0x2035
|
||||||
|
#define PMB_204B_EQUALS_2E_CHUNK_ID 0x204B
|
||||||
|
#define PMB_UNKNOWN2045_CHUNK_ID 0x2045
|
||||||
|
#define PMB_UNKNOWN2047_CHUNK_ID 0x2047
|
||||||
|
#define PMB_UNKNOWN21B0_CHUNK_ID 0x21B0
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CReferenceMaker::CReferenceMaker(CScene *scene) : CAnimatable(scene), m_ReferenceMap(false), m_204B_Equals_2E(NULL), m_References2035Value0(0), m_Unknown2045(NULL), m_Unknown2047(NULL), m_Unknown21B0(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CReferenceMaker::~CReferenceMaker()
|
||||||
|
{
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
delete m_204B_Equals_2E;
|
||||||
|
m_204B_Equals_2E = NULL;
|
||||||
|
delete m_Unknown2045;
|
||||||
|
m_Unknown2045 = NULL;
|
||||||
|
delete m_Unknown2047;
|
||||||
|
m_Unknown2047 = NULL;
|
||||||
|
delete m_Unknown21B0;
|
||||||
|
m_Unknown21B0 = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CReferenceMaker::DisplayName = ucstring("ReferenceMaker");
|
||||||
|
const char *CReferenceMaker::InternalName = "ReferenceMaker";
|
||||||
|
const char *CReferenceMaker::InternalNameUnknown = "ReferenceMakerUnknown";
|
||||||
|
const NLMISC::CClassId CReferenceMaker::ClassId = NLMISC::CClassId(0x2ec43d15, 0x10a270ad); /* Not official, please correct */
|
||||||
|
const TSClassId CReferenceMaker::SuperClassId = 0x00000100;
|
||||||
|
const CReferenceMakerClassDesc ReferenceMakerClassDesc(&DllPluginDescBuiltin);
|
||||||
|
const CReferenceMakerSuperClassDesc ReferenceMakerSuperClassDesc(&ReferenceMakerClassDesc);
|
||||||
|
|
||||||
|
void CReferenceMaker::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CAnimatable::parse(version);
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
CStorageArray<sint32> *references2034 = static_cast<CStorageArray<sint32> *>(getChunk(PMB_REFERENCES_2034_CHUNK_ID));
|
||||||
|
CStorageArray<sint32> *references2035 = static_cast<CStorageArray<sint32> *>(getChunk(PMB_REFERENCES_2035_CHUNK_ID));
|
||||||
|
if (references2034) nlassert(references2035 == NULL); // Apparently, there can be only one.
|
||||||
|
if (references2035) nlassert(references2034 == NULL);
|
||||||
|
m_204B_Equals_2E = static_cast<CStorageValue<uint8> *>(getChunk(PMB_204B_EQUALS_2E_CHUNK_ID));
|
||||||
|
if (m_204B_Equals_2E) nlassert(m_204B_Equals_2E->Value == 0x2e); // Really, let me know when it has another value.
|
||||||
|
|
||||||
|
// Parse contents
|
||||||
|
if (references2034)
|
||||||
|
{
|
||||||
|
m_ReferenceMap = false; // NOTE: Plugins may check after parse if they parsed with the correct type, to find a pattern
|
||||||
|
m_ArchivedChunks.push_back(references2034);
|
||||||
|
for (std::vector<sint32>::size_type i = 0; i < references2034->Value.size(); ++i)
|
||||||
|
{
|
||||||
|
if (references2034->Value[i] > 0)
|
||||||
|
{
|
||||||
|
CReferenceMaker *referenceMaker = dynamic_cast<CReferenceMaker *>(container()->getByStorageIndex(references2034->Value[i]));
|
||||||
|
if (!referenceMaker) nlerror("Reference maker %s %s, 0x%x is not a reference maker", ucstring(container()->getByStorageIndex(references2034->Value[i])->classDesc()->displayName()).toUtf8().c_str(), container()->getByStorageIndex(references2034->Value[i])->classDesc()->classId().toString().c_str(), container()->getByStorageIndex(references2034->Value[i])->classDesc()->superClassId());
|
||||||
|
setReference(i, referenceMaker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (references2035)
|
||||||
|
{
|
||||||
|
m_ReferenceMap = true;
|
||||||
|
m_ArchivedChunks.push_back(references2035);
|
||||||
|
std::vector<sint32>::iterator it = references2035->Value.begin();
|
||||||
|
m_References2035Value0 = (*it);
|
||||||
|
++it;
|
||||||
|
std::vector<sint32>::iterator end = references2035->Value.end();
|
||||||
|
while (it != end)
|
||||||
|
{
|
||||||
|
sint32 index = (*it);
|
||||||
|
++it;
|
||||||
|
sint32 referenceindex = (*it);
|
||||||
|
++it;
|
||||||
|
CReferenceMaker *referenceMaker = dynamic_cast<CReferenceMaker *>(container()->getByStorageIndex(referenceindex));
|
||||||
|
if (!referenceMaker) nlerror("Reference maker %s, 0x%x is not a reference maker", container()->getByStorageIndex(referenceindex)->classDesc()->classId().toString().c_str(), container()->getByStorageIndex(referenceindex)->classDesc()->superClassId());
|
||||||
|
setReference(index, referenceMaker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Unknown2045 = static_cast<CStorageRaw *>(getChunk(PMB_UNKNOWN2045_CHUNK_ID)); // not sure if this is part of maker or target
|
||||||
|
m_Unknown2047 = static_cast<CStorageRaw *>(getChunk(PMB_UNKNOWN2047_CHUNK_ID)); // not sure if this is part of maker or target
|
||||||
|
m_Unknown21B0 = static_cast<CStorageRaw *>(getChunk(PMB_UNKNOWN21B0_CHUNK_ID)); // not sure if this is part of maker or target
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceMaker::clean()
|
||||||
|
{
|
||||||
|
CAnimatable::clean(); // Nothing to do here, m_ArchivedChunks is cleaned (deleted) for us!
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceMaker::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CAnimatable::build(version);
|
||||||
|
// TODO: Build contents
|
||||||
|
//if (m_References2034) putChunk(PMB_REFERENCES_2034_CHUNK_ID, m_References2034);
|
||||||
|
//if (m_References2035) putChunk(PMB_REFERENCES_2035_CHUNK_ID, m_References2035);
|
||||||
|
if (!m_ReferenceMap)
|
||||||
|
{
|
||||||
|
CStorageArray<sint32> *references2034 = new CStorageArray<sint32>();
|
||||||
|
uint nb = nbReferences();
|
||||||
|
references2034->Value.resize(nb);
|
||||||
|
for (uint i = 0; i < nb; ++i)
|
||||||
|
{
|
||||||
|
CReferenceMaker *referenceMaker = getReference(i);
|
||||||
|
if (referenceMaker) references2034->Value[i] = container()->getOrCreateStorageIndex(referenceMaker);
|
||||||
|
else references2034->Value[i] = -1;
|
||||||
|
}
|
||||||
|
putChunk(PMB_REFERENCES_2034_CHUNK_ID, references2034);
|
||||||
|
m_ArchivedChunks.push_back(references2034);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CStorageArray<sint32> *references2035 = new CStorageArray<sint32>();
|
||||||
|
uint nb = nbReferences();
|
||||||
|
references2035->Value.push_back(m_References2035Value0);
|
||||||
|
for (uint i = 0; i < nb; ++i)
|
||||||
|
{
|
||||||
|
CReferenceMaker *referenceMaker = getReference(i);
|
||||||
|
if (referenceMaker)
|
||||||
|
{
|
||||||
|
references2035->Value.push_back(i);
|
||||||
|
references2035->Value.push_back(container()->getOrCreateStorageIndex(referenceMaker));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
putChunk(PMB_REFERENCES_2035_CHUNK_ID, references2035);
|
||||||
|
m_ArchivedChunks.push_back(references2035);
|
||||||
|
}
|
||||||
|
if (m_204B_Equals_2E) putChunk(PMB_204B_EQUALS_2E_CHUNK_ID, m_204B_Equals_2E);
|
||||||
|
if (m_Unknown2045) putChunk(PMB_UNKNOWN2045_CHUNK_ID, m_Unknown2045);
|
||||||
|
if (m_Unknown2047) putChunk(PMB_UNKNOWN2047_CHUNK_ID, m_Unknown2047);
|
||||||
|
if (m_Unknown21B0) putChunk(PMB_UNKNOWN21B0_CHUNK_ID, m_Unknown21B0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceMaker::disown()
|
||||||
|
{
|
||||||
|
m_References.clear();
|
||||||
|
m_ReferenceMap = false;
|
||||||
|
m_References2035Value0 = 0;
|
||||||
|
m_204B_Equals_2E = NULL;
|
||||||
|
m_Unknown2045 = NULL;
|
||||||
|
m_Unknown2047 = NULL;
|
||||||
|
m_Unknown21B0 = NULL;
|
||||||
|
CAnimatable::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceMaker::init()
|
||||||
|
{
|
||||||
|
CAnimatable::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CReferenceMaker::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CAnimatable::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CReferenceMaker::classDesc() const
|
||||||
|
{
|
||||||
|
return &ReferenceMakerClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceMaker::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CAnimatable::toStringLocal(ostream, pad);
|
||||||
|
uint nb = nbReferences();
|
||||||
|
if (nb)
|
||||||
|
{
|
||||||
|
if (!m_ReferenceMap) ostream << "\n" << pad << "References 0x2034: ";
|
||||||
|
else ostream << "\n" << pad << "References 0x2035: ";
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
ostream << "PARSED ";
|
||||||
|
if (!m_References.size()) ostream << "VIRTUAL ";
|
||||||
|
ostream << "{ ";
|
||||||
|
for (uint i = 0; i < nb; ++i)
|
||||||
|
{
|
||||||
|
CReferenceMaker *referenceMaker = getReference(i);
|
||||||
|
if (referenceMaker)
|
||||||
|
{
|
||||||
|
ostream << "\n" << padpad << i << ": <ptr=0x";
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(16) << (uint64)(void *)referenceMaker;
|
||||||
|
ostream << ss.str();
|
||||||
|
}
|
||||||
|
ostream << "> ";
|
||||||
|
ostream << "(" << ucstring(referenceMaker->classDesc()->displayName()).toUtf8() << ", " << referenceMaker->classDesc()->classId().toString() << ") ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
if (m_204B_Equals_2E)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "0x204B Equals 0x2E (46): ";
|
||||||
|
m_204B_Equals_2E->toString(ostream, pad + "\t");
|
||||||
|
}
|
||||||
|
if (m_Unknown2045)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "Unknown 0x2045: ";
|
||||||
|
m_Unknown2045->toString(ostream, pad + "\t");
|
||||||
|
}
|
||||||
|
if (m_Unknown2047)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "Unknown 0x2047: ";
|
||||||
|
m_Unknown2047->toString(ostream, pad + "\t");
|
||||||
|
}
|
||||||
|
if (m_Unknown21B0)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "Unknown 0x21B0: ";
|
||||||
|
m_Unknown21B0->toString(ostream, pad + "\t");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CReferenceMaker *CReferenceMaker::getReference(uint index) const
|
||||||
|
{
|
||||||
|
if (m_References.size() <= index) return NULL;
|
||||||
|
return m_References[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceMaker::setReference(uint index, CReferenceMaker *reference)
|
||||||
|
{
|
||||||
|
if (m_References.size() <= index) m_References.resize(index + 1);
|
||||||
|
m_References[index] = reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint CReferenceMaker::nbReferences() const
|
||||||
|
{
|
||||||
|
return m_References.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CReferenceMaker::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case PMB_REFERENCES_2034_CHUNK_ID:
|
||||||
|
return new CStorageArray<sint32>();
|
||||||
|
case PMB_REFERENCES_2035_CHUNK_ID:
|
||||||
|
return new CStorageArray<sint32>();
|
||||||
|
case PMB_204B_EQUALS_2E_CHUNK_ID:
|
||||||
|
return new CStorageValue<uint8>();
|
||||||
|
case PMB_UNKNOWN21B0_CHUNK_ID:
|
||||||
|
return new CStorageRaw();
|
||||||
|
}
|
||||||
|
return CAnimatable::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,110 @@
|
|||||||
|
/**
|
||||||
|
* \file reference_maker.h
|
||||||
|
* \brief CReferenceMaker
|
||||||
|
* \date 2012-08-22 08:52GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CReferenceMaker
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_REFERENCE_MAKER_H
|
||||||
|
#define PIPELINE_REFERENCE_MAKER_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../storage_array.h"
|
||||||
|
#include "animatable.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CReferenceMaker
|
||||||
|
* \date 2012-08-22 08:52GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* This class implements references
|
||||||
|
*/
|
||||||
|
class CReferenceMaker : public CAnimatable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CReferenceMaker(CScene *scene);
|
||||||
|
virtual ~CReferenceMaker();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const char *InternalNameUnknown;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
// child classes should inherit, default implementation stores in a vector
|
||||||
|
/// Get a reference
|
||||||
|
virtual CReferenceMaker *getReference(uint index) const;
|
||||||
|
virtual void setReference(uint index, CReferenceMaker *reference);
|
||||||
|
virtual uint nbReferences() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
/// Storage method
|
||||||
|
bool m_ReferenceMap;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CStorageValue<uint8> *m_204B_Equals_2E;
|
||||||
|
|
||||||
|
/// Default implementation, should preferably not use this, no direct read access will be provided
|
||||||
|
std::vector<NLMISC::CRefPtr<CReferenceMaker> > m_References;
|
||||||
|
/// Unknown value
|
||||||
|
uint32 m_References2035Value0;
|
||||||
|
|
||||||
|
CStorageRaw *m_Unknown2045;
|
||||||
|
CStorageRaw *m_Unknown2047;
|
||||||
|
CStorageRaw *m_Unknown21B0;
|
||||||
|
|
||||||
|
}; /* class CReferenceMaker */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CReferenceMaker> CReferenceMakerClassDesc;
|
||||||
|
extern const CReferenceMakerClassDesc ReferenceMakerClassDesc;
|
||||||
|
typedef CSuperClassDesc<CReferenceMaker> CReferenceMakerSuperClassDesc;
|
||||||
|
extern const CReferenceMakerSuperClassDesc ReferenceMakerSuperClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_REFERENCE_MAKER_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,113 @@
|
|||||||
|
/**
|
||||||
|
* \file reference_target.cpp
|
||||||
|
* \brief CReferenceTarget
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CReferenceTarget
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "reference_target.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CReferenceTarget::CReferenceTarget(CScene *scene) : CReferenceMaker(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CReferenceTarget::~CReferenceTarget()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CReferenceTarget::DisplayName = ucstring("ReferenceTarget");
|
||||||
|
const char *CReferenceTarget::InternalName = "ReferenceTarget";
|
||||||
|
const char *CReferenceTarget::InternalNameUnknown = "ReferenceTargetUnknown";
|
||||||
|
const NLMISC::CClassId CReferenceTarget::ClassId = NLMISC::CClassId(0x5d545dd9, 0xa422e4); /* Not official, please correct */
|
||||||
|
const TSClassId CReferenceTarget::SuperClassId = 0x00000200;
|
||||||
|
const CReferenceTargetClassDesc ReferenceTargetClassDesc(&DllPluginDescBuiltin);
|
||||||
|
const CReferenceTargetSuperClassDesc ReferenceTargetSuperClassDesc(&ReferenceTargetClassDesc);
|
||||||
|
|
||||||
|
void CReferenceTarget::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceMaker::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceTarget::clean()
|
||||||
|
{
|
||||||
|
CReferenceMaker::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceTarget::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceMaker::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceTarget::disown()
|
||||||
|
{
|
||||||
|
CReferenceMaker::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceTarget::init()
|
||||||
|
{
|
||||||
|
CReferenceMaker::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CReferenceTarget::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CReferenceMaker::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CReferenceTarget::classDesc() const
|
||||||
|
{
|
||||||
|
return &ReferenceTargetClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CReferenceTarget::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CReferenceMaker::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CReferenceTarget::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CReferenceMaker::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,90 @@
|
|||||||
|
/**
|
||||||
|
* \file reference_target.h
|
||||||
|
* \brief CReferenceTarget
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CReferenceTarget
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_REFERENCE_TARGET_H
|
||||||
|
#define PIPELINE_REFERENCE_TARGET_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "reference_maker.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CReferenceTarget
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* Dummy class, supposed to send or receive events or something.
|
||||||
|
* Nice for copy pasting the basic class layout.
|
||||||
|
*/
|
||||||
|
class CReferenceTarget : public CReferenceMaker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CReferenceTarget(CScene *scene);
|
||||||
|
virtual ~CReferenceTarget();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const char *InternalNameUnknown;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CReferenceTarget */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CReferenceTarget> CReferenceTargetClassDesc;
|
||||||
|
extern const CReferenceTargetClassDesc ReferenceTargetClassDesc;
|
||||||
|
typedef CSuperClassDesc<CReferenceTarget> CReferenceTargetSuperClassDesc;
|
||||||
|
extern const CReferenceTargetSuperClassDesc ReferenceTargetSuperClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_REFERENCE_TARGET_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
* \file root_node.cpp
|
||||||
|
* \brief CRootNode
|
||||||
|
* \date 2012-08-22 19:45GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CRootNode
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "root_node.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CRootNode::CRootNode(CScene *scene) : INode(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CRootNode::~CRootNode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CRootNode::DisplayName = ucstring("RootNode");
|
||||||
|
const char *CRootNode::InternalName = "RootNode";
|
||||||
|
const NLMISC::CClassId CRootNode::ClassId = NLMISC::CClassId(0x00000002, 0x00000000);
|
||||||
|
const TSClassId CRootNode::SuperClassId = INode::SuperClassId;
|
||||||
|
const CRootNodeClassDesc RootNodeClassDesc(&DllPluginDescBuiltin);
|
||||||
|
|
||||||
|
void CRootNode::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
INode::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRootNode::clean()
|
||||||
|
{
|
||||||
|
INode::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRootNode::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
INode::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRootNode::disown()
|
||||||
|
{
|
||||||
|
INode::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRootNode::init()
|
||||||
|
{
|
||||||
|
INode::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRootNode::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return INode::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CRootNode::classDesc() const
|
||||||
|
{
|
||||||
|
return &RootNodeClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRootNode::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
INode::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring &CRootNode::userName() const
|
||||||
|
{
|
||||||
|
static const ucstring v = ucstring("Root Node");
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CRootNode::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return INode::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* \file root_node.h
|
||||||
|
* \brief CRootNode
|
||||||
|
* \date 2012-08-22 19:45GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CRootNode
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_ROOT_NODE_H
|
||||||
|
#define PIPELINE_ROOT_NODE_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "i_node.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CRootNode
|
||||||
|
* \date 2012-08-22 20:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CRootNode
|
||||||
|
*/
|
||||||
|
class CRootNode : public INode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CRootNode(CScene *scene);
|
||||||
|
virtual ~CRootNode();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
// node interface
|
||||||
|
virtual const ucstring &userName() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CRootNode */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CRootNode> CRootNodeClassDesc;
|
||||||
|
extern const CRootNodeClassDesc RootNodeClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_ROOT_NODE_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,209 @@
|
|||||||
|
/**
|
||||||
|
* \file scene_impl.cpp
|
||||||
|
* \brief CSceneImpl
|
||||||
|
* \date 2012-08-24 12:33GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneImpl
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "scene_impl.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CSceneImpl::CSceneImpl(CScene *scene) : CReferenceMaker(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CSceneImpl::~CSceneImpl()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CSceneImpl::DisplayName = ucstring("Scene");
|
||||||
|
const char *CSceneImpl::InternalName = "SceneImpl";
|
||||||
|
const NLMISC::CClassId CSceneImpl::ClassId = NLMISC::CClassId(0x00002222, 0x00000000);
|
||||||
|
const TSClassId CSceneImpl::SuperClassId = CReferenceMaker::SuperClassId;
|
||||||
|
const CSceneImplClassDesc SceneImplClassDesc(&DllPluginDescBuiltin);
|
||||||
|
|
||||||
|
void CSceneImpl::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceMaker::parse(version);
|
||||||
|
nlassert(m_MaterialEditor);
|
||||||
|
nlassert(m_MtlBaseLib);
|
||||||
|
nlassert(m_Sound);
|
||||||
|
nlassert(m_RootNode);
|
||||||
|
nlassert(m_RenderEnvironment);
|
||||||
|
nlassert(m_NamedSelSetList);
|
||||||
|
nlassert(m_TrackViewNode);
|
||||||
|
nlassert(m_GridReference);
|
||||||
|
nlassert(m_RenderEffects);
|
||||||
|
nlassert(m_ShadowMap);
|
||||||
|
nlassert(m_LayerManager);
|
||||||
|
if (version > Version3) nlassert(m_TrackSetList);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneImpl::clean()
|
||||||
|
{
|
||||||
|
CReferenceMaker::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneImpl::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceMaker::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneImpl::disown()
|
||||||
|
{
|
||||||
|
CReferenceMaker::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneImpl::init()
|
||||||
|
{
|
||||||
|
CReferenceMaker::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSceneImpl::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CReferenceMaker::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CSceneImpl::classDesc() const
|
||||||
|
{
|
||||||
|
return &SceneImplClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneImpl::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CReferenceMaker::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
CReferenceMaker *CSceneImpl::getReference(uint index) const
|
||||||
|
{
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return m_MaterialEditor;
|
||||||
|
case 1:
|
||||||
|
return m_MtlBaseLib;
|
||||||
|
case 2:
|
||||||
|
return m_Sound;
|
||||||
|
case 3:
|
||||||
|
return m_RootNode;
|
||||||
|
case 4:
|
||||||
|
return m_RenderEnvironment;
|
||||||
|
case 5:
|
||||||
|
return m_NamedSelSetList;
|
||||||
|
case 6:
|
||||||
|
return m_TrackViewNode;
|
||||||
|
case 7:
|
||||||
|
return m_GridReference;
|
||||||
|
case 8:
|
||||||
|
return m_RenderEffects;
|
||||||
|
case 9:
|
||||||
|
return m_ShadowMap;
|
||||||
|
case 10:
|
||||||
|
return m_LayerManager;
|
||||||
|
case 11:
|
||||||
|
return m_TrackSetList;
|
||||||
|
default:
|
||||||
|
if (index > 0)
|
||||||
|
nlerror("Invalid index %i", index);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneImpl::setReference(uint index, CReferenceMaker *reference)
|
||||||
|
{
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
m_MaterialEditor = reference;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
m_MtlBaseLib = reference;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
m_Sound = reference;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
m_RootNode = dynamic_cast<CRootNode *>(reference);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
m_RenderEnvironment = reference;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
m_NamedSelSetList = reference;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
m_TrackViewNode = dynamic_cast<CTrackViewNode *>(reference);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
m_GridReference = reference;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
m_RenderEffects = reference;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
m_ShadowMap = reference;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
m_LayerManager = reference;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
m_TrackSetList = reference;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
nlerror("Unknown reference index %i entry <ptr=0x%x> (%s, 0x%x)", index, (uint32)(uint64)(void *)reference, reference->classDesc()->classId().toString().c_str(), reference->classDesc()->superClassId());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint CSceneImpl::nbReferences() const
|
||||||
|
{
|
||||||
|
return m_TrackSetList ? 12 : 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CSceneImpl::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CReferenceMaker::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,112 @@
|
|||||||
|
/**
|
||||||
|
* \file scene_impl.h
|
||||||
|
* \brief CSceneImpl
|
||||||
|
* \date 2012-08-24 12:33GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneImpl
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_SCENE_IMPL_H
|
||||||
|
#define PIPELINE_SCENE_IMPL_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "reference_maker.h"
|
||||||
|
|
||||||
|
#include "root_node.h"
|
||||||
|
#include "track_view_node.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CSceneImpl
|
||||||
|
* \date 2012-08-22 08:53GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* Scene implementation
|
||||||
|
*/
|
||||||
|
class CSceneImpl : public CReferenceMaker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSceneImpl(CScene *scene);
|
||||||
|
virtual ~CSceneImpl();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
// reference maker
|
||||||
|
virtual CReferenceMaker *getReference(uint index) const;
|
||||||
|
virtual void setReference(uint index, CReferenceMaker *reference);
|
||||||
|
virtual uint nbReferences() const;
|
||||||
|
|
||||||
|
// read access
|
||||||
|
inline CRootNode *rootNode() const { return m_RootNode; }
|
||||||
|
inline CTrackViewNode *trackViewNode() const { return m_TrackViewNode; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_MaterialEditor;
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_MtlBaseLib;
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_Sound;
|
||||||
|
NLMISC::CRefPtr<CRootNode> m_RootNode;
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_RenderEnvironment;
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_NamedSelSetList;
|
||||||
|
NLMISC::CRefPtr<CTrackViewNode> m_TrackViewNode;
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_GridReference;
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_RenderEffects;
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_ShadowMap;
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_LayerManager;
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> m_TrackSetList; // Does not exist in R3
|
||||||
|
|
||||||
|
}; /* class CSceneImpl */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CSceneImpl> CSceneImplClassDesc;
|
||||||
|
extern const CSceneImplClassDesc SceneImplClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_SCENE_IMPL_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file std_mat.cpp
|
||||||
|
* \brief CStdMat
|
||||||
|
* \date 2012-08-22 08:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStdMat
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "std_mat.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CStdMat::CStdMat(CScene *scene) : CMtl(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CStdMat::~CStdMat()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file std_mat.h
|
||||||
|
* \brief CStdMat
|
||||||
|
* \date 2012-08-22 08:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStdMat
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_STD_MAT_H
|
||||||
|
#define PIPELINE_STD_MAT_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "mtl.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CStdMat
|
||||||
|
* \date 2012-08-22 08:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStdMat
|
||||||
|
*/
|
||||||
|
class CStdMat : public CMtl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CStdMat(CScene *scene);
|
||||||
|
virtual ~CStdMat();
|
||||||
|
|
||||||
|
}; /* class CStdMat */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_STD_MAT_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file std_mat_2.cpp
|
||||||
|
* \brief CStdMat2
|
||||||
|
* \date 2012-08-22 08:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStdMat2
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "std_mat_2.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CStdMat2::CStdMat2(CScene *scene) : CStdMat(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CStdMat2::~CStdMat2()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
* \file std_mat_2.h
|
||||||
|
* \brief CStdMat2
|
||||||
|
* \date 2012-08-22 08:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStdMat2
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_STD_MAT_2_H
|
||||||
|
#define PIPELINE_STD_MAT_2_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "std_mat.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CStdMat2
|
||||||
|
* \date 2012-08-22 08:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStdMat2
|
||||||
|
*/
|
||||||
|
class CStdMat2 : public CStdMat
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
// pointers
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// instances
|
||||||
|
// ...
|
||||||
|
public:
|
||||||
|
CStdMat2(CScene *scene);
|
||||||
|
virtual ~CStdMat2();
|
||||||
|
}; /* class CStdMat2 */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_STD_MAT_2_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,507 @@
|
|||||||
|
/**
|
||||||
|
* \file app_data.cpp
|
||||||
|
* \brief CAppData
|
||||||
|
* \date 2012-08-21 11:47GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CAppData
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "app_data.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
namespace STORAGE {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define PMBS_APP_DATA_PARSE 1
|
||||||
|
|
||||||
|
// Elevate warnings to errors in this file for stricter reading
|
||||||
|
#undef nlwarning
|
||||||
|
#define nlwarning nlerror
|
||||||
|
|
||||||
|
// Elevate debug to error in this file for debugging
|
||||||
|
// #undef nldebug
|
||||||
|
// #define nldebug nlerror
|
||||||
|
|
||||||
|
// Chunk identifiers
|
||||||
|
#define PMBS_APP_DATA_HEADER_CHUNK_ID 0x0100
|
||||||
|
#define PMBS_APP_DATA_ENTRY_CHUNK_ID 0x0110
|
||||||
|
#define PMBS_APP_DATA_ENTRY_KEY_CHUNK_ID 0x0120
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CAppData::TKey::TKey(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId) : ClassId(classId), SuperClassId(superClassId), SubId(subId)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CAppData::TKey::operator<(const CAppData::TKey &right) const
|
||||||
|
{
|
||||||
|
if (ClassId < right.ClassId)
|
||||||
|
return true;
|
||||||
|
if (ClassId > right.ClassId)
|
||||||
|
return false;
|
||||||
|
if (SuperClassId < right.SuperClassId)
|
||||||
|
return true;
|
||||||
|
if (SuperClassId > right.SuperClassId)
|
||||||
|
return false;
|
||||||
|
if (SubId < right.SubId)
|
||||||
|
return true;
|
||||||
|
if (SubId > right.SubId)
|
||||||
|
return false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CAppData::TKey::operator>(const CAppData::TKey &right) const
|
||||||
|
{
|
||||||
|
if (ClassId > right.ClassId)
|
||||||
|
return true;
|
||||||
|
if (ClassId < right.ClassId)
|
||||||
|
return false;
|
||||||
|
if (SuperClassId > right.SuperClassId)
|
||||||
|
return true;
|
||||||
|
if (SuperClassId < right.SuperClassId)
|
||||||
|
return false;
|
||||||
|
if (SubId > right.SubId)
|
||||||
|
return true;
|
||||||
|
if (SubId < right.SubId)
|
||||||
|
return false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CAppData::TKey::operator==(const CAppData::TKey &right) const
|
||||||
|
{
|
||||||
|
return ClassId == right.ClassId && SuperClassId == right.SuperClassId && SubId == right.SubId;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CAppData::CAppData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CAppData::~CAppData()
|
||||||
|
{
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
for (TMap::const_iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
delete subit->second;
|
||||||
|
m_Entries.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CAppData::className() const
|
||||||
|
{
|
||||||
|
return "AppData";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppData::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") [" << m_Entries.size() << "] PARSED { ";
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
uint subi = 0;
|
||||||
|
for (TMap::const_iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "Entries[" << subi << "]: ";
|
||||||
|
subit->second->toString(ostream, padpad);
|
||||||
|
++subi;
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppData::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
#if PMBS_APP_DATA_PARSE
|
||||||
|
// Cannot be parsed yet
|
||||||
|
if (!m_ChunksOwnsPointers) { nlerror("Already parsed"); return; }
|
||||||
|
|
||||||
|
// First parse all the child nodes
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
if (m_Chunks.size() < 2) { nlwarning("Bad container size %i", m_Chunks.size()); disown(); return; }
|
||||||
|
|
||||||
|
// Header
|
||||||
|
TStorageObjectContainer::iterator it = m_Chunks.begin();
|
||||||
|
if (it->first != PMBS_APP_DATA_HEADER_CHUNK_ID) { nlwarning("Bad id %x, expected %x", (uint32)it->first, PMBS_APP_DATA_HEADER_CHUNK_ID); disown(); return; }
|
||||||
|
uint32 headerSize = static_cast<CStorageValue<uint32> *>(it->second)->Value;
|
||||||
|
++it;
|
||||||
|
|
||||||
|
// Entries
|
||||||
|
for (TStorageObjectContainer::iterator end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->first != PMBS_APP_DATA_ENTRY_CHUNK_ID) { nlwarning("Bad id %x, expected %x", (uint32)it->first, PMBS_APP_DATA_ENTRY_CHUNK_ID); disown(); return; }
|
||||||
|
CAppDataEntry *entry = static_cast<CAppDataEntry *>(it->second);
|
||||||
|
TKey key(entry->key()->ClassId, entry->key()->SuperClassId, entry->key()->SubId);
|
||||||
|
if (m_Entries.find(key) != m_Entries.end()) { nlwarning("Duplicate entry"); disown(); return; }
|
||||||
|
m_Entries[key] = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify or fail
|
||||||
|
if (m_Entries.size() != headerSize) { nlwarning("Entry count %i does not match header %i", m_Entries.size(), headerSize); disown(); return; }
|
||||||
|
|
||||||
|
// Take local ownership
|
||||||
|
m_ChunksOwnsPointers = false;
|
||||||
|
#else
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppData::clean()
|
||||||
|
{
|
||||||
|
#if PMBS_APP_DATA_PARSE
|
||||||
|
if (m_ChunksOwnsPointers) { nldebug("Not parsed, or disowned"); return; } // Must have local ownership
|
||||||
|
if (m_Chunks.size() == 0) { nlwarning("Already cleaned (or did not build due to coding error)"); return; } // Already cleaned
|
||||||
|
if (m_Chunks.begin()->first != PMBS_APP_DATA_HEADER_CHUNK_ID) { nlerror("Bad id %x, expected %x", (uint32)m_Chunks.begin()->first, PMBS_APP_DATA_HEADER_CHUNK_ID); return; } // Cannot happen, because we won't have local ownership if parsing failed
|
||||||
|
delete m_Chunks.begin()->second; // Delete the header chunk, since we own it
|
||||||
|
m_Chunks.clear(); // Clear the remaining chunks
|
||||||
|
|
||||||
|
// Clean raw storage
|
||||||
|
for (TMap::const_iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
subit->second->clean();
|
||||||
|
|
||||||
|
#else
|
||||||
|
CStorageContainer::clean();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppData::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
#if PMBS_APP_DATA_PARSE
|
||||||
|
// Must be clean first
|
||||||
|
if (!m_ChunksOwnsPointers && m_Chunks.size() != 0) { nlerror("Not cleaned"); return; }
|
||||||
|
if (m_Chunks.size() != 0) { nldebug("Not parsed, or disowned"); return; }
|
||||||
|
|
||||||
|
// Set up the header in the chunks container
|
||||||
|
CStorageValue<uint32> *headerSize = new CStorageValue<uint32>(); // Owned locally, not by m_Chunks
|
||||||
|
headerSize->Value = m_Entries.size();
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(PMBS_APP_DATA_HEADER_CHUNK_ID, headerSize));
|
||||||
|
|
||||||
|
// Set up the entries
|
||||||
|
for (TMap::iterator it = m_Entries.begin(), end = m_Entries.end(); it != end; ++it)
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(PMBS_APP_DATA_ENTRY_CHUNK_ID, it->second));
|
||||||
|
|
||||||
|
// Rebuild raw storage
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
#else
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppData::disown()
|
||||||
|
{
|
||||||
|
#if PMBS_APP_DATA_PARSE
|
||||||
|
if (m_ChunksOwnsPointers) { nldebug("Not parsed"); }
|
||||||
|
if (!m_ChunksOwnsPointers && (m_Chunks.size() != (m_Entries.size() + 1))) { nlerror("Not built"); return; } // If chunks is not the owner, built chunks must match the parsed data
|
||||||
|
// NOTE: m_Chunks must be valid at this point!
|
||||||
|
|
||||||
|
// Disown locally
|
||||||
|
m_Entries.clear();
|
||||||
|
|
||||||
|
// Give ownership back
|
||||||
|
m_ChunksOwnsPointers = true;
|
||||||
|
|
||||||
|
// Disown all the child chunks
|
||||||
|
CStorageContainer::disown();
|
||||||
|
#else
|
||||||
|
CStorageContainer::disown();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppData::init()
|
||||||
|
{
|
||||||
|
// Cannot be init yet
|
||||||
|
if (!m_ChunksOwnsPointers) { nlerror("Already parsed"); return; }
|
||||||
|
if (m_Chunks.size() != 0) { nlerror("Already built or serialized"); return; }
|
||||||
|
|
||||||
|
// We own this
|
||||||
|
m_ChunksOwnsPointers = false;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
const uint8 *CAppData::read(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId, uint32 &size) const
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers) { nlwarning("Not parsed"); return NULL; }
|
||||||
|
TKey key(classId, superClassId, subId);
|
||||||
|
TMap::const_iterator it = m_Entries.find(key);
|
||||||
|
if (it == m_Entries.end()) { nldebug("Trying to read non-existant key, this is allowed, returning NULL"); return NULL; }
|
||||||
|
size = it->second->value()->Value.size();
|
||||||
|
return &it->second->value()->Value[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8 *CAppData::lock(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId, uint32 capacity)
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers) { nlwarning("Not parsed"); return NULL; }
|
||||||
|
TKey key(classId, superClassId, subId);
|
||||||
|
TMap::const_iterator it = m_Entries.find(key);
|
||||||
|
CAppDataEntry *appDataEntry;
|
||||||
|
if (it == m_Entries.end())
|
||||||
|
{
|
||||||
|
appDataEntry = new CAppDataEntry();
|
||||||
|
m_Entries[key] = appDataEntry;
|
||||||
|
appDataEntry->key()->ClassId = classId;
|
||||||
|
appDataEntry->key()->SuperClassId = superClassId;
|
||||||
|
appDataEntry->key()->SubId = subId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
appDataEntry = it->second;
|
||||||
|
}
|
||||||
|
appDataEntry->key()->Size = capacity;
|
||||||
|
appDataEntry->value()->Value.resize(capacity);
|
||||||
|
return &appDataEntry->value()->Value[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppData::unlock(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId, uint32 size)
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers) { nlwarning("Not parsed"); return; }
|
||||||
|
TKey key(classId, superClassId, subId);
|
||||||
|
TMap::const_iterator it = m_Entries.find(key);
|
||||||
|
if (it == m_Entries.end()) { nlerror("Unlocking non-existant key"); return; }
|
||||||
|
CAppDataEntry *appDataEntry = it->second;
|
||||||
|
appDataEntry->key()->Size = size;
|
||||||
|
appDataEntry->value()->Value.resize(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppData::fill(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId, uint8 *buffer, uint32 size)
|
||||||
|
{
|
||||||
|
uint8 *dest = lock(classId, superClassId, subId, size);
|
||||||
|
memcpy(dest, buffer, size);
|
||||||
|
|
||||||
|
// Internally not necessary, since we sent the correct size.
|
||||||
|
// Outside classes should unlock in case the implementation changes.
|
||||||
|
// unlock(classId, superClassId, subId, size);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
void CAppData::erase(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId)
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers) { nlwarning("Not parsed"); return; }
|
||||||
|
TKey key(classId, superClassId, subId);
|
||||||
|
TMap::const_iterator it = m_Entries.find(key);
|
||||||
|
if (it == m_Entries.end()) { nldebug("Trying to erase non-existant key, this is allowed, doing nothing"); return; }
|
||||||
|
m_Entries.erase(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CAppData::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case PMBS_APP_DATA_HEADER_CHUNK_ID:
|
||||||
|
nlassert(!container);
|
||||||
|
return new CStorageValue<uint32>();
|
||||||
|
break;
|
||||||
|
case PMBS_APP_DATA_ENTRY_CHUNK_ID:
|
||||||
|
nlassert(container);
|
||||||
|
return new CAppDataEntry();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CAppDataEntryKey::CAppDataEntryKey()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CAppDataEntryKey::~CAppDataEntryKey()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CAppDataEntryKey::className() const
|
||||||
|
{
|
||||||
|
return "AppDataEntryKey";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppDataEntryKey::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
stream.serial(ClassId);
|
||||||
|
stream.serial(SuperClassId);
|
||||||
|
stream.serial(SubId);
|
||||||
|
stream.serial(Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppDataEntryKey::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") { ";
|
||||||
|
ostream << "\n" << pad << "ClassId: " << NLMISC::toString(ClassId);
|
||||||
|
ostream << "\n" << pad << "SuperClassId: " << SuperClassId;
|
||||||
|
ostream << "\n" << pad << "SubId: " << SubId;
|
||||||
|
ostream << "\n" << pad << "Size: " << Size;
|
||||||
|
ostream << " } ";
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CAppDataEntry::CAppDataEntry() : m_Key(NULL), m_Raw(NULL), m_Value(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CAppDataEntry::~CAppDataEntry()
|
||||||
|
{
|
||||||
|
delete m_Value;
|
||||||
|
m_Value = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CAppDataEntry::className() const
|
||||||
|
{
|
||||||
|
return "AppDataEntry";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppDataEntry::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
if (m_Key && m_Value)
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
ostream << "\n" << pad << "Key: ";
|
||||||
|
m_Key->toString(ostream, padpad);
|
||||||
|
ostream << "\n" << pad << "Value: ";
|
||||||
|
m_Value->toString(ostream, padpad);
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppDataEntry::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// CStorageContainer::parse(version);
|
||||||
|
// if (!m_ChunksOwnsPointers) { nlwarning("Already parsed"); return; }
|
||||||
|
if (m_Chunks.size() != 2) { nlwarning("Bad container size"); disown(); return; }
|
||||||
|
|
||||||
|
TStorageObjectContainer::iterator it = m_Chunks.begin();
|
||||||
|
if (it->first != PMBS_APP_DATA_ENTRY_KEY_CHUNK_ID) { nlwarning("Bad id %x, expected %x", (uint32)it->first, PMBS_APP_DATA_ENTRY_KEY_CHUNK_ID); disown(); return; }
|
||||||
|
m_Key = static_cast<CAppDataEntryKey *>(it->second);
|
||||||
|
|
||||||
|
++it;
|
||||||
|
if (it->first != PMBS_APP_DATA_ENTRY_VALUE_CHUNK_ID) { nlwarning("Bad id %x, expected %x", (uint32)it->first, PMBS_APP_DATA_ENTRY_VALUE_CHUNK_ID); disown(); return; }
|
||||||
|
m_Raw = static_cast<CStorageRaw *>(it->second);
|
||||||
|
|
||||||
|
// m_ChunksOwnsPointers = false;
|
||||||
|
nlassert(m_ChunksOwnsPointers); // Never set false here
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppDataEntry::clean()
|
||||||
|
{
|
||||||
|
// CStorageContainer::clean();
|
||||||
|
if (m_Value)
|
||||||
|
{
|
||||||
|
nlassert(m_Raw);
|
||||||
|
m_Raw->Value.resize(0);
|
||||||
|
m_Key->Size = 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppDataEntry::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// CStorageContainer::build(version);
|
||||||
|
if (m_Value)
|
||||||
|
{
|
||||||
|
nlassert(m_Raw);
|
||||||
|
NLMISC::CMemStream mem;
|
||||||
|
m_Value->serial(mem);
|
||||||
|
m_Raw->setSize(mem.getPos());
|
||||||
|
mem.invert();
|
||||||
|
m_Raw->serial(mem);
|
||||||
|
m_Key->Size = m_Raw->Value.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppDataEntry::disown()
|
||||||
|
{
|
||||||
|
// CStorageContainer::disown();
|
||||||
|
if (m_Chunks.size() != 2) { nlerror("Not built"); return; } // Built chunks must match the parsed data
|
||||||
|
m_Key = NULL;
|
||||||
|
m_Raw = NULL;
|
||||||
|
delete m_Value;
|
||||||
|
m_Value = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAppDataEntry::init()
|
||||||
|
{
|
||||||
|
nlassert(m_Chunks.size() == 0);
|
||||||
|
m_Key = new CAppDataEntryKey();
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(PMBS_APP_DATA_ENTRY_KEY_CHUNK_ID, m_Key));
|
||||||
|
m_Raw = new CStorageRaw();
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(PMBS_APP_DATA_ENTRY_VALUE_CHUNK_ID, m_Raw));
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CAppDataEntry::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case PMBS_APP_DATA_ENTRY_KEY_CHUNK_ID:
|
||||||
|
nlassert(!container);
|
||||||
|
return new CAppDataEntryKey();
|
||||||
|
case PMBS_APP_DATA_ENTRY_VALUE_CHUNK_ID:
|
||||||
|
nlassert(!container);
|
||||||
|
return new CStorageRaw();
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace STORAGE */
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,275 @@
|
|||||||
|
/**
|
||||||
|
* \file app_data.h
|
||||||
|
* \brief CAppData
|
||||||
|
* \date 2012-08-21 11:47GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CAppData
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_APP_DATA_H
|
||||||
|
#define PIPELINE_APP_DATA_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/class_id.h>
|
||||||
|
#include <nel/misc/mem_stream.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../../typedefs.h"
|
||||||
|
#include "../../storage_object.h"
|
||||||
|
#include "../../storage_value.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
namespace STORAGE {
|
||||||
|
|
||||||
|
#define PMBS_APP_DATA_CHUNK_ID 0x2150
|
||||||
|
#define PMBS_APP_DATA_ENTRY_VALUE_CHUNK_ID 0x0130
|
||||||
|
|
||||||
|
class CAppDataEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CAppData
|
||||||
|
* \date 2012-08-21 11:47GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* This implements the AppData chunk in the storage
|
||||||
|
*/
|
||||||
|
class CAppData : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct TKey
|
||||||
|
{
|
||||||
|
TKey(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId);
|
||||||
|
NLMISC::CClassId ClassId;
|
||||||
|
TSClassId SuperClassId;
|
||||||
|
uint32 SubId;
|
||||||
|
bool operator<(const TKey &right) const;
|
||||||
|
bool operator>(const TKey &right) const;
|
||||||
|
bool operator==(const TKey &right) const;
|
||||||
|
};
|
||||||
|
typedef std::map<TKey, CAppDataEntry *> TMap;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CAppData();
|
||||||
|
virtual ~CAppData();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
// init
|
||||||
|
/// Initialize a new instance of this chunk
|
||||||
|
void init();
|
||||||
|
|
||||||
|
// public // TODO: Simplify using templates and returning a specialized storage object, auto-converted to the requested type.
|
||||||
|
/*/// Gets a pointer to an appdata chunk buffer. Returns NULL if it does not exist. Size is returned in the size parameter.
|
||||||
|
const uint8 *read(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId, uint32 &size) const;
|
||||||
|
/// Locks a pointer to an appdata chunk buffer for writing to with specified capacity. May return NULL if this chunk is unparsable or no memory can be allocated.
|
||||||
|
uint8 *lock(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId, uint32 capacity);
|
||||||
|
/// Unlocks a pointer to an appdata chunk buffer, setting the final written size.
|
||||||
|
void unlock(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId, uint32 size);
|
||||||
|
/// Fills an appdata chunk buffer with specified data, which will be copied.
|
||||||
|
void fill(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId, uint8 *buffer, uint32 size);
|
||||||
|
/// Erases an appdata chunk.
|
||||||
|
void erase(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId);*/
|
||||||
|
|
||||||
|
// public
|
||||||
|
/// Gets an appdata chunk storage object, returns NULL if it does not exist
|
||||||
|
template <typename T>
|
||||||
|
T *get(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId);
|
||||||
|
/// Gets or creates a chunk storage object
|
||||||
|
template <typename T>
|
||||||
|
T *getOrCreate(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId);
|
||||||
|
/// Erases an appdata chunk.
|
||||||
|
void erase(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId);
|
||||||
|
|
||||||
|
// read access
|
||||||
|
/// Return the entries map, do not modify directly
|
||||||
|
inline const TMap &entries() const { return m_Entries; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
TMap m_Entries;
|
||||||
|
|
||||||
|
}; /* class CAppData */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CAppDataEntryKey
|
||||||
|
* \date 2012-08-18 18:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CAppDataEntryKey
|
||||||
|
*/
|
||||||
|
class CAppDataEntryKey : public IStorageObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAppDataEntryKey();
|
||||||
|
virtual ~CAppDataEntryKey();
|
||||||
|
|
||||||
|
// public data
|
||||||
|
NLMISC::CClassId ClassId;
|
||||||
|
TSClassId SuperClassId;
|
||||||
|
uint32 SubId;
|
||||||
|
uint32 Size;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void serial(NLMISC::IStream &stream);
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
|
||||||
|
}; /* class CAppDataEntryKey */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CAppDataEntry
|
||||||
|
* \date 2012-08-21 11:47GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* This implements an entry in the AppData chunk in the storage
|
||||||
|
*/
|
||||||
|
class CAppDataEntry : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
friend class CAppData;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CAppDataEntry();
|
||||||
|
virtual ~CAppDataEntry();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
// public
|
||||||
|
// Initializes a new entry
|
||||||
|
void init();
|
||||||
|
// Returns the key
|
||||||
|
inline CAppDataEntryKey *key() { return m_Key; }
|
||||||
|
// Returns the value
|
||||||
|
template <typename T>
|
||||||
|
T *value();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CAppDataEntryKey *m_Key;
|
||||||
|
CStorageRaw *m_Raw;
|
||||||
|
IStorageObject *m_Value;
|
||||||
|
|
||||||
|
}; /* class CAppDataEntry */
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T *CAppDataEntry::value()
|
||||||
|
{
|
||||||
|
if (m_Value)
|
||||||
|
{
|
||||||
|
T *result = dynamic_cast<T *>(m_Value);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlwarning("AppData value has already been cast to another type, recasting, the previous chunk becomes invalid, this may not be intended");
|
||||||
|
NLMISC::CMemStream mem;
|
||||||
|
m_Value->serial(mem);
|
||||||
|
result = new T();
|
||||||
|
result->setSize(mem.getPos());
|
||||||
|
mem.invert();
|
||||||
|
delete m_Value;
|
||||||
|
m_Value = result;
|
||||||
|
result->serial(mem);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlassert(!m_Value);
|
||||||
|
nlassert(m_Raw);
|
||||||
|
// nldebug("Casting raw to user type");
|
||||||
|
NLMISC::CMemStream mem;
|
||||||
|
m_Raw->serial(mem);
|
||||||
|
T *result = new T();
|
||||||
|
result->setSize(mem.getPos());
|
||||||
|
// nldebug("Read %i", mem.getPos());
|
||||||
|
mem.invert();
|
||||||
|
m_Raw->Value.resize(0);
|
||||||
|
m_Key->Size = 0xFFFFFFFF;
|
||||||
|
m_Value = result;
|
||||||
|
result->serial(mem);
|
||||||
|
// nldebug("Wrote %i", mem.getPos());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T *CAppData::get(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId)
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers) { nlwarning("Not parsed"); return NULL; }
|
||||||
|
TKey key(classId, superClassId, subId);
|
||||||
|
TMap::const_iterator it = m_Entries.find(key);
|
||||||
|
if (it == m_Entries.end()) { nldebug("Trying to read non-existant key, this is allowed, returning NULL"); return NULL; }
|
||||||
|
return it->second->value<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T *CAppData::getOrCreate(NLMISC::CClassId classId, TSClassId superClassId, uint32 subId)
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers) { nlwarning("Not parsed"); return NULL; }
|
||||||
|
TKey key(classId, superClassId, subId);
|
||||||
|
TMap::const_iterator it = m_Entries.find(key);
|
||||||
|
CAppDataEntry *appDataEntry;
|
||||||
|
if (it == m_Entries.end())
|
||||||
|
{
|
||||||
|
appDataEntry = new CAppDataEntry();
|
||||||
|
appDataEntry->init();
|
||||||
|
m_Entries[key] = appDataEntry;
|
||||||
|
appDataEntry->key()->ClassId = classId;
|
||||||
|
appDataEntry->key()->SuperClassId = superClassId;
|
||||||
|
appDataEntry->key()->SubId = subId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
appDataEntry = it->second;
|
||||||
|
}
|
||||||
|
return appDataEntry->value<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace STORAGE */
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_APP_DATA_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,332 @@
|
|||||||
|
/**
|
||||||
|
* \file geom_buffers.cpp
|
||||||
|
* \brief CGeomBuffers
|
||||||
|
* \date 2012-08-25 07:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CGeomBuffers
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "geom_buffers.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>s
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../../storage_array.h"
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
namespace STORAGE {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define PMBS_GEOM_BUFFERS_PARSE 0
|
||||||
|
|
||||||
|
// Elevate warnings to errors in this file for stricter reading
|
||||||
|
#undef nlwarning
|
||||||
|
#define nlwarning nlerror
|
||||||
|
|
||||||
|
// Elevate debug to error in this file for debugging
|
||||||
|
// #undef nldebug
|
||||||
|
// #define nldebug nlerror
|
||||||
|
|
||||||
|
// Chunk identifiers
|
||||||
|
#define PMBS_GEOM_BUFFERS_TRI_A_VERTEX_CHUNK_ID 0x0914
|
||||||
|
#define PMBS_GEOM_BUFFERS_TRI_A_INDEX_CHUNK_ID 0x0912
|
||||||
|
#define PMBS_GEOM_BUFFERS_TRI_B_VERTEX_CHUNK_ID 0x0916
|
||||||
|
#define PMBS_GEOM_BUFFERS_TRI_B_INDEX_CHUNK_ID 0x0918
|
||||||
|
#define PMBS_GEOM_BUFFERS_TRI_C_VERTEX_CHUNK_ID 0x0938
|
||||||
|
#define PMBS_GEOM_BUFFERS_TRI_C_INDEX_CHUNK_ID 0x0942
|
||||||
|
#define PBMS_GEOM_BUFFERS_POLY_A_VERTEX_CHUNK_ID 0x0100
|
||||||
|
#define PBMS_GEOM_BUFFERS_POLY_A_EDGE_CHUNK_ID 0x010a
|
||||||
|
#define PBMS_GEOM_BUFFERS_POLY_A_FACE_CHUNK_ID 0x011a
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CGeomTriIndex::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
stream.serial(a);
|
||||||
|
stream.serial(b);
|
||||||
|
stream.serial(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CGeomTriIndex::toString() const
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << a << " " << b << " " << c;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CGeomTriIndexInfo::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
stream.serial(a);
|
||||||
|
stream.serial(b);
|
||||||
|
stream.serial(c);
|
||||||
|
stream.serial(alwaysOne);
|
||||||
|
stream.serial(smoothingGroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CGeomTriIndexInfo::toString() const
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << a << " " << b << " " << c << ", " << alwaysOne << " " << smoothingGroups;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CGeomPolyVertexInfo::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
stream.serial(i1);
|
||||||
|
stream.serial(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CGeomPolyVertexInfo::toString() const
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "0x" << NLMISC::toString("%x", i1) << ", " << v.toString();
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CGeomPolyEdgeInfo::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
stream.serial(i1);
|
||||||
|
stream.serial(a);
|
||||||
|
stream.serial(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CGeomPolyEdgeInfo::toString() const
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "0x" << NLMISC::toString("%x", i1) << ", " << a << " " << b;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CGeomPolyFaceInfo::CGeomPolyFaceInfo() : I1(0), Material(0), SmoothingGroups(0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomPolyFaceInfo::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
// nldebug("go");
|
||||||
|
stream.serialCont(Vertices);
|
||||||
|
// nldebug("%i vertices", Vertices.size());
|
||||||
|
uint16 bitfield;
|
||||||
|
if (!stream.isReading())
|
||||||
|
{
|
||||||
|
/*nldebug("writing");*/
|
||||||
|
bitfield = 0x0000;
|
||||||
|
if (I1) bitfield |= 0x0001;
|
||||||
|
// bitfield |= 0x0002;
|
||||||
|
// bitfield |= 0x0004;
|
||||||
|
if (Material) bitfield |= 0x0008;
|
||||||
|
if (SmoothingGroups) bitfield |= 0x0010;
|
||||||
|
if (Triangulation.size()) bitfield |= 0x0020;
|
||||||
|
// bitfield |= 0x0040;
|
||||||
|
// bitfield |= 0x0080;
|
||||||
|
}
|
||||||
|
stream.serial(bitfield);
|
||||||
|
// nldebug("bitfield 0x%x", (uint32)bitfield);
|
||||||
|
if (bitfield & 0x0001) { /*nldebug("i1");*/ stream.serial(I1); nlassert(I1); bitfield &= ~0x0001; }
|
||||||
|
else I1 = 0;
|
||||||
|
if (bitfield & 0x0008) { /*nldebug("material");*/ stream.serial(Material); nlassert(Material); bitfield &= ~0x0008; }
|
||||||
|
else Material = 0;
|
||||||
|
if (bitfield & 0x0010) { /*nldebug("smoothing");*/ stream.serial(SmoothingGroups); nlassert(SmoothingGroups); bitfield &= ~0x0010; }
|
||||||
|
else SmoothingGroups = 0;
|
||||||
|
if (bitfield & 0x0020)
|
||||||
|
{
|
||||||
|
/*nldebug("triangles");*/
|
||||||
|
if (stream.isReading()) Triangulation.resize(Vertices.size() - 3);
|
||||||
|
else nlassert(Triangulation.size() == Vertices.size() - 3);
|
||||||
|
for (std::vector<std::pair<uint32, uint32> >::size_type i = 0; i < Triangulation.size(); ++i)
|
||||||
|
{
|
||||||
|
stream.serial(Triangulation[i].first);
|
||||||
|
/*nldebug("cut from %i", Triangulation[i].first);*/
|
||||||
|
nlassert(Triangulation[i].first < Vertices.size());
|
||||||
|
stream.serial(Triangulation[i].second);
|
||||||
|
/*nldebug("to %i", Triangulation[i].second);*/
|
||||||
|
nlassert(Triangulation[i].second < Vertices.size());
|
||||||
|
}
|
||||||
|
nlassert(Triangulation.size());
|
||||||
|
bitfield &= ~0x0020;
|
||||||
|
}
|
||||||
|
if (bitfield) nlerror("Remaining bitfield value 0x%x, please debug and implement", (uint32)bitfield);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CGeomPolyFaceInfo::toString() const
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "( ";
|
||||||
|
for (std::vector<uint32>::size_type i = 0; i < Vertices.size(); ++i)
|
||||||
|
{
|
||||||
|
ss << Vertices[i] << " ";
|
||||||
|
}
|
||||||
|
ss << ")";
|
||||||
|
if (I1) ss << ", I1: " << "0x" << NLMISC::toString("%x", I1);
|
||||||
|
if (Material) ss << ", M: " << Material;
|
||||||
|
if (SmoothingGroups) ss << ", S: " << SmoothingGroups;
|
||||||
|
if (Triangulation.size())
|
||||||
|
{
|
||||||
|
ss << ", ( ";
|
||||||
|
for (std::vector<std::pair<uint32, uint32> >::size_type i = 0; i < Triangulation.size(); ++i)
|
||||||
|
{
|
||||||
|
ss << Triangulation[i].first << ":" << Triangulation[i].second << " ";
|
||||||
|
}
|
||||||
|
ss << ")";
|
||||||
|
}
|
||||||
|
ss << " ";
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CGeomBuffers::CGeomBuffers()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CGeomBuffers::~CGeomBuffers()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CGeomBuffers::className() const
|
||||||
|
{
|
||||||
|
return "GeomBuffers";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomBuffers::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomBuffers::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
#if PMBS_GEOM_BUFFERS_PARSE
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
#else
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomBuffers::clean()
|
||||||
|
{
|
||||||
|
#if PMBS_GEOM_BUFFERS_PARSE
|
||||||
|
CStorageContainer::clean();
|
||||||
|
#else
|
||||||
|
CStorageContainer::clean();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomBuffers::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
#if PMBS_GEOM_BUFFERS_PARSE
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
#else
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeomBuffers::disown()
|
||||||
|
{
|
||||||
|
#if PMBS_GEOM_BUFFERS_PARSE
|
||||||
|
CStorageContainer::disown();
|
||||||
|
#else
|
||||||
|
CStorageContainer::disown();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CGeomBuffers::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
#if PMBS_GEOM_BUFFERS_PARSE
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
// nlassert(!container);
|
||||||
|
// return new CStorageArray<float>();
|
||||||
|
//case PBMS_GEOM_BUFFERS_POLY_A_INDEX_B_CHUNK_ID:
|
||||||
|
// nlassert(!container);
|
||||||
|
// return new CStorageArray<uint32>();
|
||||||
|
case PBMS_GEOM_BUFFERS_POLY_A_VERTEX_CHUNK_ID:
|
||||||
|
nlassert(!container);
|
||||||
|
return new CStorageArraySizePre<CGeomPolyVertexInfo>();
|
||||||
|
case PBMS_GEOM_BUFFERS_POLY_A_EDGE_CHUNK_ID:
|
||||||
|
nlassert(!container);
|
||||||
|
return new CStorageArraySizePre<CGeomPolyEdgeInfo>();
|
||||||
|
case PBMS_GEOM_BUFFERS_POLY_A_FACE_CHUNK_ID:
|
||||||
|
nlassert(!container);
|
||||||
|
return new CStorageArrayDynSize<CGeomPolyFaceInfo>();
|
||||||
|
case PMBS_GEOM_BUFFERS_TRI_B_INDEX_CHUNK_ID:
|
||||||
|
case PMBS_GEOM_BUFFERS_TRI_C_INDEX_CHUNK_ID:
|
||||||
|
nlassert(!container);
|
||||||
|
return new CStorageArray<CGeomTriIndex>(); // nb: parse should check if the sizes match with tri_a size (which is the master index buffer)
|
||||||
|
case PMBS_GEOM_BUFFERS_TRI_A_INDEX_CHUNK_ID:
|
||||||
|
nlassert(!container);
|
||||||
|
return new CStorageArraySizePre<CGeomTriIndexInfo>();
|
||||||
|
case PMBS_GEOM_BUFFERS_TRI_A_VERTEX_CHUNK_ID:
|
||||||
|
case PMBS_GEOM_BUFFERS_TRI_B_VERTEX_CHUNK_ID:
|
||||||
|
case PMBS_GEOM_BUFFERS_TRI_C_VERTEX_CHUNK_ID:
|
||||||
|
nlassert(!container);
|
||||||
|
return new CStorageArraySizePre<NLMISC::CVector>();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace STORAGE */
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,134 @@
|
|||||||
|
/**
|
||||||
|
* \file geom_buffers.h
|
||||||
|
* \brief CGeomBuffers
|
||||||
|
* \date 2012-08-25 07:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CGeomBuffers
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_GEOM_BUFFERS_H
|
||||||
|
#define PIPELINE_GEOM_BUFFERS_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/vector.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../../storage_object.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
namespace STORAGE {
|
||||||
|
|
||||||
|
struct CGeomTriIndex
|
||||||
|
{
|
||||||
|
uint32 a;
|
||||||
|
uint32 b;
|
||||||
|
uint32 c;
|
||||||
|
void serial(NLMISC::IStream &stream);
|
||||||
|
std::string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CGeomTriIndexInfo
|
||||||
|
{
|
||||||
|
uint32 a;
|
||||||
|
uint32 b;
|
||||||
|
uint32 c;
|
||||||
|
uint32 alwaysOne;
|
||||||
|
uint32 smoothingGroups;
|
||||||
|
void serial(NLMISC::IStream &stream);
|
||||||
|
std::string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CGeomPolyVertexInfo
|
||||||
|
{
|
||||||
|
uint32 i1;
|
||||||
|
NLMISC::CVector v;
|
||||||
|
void serial(NLMISC::IStream &stream);
|
||||||
|
std::string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CGeomPolyEdgeInfo
|
||||||
|
{
|
||||||
|
uint32 i1;
|
||||||
|
uint32 a;
|
||||||
|
uint32 b;
|
||||||
|
void serial(NLMISC::IStream &stream);
|
||||||
|
std::string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CGeomPolyFaceInfo
|
||||||
|
{
|
||||||
|
CGeomPolyFaceInfo();
|
||||||
|
/// Vertex indices in the vertex buffer
|
||||||
|
std::vector<uint32> Vertices;
|
||||||
|
// Bitfield (implicitly stored)
|
||||||
|
/// Unknown 01 00 01 00
|
||||||
|
uint32 I1;
|
||||||
|
// Unknown?
|
||||||
|
// Unknown?
|
||||||
|
/// Material index in multi-submat
|
||||||
|
uint16 Material;
|
||||||
|
/// Bitfield with smoothing groups
|
||||||
|
uint32 SmoothingGroups;
|
||||||
|
/// Cuts at local vertex index to local vertex index
|
||||||
|
std::vector<std::pair<uint32, uint32> > Triangulation;
|
||||||
|
void serial(NLMISC::IStream &stream);
|
||||||
|
std::string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CGeomBuffers
|
||||||
|
* \date 2012-08-25 07:55GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CGeomBuffers
|
||||||
|
*/
|
||||||
|
class CGeomBuffers : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CGeomBuffers();
|
||||||
|
virtual ~CGeomBuffers();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CGeomBuffers */
|
||||||
|
|
||||||
|
} /* namespace STORAGE */
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_GEOM_BUFFERS_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file super_class_unknown.cpp
|
||||||
|
* \brief CSuperClassUnknown
|
||||||
|
* \date 2012-08-22 08:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSuperClassUnknown
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "super_class_unknown.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CSuperClassUnknown::CSuperClassUnknown()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CSuperClassUnknown::~CSuperClassUnknown()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* \file super_class_unknown.h
|
||||||
|
* \brief CSuperClassUnknown
|
||||||
|
* \date 2012-08-22 08:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSuperClassUnknown
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_SUPER_CLASS_UNKNOWN_H
|
||||||
|
#define PIPELINE_SUPER_CLASS_UNKNOWN_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CSuperClassUnknown
|
||||||
|
* \date 2012-08-22 08:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSuperClassUnknown
|
||||||
|
*/
|
||||||
|
class CSuperClassUnknown
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
// pointers
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// instances
|
||||||
|
// ...
|
||||||
|
public:
|
||||||
|
CSuperClassUnknown();
|
||||||
|
virtual ~CSuperClassUnknown();
|
||||||
|
}; /* class CSuperClassUnknown */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_SUPER_CLASS_UNKNOWN_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* \file texmap.cpp
|
||||||
|
* \brief CTexmap
|
||||||
|
* \date 2012-08-22 08:56GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CTexmap
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "texmap.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CTexmap::CTexmap(CScene *scene) : CMtlBase(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CTexmap::~CTexmap()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file texmap.h
|
||||||
|
* \brief CTexmap
|
||||||
|
* \date 2012-08-22 08:56GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CTexmap
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_TEXMAP_H
|
||||||
|
#define PIPELINE_TEXMAP_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "mtl_base.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CTexmap
|
||||||
|
* \date 2012-08-22 08:56GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CTexmap
|
||||||
|
*/
|
||||||
|
class CTexmap : public CMtlBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CTexmap(CScene *scene);
|
||||||
|
virtual ~CTexmap();
|
||||||
|
|
||||||
|
}; /* class CTexmap */
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_TEXMAP_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,192 @@
|
|||||||
|
/**
|
||||||
|
* \file track_view_node.cpp
|
||||||
|
* \brief CTrackViewNode
|
||||||
|
* \date 2012-08-24 09:44GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CTrackViewNode
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "track_view_node.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
#define PMB_TVNODE_EMPTY0140_CHUNK_ID 0x0140
|
||||||
|
#define PMB_TVNODE_EMPTY0150_CHUNK_ID 0x0150
|
||||||
|
|
||||||
|
#define PMB_TVNODE_DISPLAYNAME_CHUNK_ID 0x0110
|
||||||
|
#define PMB_TVNODE_IDENTIFIER_CHUNK_ID 0x0120
|
||||||
|
#define PMB_TVNODE_ISNOTNODE_CHUNK_ID 0x0130
|
||||||
|
|
||||||
|
CTrackViewNode::CTrackViewNode(CScene *scene) : CReferenceTarget(scene), m_Empty0140(NULL), m_Empty0150(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CTrackViewNode::~CTrackViewNode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CTrackViewNode::DisplayName = ucstring("TVNode");
|
||||||
|
const char *CTrackViewNode::InternalName = "TrackViewNode";
|
||||||
|
const NLMISC::CClassId CTrackViewNode::ClassId = NLMISC::CClassId(0x8d73b8aa, 0x90f2ee71);
|
||||||
|
const TSClassId CTrackViewNode::SuperClassId = CReferenceTarget::SuperClassId;
|
||||||
|
const CTrackViewNodeClassDesc TrackViewNodeClassDesc(&DllPluginDescBuiltin);
|
||||||
|
|
||||||
|
void CTrackViewNode::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceTarget::parse(version);
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
// Read unknown chunks
|
||||||
|
m_Empty0140 = static_cast<CStorageRaw *>(getChunk(PMB_TVNODE_EMPTY0140_CHUNK_ID));
|
||||||
|
if (m_Empty0140) nlassert(m_Empty0140->Value.empty());
|
||||||
|
m_Empty0150 = static_cast<CStorageRaw *>(getChunk(PMB_TVNODE_EMPTY0150_CHUNK_ID));
|
||||||
|
if (m_Empty0150) nlassert(m_Empty0140->Value.empty());
|
||||||
|
|
||||||
|
// Read child nodes
|
||||||
|
for (std::vector<TChild>::size_type i = 0; i < m_Children.size(); ++i)
|
||||||
|
{
|
||||||
|
m_Children[i].DisplayName = getChunkValue<ucstring>(PMB_TVNODE_DISPLAYNAME_CHUNK_ID);
|
||||||
|
m_Children[i].Identifier = getChunkValue<NLMISC::CClassId>(PMB_TVNODE_IDENTIFIER_CHUNK_ID);
|
||||||
|
m_Children[i].IsNotAnotherNode = getChunkValue<sint32>(PMB_TVNODE_ISNOTNODE_CHUNK_ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTrackViewNode::clean()
|
||||||
|
{
|
||||||
|
CReferenceTarget::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTrackViewNode::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CReferenceTarget::build(version);
|
||||||
|
|
||||||
|
// Write unknown chunks
|
||||||
|
if (m_Empty0140) putChunk(PMB_TVNODE_EMPTY0140_CHUNK_ID, m_Empty0140);
|
||||||
|
if (m_Empty0150) putChunk(PMB_TVNODE_EMPTY0150_CHUNK_ID, m_Empty0150);
|
||||||
|
|
||||||
|
// Write child nodes
|
||||||
|
for (std::vector<TChild>::size_type i = 0; i < m_Children.size(); ++i)
|
||||||
|
{
|
||||||
|
putChunkValue(PMB_TVNODE_DISPLAYNAME_CHUNK_ID, m_Children[i].DisplayName);
|
||||||
|
putChunkValue(PMB_TVNODE_IDENTIFIER_CHUNK_ID, m_Children[i].Identifier);
|
||||||
|
putChunkValue(PMB_TVNODE_ISNOTNODE_CHUNK_ID, m_Children[i].IsNotAnotherNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTrackViewNode::disown()
|
||||||
|
{
|
||||||
|
m_Children.clear();
|
||||||
|
CReferenceTarget::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTrackViewNode::init()
|
||||||
|
{
|
||||||
|
CReferenceTarget::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CTrackViewNode::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CReferenceTarget::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CTrackViewNode::classDesc() const
|
||||||
|
{
|
||||||
|
return &TrackViewNodeClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTrackViewNode::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CReferenceTarget::toStringLocal(ostream, pad);
|
||||||
|
if (m_Empty0140) ostream << "\n" << pad << "Empty 0x0140 ";
|
||||||
|
if (m_Empty0150) ostream << "\n" << pad << "Empty 0x0150 ";
|
||||||
|
// std::string padpad = pad + "\t";
|
||||||
|
for (std::vector<TChild>::size_type i = 0; i < m_Children.size(); ++i)
|
||||||
|
{
|
||||||
|
CReferenceMaker *referenceMaker = m_Children[i].Reference;
|
||||||
|
nlassert(referenceMaker);
|
||||||
|
ostream << "\n" << pad << i << ": <ptr=0x";
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(16) << (uint64)(void *)referenceMaker;
|
||||||
|
ostream << ss.str();
|
||||||
|
}
|
||||||
|
ostream << "> ";
|
||||||
|
ostream << "(" << ucstring(referenceMaker->classDesc()->displayName()).toUtf8() << ", " << referenceMaker->classDesc()->classId().toString() << ") ";
|
||||||
|
ostream << "(" << m_Children[i].DisplayName.toUtf8() << ", " << m_Children[i].Identifier.toString() << ", " << (m_Children[i].IsNotAnotherNode ? "ENTRY" : "TVNODE") << ") ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CReferenceMaker *CTrackViewNode::getReference(uint index) const
|
||||||
|
{
|
||||||
|
if (m_Children.size() <= index) return NULL;
|
||||||
|
return m_Children[index].Reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTrackViewNode::setReference(uint index, CReferenceMaker *reference)
|
||||||
|
{
|
||||||
|
if (m_Children.size() <= index) m_Children.resize(index + 1);
|
||||||
|
m_Children[index].Reference = reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint CTrackViewNode::nbReferences() const
|
||||||
|
{
|
||||||
|
return m_Children.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CTrackViewNode::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case PMB_TVNODE_DISPLAYNAME_CHUNK_ID:
|
||||||
|
return new CStorageValue<ucstring>();
|
||||||
|
case PMB_TVNODE_IDENTIFIER_CHUNK_ID:
|
||||||
|
return new CStorageValue<NLMISC::CClassId>();
|
||||||
|
case PMB_TVNODE_ISNOTNODE_CHUNK_ID:
|
||||||
|
return new CStorageValue<sint32>();
|
||||||
|
}
|
||||||
|
return CReferenceTarget::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
* \file track_view_node.h
|
||||||
|
* \brief CTrackViewNode
|
||||||
|
* \date 2012-08-24 09:44GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CTrackViewNode
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_TRACK_VIEW_NODE_H
|
||||||
|
#define PIPELINE_TRACK_VIEW_NODE_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "reference_target.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CTrackViewNode
|
||||||
|
* \date 2012-08-24 09:44GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* TVNode
|
||||||
|
*/
|
||||||
|
class CTrackViewNode : public CReferenceTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct TChild
|
||||||
|
{
|
||||||
|
TChild() : IsNotAnotherNode(0) { }
|
||||||
|
NLMISC::CRefPtr<CReferenceMaker> Reference;
|
||||||
|
ucstring DisplayName;
|
||||||
|
NLMISC::CClassId Identifier;
|
||||||
|
sint32 IsNotAnotherNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
CTrackViewNode(CScene *scene);
|
||||||
|
virtual ~CTrackViewNode();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
// reference maker
|
||||||
|
virtual CReferenceMaker *getReference(uint index) const;
|
||||||
|
virtual void setReference(uint index, CReferenceMaker *reference);
|
||||||
|
virtual uint nbReferences() const;
|
||||||
|
|
||||||
|
// read access
|
||||||
|
inline const std::vector<TChild> &children() const { return m_Children; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CStorageRaw *m_Empty0140;
|
||||||
|
CStorageRaw *m_Empty0150;
|
||||||
|
|
||||||
|
std::vector<TChild> m_Children;
|
||||||
|
|
||||||
|
}; /* class CTrackViewNode */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CTrackViewNode> CTrackViewNodeClassDesc;
|
||||||
|
extern const CTrackViewNodeClassDesc TrackViewNodeClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_TRACK_VIEW_NODE_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,147 @@
|
|||||||
|
/**
|
||||||
|
* \file tri_object.cpp
|
||||||
|
* \brief CTriObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CTriObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "tri_object.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
CTriObject::CTriObject(CScene *scene) : CGeomObject(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CTriObject::~CTriObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CTriObject::DisplayName = ucstring("TriObject");
|
||||||
|
const char *CTriObject::InternalName = "TriObject";
|
||||||
|
const NLMISC::CClassId CTriObject::ClassId = NLMISC::CClassId(0x4553fa6, 0x30f8421e); /* Not official, please correct */
|
||||||
|
const TSClassId CTriObject::SuperClassId = CGeomObject::SuperClassId;
|
||||||
|
const CTriObjectClassDesc TriObjectClassDesc(&DllPluginDescBuiltin);
|
||||||
|
|
||||||
|
void CTriObject::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
if (filter == 0)
|
||||||
|
{
|
||||||
|
CGeomObject::parse(version);
|
||||||
|
}
|
||||||
|
else if (filter == PMB_TRI_OBJECT_PARSE_FILTER)
|
||||||
|
{
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
CGeomObject::parse(version, PMB_GEOM_OBJECT_PARSE_FILTER);
|
||||||
|
// 0x0901
|
||||||
|
// 0x0902
|
||||||
|
// 0x0904
|
||||||
|
// 0x0903
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTriObject::clean()
|
||||||
|
{
|
||||||
|
CGeomObject::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTriObject::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
if (filter == 0)
|
||||||
|
{
|
||||||
|
CGeomObject::build(version);
|
||||||
|
}
|
||||||
|
else if (filter == PMB_TRI_OBJECT_PARSE_FILTER)
|
||||||
|
{
|
||||||
|
CGeomObject::build(version, PMB_GEOM_OBJECT_PARSE_FILTER);
|
||||||
|
// 0x0901
|
||||||
|
// 0x0902
|
||||||
|
// 0x0904
|
||||||
|
// 0x0903
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTriObject::disown()
|
||||||
|
{
|
||||||
|
CGeomObject::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTriObject::init()
|
||||||
|
{
|
||||||
|
CGeomObject::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CTriObject::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CGeomObject::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CTriObject::classDesc() const
|
||||||
|
{
|
||||||
|
return &TriObjectClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTriObject::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
if (filter == 0)
|
||||||
|
{
|
||||||
|
CGeomObject::toStringLocal(ostream, pad);
|
||||||
|
}
|
||||||
|
else if (filter == PMB_TRI_OBJECT_PARSE_FILTER)
|
||||||
|
{
|
||||||
|
CGeomObject::toStringLocal(ostream, pad, PMB_GEOM_OBJECT_PARSE_FILTER);
|
||||||
|
// 0x0901
|
||||||
|
// 0x0902
|
||||||
|
// 0x0904
|
||||||
|
// 0x0903
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CTriObject::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CGeomObject::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,90 @@
|
|||||||
|
/**
|
||||||
|
* \file tri_object.h
|
||||||
|
* \brief CTriObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CTriObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_TRI_OBJECT_H
|
||||||
|
#define PIPELINE_TRI_OBJECT_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "geom_object.h"
|
||||||
|
|
||||||
|
/// Must be passed to the parse and build functions by
|
||||||
|
/// inheriting classes to parse the actual tri object.
|
||||||
|
#define PMB_TRI_OBJECT_PARSE_FILTER 0x38f55e43
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CTriObject
|
||||||
|
* \date 2012-08-22 08:58GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CTriObject
|
||||||
|
*/
|
||||||
|
class CTriObject : public CGeomObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CTriObject(CScene *scene);
|
||||||
|
virtual ~CTriObject();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CTriObject */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CTriObject> CTriObjectClassDesc;
|
||||||
|
extern const CTriObjectClassDesc TriObjectClassDesc;
|
||||||
|
|
||||||
|
} /* namespace BUILTIN */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_TRI_OBJECT_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,203 @@
|
|||||||
|
/**
|
||||||
|
* \file class_data.cpp
|
||||||
|
* \brief CClassData
|
||||||
|
* \date 2012-08-18 19:24GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CClassData
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "class_data.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CClassData::CClassData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CClassData::~CClassData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CClassData::className() const
|
||||||
|
{
|
||||||
|
return "ClassData";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassData::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassData::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassData::clean()
|
||||||
|
{
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassData::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassData::disown()
|
||||||
|
{
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CClassData::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2100: // ClassDataEntry
|
||||||
|
return new CClassDataEntry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CClassDataEntry::CClassDataEntry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CClassDataEntry::~CClassDataEntry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CClassDataEntry::className() const
|
||||||
|
{
|
||||||
|
return "ClassDataEntry";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassDataEntry::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassDataEntry::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassDataEntry::clean()
|
||||||
|
{
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassDataEntry::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassDataEntry::disown()
|
||||||
|
{
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CClassDataEntry::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (!container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2110: // ClassDataHeader
|
||||||
|
return new CClassDataHeader();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2120: // ClassDataBody: Depends on the ClassDataHeader: TODO
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CClassDataHeader::CClassDataHeader()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CClassDataHeader::~CClassDataHeader()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CClassDataHeader::className() const
|
||||||
|
{
|
||||||
|
return "ClassDataHeader";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassDataHeader::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
stream.serial(ClassID);
|
||||||
|
stream.serial(SuperClassID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassDataHeader::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") { ";
|
||||||
|
ostream << "\n" << pad << "ClassID: " << NLMISC::toString(ClassID);
|
||||||
|
ostream << "\n" << pad << "SuperClassID: " << SuperClassID;
|
||||||
|
ostream << " } ";
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,122 @@
|
|||||||
|
/**
|
||||||
|
* \file class_data.h
|
||||||
|
* \brief CClassData
|
||||||
|
* \date 2012-08-18 19:24GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CClassData
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_CLASS_DATA_H
|
||||||
|
#define PIPELINE_CLASS_DATA_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/class_id.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "storage_object.h"
|
||||||
|
#include "storage_value.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CClassData
|
||||||
|
* \date 2012-08-18 19:24GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CClassData
|
||||||
|
*/
|
||||||
|
class CClassData : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CClassData();
|
||||||
|
virtual ~CClassData();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CClassData */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CClassDataEntry
|
||||||
|
* \date 2012-08-18 18:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CClassDataEntry
|
||||||
|
*/
|
||||||
|
class CClassDataEntry : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CClassDataEntry();
|
||||||
|
virtual ~CClassDataEntry();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CClassDataEntry */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CClassDataHeader
|
||||||
|
* \date 2012-08-18 18:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CClassDataHeader
|
||||||
|
*/
|
||||||
|
class CClassDataHeader : public IStorageObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CClassDataHeader();
|
||||||
|
virtual ~CClassDataHeader();
|
||||||
|
|
||||||
|
// public data
|
||||||
|
NLMISC::CClassId ClassID;
|
||||||
|
uint32 SuperClassID;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void serial(NLMISC::IStream &stream);
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
|
||||||
|
}; /* class CClassDataHeader */
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_CLASS_DATA_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,430 @@
|
|||||||
|
/**
|
||||||
|
* \file class_directory_3.cpp
|
||||||
|
* \brief CClassDirectory3
|
||||||
|
* \date 2012-08-18 18:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CClassDirectory3
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "class_directory_3.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "dll_directory.h"
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CClassDirectory3::CClassDirectory3(CDllDirectory *dllDirectory) : m_DllDirectory(dllDirectory)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CDllDirectory
|
||||||
|
CClassDirectory3::~CClassDirectory3()
|
||||||
|
{
|
||||||
|
// Delete m_ChunkCache and m_Entries when !m_ChunksOwnsPointers
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
for (TStorageObjectContainer::iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
for (std::vector<CClassEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
{
|
||||||
|
delete (*subit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_ChunkCache.clear();
|
||||||
|
m_Entries.clear();
|
||||||
|
m_ClassIdToIndex.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CClassDirectory3::className() const
|
||||||
|
{
|
||||||
|
return "ClassDirectory3";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CDllDirectory
|
||||||
|
void CClassDirectory3::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
sint i = 0;
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
uint16 id = it->first;
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2040: // ClassEntry
|
||||||
|
{
|
||||||
|
uint subi = 0;
|
||||||
|
for (std::vector<CClassEntry *>::const_iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "Entries[" << subi << "]: ";
|
||||||
|
(*subit)->toString(ostream, padpad);
|
||||||
|
++subi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(4) << it->first;
|
||||||
|
ostream << "\n" << pad << "0x" << ss.str() << ": ";
|
||||||
|
it->second->toString(ostream, padpad);
|
||||||
|
++i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CDllDirectory
|
||||||
|
void CClassDirectory3::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Ensure not yet parsed
|
||||||
|
nlassert(m_ChunkCache.empty());
|
||||||
|
nlassert(m_Entries.empty());
|
||||||
|
|
||||||
|
// Parse entries first
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
|
||||||
|
// Initialize
|
||||||
|
uint16 lastCached = 0xFFFF;
|
||||||
|
bool parsedDllEntry = false;
|
||||||
|
|
||||||
|
// Parse chunks
|
||||||
|
for (TStorageObjectContainer::iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
uint16 id = it->first;
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2040: // ClassEntry
|
||||||
|
{
|
||||||
|
if (parsedDllEntry && (lastCached != id))
|
||||||
|
throw EStorageParse(); // There were chunks inbetween
|
||||||
|
if (!parsedDllEntry)
|
||||||
|
{
|
||||||
|
m_ChunkCache.push_back(TStorageObjectWithId(id, NULL)); // Dummy entry to know the location
|
||||||
|
lastCached = id;
|
||||||
|
parsedDllEntry = true;
|
||||||
|
}
|
||||||
|
CClassEntry *classEntry = static_cast<CClassEntry *>(it->second);
|
||||||
|
m_ClassIdToIndex[classEntry->classId()] = m_Entries.size();
|
||||||
|
m_Entries.push_back(classEntry);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
m_ChunkCache.push_back(*it); // Dummy entry to know the location
|
||||||
|
lastCached = id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now ownership of the pointers lies in m_ChunkCache and m_Entries
|
||||||
|
m_ChunksOwnsPointers = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CDllDirectory
|
||||||
|
void CClassDirectory3::clean()
|
||||||
|
{
|
||||||
|
// Ensure parsed
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
|
||||||
|
// Clear m_Chunks
|
||||||
|
m_Chunks.clear();
|
||||||
|
|
||||||
|
// Clean chunks
|
||||||
|
for (TStorageObjectContainer::iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->second != NULL && it->second->isContainer())
|
||||||
|
{
|
||||||
|
static_cast<CStorageContainer *>(it->second)->clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (std::vector<CClassEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
{
|
||||||
|
(*subit)->clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CDllDirectory
|
||||||
|
void CClassDirectory3::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Ensure parsed
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
|
||||||
|
// Initialize
|
||||||
|
nlassert(m_Chunks.empty());
|
||||||
|
|
||||||
|
// Set up the m_Chunks list, when (CClassEntry::ID, NULL) is found write out all of the entries.
|
||||||
|
for (TStorageObjectContainer::iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
uint16 id = it->first;
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2040: // ClassEntry
|
||||||
|
for (std::vector<CClassEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(id, (*subit)));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_Chunks.push_back(*it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the entries last (after m_Chunks is built)
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
|
||||||
|
// NOTE: Ownership remains with m_ChunkCache and m_Entries
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CDllDirectory
|
||||||
|
void CClassDirectory3::disown()
|
||||||
|
{
|
||||||
|
m_ChunkCache.clear();
|
||||||
|
m_Entries.clear();
|
||||||
|
m_ClassIdToIndex.clear();
|
||||||
|
|
||||||
|
// Ownership goes back to m_Chunks
|
||||||
|
m_ChunksOwnsPointers = true;
|
||||||
|
|
||||||
|
// Disown child chunks
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CDllDirectory
|
||||||
|
const CClassEntry *CClassDirectory3::get(uint16 index) const
|
||||||
|
{
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
if (index >= m_Entries.size()) { nlerror("Index 0x%x is above the number of entries %i", (uint32)index, (uint32)m_Entries.size()); return NULL; }
|
||||||
|
return m_Entries[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CDllDirectory
|
||||||
|
void CClassDirectory3::reset()
|
||||||
|
{
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
for (std::vector<CClassEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
{
|
||||||
|
delete (*subit);
|
||||||
|
}
|
||||||
|
m_Entries.clear();
|
||||||
|
m_ClassIdToIndex.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CDllDirectory
|
||||||
|
uint16 CClassDirectory3::getOrCreateIndex(const ISceneClassDesc *sceneClassDesc)
|
||||||
|
{
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
std::map<NLMISC::CClassId, uint16>::iterator it = m_ClassIdToIndex.find(sceneClassDesc->classId());
|
||||||
|
|
||||||
|
// Return existing index
|
||||||
|
if (it != m_ClassIdToIndex.end())
|
||||||
|
return it->second;
|
||||||
|
|
||||||
|
// Create new entry
|
||||||
|
CClassEntry *classEntry = new CClassEntry(m_DllDirectory, sceneClassDesc);
|
||||||
|
uint16 index = m_Entries.size();
|
||||||
|
m_ClassIdToIndex[classEntry->classId()] = index;
|
||||||
|
m_Entries.push_back(classEntry);
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CClassDirectory3::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2040: // ClassEntry
|
||||||
|
return new CClassEntry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Entries[13]: (ClassEntry) [2] {
|
||||||
|
// 0 0x2060: (ClassEntryHeader) {
|
||||||
|
// DllIndex: -2
|
||||||
|
// ClassID: (0x222b9eb9, 0x64c75fec)
|
||||||
|
// SuperClassID: 3072 }
|
||||||
|
// 1 0x2042: (CStorageValue) { NeL Material } }
|
||||||
|
|
||||||
|
CClassEntry::CClassEntry() : m_Header(NULL), m_Name(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CClassEntry::CClassEntry(CDllDirectory *dllDirectory, const ISceneClassDesc *sceneClassDesc) : m_Header(new CClassEntryHeader()), m_Name(new CStorageValue<ucstring>())
|
||||||
|
{
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(0x2060, m_Header));
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(0x2042, m_Name));
|
||||||
|
m_Header->DllIndex = dllDirectory->getOrCreateIndex(sceneClassDesc->dllPluginDesc());
|
||||||
|
m_Header->ClassId = sceneClassDesc->classId();
|
||||||
|
m_Header->SuperClassId = sceneClassDesc->superClassId();
|
||||||
|
m_Name->Value = sceneClassDesc->displayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
CClassEntry::~CClassEntry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CClassEntry::className() const
|
||||||
|
{
|
||||||
|
return "ClassEntry";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassEntry::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
if (m_Header && m_Name)
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
ostream << "\n" << pad << "Header: ";
|
||||||
|
m_Header->toString(ostream, padpad);
|
||||||
|
ostream << "\n" << pad << "Name: " << m_Name->Value.toUtf8();
|
||||||
|
ostream << " } ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassEntry::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// CStorageContainer::parse(version);
|
||||||
|
nlassert(m_ChunksOwnsPointers);
|
||||||
|
nlassert(m_Chunks.size() == 2);
|
||||||
|
TStorageObjectContainer::iterator it = m_Chunks.begin();
|
||||||
|
nlassert(it->first == 0x2060); // ClassEntryHeader
|
||||||
|
m_Header = static_cast<CClassEntryHeader *>(it->second);
|
||||||
|
++it;
|
||||||
|
nlassert(it->first == 0x2042); // ClassEntryName
|
||||||
|
m_Name = static_cast<CStorageValue<ucstring> *>(it->second);
|
||||||
|
// ++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassEntry::clean()
|
||||||
|
{
|
||||||
|
// Nothing to do here! (m_Chunks retains ownership)
|
||||||
|
// CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassEntry::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Nothing to do here!
|
||||||
|
// CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassEntry::disown()
|
||||||
|
{
|
||||||
|
// CStorageContainer::disown();
|
||||||
|
m_Header = NULL;
|
||||||
|
m_Name = NULL;
|
||||||
|
nlassert(m_ChunksOwnsPointers);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CClassEntry::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (!container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2060: // ClassEntryHeader
|
||||||
|
return new CClassEntryHeader();
|
||||||
|
case 0x2042: // ClassEntryName
|
||||||
|
return new CStorageValue<ucstring>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CClassEntryHeader::CClassEntryHeader()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CClassEntryHeader::~CClassEntryHeader()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CClassEntryHeader::className() const
|
||||||
|
{
|
||||||
|
return "ClassEntryHeader";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassEntryHeader::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
stream.serial(DllIndex);
|
||||||
|
stream.serial(ClassId);
|
||||||
|
stream.serial(SuperClassId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClassEntryHeader::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") { ";
|
||||||
|
ostream << "\n" << pad << "DllIndex: " << DllIndex;
|
||||||
|
ostream << "\n" << pad << "ClassId: " << NLMISC::toString(ClassId);
|
||||||
|
ostream << "\n" << pad << "SuperClassId: " << SuperClassId;
|
||||||
|
ostream << " } ";
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,160 @@
|
|||||||
|
/**
|
||||||
|
* \file class_directory_3.h
|
||||||
|
* \brief CClassDirectory3
|
||||||
|
* \date 2012-08-18 18:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CClassDirectory3
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_CLASS_DIRECTORY_3_H
|
||||||
|
#define PIPELINE_CLASS_DIRECTORY_3_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/class_id.h>
|
||||||
|
#include <nel/misc/ucstring.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "storage_object.h"
|
||||||
|
#include "storage_value.h"
|
||||||
|
#include "scene_class.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
class CDllDirectory;
|
||||||
|
|
||||||
|
class CClassEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CClassDirectory3
|
||||||
|
* \date 2012-08-18 18:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* This class is used for parsing the local class indices in a max file,
|
||||||
|
* both reading and writing is supported. It is not used at runtime,
|
||||||
|
* and should be reset when no longer necessary. Plugins have their own
|
||||||
|
* static copy of the actual ISceneClassDesc. This class only contains
|
||||||
|
* CClassEntry instances, which should not be used directly.
|
||||||
|
*/
|
||||||
|
class CClassDirectory3 : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CClassDirectory3(CDllDirectory *dllDirectory);
|
||||||
|
virtual ~CClassDirectory3();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
// public
|
||||||
|
// Get a class entry corresponding to a chunk index, pointers become invalid after reset
|
||||||
|
const CClassEntry *get(uint16 index) const;
|
||||||
|
// Reset the class directory, all class entry pointers become invalid, use class id and scene class registry
|
||||||
|
void reset();
|
||||||
|
// Get or create the chunk index for a class by class description
|
||||||
|
uint16 getOrCreateIndex(const ISceneClassDesc *sceneClassDesc);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
TStorageObjectContainer m_ChunkCache;
|
||||||
|
std::vector<CClassEntry *> m_Entries;
|
||||||
|
std::map<NLMISC::CClassId, uint16> m_ClassIdToIndex;
|
||||||
|
|
||||||
|
CDllDirectory *m_DllDirectory;
|
||||||
|
|
||||||
|
}; /* class CClassDirectory3 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CClassEntryHeader
|
||||||
|
* \date 2012-08-18 18:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CClassEntryHeader
|
||||||
|
*/
|
||||||
|
class CClassEntryHeader : public IStorageObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CClassEntryHeader();
|
||||||
|
virtual ~CClassEntryHeader();
|
||||||
|
|
||||||
|
// public data
|
||||||
|
sint32 DllIndex;
|
||||||
|
NLMISC::CClassId ClassId;
|
||||||
|
uint32 SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void serial(NLMISC::IStream &stream);
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
|
||||||
|
}; /* class CClassEntryHeader */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CClassEntry
|
||||||
|
* \date 2012-08-18 18:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CClassEntry
|
||||||
|
*/
|
||||||
|
class CClassEntry : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CClassEntry();
|
||||||
|
CClassEntry(CDllDirectory *dllDirectory, const ISceneClassDesc *sceneClassDesc);
|
||||||
|
virtual ~CClassEntry();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
// read access
|
||||||
|
const ucstring &displayName() const { return m_Name->Value; }
|
||||||
|
sint32 dllIndex() const { return m_Header->DllIndex; }
|
||||||
|
NLMISC::CClassId classId() const { return m_Header->ClassId; }
|
||||||
|
uint32 superClassId() const { return m_Header->SuperClassId; }
|
||||||
|
|
||||||
|
// debug
|
||||||
|
void overrideClassId(NLMISC::CClassId classId) { m_Header->ClassId = classId; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
CClassEntryHeader *m_Header;
|
||||||
|
CStorageValue<ucstring> *m_Name;
|
||||||
|
|
||||||
|
}; /* class CClassEntry */
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_CLASS_DIRECTORY_3_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,553 @@
|
|||||||
|
/**
|
||||||
|
* \file config.cpp
|
||||||
|
* \brief CConfig
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfig
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
#include <nel/misc/vector.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CConfig::CConfig()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfig::~CConfig()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConfig::className() const
|
||||||
|
{
|
||||||
|
return "Config";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig::clean()
|
||||||
|
{
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig::disown()
|
||||||
|
{
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CConfig::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x20a0: // unknown
|
||||||
|
return new CConfig20a0();
|
||||||
|
case 0x2180: // CConfigScript
|
||||||
|
return new CConfigScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2090: // unknown; known values: 1 (m3), 0 (m9, m2008, m2010)
|
||||||
|
return new CStorageValue<sint32>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CConfig20a0::CConfig20a0()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfig20a0::~CConfig20a0()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConfig20a0::className() const
|
||||||
|
{
|
||||||
|
return "Config20a0";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0::clean()
|
||||||
|
{
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0::disown()
|
||||||
|
{
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CConfig20a0::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x0110: // CConfig20a0Entry
|
||||||
|
return new CConfig20a0Entry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x0100: // CConfig20a0Header: Number of entries
|
||||||
|
return new CStorageValue<sint32>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CConfig20a0Entry::CConfig20a0Entry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfig20a0Entry::~CConfig20a0Entry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConfig20a0Entry::className() const
|
||||||
|
{
|
||||||
|
return "Config20a0Entry";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0Entry::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0Entry::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0Entry::clean()
|
||||||
|
{
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0Entry::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfig20a0Entry::disown()
|
||||||
|
{
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CConfig20a0Entry::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x0300: // unknown, contains 0x0100 with 4 bytes int value
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x0100: // unknown
|
||||||
|
case 0x0110: // unknown
|
||||||
|
case 0x0120: // unknown
|
||||||
|
case 0x0130: // unknown
|
||||||
|
case 0x0140: // unknown
|
||||||
|
case 0x0150: // unknown
|
||||||
|
case 0x0160: // unknown
|
||||||
|
case 0x0161: // unknown
|
||||||
|
case 0x0170: // unknown
|
||||||
|
case 0x0180: // unknown
|
||||||
|
case 0x0190: // unknown
|
||||||
|
case 0x0200: // unknown
|
||||||
|
case 0x0210: // unknown
|
||||||
|
case 0x0220: // unknown
|
||||||
|
case 0x0230: // unknown
|
||||||
|
case 0x0240: // unknown
|
||||||
|
case 0x0250: // unknown
|
||||||
|
case 0x0270: // unknown
|
||||||
|
case 0x0280: // unknown
|
||||||
|
case 0x0310: // unknown
|
||||||
|
case 0x0320: // unknown
|
||||||
|
return new CStorageValue<sint32>();
|
||||||
|
case 0x0260: // unknown
|
||||||
|
return new CStorageValue<sint64>();
|
||||||
|
case 0x0330: // unknown, 16 bytes
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
case 0x0290: // unknown
|
||||||
|
case 0x0390: // unknown
|
||||||
|
return new CStorageValue<ucstring>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CConfigScript::CConfigScript()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfigScript::~CConfigScript()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConfigScript::className() const
|
||||||
|
{
|
||||||
|
return "ConfigScript";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScript::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScript::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScript::clean()
|
||||||
|
{
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScript::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScript::disown()
|
||||||
|
{
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CConfigScript::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x0040: // ConfigScriptEntry
|
||||||
|
return new CConfigScriptEntry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CConfigScriptEntry::CConfigScriptEntry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfigScriptEntry::~CConfigScriptEntry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConfigScriptEntry::className() const
|
||||||
|
{
|
||||||
|
return "ConfigScriptEntry";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptEntry::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptEntry::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptEntry::clean()
|
||||||
|
{
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptEntry::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptEntry::disown()
|
||||||
|
{
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CConfigScriptEntry::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x0007: // ConfigScriptMetaContainer
|
||||||
|
return new CConfigScriptMetaContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x0050: // ConfigScriptHeader
|
||||||
|
return new CConfigScriptHeader();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CConfigScriptHeader::CConfigScriptHeader()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfigScriptHeader::~CConfigScriptHeader()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConfigScriptHeader::className() const
|
||||||
|
{
|
||||||
|
return "ConfigScriptHeader";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptHeader::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
stream.serial(SuperClassID);
|
||||||
|
stream.serial(ClassID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptHeader::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") { ";
|
||||||
|
ostream << "\n" << pad << "SuperClassID: " << SuperClassID;
|
||||||
|
ostream << "\n" << pad << "ClassID: " << NLMISC::toString(ClassID);
|
||||||
|
ostream << " } ";
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CConfigScriptMetaContainer::CConfigScriptMetaContainer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfigScriptMetaContainer::~CConfigScriptMetaContainer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConfigScriptMetaContainer::className() const
|
||||||
|
{
|
||||||
|
return "ConfigScriptMetaContainer";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptMetaContainer::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptMetaContainer::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptMetaContainer::clean()
|
||||||
|
{
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptMetaContainer::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptMetaContainer::disown()
|
||||||
|
{
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CConfigScriptMetaContainer::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x0007: // ConfigScriptMetaContainer
|
||||||
|
return new CConfigScriptMetaContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x0001: // type: boolean (stored in four bytes, yes)
|
||||||
|
return new CStorageValue<uint32>();
|
||||||
|
case 0x0002: // ???
|
||||||
|
nlerror("0x0002 found, please implement");
|
||||||
|
break;
|
||||||
|
case 0x0003: // type: integer (not sure if signed)
|
||||||
|
return new CStorageValue<sint32>();
|
||||||
|
case 0x0004: // type: float
|
||||||
|
return new CStorageValue<float>();
|
||||||
|
case 0x0005: // type: string (same format as the meta string)
|
||||||
|
case 0x0006: // ConfigScriptMetaString
|
||||||
|
return new CConfigScriptMetaString();
|
||||||
|
case 0x0008: // type: color (stored as 3 float vector)
|
||||||
|
return new CStorageValue<NLMISC::CVector>;
|
||||||
|
case 0x0060: // ConfigScriptMetaContainerHeader (contains the number of entries, amusingly)
|
||||||
|
return new CStorageValue<uint32>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CConfigScriptMetaString::CConfigScriptMetaString()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CConfigScriptMetaString::~CConfigScriptMetaString()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CConfigScriptMetaString::className() const
|
||||||
|
{
|
||||||
|
return "ConfigScriptMetaString";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptMetaString::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
if (stream.isReading())
|
||||||
|
{
|
||||||
|
uint32 size;
|
||||||
|
stream.serial(size);
|
||||||
|
Value.resize(size - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uint32 size = Value.size() + 1;
|
||||||
|
stream.serial(size);
|
||||||
|
}
|
||||||
|
stream.serialBuffer(static_cast<uint8 *>(static_cast<void *>(&Value[0])), Value.size());
|
||||||
|
uint8 endByte = 0;
|
||||||
|
stream.serial(endByte);
|
||||||
|
nlassert(endByte == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConfigScriptMetaString::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") { " << Value << " } ";
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,245 @@
|
|||||||
|
/**
|
||||||
|
* \file config.h
|
||||||
|
* \brief CConfig
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfig
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_CONFIG_H
|
||||||
|
#define PIPELINE_CONFIG_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/class_id.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "storage_object.h"
|
||||||
|
#include "storage_value.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CConfig
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfig
|
||||||
|
*/
|
||||||
|
class CConfig : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CConfig();
|
||||||
|
virtual ~CConfig();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CConfig */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CConfig20a0
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfig
|
||||||
|
*/
|
||||||
|
class CConfig20a0 : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CConfig20a0();
|
||||||
|
virtual ~CConfig20a0();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CConfig20a0 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CConfig20a0Entry
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfig20a0Entry
|
||||||
|
*/
|
||||||
|
class CConfig20a0Entry : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CConfig20a0Entry();
|
||||||
|
virtual ~CConfig20a0Entry();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CConfig20a0Entry */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CConfigScript
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfig
|
||||||
|
*/
|
||||||
|
class CConfigScript : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CConfigScript();
|
||||||
|
virtual ~CConfigScript();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CConfigScript */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CConfigScriptEntry
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfig
|
||||||
|
*/
|
||||||
|
class CConfigScriptEntry : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CConfigScriptEntry();
|
||||||
|
virtual ~CConfigScriptEntry();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CConfigScriptEntry */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CConfigScriptHeader
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfigScriptHeader
|
||||||
|
*/
|
||||||
|
class CConfigScriptHeader : public IStorageObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CConfigScriptHeader();
|
||||||
|
virtual ~CConfigScriptHeader();
|
||||||
|
|
||||||
|
// public data
|
||||||
|
uint32 SuperClassID;
|
||||||
|
NLMISC::CClassId ClassID;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void serial(NLMISC::IStream &stream);
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
|
||||||
|
}; /* class CConfigScriptHeader */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CConfigScriptMetaContainer
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfigScriptMetaContainer
|
||||||
|
* This is totally hilarious.
|
||||||
|
*/
|
||||||
|
class CConfigScriptMetaContainer : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CConfigScriptMetaContainer();
|
||||||
|
virtual ~CConfigScriptMetaContainer();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
}; /* class CConfigScriptMetaContainer */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CConfigScriptMetaString
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CConfigScriptMetaString
|
||||||
|
*/
|
||||||
|
class CConfigScriptMetaString : public IStorageObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CConfigScriptMetaString();
|
||||||
|
virtual ~CConfigScriptMetaString();
|
||||||
|
|
||||||
|
// public data
|
||||||
|
std::string Value;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void serial(NLMISC::IStream &stream);
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
|
||||||
|
}; /* class CConfigScriptMetaString */
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_CONFIG_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* \file derived_object.cpp
|
||||||
|
* \brief CDerivedObject
|
||||||
|
* \date 2012-08-26 12:04GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CDerivedObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "derived_object.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
|
||||||
|
CDerivedObject::CDerivedObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CDerivedObject::~CDerivedObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file derived_object.h
|
||||||
|
* \brief CDerivedObject
|
||||||
|
* \date 2012-08-26 12:04GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CDerivedObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_DERIVED_OBJECT_H
|
||||||
|
#define PIPELINE_DERIVED_OBJECT_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CDerivedObject
|
||||||
|
* \date 2012-08-26 12:04GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CDerivedObject
|
||||||
|
*/
|
||||||
|
class CDerivedObject
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
// pointers
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// instances
|
||||||
|
// ...
|
||||||
|
public:
|
||||||
|
CDerivedObject();
|
||||||
|
virtual ~CDerivedObject();
|
||||||
|
}; /* class CDerivedObject */
|
||||||
|
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_DERIVED_OBJECT_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,420 @@
|
|||||||
|
/**
|
||||||
|
* \file dll_directory.cpp
|
||||||
|
* \brief CDllDirectory
|
||||||
|
* \date 2012-08-18 09:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CDllDirectory
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "dll_directory.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CDllDirectory::CDllDirectory() : m_DllEntryBuiltin(&DllPluginDescBuiltin), m_DllEntryScript(&DllPluginDescScript)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CClassDirectory3
|
||||||
|
CDllDirectory::~CDllDirectory()
|
||||||
|
{
|
||||||
|
// Delete m_ChunkCache and m_Entries when !m_ChunksOwnsPointers
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
for (TStorageObjectContainer::iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
for (std::vector<CDllEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
{
|
||||||
|
delete (*subit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_ChunkCache.clear();
|
||||||
|
m_Entries.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CDllDirectory::className() const
|
||||||
|
{
|
||||||
|
return "DllDirectory";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CClassDirectory3
|
||||||
|
void CDllDirectory::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
sint i = 0;
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
uint16 id = it->first;
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2038: // DllEntry
|
||||||
|
{
|
||||||
|
uint subi = 0;
|
||||||
|
for (std::vector<CDllEntry *>::const_iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "Entries[" << subi << "]: ";
|
||||||
|
(*subit)->toString(ostream, padpad);
|
||||||
|
++subi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(4) << it->first;
|
||||||
|
ostream << "\n" << pad << "0x" << ss.str() << ": ";
|
||||||
|
it->second->toString(ostream, padpad);
|
||||||
|
++i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CClassDirectory3
|
||||||
|
void CDllDirectory::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Ensure not yet parsed
|
||||||
|
nlassert(m_ChunkCache.empty());
|
||||||
|
nlassert(m_Entries.empty());
|
||||||
|
|
||||||
|
// Parse entries first
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
|
||||||
|
// Initialize
|
||||||
|
addInternalIndices();
|
||||||
|
uint16 lastCached = 0xFFFF;
|
||||||
|
bool parsedDllEntry = false;
|
||||||
|
|
||||||
|
// Parse chunks
|
||||||
|
for (TStorageObjectContainer::iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
uint16 id = it->first;
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2038: // DllEntry
|
||||||
|
{
|
||||||
|
if (parsedDllEntry && (lastCached != id))
|
||||||
|
throw EStorageParse(); // There were chunks inbetween
|
||||||
|
if (!parsedDllEntry)
|
||||||
|
{
|
||||||
|
m_ChunkCache.push_back(TStorageObjectWithId(id, NULL)); // Dummy entry to know the location
|
||||||
|
lastCached = id;
|
||||||
|
parsedDllEntry = true;
|
||||||
|
}
|
||||||
|
CDllEntry *dllEntry = static_cast<CDllEntry *>(it->second);
|
||||||
|
m_InternalNameToIndex[NLMISC::toLower(dllEntry->dllFilename())] = m_Entries.size();
|
||||||
|
m_Entries.push_back(dllEntry);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_ChunkCache.push_back(*it); // Dummy entry to know the location
|
||||||
|
lastCached = id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now ownership of the pointers lies in m_ChunkCache and m_Entries
|
||||||
|
m_ChunksOwnsPointers = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CClassDirectory3
|
||||||
|
void CDllDirectory::clean()
|
||||||
|
{
|
||||||
|
// Ensure parsed
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
|
||||||
|
// Clear m_Chunks
|
||||||
|
m_Chunks.clear();
|
||||||
|
|
||||||
|
// Clean chunks
|
||||||
|
for (TStorageObjectContainer::iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->second != NULL && it->second->isContainer())
|
||||||
|
{
|
||||||
|
static_cast<CStorageContainer *>(it->second)->clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (std::vector<CDllEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
{
|
||||||
|
(*subit)->clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CClassDirectory3
|
||||||
|
void CDllDirectory::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Ensure parsed
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
|
||||||
|
// Initialize
|
||||||
|
nlassert(m_Chunks.empty());
|
||||||
|
|
||||||
|
// Set up the m_Chunks list, when (CDllEntry::ID, NULL) is found write out all of the entries.
|
||||||
|
for (TStorageObjectContainer::iterator it = m_ChunkCache.begin(), end = m_ChunkCache.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
uint16 id = it->first;
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2038: // DllEntry
|
||||||
|
for (std::vector<CDllEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(id, (*subit)));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_Chunks.push_back(*it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the entries last (after m_Chunks is built)
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
|
||||||
|
// NOTE: Ownership remains with m_ChunkCache and m_Entries
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CClassDirectory3
|
||||||
|
void CDllDirectory::disown()
|
||||||
|
{
|
||||||
|
m_ChunkCache.clear();
|
||||||
|
m_Entries.clear();
|
||||||
|
m_InternalNameToIndex.clear();
|
||||||
|
|
||||||
|
// Ownership goes back to m_Chunks
|
||||||
|
m_ChunksOwnsPointers = true;
|
||||||
|
|
||||||
|
// Disown child chunks
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CClassDirectory3
|
||||||
|
const CDllEntry *CDllDirectory::get(sint32 index) const
|
||||||
|
{
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
// Handle internal dummy values
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
return &m_DllEntryBuiltin;
|
||||||
|
case -2:
|
||||||
|
return &m_DllEntryScript;
|
||||||
|
default:
|
||||||
|
nlerror("Bad dll entry index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlassert(index < (sint32)m_Entries.size());
|
||||||
|
return m_Entries[index];
|
||||||
|
}
|
||||||
|
nlassert(false);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CClassDirectory3
|
||||||
|
void CDllDirectory::reset()
|
||||||
|
{
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
for (std::vector<CDllEntry *>::iterator subit = m_Entries.begin(), subend = m_Entries.end(); subit != subend; ++subit)
|
||||||
|
{
|
||||||
|
delete (*subit);
|
||||||
|
}
|
||||||
|
m_Entries.clear();
|
||||||
|
m_InternalNameToIndex.clear();
|
||||||
|
addInternalIndices();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parallel to CClassDirectory3
|
||||||
|
sint32 CDllDirectory::getOrCreateIndex(const IDllPluginDescInternal *dllPluginDesc)
|
||||||
|
{
|
||||||
|
nlassert(!m_ChunksOwnsPointers);
|
||||||
|
std::map<ucstring, sint32>::iterator it = m_InternalNameToIndex.find(NLMISC::toLower(ucstring(dllPluginDesc->internalName())));
|
||||||
|
|
||||||
|
// Return existing index
|
||||||
|
if (it != m_InternalNameToIndex.end())
|
||||||
|
return it->second;
|
||||||
|
|
||||||
|
// Create new entry
|
||||||
|
CDllEntry *dllEntry = new CDllEntry(dllPluginDesc);
|
||||||
|
sint32 index = m_Entries.size();
|
||||||
|
m_InternalNameToIndex[NLMISC::toLower(dllEntry->dllFilename())] = index;
|
||||||
|
m_Entries.push_back(dllEntry);
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDllDirectory::addInternalIndices()
|
||||||
|
{
|
||||||
|
m_InternalNameToIndex[NLMISC::toLower(ucstring(DllPluginDescBuiltin.internalName()))] = -1;
|
||||||
|
m_InternalNameToIndex[NLMISC::toLower(ucstring(DllPluginDescScript.internalName()))] = -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CDllDirectory::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2038: // DllEntry
|
||||||
|
return new CDllEntry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x21C0: // DllDirectoryHeader
|
||||||
|
return new CStorageValue<uint32>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Entries[5]: (DllEntry) [2] PARSED {
|
||||||
|
// DllDescription: ...
|
||||||
|
// DllFilename: ... }
|
||||||
|
|
||||||
|
CDllEntry::CDllEntry() : m_DllDescription(NULL), m_DllFilename(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CDllEntry::CDllEntry(const IDllPluginDescInternal *dllPluginDesc) : m_DllDescription(new CStorageValue<ucstring>()), m_DllFilename(new CStorageValue<ucstring>())
|
||||||
|
{
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(0x2039, m_DllDescription));
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(0x2037, m_DllFilename));
|
||||||
|
m_DllDescription->Value = dllPluginDesc->displayName();
|
||||||
|
m_DllFilename->Value = dllPluginDesc->internalName();
|
||||||
|
}
|
||||||
|
|
||||||
|
CDllEntry::~CDllEntry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CDllEntry::className() const
|
||||||
|
{
|
||||||
|
return "DllEntry";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDllEntry::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
if (m_DllDescription && m_DllFilename)
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") [" << m_Chunks.size() << "] PARSED { ";
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
ostream << "\n" << pad << "DllDescription: " << m_DllDescription->Value.toUtf8();
|
||||||
|
ostream << "\n" << pad << "DllFilename: " << m_DllFilename->Value.toUtf8();
|
||||||
|
ostream << " } ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDllEntry::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// CStorageContainer::parse(version);
|
||||||
|
nlassert(m_ChunksOwnsPointers);
|
||||||
|
nlassert(m_Chunks.size() == 2);
|
||||||
|
TStorageObjectContainer::iterator it = m_Chunks.begin();
|
||||||
|
nlassert(it->first == 0x2039); // DllDescription
|
||||||
|
m_DllDescription = static_cast<CStorageValue<ucstring> *>(it->second);
|
||||||
|
++it;
|
||||||
|
nlassert(it->first == 0x2037); // DllFilename
|
||||||
|
m_DllFilename = static_cast<CStorageValue<ucstring> *>(it->second);
|
||||||
|
// ++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDllEntry::clean()
|
||||||
|
{
|
||||||
|
// Nothing to do here! (m_Chunks retains ownership)
|
||||||
|
// CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDllEntry::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Nothing to do here!
|
||||||
|
// CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDllEntry::disown()
|
||||||
|
{
|
||||||
|
// CStorageContainer::disown();
|
||||||
|
m_DllDescription = NULL;
|
||||||
|
m_DllFilename = NULL;
|
||||||
|
nlassert(m_ChunksOwnsPointers);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CDllEntry::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (!container)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case 0x2039: // DllDescription
|
||||||
|
case 0x2037: // DllFilename
|
||||||
|
return new CStorageValue<ucstring>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,135 @@
|
|||||||
|
/**
|
||||||
|
* \file dll_directory.h
|
||||||
|
* \brief CDllDirectory
|
||||||
|
* \date 2012-08-18 09:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CDllDirectory
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_DLL_DIRECTORY_H
|
||||||
|
#define PIPELINE_DLL_DIRECTORY_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "storage_object.h"
|
||||||
|
#include "storage_value.h"
|
||||||
|
#include "dll_plugin_desc.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CDllEntry
|
||||||
|
* \date 2012-08-18 09:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CDllEntry
|
||||||
|
*/
|
||||||
|
class CDllEntry : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CDllEntry();
|
||||||
|
CDllEntry(const IDllPluginDescInternal *dllPluginDesc);
|
||||||
|
virtual ~CDllEntry();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
// read access
|
||||||
|
const ucstring &dllDescription() const { return m_DllDescription->Value; }
|
||||||
|
const ucstring &dllFilename() const { return m_DllFilename->Value; }
|
||||||
|
|
||||||
|
// debug
|
||||||
|
void overrideDllFilename(const ucstring &dllFilename) { m_DllFilename->Value = dllFilename; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
CStorageValue<ucstring> *m_DllDescription;
|
||||||
|
CStorageValue<ucstring> *m_DllFilename;
|
||||||
|
|
||||||
|
}; /* class CDllDirectory */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CDllDirectory
|
||||||
|
* \date 2012-08-18 09:01GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* This class is used for parsing the local dll indices in a max file,
|
||||||
|
* both reading and writing is supported. It is not used at runtime,
|
||||||
|
* and should be reset when no longer necessary. Plugins have their own
|
||||||
|
* copy of the actual IDllPluginDescInternal. This class only contains
|
||||||
|
* CDllEntry instances, which should not be used directly. The instance
|
||||||
|
* of this class used to parse the max file should be kept, as there
|
||||||
|
* might be chunks that were not parsed, which should be rewritten to
|
||||||
|
* the stream.
|
||||||
|
*/
|
||||||
|
class CDllDirectory : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CDllDirectory();
|
||||||
|
virtual ~CDllDirectory();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
// public
|
||||||
|
// Get a dll entry corresponding to a chunk index, pointers become invalid after reset
|
||||||
|
const CDllEntry *get(sint32 index) const;
|
||||||
|
// Reset the dll directory, all dll entry pointers become invalid, use internal name and dll plugin registry
|
||||||
|
void reset();
|
||||||
|
// Get or create the chunk index for a dll by dll plugin description
|
||||||
|
sint32 getOrCreateIndex(const IDllPluginDescInternal *dllPluginDesc);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void addInternalIndices();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
TStorageObjectContainer m_ChunkCache;
|
||||||
|
std::vector<CDllEntry *> m_Entries;
|
||||||
|
std::map<ucstring, sint32> m_InternalNameToIndex;
|
||||||
|
|
||||||
|
const CDllEntry m_DllEntryBuiltin;
|
||||||
|
const CDllEntry m_DllEntryScript;
|
||||||
|
|
||||||
|
}; /* class CDllDirectory */
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_DLL_DIRECTORY_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* \file dll_plugin_desc.cpp
|
||||||
|
* \brief CDllPluginDesc
|
||||||
|
* \date 2012-08-20 09:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CDllPluginDesc
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "dll_plugin_desc.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
const ucchar *CDllPluginDescBuiltin::displayName() const
|
||||||
|
{
|
||||||
|
static const ucstring value = ucstring("Builtin");
|
||||||
|
return value.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucchar *CDllPluginDescBuiltin::internalName() const
|
||||||
|
{
|
||||||
|
static const ucstring value = ucstring("Builtin");
|
||||||
|
return value.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const CDllPluginDescBuiltin DllPluginDescBuiltin;
|
||||||
|
|
||||||
|
const ucchar *CDllPluginDescScript::displayName() const
|
||||||
|
{
|
||||||
|
static const ucstring value = ucstring("Script");
|
||||||
|
return value.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucchar *CDllPluginDescScript::internalName() const
|
||||||
|
{
|
||||||
|
static const ucstring value = ucstring("Script");
|
||||||
|
return value.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const CDllPluginDescScript DllPluginDescScript;
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
* \file dll_plugin_desc.h
|
||||||
|
* \brief CDllPluginDesc
|
||||||
|
* \date 2012-08-20 09:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CDllPluginDesc
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_DLL_PLUGIN_DESC_H
|
||||||
|
#define PIPELINE_DLL_PLUGIN_DESC_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/ucstring.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief IDllPluginDescInternal
|
||||||
|
* \date 2012-08-20 09:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* Used for internal plugin descriptions that have no actual plugin
|
||||||
|
* associated with them.
|
||||||
|
*/
|
||||||
|
class IDllPluginDescInternal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const ucchar *displayName() const = 0;
|
||||||
|
virtual const ucchar *internalName() const = 0;
|
||||||
|
|
||||||
|
}; /* class IDllPluginDescInternal */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief IDllPluginDesc
|
||||||
|
* \date 2012-08-20 09:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* Inherit from this when making a plugin
|
||||||
|
*/
|
||||||
|
class IDllPluginDesc : public IDllPluginDescInternal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// virtual const ucchar *displayName() const = 0;
|
||||||
|
// virtual const ucchar *internalName() const = 0;
|
||||||
|
// TODO: list scene classes
|
||||||
|
|
||||||
|
}; /* class IDllPluginDesc */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CDllPluginDescBuiltin
|
||||||
|
* \date 2012-08-20 09:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* Use only internally for builtin classes
|
||||||
|
* TODO: Move to separate header?
|
||||||
|
*/
|
||||||
|
class CDllPluginDescBuiltin : public IDllPluginDescInternal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const ucchar *displayName() const;
|
||||||
|
virtual const ucchar *internalName() const;
|
||||||
|
}; /* class CDllPluginDescBuiltin */
|
||||||
|
|
||||||
|
extern const CDllPluginDescBuiltin DllPluginDescBuiltin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CDllPluginDescScript
|
||||||
|
* \date 2012-08-20 09:59GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* Use only internally for scripts
|
||||||
|
* TODO: Move to separate header?
|
||||||
|
*/
|
||||||
|
class CDllPluginDescScript : public IDllPluginDescInternal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const ucchar *displayName() const;
|
||||||
|
virtual const ucchar *internalName() const;
|
||||||
|
}; /* class CDllPluginDescScript */
|
||||||
|
|
||||||
|
extern const CDllPluginDescScript DllPluginDescScript;
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_DLL_PLUGIN_DESC_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,158 @@
|
|||||||
|
/**
|
||||||
|
* \file editable_poly.cpp
|
||||||
|
* \brief CEditablePoly
|
||||||
|
* \date 2012-08-26 12:02GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CEditablePoly
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "editable_poly.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "epoly.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace EPOLY {
|
||||||
|
|
||||||
|
CEditablePoly::CEditablePoly(CScene *scene) : CPolyObject(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CEditablePoly::~CEditablePoly()
|
||||||
|
{
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
for (TStorageObjectContainer::iterator it = m_EditablePolyUnknown.begin(), end = m_EditablePolyUnknown.end(); it != end; ++it)
|
||||||
|
delete it->second;
|
||||||
|
m_EditablePolyUnknown.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CEditablePoly::DisplayName = ucstring("EditablePoly");
|
||||||
|
const char *CEditablePoly::InternalName = "EditablePoly";
|
||||||
|
const NLMISC::CClassId CEditablePoly::ClassId = NLMISC::CClassId(0x1bf8338d, 0x192f6098);
|
||||||
|
const TSClassId CEditablePoly::SuperClassId = CPolyObject::SuperClassId;
|
||||||
|
const CEditablePolyClassDesc EditablePolyClassDesc(&DllPluginDescEPoly);
|
||||||
|
|
||||||
|
void CEditablePoly::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CPolyObject::parse(version);
|
||||||
|
|
||||||
|
IStorageObject *so;
|
||||||
|
so = getChunk(0x4039);
|
||||||
|
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x4039, so));
|
||||||
|
so = getChunk(0x403a);
|
||||||
|
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x403a, so));
|
||||||
|
for (; ; )
|
||||||
|
{ // note: also in editable mesh, copy paste or related somehow? / use a common parser class inbetween?
|
||||||
|
so = getChunk(0x3003);
|
||||||
|
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x3003, so));
|
||||||
|
else break;
|
||||||
|
so = getChunk(0x3004);
|
||||||
|
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x3004, so));
|
||||||
|
}
|
||||||
|
so = getChunk(0x3002);
|
||||||
|
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x3002, so));
|
||||||
|
so = getChunk(0x4038);
|
||||||
|
if (so) m_EditablePolyUnknown.push_back(TStorageObjectWithId(0x4038, so));
|
||||||
|
|
||||||
|
CPolyObject::parse(version, PMB_POLY_OBJECT_PARSE_FILTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePoly::clean()
|
||||||
|
{
|
||||||
|
CPolyObject::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePoly::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CPolyObject::build(version);
|
||||||
|
|
||||||
|
for (TStorageObjectContainer::iterator it = m_EditablePolyUnknown.begin(), end = m_EditablePolyUnknown.end(); it != end; ++it)
|
||||||
|
putChunk(it->first, it->second);
|
||||||
|
|
||||||
|
CPolyObject::build(version, PMB_POLY_OBJECT_PARSE_FILTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePoly::disown()
|
||||||
|
{
|
||||||
|
m_EditablePolyUnknown.clear();
|
||||||
|
CPolyObject::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePoly::init()
|
||||||
|
{
|
||||||
|
CPolyObject::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEditablePoly::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
if (classId == classDesc()->classId()) return true;
|
||||||
|
return CPolyObject::inherits(classId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CEditablePoly::classDesc() const
|
||||||
|
{
|
||||||
|
return &EditablePolyClassDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditablePoly::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
CPolyObject::toStringLocal(ostream, pad);
|
||||||
|
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
sint i = 0;
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_EditablePolyUnknown.begin(), end = m_EditablePolyUnknown.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(4) << it->first;
|
||||||
|
ostream << "\n" << pad << "EditablePolyUnkown[" << i << "] 0x" << ss.str() << ": ";
|
||||||
|
it->second->toString(ostream, padpad);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPolyObject::toStringLocal(ostream, pad, PMB_POLY_OBJECT_PARSE_FILTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CEditablePoly::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CPolyObject::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace EPOLY */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* \file editable_poly.h
|
||||||
|
* \brief CEditablePoly
|
||||||
|
* \date 2012-08-26 12:02GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CEditablePoly
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_EDITABLE_POLY_H
|
||||||
|
#define PIPELINE_EDITABLE_POLY_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../builtin/poly_object.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace EPOLY {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CEditablePoly
|
||||||
|
* \date 2012-08-26 12:02GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CEditablePoly
|
||||||
|
*/
|
||||||
|
class CEditablePoly : public PIPELINE::MAX::BUILTIN::CPolyObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CEditablePoly(CScene *scene);
|
||||||
|
virtual ~CEditablePoly();
|
||||||
|
|
||||||
|
// class desc
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
virtual void init();
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// inherited
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
TStorageObjectContainer m_EditablePolyUnknown;
|
||||||
|
|
||||||
|
}; /* class CEditablePoly */
|
||||||
|
|
||||||
|
typedef CSceneClassDesc<CEditablePoly> CEditablePolyClassDesc;
|
||||||
|
extern const CEditablePolyClassDesc EditablePolyClassDesc;
|
||||||
|
|
||||||
|
} /* namespace EPOLY */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_EDITABLE_POLY_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* \file epoly.cpp
|
||||||
|
* \brief CEPoly
|
||||||
|
* \date 2012-08-26 12:03GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CEPoly
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "epoly.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../scene_class_registry.h"
|
||||||
|
|
||||||
|
#include "editable_poly.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace EPOLY {
|
||||||
|
|
||||||
|
CEPoly::CEPoly()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CEPoly::~CEPoly()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEPoly::registerClasses(CSceneClassRegistry *registry)
|
||||||
|
{
|
||||||
|
registry->add(&EditablePolyClassDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucchar *CDllPluginDescEPoly::displayName() const
|
||||||
|
{
|
||||||
|
static const ucstring value = ucstring("Editable Poly Object (Ryzom Core)");
|
||||||
|
return value.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucchar *CDllPluginDescEPoly::internalName() const
|
||||||
|
{
|
||||||
|
static const ucstring value = ucstring("EPoly.dlo");
|
||||||
|
return value.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const CDllPluginDescEPoly DllPluginDescEPoly;
|
||||||
|
|
||||||
|
} /* namespace EPOLY */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,84 @@
|
|||||||
|
/**
|
||||||
|
* \file epoly.h
|
||||||
|
* \brief CEPoly
|
||||||
|
* \date 2012-08-26 12:03GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CEPoly
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_EPOLY_H
|
||||||
|
#define PIPELINE_EPOLY_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../dll_plugin_desc.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
class CSceneClassRegistry;
|
||||||
|
|
||||||
|
namespace EPOLY {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CEPoly
|
||||||
|
* \date 2012-08-26 12:03GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CEPoly
|
||||||
|
*/
|
||||||
|
class CEPoly
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void registerClasses(CSceneClassRegistry *registry);
|
||||||
|
|
||||||
|
public:
|
||||||
|
CEPoly();
|
||||||
|
virtual ~CEPoly();
|
||||||
|
|
||||||
|
}; /* class CEPoly */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CDllPluginDescEPoly
|
||||||
|
* \date 2012-08-26 12:03GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CDllPluginDescEPoly
|
||||||
|
*/
|
||||||
|
class CDllPluginDescEPoly : public IDllPluginDescInternal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const ucchar *displayName() const;
|
||||||
|
virtual const ucchar *internalName() const;
|
||||||
|
}; /* class CDllPluginDescScript */
|
||||||
|
|
||||||
|
extern const CDllPluginDescEPoly DllPluginDescEPoly;
|
||||||
|
|
||||||
|
} /* namespace EPOLY */
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_EPOLY_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,237 @@
|
|||||||
|
/**
|
||||||
|
* \file scene.cpp
|
||||||
|
* \brief CScene
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CScene
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "scene.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
#include <nel/misc/ucstring.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "dll_directory.h"
|
||||||
|
#include "class_directory_3.h"
|
||||||
|
#include "scene_class_registry.h"
|
||||||
|
#include "scene_class_unknown.h"
|
||||||
|
#include "builtin/scene_impl.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CScene::CScene(const CSceneClassRegistry *sceneClassRegistry, CDllDirectory *dllDirectory, CClassDirectory3 *classDirectory3) : m_SceneClassRegistry(sceneClassRegistry), m_DllDirectory(dllDirectory), m_ClassDirectory3(classDirectory3)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CScene::~CScene()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CScene::className() const
|
||||||
|
{
|
||||||
|
return "Scene";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScene::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScene::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
nlassert(m_Chunks.size() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScene::clean()
|
||||||
|
{
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScene::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
nlassert(m_Chunks.size() == 1);
|
||||||
|
CStorageContainer::build(this->version());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScene::disown()
|
||||||
|
{
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16 CScene::version()
|
||||||
|
{
|
||||||
|
nlassert(m_Chunks.size() == 1);
|
||||||
|
return m_Chunks.begin()->first;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSceneClassContainer *CScene::container()
|
||||||
|
{
|
||||||
|
nlassert(m_Chunks.size() == 1);
|
||||||
|
return static_cast<CSceneClassContainer *>(m_Chunks.begin()->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CScene::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
// Return the scene class container. There can be only one.
|
||||||
|
return new CSceneClassContainer(this, m_SceneClassRegistry, m_DllDirectory, m_ClassDirectory3);
|
||||||
|
}
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CSceneClassContainer::CSceneClassContainer(CScene *scene, const CSceneClassRegistry *sceneClassRegistry, CDllDirectory *dllDirectory, CClassDirectory3 *classDirectory3) : m_Scene(scene), m_SceneClassRegistry(sceneClassRegistry), m_DllDirectory(dllDirectory), m_ClassDirectory3(classDirectory3), m_BuiltinScene(NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CSceneClassContainer::~CSceneClassContainer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CSceneClassContainer::className() const
|
||||||
|
{
|
||||||
|
return "SceneClassContainer";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClassContainer::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClassContainer::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Temporary 'readonly' implementation, not modifying m_Chunks!
|
||||||
|
m_StorageObjectByIndex.resize(m_Chunks.size());
|
||||||
|
TStorageObjectIterator it = m_Chunks.begin();
|
||||||
|
for (std::vector<CSceneClass *>::size_type i = 0; i < m_StorageObjectByIndex.size(); ++i)
|
||||||
|
{
|
||||||
|
m_StorageObjectByIndex[i] = static_cast<CSceneClass *>(it->second);
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
CSceneClass *builtinScene = m_StorageObjectByIndex[m_StorageObjectByIndex.size() - 1];
|
||||||
|
nlassert(builtinScene);
|
||||||
|
m_BuiltinScene = dynamic_cast<BUILTIN::CSceneImpl *>(builtinScene);
|
||||||
|
nlassert(m_BuiltinScene);
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClassContainer::clean()
|
||||||
|
{
|
||||||
|
// Temporary 'readonly' implementation, not modifying m_Chunks!
|
||||||
|
CStorageContainer::clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClassContainer::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Temporary 'readonly' implementation, not modifying m_Chunks!
|
||||||
|
for (std::vector<CSceneClass *>::size_type i = 0; i < m_StorageObjectByIndex.size(); ++i)
|
||||||
|
{
|
||||||
|
m_StorageObjectToIndex[m_StorageObjectByIndex[i]] = i;
|
||||||
|
}
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClassContainer::disown()
|
||||||
|
{
|
||||||
|
// Temporary 'readonly' implementation, not modifying m_Chunks!
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
CSceneClass *CSceneClassContainer::getByStorageIndex(uint32 index) const
|
||||||
|
{
|
||||||
|
// Temporary 'readonly' implementation, not modifying m_Chunks!
|
||||||
|
if (index >= m_StorageObjectByIndex.size()) { nlerror("Index %i is outside size %i", index, m_StorageObjectByIndex.size()); return NULL; }
|
||||||
|
return m_StorageObjectByIndex[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 CSceneClassContainer::getOrCreateStorageIndex(CSceneClass *storageObject)
|
||||||
|
{
|
||||||
|
// Temporary 'readonly' implementation, not modifying m_Chunks!
|
||||||
|
return m_StorageObjectToIndex[storageObject];
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CSceneClassContainer::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
// nldebug("Scene class id %x (%i)", (uint32)id, (uint32)id);
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
// Known unknown special identifiers...
|
||||||
|
case 0x2032:
|
||||||
|
return m_SceneClassRegistry->createUnknown(m_Scene, 0x0, NLMISC::CClassId(0x29263a68, 0x405f22f5), ucstring("OSM Derived"), ucstring("Internal"), ucstring("Internal"));
|
||||||
|
case 0x2033:
|
||||||
|
return m_SceneClassRegistry->createUnknown(m_Scene, 0x0, NLMISC::CClassId(0x4ec13906, 0x5578130e), ucstring("WSM Derived"), ucstring("Internal"), ucstring("Internal"));
|
||||||
|
// return new CSceneClass(m_Scene); // TODO: Make dummy dllentry and classentry for these...
|
||||||
|
// return static_cast<IStorageObject *>(new CSceneClassUnknown<CSceneClass>(dllEntry, classEntry));
|
||||||
|
}
|
||||||
|
const CClassEntry *classEntry = m_ClassDirectory3->get(id);
|
||||||
|
CSceneClass *sceneClass = m_SceneClassRegistry->create(m_Scene, classEntry->superClassId(), classEntry->classId());
|
||||||
|
if (sceneClass)
|
||||||
|
{
|
||||||
|
return static_cast<IStorageObject *>(sceneClass);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const CDllEntry *dllEntry = m_DllDirectory->get(classEntry->dllIndex());
|
||||||
|
sceneClass = m_SceneClassRegistry->createUnknown(m_Scene, classEntry->superClassId(), classEntry->classId(), classEntry->displayName(), dllEntry->dllFilename(), dllEntry->dllDescription());
|
||||||
|
if (sceneClass)
|
||||||
|
{
|
||||||
|
return static_cast<IStorageObject *>(sceneClass);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Create an invalid unknown scene class
|
||||||
|
return static_cast<IStorageObject *>(new CSceneClassUnknown<CSceneClass>(m_Scene,classEntry->classId(), classEntry->superClassId(), classEntry->displayName(), "SceneClassUnknown", dllEntry->dllFilename(), dllEntry->dllDescription()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,146 @@
|
|||||||
|
/**
|
||||||
|
* \file scene.h
|
||||||
|
* \brief CScene
|
||||||
|
* \date 2012-08-18 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CScene
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_SCENE_H
|
||||||
|
#define PIPELINE_SCENE_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/class_id.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "storage_object.h"
|
||||||
|
#include "storage_value.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
class CSceneImpl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class CSceneClass;
|
||||||
|
|
||||||
|
// Registry containing available scene classes
|
||||||
|
class CSceneClassRegistry;
|
||||||
|
|
||||||
|
// Storage
|
||||||
|
class CDllDirectory;
|
||||||
|
class CClassDirectory3;
|
||||||
|
class CSceneClassContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CScene
|
||||||
|
* \date 2012-08-19 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CScene
|
||||||
|
*/
|
||||||
|
class CScene : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CScene(const CSceneClassRegistry *sceneClassRegistry, CDllDirectory *dllDirectory, CClassDirectory3 *classDirectory3);
|
||||||
|
virtual ~CScene();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
// public
|
||||||
|
uint16 version();
|
||||||
|
CSceneClassContainer *container();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const CSceneClassRegistry *m_SceneClassRegistry;
|
||||||
|
CDllDirectory *m_DllDirectory;
|
||||||
|
CClassDirectory3 *m_ClassDirectory3;
|
||||||
|
|
||||||
|
}; /* class CScene */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CSceneClassContainer
|
||||||
|
* \date 2012-08-19 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClassContainer
|
||||||
|
*/
|
||||||
|
class CSceneClassContainer : public CStorageContainer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSceneClassContainer(CScene *scene, const CSceneClassRegistry *sceneClassRegistry, CDllDirectory *dllDirectory, CClassDirectory3 *classDirectory3);
|
||||||
|
virtual ~CSceneClassContainer();
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
virtual void clean();
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
virtual void disown();
|
||||||
|
|
||||||
|
/// Use while parsing to get an object by it's index
|
||||||
|
CSceneClass *getByStorageIndex(uint32 index) const;
|
||||||
|
/// Use while building to get an index for an object
|
||||||
|
uint32 getOrCreateStorageIndex(CSceneClass *storageObject);
|
||||||
|
|
||||||
|
/// TODO: Evaluate the references tree to build new indexes.
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Return the single instance of the builtin scene class
|
||||||
|
inline BUILTIN::CSceneImpl *scene() const { return m_BuiltinScene; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
CScene *m_Scene;
|
||||||
|
|
||||||
|
const CSceneClassRegistry *m_SceneClassRegistry;
|
||||||
|
CDllDirectory *m_DllDirectory;
|
||||||
|
CClassDirectory3 *m_ClassDirectory3;
|
||||||
|
|
||||||
|
std::vector<CSceneClass *> m_StorageObjectByIndex;
|
||||||
|
std::map<CSceneClass *, uint32> m_StorageObjectToIndex;
|
||||||
|
|
||||||
|
BUILTIN::CSceneImpl *m_BuiltinScene;
|
||||||
|
|
||||||
|
}; /* class CSceneClassContainer */
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_SCENE_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,288 @@
|
|||||||
|
/**
|
||||||
|
* \file scene_class.cpp
|
||||||
|
* \brief CSceneClass
|
||||||
|
* \date 2012-08-20 09:07GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClass
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "scene_class.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Elevate warnings to errors in this file for stricter reading
|
||||||
|
#undef nlwarning
|
||||||
|
#define nlwarning nlerror
|
||||||
|
|
||||||
|
// Elevate debug to error in this file for debugging
|
||||||
|
// #undef nldebug
|
||||||
|
// #define nldebug nlerror
|
||||||
|
|
||||||
|
// Chunk identifiers
|
||||||
|
// #define ...
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CSceneClass::CSceneClass(CScene *scene) : m_Scene(scene)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CSceneClass::~CSceneClass()
|
||||||
|
{
|
||||||
|
if (!m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
for (TStorageObjectContainer::iterator it = m_OrphanedChunks.begin(), end = m_OrphanedChunks.end(); it != end; ++it)
|
||||||
|
delete it->second;
|
||||||
|
m_OrphanedChunks.clear();
|
||||||
|
for (std::vector<IStorageObject *>::iterator it = m_ArchivedChunks.begin(), end = m_ArchivedChunks.end(); it != end; ++it)
|
||||||
|
delete (*it);
|
||||||
|
m_ArchivedChunks.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CSceneClass::className() const
|
||||||
|
{
|
||||||
|
return classDesc()->internalName();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClass::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
CStorageContainer::toString(ostream, pad);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ostream << "<ptr=0x";
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(16) << (uint64)(void *)this;
|
||||||
|
ostream << ss.str();
|
||||||
|
}
|
||||||
|
ostream << "> ";
|
||||||
|
ostream << "(" << className() << ": " << ucstring(classDesc()->displayName()).toUtf8() << ", " << classDesc()->classId().toString() << ", 0x";
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(8) << classDesc()->superClassId();
|
||||||
|
ostream << ss.str();
|
||||||
|
}
|
||||||
|
ostream << ", " << ucstring(classDesc()->dllPluginDesc()->internalName()).toUtf8() << ") [" << m_OrphanedChunks.size() << "] { ";
|
||||||
|
toStringLocal(ostream, pad);
|
||||||
|
// Append orphans
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
sint i = 0;
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_OrphanedChunks.begin(), end = m_OrphanedChunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(4) << it->first;
|
||||||
|
ostream << "\n" << pad << "Orphan[" << i << "] 0x" << ss.str() << ": ";
|
||||||
|
it->second->toString(ostream, padpad);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClass::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Cannot be parsed yet
|
||||||
|
if (!m_ChunksOwnsPointers) { nlerror("Already parsed"); return; } // Already parsed, illegal to call twice
|
||||||
|
|
||||||
|
// Parse all child chunks
|
||||||
|
CStorageContainer::parse(version);
|
||||||
|
|
||||||
|
// Orphanize all child chunk
|
||||||
|
m_OrphanedChunks.insert(m_OrphanedChunks.end(), m_Chunks.begin(), m_Chunks.end());
|
||||||
|
|
||||||
|
// Take ownership
|
||||||
|
m_ChunksOwnsPointers = false;
|
||||||
|
|
||||||
|
// Inheriting classes take control from here on, they should check
|
||||||
|
// m_ChunksOwnsPointers to be false before taking action, in case
|
||||||
|
// a subclass called disown due to failure.
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClass::clean()
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers) { nldebug("Not parsed, or disowned"); return; } // Must have local ownership, parsing may have failed
|
||||||
|
if (m_Chunks.size() == 0 && m_OrphanedChunks.size() != 0) { nlwarning("Already cleaned"); return; } // Already cleaned, should not call twice, not reliable because not all chunks have child chunks
|
||||||
|
|
||||||
|
// Clear unneeded references from the parent
|
||||||
|
m_Chunks.clear();
|
||||||
|
|
||||||
|
// Clean owned child chunks
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_OrphanedChunks.begin(), end = m_OrphanedChunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->second->isContainer())
|
||||||
|
{
|
||||||
|
static_cast<CStorageContainer *>(it->second)->clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Erase archived chunks, they must have been parsed perfectly
|
||||||
|
for (std::vector<IStorageObject *>::iterator it = m_ArchivedChunks.begin(), end = m_ArchivedChunks.end(); it != end; ++it)
|
||||||
|
delete (*it);
|
||||||
|
m_ArchivedChunks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClass::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
// Must be clean first
|
||||||
|
if (!m_ChunksOwnsPointers && m_Chunks.size() != 0) { nlerror("Not cleaned"); return; } // Cannot call twice, illegal call
|
||||||
|
if (m_Chunks.size() != 0) { nldebug("Not parsed, or disowned"); return; } // Don't have local ownership, parsing may have failed, the built version is implicitly up to date
|
||||||
|
|
||||||
|
// Store orphan chunks
|
||||||
|
m_Chunks.insert(m_Chunks.end(), m_OrphanedChunks.begin(), m_OrphanedChunks.end());
|
||||||
|
|
||||||
|
// Build the orphan chunks (this is a little trick to do it this
|
||||||
|
// way here, don't do this from subclasses)
|
||||||
|
CStorageContainer::build(version);
|
||||||
|
|
||||||
|
// Set the insertion pointer before the orphans
|
||||||
|
m_PutChunkInsert = m_Chunks.begin();
|
||||||
|
|
||||||
|
// Inheriting classes take control from here on, so the build is
|
||||||
|
// called to owned subclasses from the putChunk function.
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClass::disown()
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers) { nldebug("Not parsed"); }
|
||||||
|
if (!m_ChunksOwnsPointers && (m_Chunks.size() < m_OrphanedChunks.size())) { nlerror("Not built"); return; } // If chunks is not the owner, built chunks must match the parsed data. This check is not fully reliable
|
||||||
|
|
||||||
|
// Clear local references
|
||||||
|
m_OrphanedChunks.clear();
|
||||||
|
m_ArchivedChunks.clear();
|
||||||
|
|
||||||
|
// Return ownership
|
||||||
|
m_ChunksOwnsPointers = true;
|
||||||
|
|
||||||
|
// Disown children
|
||||||
|
CStorageContainer::disown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClass::init()
|
||||||
|
{
|
||||||
|
// Nothing to do here!
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CSceneClass::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
return CStorageContainer::createChunkById(id, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucstring CSceneClass::DisplayName = ucstring("Invalid Scene Class");
|
||||||
|
const char *CSceneClass::InternalName = "SceneClass";
|
||||||
|
const NLMISC::CClassId CSceneClass::ClassId = NLMISC::CClassId::Null; // This class is invalid
|
||||||
|
const TSClassId CSceneClass::SuperClassId = 0x0000; // This class is invalid
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
static const CSceneClassDesc<CSceneClass> SceneClassDesc(static_cast<const IDllPluginDescInternal *>(&DllPluginDescBuiltin));
|
||||||
|
} /* anonymous namespace */
|
||||||
|
|
||||||
|
bool CSceneClass::inherits(const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISceneClassDesc *CSceneClass::classDesc() const
|
||||||
|
{
|
||||||
|
return static_cast<const ISceneClassDesc *>(&SceneClassDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClass::toStringLocal(std::ostream &ostream, const std::string &pad, uint filter) const
|
||||||
|
{
|
||||||
|
// Nothing to do here...
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CSceneClass::getChunk(uint16 id)
|
||||||
|
{
|
||||||
|
if (m_OrphanedChunks.begin()->first == id)
|
||||||
|
{
|
||||||
|
IStorageObject *result = m_OrphanedChunks.begin()->second;
|
||||||
|
m_OrphanedChunks.pop_front();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (TStorageObjectContainer::iterator it = m_OrphanedChunks.begin(), end = m_OrphanedChunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->first == id)
|
||||||
|
{
|
||||||
|
nlwarning("Try to get chunk with 0x%x id, but found 0x%x instead. Found the correct chunk at a different position. Unknown chunks, or chunks out of order", (uint32)id, (uint32)m_OrphanedChunks.begin()->first);
|
||||||
|
IStorageObject *result = it->second;
|
||||||
|
m_OrphanedChunks.erase(it);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// nldebug("Chunk 0x%x not found, this is allowed, returning NULL", (uint32)id);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClass::putChunk(uint16 id, IStorageObject *storageObject)
|
||||||
|
{
|
||||||
|
if (storageObject->isContainer())
|
||||||
|
{
|
||||||
|
static_cast<CStorageContainer *>(storageObject)->build(VersionUnknown); // FIXME
|
||||||
|
}
|
||||||
|
m_OrphanedChunks.insert(m_PutChunkInsert, TStorageObjectWithId(id, storageObject));
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16 CSceneClass::peekChunk()
|
||||||
|
{
|
||||||
|
if (m_OrphanedChunks.size())
|
||||||
|
return m_OrphanedChunks.begin()->first;
|
||||||
|
return 0x0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,231 @@
|
|||||||
|
/**
|
||||||
|
* \file scene_class.h
|
||||||
|
* \brief CSceneClass
|
||||||
|
* \date 2012-08-20 09:07GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClass
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_SCENE_CLASS_H
|
||||||
|
#define PIPELINE_SCENE_CLASS_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/class_id.h>
|
||||||
|
#include <nel/misc/smart_ptr.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "typedefs.h"
|
||||||
|
#include "storage_object.h"
|
||||||
|
#include "storage_value.h"
|
||||||
|
#include "dll_plugin_desc.h"
|
||||||
|
#include "scene.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
namespace BUILTIN {
|
||||||
|
|
||||||
|
class CSceneImpl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ISceneClassDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CSceneClass
|
||||||
|
* \date 2012-08-19 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* It is recommended to use CRefPtr<T> to refer to any pointers to
|
||||||
|
* classes inherited from this class.
|
||||||
|
* NOTE: CRefPtr<T> does not delete the class when references go to
|
||||||
|
* zero. When you remove a class from the scene, the class will be
|
||||||
|
* deleted if the reference count is zero. Otherwise, you are
|
||||||
|
* responsible for deleting it (for example, if you keep the class
|
||||||
|
* backed up in an undo stack for undeletion). You may use CSmartPtr<T>
|
||||||
|
* when the class is no longer owned by the scene container.
|
||||||
|
* CRefPtr<T> is a safe handle, which you can use to verify if the class
|
||||||
|
* has been deleted or not, similar to AnimHandle in max.
|
||||||
|
*/
|
||||||
|
class CSceneClass : public CStorageContainer, public NLMISC::CVirtualRefCount
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSceneClass(CScene *scene);
|
||||||
|
virtual ~CSceneClass();
|
||||||
|
|
||||||
|
//! \name Inherited functions that are implemented by wrapping around other virtual functions in this class
|
||||||
|
//@{
|
||||||
|
virtual std::string className() const; // do not override, implemented using classDesc
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const; // do not override, implemented using toStringLocal
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//! \name Inherited functions called through the storage loading and saving system
|
||||||
|
//@{
|
||||||
|
/// Override this to read a chunk from the chunks stream. Call the parent's parse function first. Get the necessary chunks implemented by your class using getChunk. See the getChunk function for further information. In case of failure, call disown. If m_ChunksOwnsPointers is true, the parsing has failed, warnings have already been printed, and nothing should happen. Chunks are already parsed when you get them from getChunk
|
||||||
|
virtual void parse(uint16 version, uint filter = 0);
|
||||||
|
/// Override this if the chunks you are using are not needed after they have been parsed. You may delete any chunks you own. Call the parent's clean first. You must call clean on any chunks you own if they implement this function
|
||||||
|
virtual void clean();
|
||||||
|
/// Override this to write a chunk to the chunks stream. If you create a new chunk, the creating class owns it, and should delete it when clean is called. You no longer own any created chunks when disown has been called. Use putChunk to add the chunk. Call the parent's build first. The putChunk function calls build on added chunks
|
||||||
|
virtual void build(uint16 version, uint filter = 0);
|
||||||
|
/// Remove any references to chunks that are owned by the inheriting class (those that were acquired using getChunk during parse or created using putChunk during build). You no longer have ownership over these chunks, and should not use them anymore. This function may be called after build to disable any functionality from the loaded storage. Call the parent's disown after disowning your own chunks. Disown is called on the disowned child chunks for you
|
||||||
|
virtual void disown();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//! \name Virtual functionality for inheriting classes to implement
|
||||||
|
//@{
|
||||||
|
/// Initialize this class from scratch, call the parent first
|
||||||
|
virtual void init();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//! \name Static const variables for the class description
|
||||||
|
//@{
|
||||||
|
static const ucstring DisplayName;
|
||||||
|
static const char *InternalName;
|
||||||
|
static const NLMISC::CClassId ClassId;
|
||||||
|
static const TSClassId SuperClassId;
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//! \name More virtual functionality for inheriting classes to implement
|
||||||
|
//@{
|
||||||
|
/// Returns whether the class inherits from a class with given class id
|
||||||
|
virtual bool inherits(const NLMISC::CClassId classId) const;
|
||||||
|
/// Return the class description of the inheriting class
|
||||||
|
virtual const ISceneClassDesc *classDesc() const;
|
||||||
|
/// Create a readable representation of this class
|
||||||
|
virtual void toStringLocal(std::ostream &ostream, const std::string &pad = "", uint filter = 0) const;
|
||||||
|
//@}
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! \name Read access to internal data, provided for browsing trough the file from code
|
||||||
|
//@{
|
||||||
|
inline const TStorageObjectContainer &orphanedChunks() const { return m_OrphanedChunks; }
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//! \name Scene utility access
|
||||||
|
//@{
|
||||||
|
/// Return the scene scene class
|
||||||
|
inline BUILTIN::CSceneImpl *scene() const { return m_Scene->container()->scene(); }
|
||||||
|
/// Return the scene version
|
||||||
|
inline uint16 version() const { return m_Scene->version(); }
|
||||||
|
/// Return the scene container
|
||||||
|
inline CSceneClassContainer *container() const { return m_Scene->container(); }
|
||||||
|
//@}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \name Methods used by inheriting classes to read and write to the storage safely
|
||||||
|
//@{
|
||||||
|
/// Use during parsing. Gets the chunk with specified id. Warnings when chunks are skipped may be elevated to errors. Remaining orphaned chunks will be appended after chunks that are written by the classes. Returns NULL when the chunk does not exist. Empty chunks are often not written by classes. You have ownership over the chunk until it is disowned. In case that the chunk cannot be parsed, call disown and abort parsing, or you may keep the chunk as is without modifications and put it back as is during build with putChunk. If this function returns NULL it is also possible that the parsing has been aborted when m_ChunksOwnsPointers is true
|
||||||
|
IStorageObject *getChunk(uint16 id);
|
||||||
|
/// Use during file build. Adds a chunk to the chunks that will be written to the file. Build is called when a chunk is passed through
|
||||||
|
void putChunk(uint16 id, IStorageObject *storageObject);
|
||||||
|
/// Same as getChunk but for lazy programmers, must use together with putChunkValue
|
||||||
|
template <typename T>
|
||||||
|
const T &getChunkValue(uint16 id);
|
||||||
|
/// Same as putChunk but for lazy programmers, must use together with getChunkValue
|
||||||
|
template <typename T>
|
||||||
|
void putChunkValue(uint16 id, const T &value);
|
||||||
|
/// See the next chunk id
|
||||||
|
uint16 peekChunk();
|
||||||
|
//@}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual IStorageObject *createChunkById(uint16 id, bool container);
|
||||||
|
|
||||||
|
/// Chunks which have been parsed, kept unmodified, and which are no longer necessary, should be placed here
|
||||||
|
std::vector<IStorageObject *> m_ArchivedChunks;
|
||||||
|
|
||||||
|
private:
|
||||||
|
TStorageObjectContainer m_OrphanedChunks;
|
||||||
|
TStorageObjectIterator m_PutChunkInsert;
|
||||||
|
|
||||||
|
CScene *m_Scene;
|
||||||
|
|
||||||
|
}; /* class CSceneClass */
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
const T &CSceneClass::getChunkValue(uint16 id)
|
||||||
|
{
|
||||||
|
CStorageValue<T> *chunk = static_cast<CStorageValue<T> *>(getChunk(id));
|
||||||
|
if (!chunk) { nlerror("Try to get required chunk value 0x%x but it does not exist, bad file format"); }
|
||||||
|
m_ArchivedChunks.push_back(chunk);
|
||||||
|
return chunk->Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CSceneClass::putChunkValue(uint16 id, const T &value)
|
||||||
|
{
|
||||||
|
CStorageValue<T> *chunk = new CStorageValue<T>();
|
||||||
|
chunk->Value = value;
|
||||||
|
m_ArchivedChunks.push_back(chunk);
|
||||||
|
putChunk(id, chunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief ISceneClassDesc
|
||||||
|
* \date 2012-08-19 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* ISceneClassDesc
|
||||||
|
*/
|
||||||
|
class ISceneClassDesc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual CSceneClass *create(CScene *scene) const = 0;
|
||||||
|
virtual void destroy(CSceneClass *sc) const = 0;
|
||||||
|
virtual const ucchar *displayName() const = 0;
|
||||||
|
virtual const char *internalName() const = 0;
|
||||||
|
virtual NLMISC::CClassId classId() const = 0;
|
||||||
|
virtual TSClassId superClassId() const = 0;
|
||||||
|
virtual const IDllPluginDescInternal *dllPluginDesc() const = 0;
|
||||||
|
|
||||||
|
}; /* class ISceneClassDesc */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CSceneClassDesc
|
||||||
|
* \date 2012-08-19 19:25GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClassDesc
|
||||||
|
* Use in a cpp when registering the CClassId.
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
class CSceneClassDesc : public ISceneClassDesc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSceneClassDesc(const IDllPluginDescInternal *dllPluginDesc) : m_DllPluginDesc(dllPluginDesc) { }
|
||||||
|
virtual CSceneClass *create(CScene *scene) const { return static_cast<CSceneClass *>(new T(scene)); }
|
||||||
|
virtual void destroy(CSceneClass *sc) const { delete static_cast<T *>(sc); }
|
||||||
|
virtual const ucchar *displayName() const { return T::DisplayName.c_str(); }
|
||||||
|
virtual const char *internalName() const { return T::InternalName; }
|
||||||
|
virtual NLMISC::CClassId classId() const { return T::ClassId; }
|
||||||
|
virtual TSClassId superClassId() const { return T::SuperClassId; }
|
||||||
|
virtual const IDllPluginDescInternal *dllPluginDesc() const { return m_DllPluginDesc; }
|
||||||
|
private:
|
||||||
|
const IDllPluginDescInternal *m_DllPluginDesc;
|
||||||
|
|
||||||
|
}; /* class CSceneClassDesc */
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_SCENE_CLASS_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,176 @@
|
|||||||
|
/**
|
||||||
|
* \file scene_class_registry.cpp
|
||||||
|
* \brief CSceneClassRegistry
|
||||||
|
* \date 2012-08-20 09:57GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClassRegistry
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "scene_class_registry.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Elevate warnings to errors in this file for stricter reading
|
||||||
|
#undef nlwarning
|
||||||
|
#define nlwarning nlerror
|
||||||
|
|
||||||
|
// Elevate debug to error in this file for debugging
|
||||||
|
// #undef nldebug
|
||||||
|
// #define nldebug nlerror
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CSceneClassRegistry::CSceneClassRegistry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CSceneClassRegistry::~CSceneClassRegistry()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClassRegistry::add(const ISceneClassDesc *desc)
|
||||||
|
{
|
||||||
|
TKey key(desc->superClassId(), desc->classId());
|
||||||
|
if (m_ClassDescriptions.find(key) != m_ClassDescriptions.end()) { nlerror("Already added this class to the registry"); return; }
|
||||||
|
m_ClassDescriptions[key] = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClassRegistry::remove(const TSClassId superClassId, const NLMISC::CClassId classId)
|
||||||
|
{
|
||||||
|
TKey key(superClassId, classId);
|
||||||
|
if (m_ClassDescriptions.find(key) == m_ClassDescriptions.end()) { nlwarning("Try to remove class that is not found"); return; }
|
||||||
|
m_ClassDescriptions.erase(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add a superclass to the registry
|
||||||
|
void CSceneClassRegistry::add(const ISuperClassDesc *desc)
|
||||||
|
{
|
||||||
|
// nldebug("Register superclass 0x%x", desc->superClassId());
|
||||||
|
if (m_SuperClassDescriptions.find(desc->superClassId()) != m_SuperClassDescriptions.end()) { nlerror("Already added this superclass to the registry"); return; }
|
||||||
|
m_SuperClassDescriptions[desc->superClassId()] = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Remove a superclass from the registry
|
||||||
|
void CSceneClassRegistry::remove(const TSClassId superClassId)
|
||||||
|
{
|
||||||
|
if (m_SuperClassDescriptions.find(superClassId) == m_SuperClassDescriptions.end()) { nlwarning("Try to remove superclass that is not found"); return; }
|
||||||
|
m_SuperClassDescriptions.erase(superClassId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a class by class id
|
||||||
|
CSceneClass *CSceneClassRegistry::create(CScene *scene, const TSClassId superClassId, const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
TKey key(superClassId, classId);
|
||||||
|
if (m_ClassDescriptions.find(key) == m_ClassDescriptions.end()) { /* nldebug("Try to create class that does not exist"); */ return NULL; }
|
||||||
|
return m_ClassDescriptions.find(key)->second->create(scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create an unknown class by superclass id
|
||||||
|
CSceneClass *CSceneClassRegistry::createUnknown(CScene *scene, TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const
|
||||||
|
{
|
||||||
|
if (m_SuperClassDescriptions.find(superClassId) == m_SuperClassDescriptions.end()) { nlwarning("Creating superclass 0x%x (%s) %s that does not exist", superClassId, displayName.toUtf8().c_str(), classId.toString().c_str()); return NULL; }
|
||||||
|
return m_SuperClassDescriptions.find(superClassId)->second->createUnknown(scene, classId, displayName, dllFilename, dllDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Destroy a class by pointer
|
||||||
|
void CSceneClassRegistry::destroy(CSceneClass *sceneClass) const
|
||||||
|
{
|
||||||
|
sceneClass->classDesc()->destroy(sceneClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the description of a class by class id
|
||||||
|
const ISceneClassDesc *CSceneClassRegistry::describe(const TSClassId superClassId, const NLMISC::CClassId classId) const
|
||||||
|
{
|
||||||
|
TKey key(superClassId, classId);
|
||||||
|
if (m_ClassDescriptions.find(key) == m_ClassDescriptions.end()) { nldebug("Try to describe class that does not exist"); return NULL; }
|
||||||
|
return m_ClassDescriptions.find(key)->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CSceneClassRegistry::TKey::TKey(TSClassId superClassId, NLMISC::CClassId classId) : SuperClassId(superClassId), ClassId(classId)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSceneClassRegistry::TKey::operator<(const CSceneClassRegistry::TKey &right) const
|
||||||
|
{
|
||||||
|
if (SuperClassId < right.SuperClassId)
|
||||||
|
return true;
|
||||||
|
if (SuperClassId > right.SuperClassId)
|
||||||
|
return false;
|
||||||
|
if (ClassId < right.ClassId)
|
||||||
|
return true;
|
||||||
|
if (ClassId > right.ClassId)
|
||||||
|
return false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSceneClassRegistry::TKey::operator>(const CSceneClassRegistry::TKey &right) const
|
||||||
|
{
|
||||||
|
if (SuperClassId > right.SuperClassId)
|
||||||
|
return true;
|
||||||
|
if (SuperClassId < right.SuperClassId)
|
||||||
|
return false;
|
||||||
|
if (ClassId > right.ClassId)
|
||||||
|
return true;
|
||||||
|
if (ClassId < right.ClassId)
|
||||||
|
return false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSceneClassRegistry::TKey::operator==(const CSceneClassRegistry::TKey &right) const
|
||||||
|
{
|
||||||
|
return ClassId == right.ClassId && SuperClassId == right.SuperClassId;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,98 @@
|
|||||||
|
/**
|
||||||
|
* \file scene_class_registry.h
|
||||||
|
* \brief CSceneClassRegistry
|
||||||
|
* \date 2012-08-20 09:57GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClassRegistry
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_SCENE_CLASS_REGISTRY_H
|
||||||
|
#define PIPELINE_SCENE_CLASS_REGISTRY_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "scene_class.h"
|
||||||
|
#include "super_class_desc.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CSceneClassRegistry
|
||||||
|
* \date 2012-08-20 09:57GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClassRegistry
|
||||||
|
*/
|
||||||
|
class CSceneClassRegistry
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSceneClassRegistry();
|
||||||
|
virtual ~CSceneClassRegistry();
|
||||||
|
|
||||||
|
/// Add a class to the registry
|
||||||
|
void add(const ISceneClassDesc *desc);
|
||||||
|
/// Remove a class from the registry
|
||||||
|
void remove(TSClassId superClassId, const NLMISC::CClassId classId);
|
||||||
|
|
||||||
|
/// Add a superclass to the registry
|
||||||
|
void add(const ISuperClassDesc *desc);
|
||||||
|
/// Remove a superclass from the registry
|
||||||
|
void remove(const TSClassId superClassId);
|
||||||
|
|
||||||
|
/// Create a class by class id
|
||||||
|
CSceneClass *create(CScene *scene, TSClassId superClassId, const NLMISC::CClassId classId) const;
|
||||||
|
|
||||||
|
/// Create an unknown class by superclass id
|
||||||
|
CSceneClass *createUnknown(CScene *scene, TSClassId superClassId, const NLMISC::CClassId classId, const ucstring &displayName, const ucstring &dllFilename, const ucstring &dllDescription) const;
|
||||||
|
|
||||||
|
/// Destroy a class by pointer
|
||||||
|
void destroy(CSceneClass *sceneClass) const;
|
||||||
|
|
||||||
|
/// Return the description of a class by class id
|
||||||
|
const ISceneClassDesc *describe(TSClassId superClassId, const NLMISC::CClassId classId) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct TKey
|
||||||
|
{
|
||||||
|
TKey(TSClassId superClassId, NLMISC::CClassId classId);
|
||||||
|
TSClassId SuperClassId;
|
||||||
|
NLMISC::CClassId ClassId;
|
||||||
|
bool operator<(const TKey &right) const;
|
||||||
|
bool operator>(const TKey &right) const;
|
||||||
|
bool operator==(const TKey &right) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::map<TKey, const ISceneClassDesc *> m_ClassDescriptions;
|
||||||
|
std::map<TSClassId, const ISuperClassDesc *> m_SuperClassDescriptions;
|
||||||
|
|
||||||
|
}; /* class CSceneClassRegistry */
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_SCENE_CLASS_REGISTRY_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,114 @@
|
|||||||
|
/**
|
||||||
|
* \file scene_class_unknown.cpp
|
||||||
|
* \brief CSceneClassUnknown
|
||||||
|
* \date 2012-08-20 13:23GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClassUnknown
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "scene_class_unknown.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CSceneClassUnknownDllPluginDesc::CSceneClassUnknownDllPluginDesc(const ucstring &dllFilename, const ucstring &dllDescription) : m_InternalName(dllFilename), m_DisplayName(dllDescription)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucchar *CSceneClassUnknownDllPluginDesc::internalName() const
|
||||||
|
{
|
||||||
|
return m_InternalName.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucchar *CSceneClassUnknownDllPluginDesc::displayName() const
|
||||||
|
{
|
||||||
|
return m_DisplayName.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CSceneClassUnknownDesc::CSceneClassUnknownDesc(const NLMISC::CClassId classId, const TSClassId superClassId, const ucstring &displayName, const std::string &internalName, const ucstring &dllFilename, const ucstring &dllDescription) : m_DisplayName(displayName), m_InternalName(internalName), m_ClassId(classId), m_SuperClassId(superClassId), m_DllPluginDesc(dllFilename, dllDescription)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CSceneClass *CSceneClassUnknownDesc::create(CScene *scene) const
|
||||||
|
{
|
||||||
|
nlassert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSceneClassUnknownDesc::destroy(CSceneClass *sc) const
|
||||||
|
{
|
||||||
|
delete sc;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ucchar *CSceneClassUnknownDesc::displayName() const
|
||||||
|
{
|
||||||
|
return m_DisplayName.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *CSceneClassUnknownDesc::internalName() const
|
||||||
|
{
|
||||||
|
return m_InternalName.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
NLMISC::CClassId CSceneClassUnknownDesc::classId() const
|
||||||
|
{
|
||||||
|
return m_ClassId;
|
||||||
|
}
|
||||||
|
|
||||||
|
TSClassId CSceneClassUnknownDesc::superClassId() const
|
||||||
|
{
|
||||||
|
return m_SuperClassId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const IDllPluginDescInternal *CSceneClassUnknownDesc::dllPluginDesc() const
|
||||||
|
{
|
||||||
|
return &m_DllPluginDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,115 @@
|
|||||||
|
/**
|
||||||
|
* \file scene_class_unknown.h
|
||||||
|
* \brief CSceneClassUnknown
|
||||||
|
* \date 2012-08-20 13:23GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClassUnknown
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_SCENE_CLASS_UNKNOWN_H
|
||||||
|
#define PIPELINE_SCENE_CLASS_UNKNOWN_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "scene_class.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CSceneClassUnknownDllPluginDesc
|
||||||
|
* \date 2012-08-20 13:23GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClassUnknownDllPluginDesc
|
||||||
|
*/
|
||||||
|
class CSceneClassUnknownDllPluginDesc : public IDllPluginDescInternal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSceneClassUnknownDllPluginDesc(const ucstring &dllFilename, const ucstring &dllDescription);
|
||||||
|
virtual const ucchar *internalName() const;
|
||||||
|
virtual const ucchar *displayName() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ucstring m_InternalName;
|
||||||
|
ucstring m_DisplayName;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CSceneClassUnknownDesc
|
||||||
|
* \date 2012-08-20 13:23GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CSceneClassUnknownDesc
|
||||||
|
*/
|
||||||
|
class CSceneClassUnknownDesc : public ISceneClassDesc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSceneClassUnknownDesc(const NLMISC::CClassId classId, const TSClassId superClassId, const ucstring &displayName, const std::string &internalName, const ucstring &dllFilename, const ucstring &dllDescription);
|
||||||
|
virtual CSceneClass *create(CScene *scene) const;
|
||||||
|
virtual void destroy(CSceneClass *sc) const;
|
||||||
|
virtual const ucchar *displayName() const;
|
||||||
|
virtual const char *internalName() const;
|
||||||
|
virtual NLMISC::CClassId classId() const;
|
||||||
|
virtual TSClassId superClassId() const;
|
||||||
|
virtual const IDllPluginDescInternal *dllPluginDesc() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ucstring m_DisplayName;
|
||||||
|
std::string m_InternalName;
|
||||||
|
NLMISC::CClassId m_ClassId;
|
||||||
|
TSClassId m_SuperClassId;
|
||||||
|
CSceneClassUnknownDllPluginDesc m_DllPluginDesc;
|
||||||
|
|
||||||
|
}; /* class ISceneClassDesc */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CSceneClassUnknown
|
||||||
|
* \date 2012-08-20 13:23GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* Utility class for parsing unknown scene classes and keeping them
|
||||||
|
* in storage as is.
|
||||||
|
*/
|
||||||
|
template <typename TSuperClass>
|
||||||
|
class CSceneClassUnknown : public TSuperClass
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSceneClassUnknown(CScene *scene, const NLMISC::CClassId classId, const TSClassId superClassId, const ucstring &displayName, const std::string &internalName, const ucstring &dllFilename, const ucstring &dllDescription) : TSuperClass(scene), m_Desc(classId, superClassId, displayName, internalName, dllFilename, dllDescription) { }
|
||||||
|
virtual ~CSceneClassUnknown() { }
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual const ISceneClassDesc *classDesc() const { return &m_Desc; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
CSceneClassUnknownDesc m_Desc;
|
||||||
|
|
||||||
|
}; /* class CSceneClass */
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_SCENE_CLASS_UNKNOWN_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* \file storage_array.cpp
|
||||||
|
* \brief CStorageArray
|
||||||
|
* \date 2012-08-21 11:33GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStorageArray
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "storage_array.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
void blahblahblah() { }
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,217 @@
|
|||||||
|
/**
|
||||||
|
* \file storage_array.h
|
||||||
|
* \brief CStorageArray
|
||||||
|
* \date 2012-08-21 11:33GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStorageArray
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_STORAGE_ARRAY_H
|
||||||
|
#define PIPELINE_STORAGE_ARRAY_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/ucstring.h>
|
||||||
|
#include <nel/misc/string_common.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "storage_object.h"
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CStorageArray
|
||||||
|
* \date 2012-08-21 11:33GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* WARNING: sizeof(TType) should match the serialized size,
|
||||||
|
* otherwise you must specialize the getSize and setSize functions!
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
class CStorageArray : public IStorageObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// public data
|
||||||
|
typedef T TType;
|
||||||
|
typedef std::vector<TType> TTypeArray;
|
||||||
|
TTypeArray Value;
|
||||||
|
|
||||||
|
// inherited
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void serial(NLMISC::IStream &stream);
|
||||||
|
virtual void toString(std::ostream &ostream, const std::string &pad = "") const;
|
||||||
|
|
||||||
|
public: // should be protected but that doesn't compile, nice c++!
|
||||||
|
// Sets size when reading
|
||||||
|
virtual void setSize(sint32 size);
|
||||||
|
// Gets the size when writing, return false if unknown
|
||||||
|
virtual bool getSize(sint32 &size) const;
|
||||||
|
}; /* class CStorageArray */
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
std::string CStorageArray<T>::className() const
|
||||||
|
{
|
||||||
|
return "StorageArray";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CStorageArray<T>::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
for (typename TTypeArray::iterator it = Value.begin(), end = Value.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
stream.serial(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CStorageArray<T>::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
ostream << "(" << className() << ") [" << Value.size() << "] { "; // << s << " } ";
|
||||||
|
uint i = 0;
|
||||||
|
for (typename TTypeArray::const_iterator it = Value.begin(), end = Value.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
std::string s = NLMISC::toString(*it);
|
||||||
|
//ostream << "\n" << pad << i << ": " << s;
|
||||||
|
ostream << "{ " << s << " } ";
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CStorageArray<T>::setSize(sint32 size)
|
||||||
|
{
|
||||||
|
if (size % (sizeof(TType)) != 0)
|
||||||
|
nlerror("Size %i is not a multiple of value type size %i", size, sizeof(TType));
|
||||||
|
Value.resize(size / sizeof(TType));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool CStorageArray<T>::getSize(sint32 &size) const
|
||||||
|
{
|
||||||
|
size = Value.size() * sizeof(TType);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class CStorageArraySizePre : public CStorageArray<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void serial(NLMISC::IStream &stream);
|
||||||
|
virtual void setSize(sint32 size);
|
||||||
|
virtual bool getSize(sint32 &size) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
std::string CStorageArraySizePre<T>::className() const
|
||||||
|
{
|
||||||
|
return "StorageArraySizePre";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CStorageArraySizePre<T>::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
uint32 size = this->Value.size();
|
||||||
|
stream.serial(size);
|
||||||
|
nlassert(this->Value.size() == size);
|
||||||
|
CStorageArray<T>::serial(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CStorageArraySizePre<T>::setSize(sint32 size)
|
||||||
|
{
|
||||||
|
CStorageArray<T>::setSize(size - sizeof(uint32));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool CStorageArraySizePre<T>::getSize(sint32 &size) const
|
||||||
|
{
|
||||||
|
size = CStorageArray<T>::getSize(size) + sizeof(uint32);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/// Same as CStorageArraySizePre but with no sizeof checks.
|
||||||
|
/// Use when serializing variable sizes in type T.
|
||||||
|
template <typename T>
|
||||||
|
class CStorageArrayDynSize : public CStorageArray<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual std::string className() const;
|
||||||
|
virtual void serial(NLMISC::IStream &stream);
|
||||||
|
virtual void setSize(sint32 size);
|
||||||
|
virtual bool getSize(sint32 &size) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
std::string CStorageArrayDynSize<T>::className() const
|
||||||
|
{
|
||||||
|
return "StorageArrayDynSize";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CStorageArrayDynSize<T>::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
uint32 size = this->Value.size();
|
||||||
|
stream.serial(size);
|
||||||
|
this->Value.resize(size);
|
||||||
|
CStorageArray<T>::serial(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CStorageArrayDynSize<T>::setSize(sint32 size)
|
||||||
|
{
|
||||||
|
// Nothing to do here!
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool CStorageArrayDynSize<T>::getSize(sint32 &size) const
|
||||||
|
{
|
||||||
|
// Nothing to do here!
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_STORAGE_ARRAY_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,202 @@
|
|||||||
|
/**
|
||||||
|
* \file storage_chunks.cpp
|
||||||
|
* \brief CStorageChunks
|
||||||
|
* \date 2012-08-18 09:20GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStorageChunks
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "storage_chunks.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
// #define NL_DEBUG_STORAGE
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
CStorageChunks::CStorageChunks(NLMISC::IStream &stream, sint64 size) : m_Stream(stream), m_Is64Bit(false)
|
||||||
|
{
|
||||||
|
if (size >= 2147483647L)
|
||||||
|
throw NLMISC::EStream("64bit chunks not supported");
|
||||||
|
m_Chunks.reserve(64);
|
||||||
|
m_Chunks.resize(1);
|
||||||
|
m_Chunks[0].HeaderSize = 0;
|
||||||
|
m_Chunks[0].OffsetBegin = stream.getPos();
|
||||||
|
if (stream.isReading())
|
||||||
|
{
|
||||||
|
m_Chunks[0].Id = 0;
|
||||||
|
m_Chunks[0].Size = 0x80000000 | (uint32)(size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Chunks[0].Id = 1;
|
||||||
|
m_Chunks[0].Size = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CStorageChunks::~CStorageChunks()
|
||||||
|
{
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
if (m_Chunks.size() != 1)
|
||||||
|
nldebug("Not all chunks were closed");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CStorageChunks::enterChunk()
|
||||||
|
{
|
||||||
|
if (m_Stream.isReading())
|
||||||
|
{
|
||||||
|
// input logic
|
||||||
|
if (!isChunkContainer())
|
||||||
|
{
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Current chunk is not a container, cannot enter");
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (endOfChunk())
|
||||||
|
{
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("End of chunk, cannot enter");
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Chunks.resize(m_Chunks.size() + 1);
|
||||||
|
CChunk *chunk = currentChunk();
|
||||||
|
chunk->OffsetBegin = m_Stream.getPos();
|
||||||
|
m_Stream.serial(chunk->Id);
|
||||||
|
m_Stream.serial(chunk->Size);
|
||||||
|
chunk->HeaderSize = 6;
|
||||||
|
if (chunk->Size == 0)
|
||||||
|
{
|
||||||
|
// this is a 64bit chunk
|
||||||
|
uint64 size64;
|
||||||
|
m_Stream.serial(size64);
|
||||||
|
chunk->HeaderSize += 8;
|
||||||
|
bool iscont = (size64 & 0x8000000000000000) == 0x8000000000000000;
|
||||||
|
size64 &= 0x7FFFFFFFFFFFFFFF;
|
||||||
|
if (size64 >= 2147483647L)
|
||||||
|
throw NLMISC::EStream("64bit chunks not supported");
|
||||||
|
// downgrade to 32 bit chunk
|
||||||
|
chunk->Size = (uint32)size64;
|
||||||
|
if (iscont) chunk->Size |= 0x80000000;
|
||||||
|
m_Is64Bit = true; // it's true
|
||||||
|
}
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Entered reading chunk of size %i", chunk->Size);
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("No input, this function cannot output, throw exception");
|
||||||
|
#endif
|
||||||
|
throw NLMISC::EStream();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CStorageChunks::enterChunk(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (!m_Stream.isReading())
|
||||||
|
{
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Writing, enter chunk");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (m_Is64Bit)
|
||||||
|
throw NLMISC::EStream("64bit chunks not supported");
|
||||||
|
|
||||||
|
// enter the new chunk
|
||||||
|
m_Chunks.resize(m_Chunks.size() + 1);
|
||||||
|
CChunk *chunk = currentChunk();
|
||||||
|
uint32 sizeDummy = 0xFFFFFFFF;
|
||||||
|
chunk->Id = container ? 1 : 0;
|
||||||
|
chunk->OffsetBegin = m_Stream.getPos(); // store current pos
|
||||||
|
|
||||||
|
// write header
|
||||||
|
m_Stream.serial(id); // write the id
|
||||||
|
m_Stream.serial(sizeDummy); // write 32 bit size placeholder
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else // input or exception
|
||||||
|
{
|
||||||
|
while (enterChunk())
|
||||||
|
{
|
||||||
|
if (getChunkId() == id)
|
||||||
|
return true;
|
||||||
|
leaveChunk(); // skip data
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sint32 CStorageChunks::leaveChunk()
|
||||||
|
{
|
||||||
|
if (m_Stream.isReading())
|
||||||
|
{
|
||||||
|
// input logic
|
||||||
|
sint32 skipped = currentChunk()->endOfChunk() - m_Stream.getPos();
|
||||||
|
if (skipped)
|
||||||
|
{
|
||||||
|
m_Stream.seek(currentChunk()->endOfChunk(), NLMISC::IStream::begin);
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Skipped %i bytes in the current chunk", skipped);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
m_Chunks.resize(m_Chunks.size() - 1);
|
||||||
|
return skipped;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Writing, leave chunk");
|
||||||
|
#endif
|
||||||
|
sint32 pos = m_Stream.getPos();
|
||||||
|
sint32 sizeWithHeader = pos - currentChunk()->OffsetBegin;
|
||||||
|
sint32 sizePos = currentChunk()->OffsetBegin + 2;
|
||||||
|
m_Stream.seek(sizePos, NLMISC::IStream::begin); // hopefully this correctly overwrites!!!
|
||||||
|
uint32 sizeField = (uint32)sizeWithHeader | (uint32)currentChunk()->Id << 31; // add container flag
|
||||||
|
m_Stream.serial(sizeField);
|
||||||
|
m_Stream.seek(pos, NLMISC::IStream::begin);
|
||||||
|
m_Chunks.resize(m_Chunks.size() - 1);
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Size: %i, Field: %x", sizeWithHeader, sizeField);
|
||||||
|
#endif
|
||||||
|
return sizeWithHeader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,107 @@
|
|||||||
|
/**
|
||||||
|
* \file storage_chunks.h
|
||||||
|
* \brief CStorageChunks
|
||||||
|
* \date 2012-08-18 09:20GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStorageChunks
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_STORAGE_CHUNKS_H
|
||||||
|
#define PIPELINE_STORAGE_CHUNKS_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/stream.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CStorageChunks
|
||||||
|
* \date 2012-08-18 09:20GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStorageChunks
|
||||||
|
*/
|
||||||
|
class CStorageChunks
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
struct CChunk
|
||||||
|
{
|
||||||
|
// Size of the chunk header, 6 for 32 bit, 14 for 64 bit
|
||||||
|
uint8 HeaderSize;
|
||||||
|
// Where the header starts
|
||||||
|
sint32 OffsetBegin;
|
||||||
|
|
||||||
|
// Identifier
|
||||||
|
uint16 Id;
|
||||||
|
// Size including header size
|
||||||
|
uint32 Size;
|
||||||
|
|
||||||
|
inline sint32 getSizeWithHeader() const { return (sint32)(Size & 0x7FFFFFFF); }
|
||||||
|
inline sint32 getSize() const { return getSizeWithHeader() - (sint32)HeaderSize; }
|
||||||
|
inline bool isContainer() const { return (Size & 0x80000000) == 0x80000000; }
|
||||||
|
inline sint32 endOfChunk() const { return OffsetBegin + getSizeWithHeader(); }
|
||||||
|
inline sint32 getDataBegin() const { return OffsetBegin + (sint32)HeaderSize; }
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
CStorageChunks(NLMISC::IStream &stream, sint64 size = 0);
|
||||||
|
virtual ~CStorageChunks();
|
||||||
|
|
||||||
|
// Returns true if there's another chunk, false if no more chunks in this container or if the current chunk is not a container
|
||||||
|
bool enterChunk();
|
||||||
|
// Reads and skips chunks until the one with given id is found, or writes a chunk with this id
|
||||||
|
bool enterChunk(uint16 id, bool container);
|
||||||
|
// Returns the number of skipped bytes in read more, returns chunk size including header in write mode
|
||||||
|
sint32 leaveChunk();
|
||||||
|
|
||||||
|
inline bool is64Bit() const { return m_Is64Bit; }
|
||||||
|
inline void set64Bit(bool enabled = true) { m_Is64Bit = enabled; }
|
||||||
|
|
||||||
|
inline uint16 getChunkId() const { return currentChunk()->Id; }
|
||||||
|
inline sint32 getChunkSize() const { return currentChunk()->getSize(); }
|
||||||
|
inline bool isChunkContainer() const { return currentChunk()->isContainer(); }
|
||||||
|
inline bool endOfChunk() const { return /*m_Chunks.size() == 1 ? eof() :*/ m_Stream.getPos() >= currentChunk()->endOfChunk(); }
|
||||||
|
|
||||||
|
inline NLMISC::IStream &stream() { return m_Stream; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
inline const CChunk *currentChunk() const { return &m_Chunks[m_Chunks.size() - 1]; }
|
||||||
|
inline CChunk *currentChunk() { return &m_Chunks[m_Chunks.size() - 1]; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
NLMISC::IStream &m_Stream;
|
||||||
|
std::vector<CChunk> m_Chunks;
|
||||||
|
bool m_Is64Bit;
|
||||||
|
|
||||||
|
}; /* class CStorageChunks */
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_STORAGE_CHUNKS_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* \file storage_file.cpp
|
||||||
|
* \brief CStorageFile
|
||||||
|
* \date 2012-08-20 13:35GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStorageFile
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "storage_file.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
|
||||||
|
CStorageFile::CStorageFile()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CStorageFile::~CStorageFile()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* \file storage_file.h
|
||||||
|
* \brief CStorageFile
|
||||||
|
* \date 2012-08-20 13:35GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStorageFile
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIPELINE_STORAGE_FILE_H
|
||||||
|
#define PIPELINE_STORAGE_FILE_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief CStorageFile
|
||||||
|
* \date 2012-08-20 13:35GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStorageFile
|
||||||
|
*/
|
||||||
|
class CStorageFile
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
// pointers
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// instances
|
||||||
|
// ...
|
||||||
|
public:
|
||||||
|
CStorageFile();
|
||||||
|
virtual ~CStorageFile();
|
||||||
|
}; /* class CStorageFile */
|
||||||
|
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
#endif /* #ifndef PIPELINE_STORAGE_FILE_H */
|
||||||
|
|
||||||
|
/* end of file */
|
@ -0,0 +1,386 @@
|
|||||||
|
/**
|
||||||
|
* \file storage_object.cpp
|
||||||
|
* \brief CStorageObject
|
||||||
|
* \date 2012-08-18 09:02GMT
|
||||||
|
* \author Jan Boon (Kaetemi)
|
||||||
|
* CStorageObject
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 by authors
|
||||||
|
*
|
||||||
|
* This file is part of RYZOM CORE PIPELINE.
|
||||||
|
* RYZOM CORE PIPELINE is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RYZOM CORE PIPELINE 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with RYZOM CORE PIPELINE. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include "storage_object.h"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "storage_stream.h"
|
||||||
|
#include "storage_chunks.h"
|
||||||
|
|
||||||
|
// using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
// #define NL_DEBUG_STORAGE
|
||||||
|
|
||||||
|
namespace PIPELINE {
|
||||||
|
namespace MAX {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IStorageObject::IStorageObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject::~IStorageObject()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string IStorageObject::toString()
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
toString(ss);
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IStorageObject::setSize(sint32 size)
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IStorageObject::getSize(sint32 &size) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IStorageObject::isContainer() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CStorageContainer::CStorageContainer() : m_ChunksOwnsPointers(true)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CStorageContainer::~CStorageContainer()
|
||||||
|
{
|
||||||
|
if (m_ChunksOwnsPointers)
|
||||||
|
{
|
||||||
|
for (TStorageObjectContainer::iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_Chunks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CStorageContainer::className() const // why is this not const in IClassable?
|
||||||
|
{
|
||||||
|
return "StorageContainer";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageContainer::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
if (stream.isReading())
|
||||||
|
{
|
||||||
|
nlassert(m_ChunksOwnsPointers);
|
||||||
|
nlassert(m_Chunks.empty());
|
||||||
|
}
|
||||||
|
if (stream.getPos() == 0)
|
||||||
|
{
|
||||||
|
CStorageStream *storageStream = dynamic_cast<CStorageStream *>(&stream);
|
||||||
|
if (storageStream)
|
||||||
|
{
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Implicitly assume the entire stream is the container");
|
||||||
|
#endif
|
||||||
|
CStorageChunks chunks(stream, stream.isReading() ? storageStream->size() : 0);
|
||||||
|
serial(chunks);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Wrap the container inside a chunk, as the size is not known");
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
// Use dummy size value so the system can at least read the header
|
||||||
|
CStorageChunks chunks(stream, stream.isReading() ? 0xFF : 0);
|
||||||
|
bool ok = chunks.enterChunk(0x4352, true);
|
||||||
|
nlassert(ok);
|
||||||
|
serial(chunks);
|
||||||
|
chunks.leaveChunk();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageContainer::serial(NLMISC::IStream &stream, uint size)
|
||||||
|
{
|
||||||
|
CStorageChunks chunks(stream, size);
|
||||||
|
serial(chunks);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageContainer::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
// note: only use pad when multi-lining
|
||||||
|
// like Blah: (Something) "SingleValue"
|
||||||
|
// Blahblah: (Container) {
|
||||||
|
// Moo: (Foo) "What" }
|
||||||
|
// only increase pad when multi-lining sub-items
|
||||||
|
nlassert(m_ChunksOwnsPointers);
|
||||||
|
ostream << "(" << className() << ") [" << m_Chunks.size() << "] { ";
|
||||||
|
std::string padpad = pad + "\t";
|
||||||
|
sint i = 0;
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
|
ss << std::setw(4) << it->first;
|
||||||
|
ostream << "\n" << pad << i << " 0x" << ss.str() << ": ";
|
||||||
|
it->second->toString(ostream, padpad);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageContainer::parse(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
nlassert(m_ChunksOwnsPointers); // Can only use this when m_Chunks still has ownership.
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->second->isContainer())
|
||||||
|
{
|
||||||
|
static_cast<CStorageContainer *>(it->second)->parse(version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageContainer::clean()
|
||||||
|
{
|
||||||
|
nlassert(m_ChunksOwnsPointers); // Can only use the default when m_Chunks retains ownership.
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->second->isContainer())
|
||||||
|
{
|
||||||
|
static_cast<CStorageContainer *>(it->second)->clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageContainer::build(uint16 version, uint filter)
|
||||||
|
{
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->second->isContainer())
|
||||||
|
{
|
||||||
|
static_cast<CStorageContainer *>(it->second)->build(version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageContainer::disown()
|
||||||
|
{
|
||||||
|
nlassert(m_ChunksOwnsPointers); // Can only use this when m_Chunks has been given ownership.
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->second->isContainer())
|
||||||
|
{
|
||||||
|
static_cast<CStorageContainer *>(it->second)->disown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CStorageContainer::findStorageObject(uint16 id, uint nb) const
|
||||||
|
{
|
||||||
|
uint c = 0;
|
||||||
|
for (TStorageObjectContainer::const_iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->first == id)
|
||||||
|
{
|
||||||
|
if (c == nb) return it->second;
|
||||||
|
else ++c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CStorageContainer::findLastStorageObject(uint16 id) const
|
||||||
|
{
|
||||||
|
for (TStorageObjectContainer::const_reverse_iterator it = m_Chunks.rbegin(), end = m_Chunks.rend(); it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->first == id)
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CStorageContainer::isContainer() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageContainer::serial(CStorageChunks &chunks)
|
||||||
|
{
|
||||||
|
if (chunks.stream().isReading())
|
||||||
|
{
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Reading container chunk");
|
||||||
|
#endif
|
||||||
|
nlassert(m_ChunksOwnsPointers);
|
||||||
|
nlassert(m_Chunks.empty());
|
||||||
|
while (chunks.enterChunk())
|
||||||
|
{
|
||||||
|
uint16 id = chunks.getChunkId();
|
||||||
|
bool cont = chunks.isChunkContainer();
|
||||||
|
IStorageObject *storageObject = createChunkById(id, cont);
|
||||||
|
storageObject->setSize(chunks.getChunkSize());
|
||||||
|
if (storageObject->isContainer()) static_cast<CStorageContainer *>(storageObject)->serial(chunks);
|
||||||
|
else storageObject->serial(chunks.stream());
|
||||||
|
m_Chunks.push_back(TStorageObjectWithId(id, storageObject));
|
||||||
|
if (chunks.leaveChunk()) // bytes were skipped while reading
|
||||||
|
throw EStorage();
|
||||||
|
/*TStorageObjectContainer::iterator soit = m_Chunks.end();
|
||||||
|
--soit;
|
||||||
|
serialized(soit, cont);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef NL_DEBUG_STORAGE
|
||||||
|
nldebug("Writing container chunk");
|
||||||
|
#endif
|
||||||
|
for (TStorageObjectContainer::iterator it = m_Chunks.begin(), end = m_Chunks.end(); it != end; ++it)
|
||||||
|
{
|
||||||
|
chunks.enterChunk(it->first, it->second->isContainer());
|
||||||
|
IStorageObject *storageObject = it->second;
|
||||||
|
if (storageObject->isContainer()) static_cast<CStorageContainer *>(storageObject)->serial(chunks);
|
||||||
|
else storageObject->serial(chunks.stream());
|
||||||
|
chunks.leaveChunk();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IStorageObject *CStorageContainer::createChunkById(uint16 id, bool container)
|
||||||
|
{
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
return new CStorageContainer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new CStorageRaw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CStorageRaw::CStorageRaw()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CStorageRaw::~CStorageRaw()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CStorageRaw::className() const
|
||||||
|
{
|
||||||
|
return "StorageRaw";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageRaw::serial(NLMISC::IStream &stream)
|
||||||
|
{
|
||||||
|
stream.serialBuffer(&Value[0], Value.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageRaw::toString(std::ostream &ostream, const std::string &pad) const
|
||||||
|
{
|
||||||
|
// note: only use pad when multi-lining
|
||||||
|
// like Blah: (Something) "SingleValue"
|
||||||
|
// Blahblah: (Container) {
|
||||||
|
// Moo: (Foo) "What" }
|
||||||
|
// only increase pad when multi-lining sub-items
|
||||||
|
ostream << "(" << className() << ") { ";
|
||||||
|
ostream << "\n" << pad << "Size: " << Value.size();
|
||||||
|
bool isString = true;
|
||||||
|
ostream << "\n" << pad << "String: ";
|
||||||
|
for (TType::size_type i = 0; i < Value.size(); ++i)
|
||||||
|
{
|
||||||
|
char c = Value[i];
|
||||||
|
if (c == 0 || c == 123 || c == 125) ostream << ".";
|
||||||
|
else if (c >= 32 && c <= 126) ostream << c;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ostream << ".";
|
||||||
|
isString = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ostream << " ";
|
||||||
|
if (!isString || Value.size() <= 4)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "Hex: ";
|
||||||
|
for (TType::size_type i = 0; i < Value.size(); ++i)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0') << std::setw(2) << (int)Value[i];
|
||||||
|
ostream << ss.str() << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Value.size() == 4)
|
||||||
|
{
|
||||||
|
ostream << "\n" << pad << "Int: " << (*(sint32 *)(void *)(&Value[0])) << " ";
|
||||||
|
ostream << "\n" << pad << "Float: " << (*(float *)(void *)(&Value[0])) << " ";
|
||||||
|
}
|
||||||
|
ostream << "} ";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStorageRaw::setSize(sint32 size)
|
||||||
|
{
|
||||||
|
Value.resize(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CStorageRaw::getSize(sint32 &size) const
|
||||||
|
{
|
||||||
|
size = Value.size();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
} /* namespace MAX */
|
||||||
|
} /* namespace PIPELINE */
|
||||||
|
|
||||||
|
/* end of file */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue