Merged default into lightmap_optimizer_port_to_linux

This commit is contained in:
liria 2014-04-05 15:40:17 +02:00
parent 1007da5a54
commit 18b67b2337
3143 changed files with 10859 additions and 218175 deletions

View file

@ -160,6 +160,7 @@ code/build/*
code/build-2010/*
build/*
install/*
code/nel/tools/build_gamedata/configuration/buildsite.py
# Linux nel compile
code/nel/build/nel-config
@ -240,4 +241,7 @@ ryzom_tools*
#Dumps
*.dmp
code/nel/tools/build_gamedata/processes/ai_wmap/ai_build_wmap.cfg
code/nel/tools/build_gamedata/processes/sheets/sheets_packer.cfg
code/nel/tools/build_gamedata/processes/rbank/build_rbank.cfg
code/nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg

View file

@ -41,10 +41,8 @@ INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
# Force out of source builds.
CHECK_OUT_OF_SOURCE()
# Specify Mac OS X deployment target before including Darwin.cmake
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6")
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
# To be able to specify a different deployment target on Mac OS X :
# export MACOSX_DEPLOYMENT_TARGET=10.6
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(RyzomCore CXX C)

View file

@ -10,7 +10,7 @@ IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
FIND_PATH(FREETYPE_INCLUDE_DIRS
freetype.h
freetype
PATHS
$ENV{FREETYPE_DIR}/include
/usr/local/include
@ -19,9 +19,13 @@ FIND_PATH(FREETYPE_INCLUDE_DIRS
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES freetype2/freetype freetype freetype2
PATH_SUFFIXES freetype2
)
IF(NOT FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_INCLUDE_DIRS "")
ENDIF(NOT FREETYPE_INCLUDE_DIRS)
# ft2build.h does not reside in the freetype include dir
FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
ft2build.h

View file

@ -71,11 +71,14 @@ SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
# Search version in headers
IF(EXISTS ${WINSDK_DIR}/include/Msi.h)
SET(_MSI_FILE ${WINSDK_DIR}/include/Msi.h)
ENDIF(EXISTS ${WINSDK_DIR}/include/Msi.h)
FIND_FILE(_MSI_FILE Msi.h
PATHS
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
)
IF(_MSI_FILE)
# Look for Windows SDK 8.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
@ -88,11 +91,11 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN7")
IF(_CONTENT)
IF(EXISTS ${WINSDK_DIR}/include/winsdkver.h)
SET(_WINSDKVER_FILE ${WINSDK_DIR}/include/winsdkver.h)
ELSEIF(EXISTS ${WINSDK_DIR}/include/WinSDKVer.h)
SET(_WINSDKVER_FILE ${WINSDK_DIR}/include/WinSDKVer.h)
ENDIF(EXISTS ${WINSDK_DIR}/include/winsdkver.h)
FIND_FILE(_WINSDKVER_FILE winsdkver.h WinSDKVer.h
PATHS
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
)
IF(_WINSDKVER_FILE)
# Load WinSDKVer.h content
@ -162,9 +165,13 @@ MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_VERSION_FULL "")
# Use WINSDK environment variable
IF(WINSDKENV_DIR AND EXISTS ${WINSDKENV_DIR}/include/Windows.h)
SET(WINSDK_DIR ${WINSDKENV_DIR})
ENDIF(WINSDKENV_DIR AND EXISTS ${WINSDKENV_DIR}/include/Windows.h)
IF(WINSDKENV_DIR)
FIND_PATH(WINSDK_DIR Windows.h
HINTS
${WINSDKENV_DIR}/Include/um
${WINSDKENV_DIR}/Include
)
ENDIF(WINSDKENV_DIR)
# Use INCLUDE environment variable
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
@ -173,8 +180,8 @@ MACRO(USE_CURRENT_WINSDK)
# Look for Windows.h because there are several paths
IF(EXISTS ${_INCLUDE}/Windows.h)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK environment variable in ${WINSDK_DIR}")
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK from include environment variable in ${WINSDK_DIR}")
BREAK()
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
ENDFOREACH(_INCLUDE)

View file

@ -323,6 +323,7 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
OPTION(WITH_LIBOVR "With LibOVR support" OFF)
OPTION(WITH_LIBVR "With LibVR support" OFF)
OPTION(WITH_PERFHUD "With NVIDIA PerfHUD support" OFF)
ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
@ -341,6 +342,7 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
OPTION(WITH_RYZOM_TOOLS "Build Ryzom Core Tools" ON )
OPTION(WITH_RYZOM_SERVER "Build Ryzom Core Services" ON )
OPTION(WITH_RYZOM_SOUND "Enable Ryzom Core Sound" ON )
OPTION(WITH_RYZOM_PATCH "Enable Ryzom in-game patch support" OFF)
###
# Optional support
@ -786,11 +788,15 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SIMULATOR_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-mios-simulator-version-min=${IOS_VERSION}")
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET)
ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
ELSE(IOS)
# Always force -mmacosx-version-min to override environement variable
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET)
ENDIF(IOS)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names")
@ -883,7 +889,7 @@ MACRO(NL_SETUP_BUILD)
SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g")
ELSE(WITH_SYMBOLS)
IF(APPLE)
SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip -Wl,-x ${NL_RELEASE_LINKFLAGS}")
SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip ${NL_RELEASE_LINKFLAGS}")
ELSE(APPLE)
SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}")
ENDIF(APPLE)

View file

@ -60,6 +60,7 @@ public:
{
StereoDisplay,
StereoHMD,
StereoNGHMD,
};
enum TStereoDeviceLibrary
@ -77,6 +78,7 @@ public:
std::string Manufacturer;
std::string ProductName;
std::string Serial; // A unique device identifier
bool AllowAuto; // Allow this device to be automatically selected when no device is configured
};
/**

View file

@ -0,0 +1,62 @@
/**
* \file stereo_ng_hmd.h
* \brief IStereoNGHMD
* \date 2014-04-01 10:53GMT
* \author Jan Boon (Kaetemi)
* IStereoNGHMD
*/
/*
* Copyright (C) 2014 by authors
*
* This file is part of NL3D.
* NL3D 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.
*
* NL3D 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 NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_STEREO_NG_HMD_H
#define NL3D_STEREO_NG_HMD_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
#include <nel/3d/stereo_hmd.h>
namespace NL3D {
/**
* \brief IStereoNGHMD
* \date 2014-04-01 10:53GMT
* \author Jan Boon (Kaetemi)
* IStereoNGHMD
*/
class IStereoNGHMD : public IStereoHMD
{
public:
IStereoNGHMD();
virtual ~IStereoNGHMD();
/// Kill the player
virtual void killUser() const = 0;
}; /* class IStereoNGHMD */
} /* namespace NL3D */
#endif /* #ifndef NL3D_STEREO_NG_HMD_H */
/* end of file */

View file

@ -466,6 +466,7 @@ private:
uint _NumberOfPatchComputed;
uint _ProcessCount;
uint64 _CPUMask;
NLMISC::CMutex _ProcessExitedMutex;
volatile uint _ProcessExited;
// *** Bitmap sharing

View file

@ -44,7 +44,7 @@ public:
UFormElm& getRootNode ();
const UFormElm& getRootNode () const;
const std::string &getComment () const;
void write (class NLMISC::IStream &stream, bool georges4CVS);
void write (class NLMISC::IStream &stream);
void getDependencies (std::set<std::string> &dependencies) const;
uint getNumParent () const;
UForm *getParentForm (uint parent) const;
@ -73,7 +73,7 @@ public:
// ** IO functions
// Set the filename before saving the form
void write (xmlDocPtr doc, const char *filename, bool georges4CVS);
void write (xmlDocPtr doc, const char *filename);
// ** Parent access

View file

@ -161,7 +161,7 @@ public:
};
// ** IO functions
void write (xmlDocPtr root, const char *filename, bool georges4CVS);
void write (xmlDocPtr root, const char *filename);
// Count parent DFN
uint countParentDfn (uint32 round=0) const;

View file

@ -54,9 +54,6 @@ public:
/// State of the form
TState State;
/// CVS Revision string
std::string Revision;
/// Comments of the form
std::string Comments;
@ -65,7 +62,7 @@ public:
/// ** IO functions
void read (xmlNodePtr root);
void write (xmlNodePtr node, bool georges4CVS) const;
void write (xmlNodePtr node) const;
// Get state string
static const char *getStateString (TState state);

View file

@ -55,7 +55,7 @@ public:
static bool uiCompatible (TType type, TUI ui);
// ** IO functions
void write (xmlDocPtr doc, bool georges4CVS) const;
void write (xmlDocPtr doc) const;
// Header
CFileHeader Header;

View file

@ -53,9 +53,8 @@ public:
/** Write the form in a stream.
*
* \param stream is the stream used to write the form
* \param georges4CVS should be true if you use Georges with CVS false else
*/
virtual void write (NLMISC::IStream &stream, bool georges4CVS) = 0;
virtual void write (NLMISC::IStream &stream) = 0;
/**
* Access form parents

View file

@ -90,6 +90,7 @@
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later
# define NL_ISO_STDTR1_AVAILABLE
# define NL_ISO_STDTR1_HEADER(header) <header>
# define NL_ISO_STDTR1_NAMESPACE std::tr1
# endif
# ifdef _DEBUG
# define NL_DEBUG
@ -153,8 +154,16 @@
#ifdef NL_COMP_GCC
# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
# if GCC_VERSION > 40100
// new libc++ bundled with clang under Mac OS X 10.9+ doesn't define __GLIBCXX__
# ifdef __GLIBCXX__
# define NL_ISO_STDTR1_AVAILABLE
# define NL_ISO_STDTR1_HEADER(header) <tr1/header>
# define NL_ISO_STDTR1_NAMESPACE std::tr1
# else
# define NL_ISO_STDTR1_AVAILABLE
# define NL_ISO_STDTR1_HEADER(header) <header>
# define NL_ISO_STDTR1_NAMESPACE std
# endif
# endif
#endif
@ -331,9 +340,9 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
#elif defined(NL_ISO_STDTR1_AVAILABLE) // use std::tr1 for CHash* classes, if available (gcc 4.1+ and VC9 with TR1 feature pack)
# include NL_ISO_STDTR1_HEADER(unordered_map)
# include NL_ISO_STDTR1_HEADER(unordered_set)
# define CHashMap std::tr1::unordered_map
# define CHashSet std::tr1::unordered_set
# define CHashMultiMap std::tr1::unordered_multimap
# define CHashMap NL_ISO_STDTR1_NAMESPACE::unordered_map
# define CHashSet NL_ISO_STDTR1_NAMESPACE::unordered_set
# define CHashMultiMap NL_ISO_STDTR1_NAMESPACE::unordered_multimap
#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 70 && NL_COMP_VC_VERSION <= 90) // VC7 through 9
# include <hash_map>
# include <hash_set>

View file

@ -316,14 +316,14 @@ public:
// output the oldest part of the buffer first
for (uint i=_Mean.getCurrentFrame(); i<_Mean.getNumFrame(); ++i)
{
str << _Mean.getLastFrames()[i];
str << (T)_Mean.getLastFrames()[i];
if (i < _Mean.getNumFrame()-1 || _Mean.getCurrentFrame() != 0)
str << ",";
}
// then output the newest part
for (uint i = 0; i < _Mean.getCurrentFrame(); i++)
{
str << _Mean.getLastFrames()[i];
str << (T)_Mean.getLastFrames()[i];
if (i < _Mean.getCurrentFrame()-1)
str << ",";
}

View file

@ -289,7 +289,7 @@ int main(void)
// and finally save the form out in case we made changes.
// if you're accessing a form read-only (not using set*) you can skip this.
NLMISC::COFile saveSample(sampleConfigFile);
form->write(saveSample, false);
form->write(saveSample);
nlinfo("Saved sample config file.");
} else {
// CPath didn't find the file, just print an error and exit.

View file

@ -697,6 +697,8 @@ SOURCE_GROUP(Stereo FILES
../../include/nel/3d/stereo_display.h
stereo_hmd.cpp
../../include/nel/3d/stereo_hmd.h
stereo_ng_hmd.cpp
../../include/nel/3d/stereo_ng_hmd.h
stereo_ovr.cpp
stereo_ovr_fp.cpp
../../include/nel/3d/stereo_ovr.h

View file

@ -1464,6 +1464,24 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
return false;
}
#if WITH_PERFHUD
// Look for 'NVIDIA PerfHUD' adapter
// If it is present, override default settings
for (UINT gAdapter=0;gAdapter<_D3D->GetAdapterCount();gAdapter++)
{
D3DADAPTER_IDENTIFIER9 Identifier;
HRESULT Res;
Res = _D3D->GetAdapterIdentifier(gAdapter,0,&Identifier);
if (strstr(Identifier.Description,"PerfHUD") != 0)
{
nlinfo ("Setting up with PerfHUD");
adapter=gAdapter;
_Rasterizer=D3DDEVTYPE_REF;
break;
}
}
#endif WITH_PERFHUD
// Create the D3D device
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE, &parameters, &_DeviceInterface);
if (result != D3D_OK)
@ -1487,6 +1505,8 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
}
}
// _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
// Check some caps
@ -2635,6 +2655,7 @@ bool CDriverD3D::reset (const GfxMode& mode)
#ifndef NL_NO_ASM
CFpuRestorer fpuRestorer; // fpu control word is changed by "Reset"
#endif
if (_Rasterizer!=D3DDEVTYPE_REF) {
HRESULT hr = _DeviceInterface->Reset (&parameters);
if (hr != D3D_OK)
{
@ -2644,6 +2665,7 @@ bool CDriverD3D::reset (const GfxMode& mode)
return false;
}
}
}
_Lost = false;
// BeginScene now

View file

@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2013 The Khronos Group Inc.
** Copyright (c) 2013-2014 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@ -33,7 +33,7 @@ extern "C" {
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision: 23855 $ on $Date: 2013-11-02 22:54:48 -0700 (Sat, 02 Nov 2013) $
** Khronos $Revision: 26007 $ on $Date: 2014-03-19 01:28:09 -0700 (Wed, 19 Mar 2014) $
*/
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@ -53,7 +53,7 @@ extern "C" {
#define GLAPI extern
#endif
#define GL_GLEXT_VERSION 20131102
#define GL_GLEXT_VERSION 20140319
/* Generated C header for:
* API: gl
@ -1485,7 +1485,7 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum atta
typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);
typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
@ -1505,7 +1505,7 @@ GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLui
GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask);
GLAPI void APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask);
#endif
#endif /* GL_VERSION_3_2 */
@ -2144,6 +2144,10 @@ GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data)
#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD
#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C
#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D
#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
@ -2432,6 +2436,7 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum
#define GL_VERTEX_BINDING_STRIDE 0x82D8
#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
#define GL_VERTEX_BINDING_BUFFER 0x8F4F
#define GL_DISPLAY_LIST 0x82E7
typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
@ -4836,6 +4841,20 @@ GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name);
#endif
#endif /* GL_AMD_name_gen_delete */
#ifndef GL_AMD_occlusion_query_event
#define GL_AMD_occlusion_query_event 1
#define GL_OCCLUSION_QUERY_EVENT_MASK_AMD 0x874F
#define GL_QUERY_DEPTH_PASS_EVENT_BIT_AMD 0x00000001
#define GL_QUERY_DEPTH_FAIL_EVENT_BIT_AMD 0x00000002
#define GL_QUERY_STENCIL_FAIL_EVENT_BIT_AMD 0x00000004
#define GL_QUERY_DEPTH_BOUNDS_FAIL_EVENT_BIT_AMD 0x00000008
#define GL_QUERY_ALL_EVENT_BITS_AMD 0xFFFFFFFF
typedef void (APIENTRYP PFNGLQUERYOBJECTPARAMETERUIAMDPROC) (GLenum target, GLuint id, GLenum pname, GLuint param);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glQueryObjectParameteruiAMD (GLenum target, GLuint id, GLenum pname, GLuint param);
#endif
#endif /* GL_AMD_occlusion_query_event */
#ifndef GL_AMD_performance_monitor
#define GL_AMD_performance_monitor 1
#define GL_COUNTER_TYPE_AMD 0x8BC0
@ -6163,7 +6182,7 @@ typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintp
typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);
typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x);
@ -6419,7 +6438,7 @@ GLAPI void *APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, G
GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length);
GLAPI void APIENTRY glNamedBufferStorageEXT (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);
GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param);
GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x);
@ -7062,6 +7081,10 @@ GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *strin
#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA
#endif /* GL_EXT_separate_specular_color */
#ifndef GL_EXT_shader_image_load_formatted
#define GL_EXT_shader_image_load_formatted 1
#endif /* GL_EXT_shader_image_load_formatted */
#ifndef GL_EXT_shader_image_load_store
#define GL_EXT_shader_image_load_store 1
#define GL_MAX_IMAGE_UNITS_EXT 0x8F38
@ -8108,6 +8131,52 @@ GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const void
#endif
#endif /* GL_INTEL_parallel_arrays */
#ifndef GL_INTEL_performance_query
#define GL_INTEL_performance_query 1
#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
#define GL_PERFQUERY_WAIT_INTEL 0x83FB
#define GL_PERFQUERY_FLUSH_INTEL 0x83FA
#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9
#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0
#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4
#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
typedef void (APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
typedef void (APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
typedef void (APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
typedef void (APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
typedef void (APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
typedef void (APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
typedef void (APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
typedef void (APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
typedef void (APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
typedef void (APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
GLAPI void APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
GLAPI void APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
GLAPI void APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
GLAPI void APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
GLAPI void APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
GLAPI void APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
GLAPI void APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
GLAPI void APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
#endif
#endif /* GL_INTEL_performance_query */
#ifndef GL_MESAX_texture_stack
#define GL_MESAX_texture_stack 1
#define GL_TEXTURE_1D_STACK_MESAX 0x8759
@ -8202,6 +8271,15 @@ GLAPI void APIENTRY glEndConditionalRenderNVX (void);
#endif
#endif /* GL_NVX_conditional_render */
#ifndef GL_NVX_gpu_memory_info
#define GL_NVX_gpu_memory_info 1
#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
#endif /* GL_NVX_gpu_memory_info */
#ifndef GL_NV_bindless_multi_draw_indirect
#define GL_NV_bindless_multi_draw_indirect 1
typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
@ -8248,6 +8326,7 @@ GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
#define GL_NV_blend_equation_advanced 1
#define GL_BLEND_OVERLAP_NV 0x9281
#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280
#define GL_BLUE_NV 0x1905
#define GL_COLORBURN_NV 0x929A
#define GL_COLORDODGE_NV 0x9299
#define GL_CONJOINT_NV 0x9284
@ -8261,6 +8340,7 @@ GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
#define GL_DST_OUT_NV 0x928D
#define GL_DST_OVER_NV 0x9289
#define GL_EXCLUSION_NV 0x92A0
#define GL_GREEN_NV 0x1904
#define GL_HARDLIGHT_NV 0x929B
#define GL_HARDMIX_NV 0x92A9
#define GL_HSL_COLOR_NV 0x92AF
@ -8282,6 +8362,7 @@ GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
#define GL_PLUS_CLAMPED_NV 0x92B1
#define GL_PLUS_DARKER_NV 0x9292
#define GL_PLUS_NV 0x9291
#define GL_RED_NV 0x1903
#define GL_SCREEN_NV 0x9295
#define GL_SOFTLIGHT_NV 0x929C
#define GL_SRC_ATOP_NV 0x928E
@ -8291,6 +8372,7 @@ GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
#define GL_SRC_OVER_NV 0x9288
#define GL_UNCORRELATED_NV 0x9282
#define GL_VIVIDLIGHT_NV 0x92A6
#define GL_XOR_NV 0x1506
typedef void (APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
typedef void (APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
#ifdef GL_GLEXT_PROTOTYPES
@ -9350,6 +9432,17 @@ GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLs
#define GL_NV_shader_storage_buffer_object 1
#endif /* GL_NV_shader_storage_buffer_object */
#ifndef GL_NV_shader_thread_group
#define GL_NV_shader_thread_group 1
#define GL_WARP_SIZE_NV 0x9339
#define GL_WARPS_PER_SM_NV 0x933A
#define GL_SM_COUNT_NV 0x933B
#endif /* GL_NV_shader_thread_group */
#ifndef GL_NV_shader_thread_shuffle
#define GL_NV_shader_thread_shuffle 1
#endif /* GL_NV_shader_thread_shuffle */
#ifndef GL_NV_tessellation_program5
#define GL_NV_tessellation_program5 1
#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8
@ -9625,7 +9718,7 @@ typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const void *vdpDevice, const void
typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void);
typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);
typedef GLboolean (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);
typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);
typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access);
@ -9636,7 +9729,7 @@ GLAPI void APIENTRY glVDPAUInitNV (const void *vdpDevice, const void *getProcAdd
GLAPI void APIENTRY glVDPAUFiniNV (void);
GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface);
GLAPI GLboolean APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface);
GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface);
GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access);

View file

@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2013 The Khronos Group Inc.
** Copyright (c) 2013-2014 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@ -33,10 +33,10 @@ extern "C" {
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $
** Khronos $Revision: 25923 $ on $Date: 2014-03-17 03:54:56 -0700 (Mon, 17 Mar 2014) $
*/
#define GLX_GLXEXT_VERSION 20131028
#define GLX_GLXEXT_VERSION 20140317
/* Generated C header for:
* API: glx
@ -49,6 +49,7 @@ extern "C" {
#ifndef GLX_VERSION_1_3
#define GLX_VERSION_1_3 1
typedef XID GLXContextID;
typedef struct __GLXFBConfigRec *GLXFBConfig;
typedef XID GLXWindow;
typedef XID GLXPbuffer;
@ -272,7 +273,6 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
#ifndef GLX_EXT_import_context
#define GLX_EXT_import_context 1
typedef XID GLXContextID;
#define GLX_SHARE_CONTEXT_EXT 0x800A
#define GLX_VISUAL_ID_EXT 0x800B
#define GLX_SCREEN_EXT 0x800C
@ -407,6 +407,32 @@ GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixm
#endif
#endif /* GLX_MESA_pixmap_colormap */
#ifndef GLX_MESA_query_renderer
#define GLX_MESA_query_renderer 1
#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
#define GLX_RENDERER_VERSION_MESA 0x8185
#define GLX_RENDERER_ACCELERATED_MESA 0x8186
#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187
#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188
#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189
#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A
#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B
#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C
#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D
#define GLX_RENDERER_ID_MESA 0x818E
typedef Bool ( *PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value);
typedef const char *( *PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute);
typedef Bool ( *PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
typedef const char *( *PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXQueryCurrentRendererIntegerMESA (int attribute, unsigned int *value);
const char *glXQueryCurrentRendererStringMESA (int attribute);
Bool glXQueryRendererIntegerMESA (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
const char *glXQueryRendererStringMESA (Display *dpy, int screen, int renderer, int attribute);
#endif
#endif /* GLX_MESA_query_renderer */
#ifndef GLX_MESA_release_buffers
#define GLX_MESA_release_buffers 1
typedef Bool ( *PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
@ -433,6 +459,14 @@ void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLe
#endif
#endif /* GLX_NV_copy_image */
#ifndef GLX_NV_delay_before_swap
#define GLX_NV_delay_before_swap 1
typedef Bool ( *PFNGLXDELAYBEFORESWAPNVPROC) (Display *dpy, GLXDrawable drawable, GLfloat seconds);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXDelayBeforeSwapNV (Display *dpy, GLXDrawable drawable, GLfloat seconds);
#endif
#endif /* GLX_NV_delay_before_swap */
#ifndef GLX_NV_float_buffer
#define GLX_NV_float_buffer 1
#define GLX_FLOAT_COMPONENTS_NV 0x20B0

View file

@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2013 The Khronos Group Inc.
** Copyright (c) 2013-2014 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@ -33,7 +33,7 @@ extern "C" {
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $
** Khronos $Revision: 25923 $ on $Date: 2014-03-17 03:54:56 -0700 (Mon, 17 Mar 2014) $
*/
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@ -41,7 +41,7 @@ extern "C" {
#include <windows.h>
#endif
#define WGL_WGLEXT_VERSION 20131028
#define WGL_WGLEXT_VERSION 20140317
/* Generated C header for:
* API: wgl

File diff suppressed because it is too large Load diff

View file

@ -109,6 +109,17 @@ struct CGlExtensions
bool OESDrawTexture;
bool OESMapBuffer;
// extensions to get memory info
// GL_NVX_gpu_memory_info
bool NVXGPUMemoryInfo;
// GL_ATI_meminfo
bool ATIMeminfo;
// WGL_AMD_gpu_association
bool WGLAMDGPUAssociation;
public:
/// \name Disable Hardware feature. False by default. setuped by IDriver
@ -151,7 +162,6 @@ public:
ATIVertexArrayObject= false;
ATIEnvMapBumpMap = false;
ATIFragmentShader = false;
ATIVertexArrayObject = false;
ATIMapObjectBuffer = false;
ATIVertexAttribArrayObject = false;
EXTVertexShader= false;
@ -176,6 +186,10 @@ public:
OESDrawTexture = false;
OESMapBuffer = false;
NVXGPUMemoryInfo = false;
ATIMeminfo = false;
WGLAMDGPUAssociation = false;
/// \name Disable Hardware feature. False by default. setuped by IDriver
DisableHardwareVertexProgram= false;
DisableHardwarePixelProgram= false;
@ -225,12 +239,15 @@ public:
result += NVOcclusionQuery ? "NVOcclusionQuery " : "";
result += NVStateVARWithoutFlush ? "NVStateVARWithoutFlush " : "";
result += ARBMultisample ? "ARBMultisample " : "";
result += NVXGPUMemoryInfo ? "NVXGPUMemoryInfo " : "";
result += ATIMeminfo ? "ATIMeminfo " : "";
#ifdef NL_OS_WINDOWS
result += "\n WindowsGL: ";
result += WGLARBPBuffer ? "WGLARBPBuffer " : "";
result += WGLARBPixelFormat ? "WGLARBPixelFormat " : "";
result += WGLEXTSwapControl ? "WGLEXTSwapControl " : "";
result += WGLAMDGPUAssociation ? "WGLAMDGPUAssociation " : "";
#elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX)
result += "\n GLX: ";
@ -294,230 +311,228 @@ void registerGlExtensions(CGlExtensions &ext);
// OES_mapbuffer.
//===============
extern NEL_PFNGLMAPBUFFEROESPROC nglMapBufferOES;
extern NEL_PFNGLUNMAPBUFFEROESPROC nglUnmapBufferOES;
extern NEL_PFNGLGETBUFFERPOINTERVOESPROC nglGetBufferPointervOES;
extern NEL_PFNGLBUFFERSUBDATAPROC nglBufferSubData;
extern PFNGLMAPBUFFEROESPROC nglMapBufferOES;
extern PFNGLUNMAPBUFFEROESPROC nglUnmapBufferOES;
extern PFNGLGETBUFFERPOINTERVOESPROC nglGetBufferPointervOES;
extern PFNGLDRAWTEXFOESPROC nglDrawTexfOES;
// GL_OES_framebuffer_object
extern NEL_PFNGLISRENDERBUFFEROESPROC nglIsRenderbufferOES;
extern NEL_PFNGLBINDRENDERBUFFEROESPROC nglBindRenderbufferOES;
extern NEL_PFNGLDELETERENDERBUFFERSOESPROC nglDeleteRenderbuffersOES;
extern NEL_PFNGLGENRENDERBUFFERSOESPROC nglGenRenderbuffersOES;
extern NEL_PFNGLRENDERBUFFERSTORAGEOESPROC nglRenderbufferStorageOES;
extern NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC nglGetRenderbufferParameterivOES;
extern NEL_PFNGLISFRAMEBUFFEROESPROC nglIsFramebufferOES;
extern NEL_PFNGLBINDFRAMEBUFFEROESPROC nglBindFramebufferOES;
extern NEL_PFNGLDELETEFRAMEBUFFERSOESPROC nglDeleteFramebuffersOES;
extern NEL_PFNGLGENFRAMEBUFFERSOESPROC nglGenFramebuffersOES;
extern NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC nglCheckFramebufferStatusOES;
extern NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC nglFramebufferRenderbufferOES;
extern NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC nglFramebufferTexture2DOES;
extern NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC nglGetFramebufferAttachmentParameterivOES;
extern NEL_PFNGLGENERATEMIPMAPOESPROC nglGenerateMipmapOES;
extern PFNGLISRENDERBUFFEROESPROC nglIsRenderbufferOES;
extern PFNGLBINDRENDERBUFFEROESPROC nglBindRenderbufferOES;
extern PFNGLDELETERENDERBUFFERSOESPROC nglDeleteRenderbuffersOES;
extern PFNGLGENRENDERBUFFERSOESPROC nglGenRenderbuffersOES;
extern PFNGLRENDERBUFFERSTORAGEOESPROC nglRenderbufferStorageOES;
extern PFNGLGETRENDERBUFFERPARAMETERIVOESPROC nglGetRenderbufferParameterivOES;
extern PFNGLISFRAMEBUFFEROESPROC nglIsFramebufferOES;
extern PFNGLBINDFRAMEBUFFEROESPROC nglBindFramebufferOES;
extern PFNGLDELETEFRAMEBUFFERSOESPROC nglDeleteFramebuffersOES;
extern PFNGLGENFRAMEBUFFERSOESPROC nglGenFramebuffersOES;
extern PFNGLCHECKFRAMEBUFFERSTATUSOESPROC nglCheckFramebufferStatusOES;
extern PFNGLFRAMEBUFFERRENDERBUFFEROESPROC nglFramebufferRenderbufferOES;
extern PFNGLFRAMEBUFFERTEXTURE2DOESPROC nglFramebufferTexture2DOES;
extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC nglGetFramebufferAttachmentParameterivOES;
extern PFNGLGENERATEMIPMAPOESPROC nglGenerateMipmapOES;
// GL_OES_texture_cube_map
extern NEL_PFNGLTEXGENFOESPROC nglTexGenfOES;
extern NEL_PFNGLTEXGENFVOESPROC nglTexGenfvOES;
extern NEL_PFNGLTEXGENIOESPROC nglTexGeniOES;
extern NEL_PFNGLTEXGENIVOESPROC nglTexGenivOES;
extern NEL_PFNGLTEXGENXOESPROC nglTexGenxOES;
extern NEL_PFNGLTEXGENXVOESPROC nglTexGenxvOES;
extern NEL_PFNGLGETTEXGENFVOESPROC nglGetTexGenfvOES;
extern NEL_PFNGLGETTEXGENIVOESPROC nglGetTexGenivOES;
extern NEL_PFNGLGETTEXGENXVOESPROC nglGetTexGenxvOES;
extern PFNGLTEXGENFOESPROC nglTexGenfOES;
extern PFNGLTEXGENFVOESPROC nglTexGenfvOES;
extern PFNGLTEXGENIOESPROC nglTexGeniOES;
extern PFNGLTEXGENIVOESPROC nglTexGenivOES;
extern PFNGLTEXGENXOESPROC nglTexGenxOES;
extern PFNGLTEXGENXVOESPROC nglTexGenxvOES;
extern PFNGLGETTEXGENFVOESPROC nglGetTexGenfvOES;
extern PFNGLGETTEXGENIVOESPROC nglGetTexGenivOES;
extern PFNGLGETTEXGENXVOESPROC nglGetTexGenxvOES;
#else
// ARB_multitexture
//=================
extern NEL_PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB;
extern NEL_PFNGLCLIENTACTIVETEXTUREARBPROC nglClientActiveTextureARB;
extern PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB;
extern PFNGLCLIENTACTIVETEXTUREARBPROC nglClientActiveTextureARB;
extern NEL_PFNGLMULTITEXCOORD1SARBPROC nglMultiTexCoord1sARB;
extern NEL_PFNGLMULTITEXCOORD1IARBPROC nglMultiTexCoord1iARB;
extern NEL_PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
extern NEL_PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
extern NEL_PFNGLMULTITEXCOORD1DARBPROC nglMultiTexCoord1dARB;
extern NEL_PFNGLMULTITEXCOORD2SARBPROC nglMultiTexCoord2sARB;
extern NEL_PFNGLMULTITEXCOORD2IARBPROC nglMultiTexCoord2iARB;
extern NEL_PFNGLMULTITEXCOORD2FARBPROC nglMultiTexCoord2fARB;
extern NEL_PFNGLMULTITEXCOORD2DARBPROC nglMultiTexCoord2dARB;
extern NEL_PFNGLMULTITEXCOORD3SARBPROC nglMultiTexCoord3sARB;
extern NEL_PFNGLMULTITEXCOORD3IARBPROC nglMultiTexCoord3iARB;
extern NEL_PFNGLMULTITEXCOORD3FARBPROC nglMultiTexCoord3fARB;
extern NEL_PFNGLMULTITEXCOORD3DARBPROC nglMultiTexCoord3dARB;
extern NEL_PFNGLMULTITEXCOORD4SARBPROC nglMultiTexCoord4sARB;
extern NEL_PFNGLMULTITEXCOORD4IARBPROC nglMultiTexCoord4iARB;
extern NEL_PFNGLMULTITEXCOORD4FARBPROC nglMultiTexCoord4fARB;
extern NEL_PFNGLMULTITEXCOORD4DARBPROC nglMultiTexCoord4dARB;
extern PFNGLMULTITEXCOORD1SARBPROC nglMultiTexCoord1sARB;
extern PFNGLMULTITEXCOORD1IARBPROC nglMultiTexCoord1iARB;
extern PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
extern PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
extern PFNGLMULTITEXCOORD1DARBPROC nglMultiTexCoord1dARB;
extern PFNGLMULTITEXCOORD2SARBPROC nglMultiTexCoord2sARB;
extern PFNGLMULTITEXCOORD2IARBPROC nglMultiTexCoord2iARB;
extern PFNGLMULTITEXCOORD2FARBPROC nglMultiTexCoord2fARB;
extern PFNGLMULTITEXCOORD2DARBPROC nglMultiTexCoord2dARB;
extern PFNGLMULTITEXCOORD3SARBPROC nglMultiTexCoord3sARB;
extern PFNGLMULTITEXCOORD3IARBPROC nglMultiTexCoord3iARB;
extern PFNGLMULTITEXCOORD3FARBPROC nglMultiTexCoord3fARB;
extern PFNGLMULTITEXCOORD3DARBPROC nglMultiTexCoord3dARB;
extern PFNGLMULTITEXCOORD4SARBPROC nglMultiTexCoord4sARB;
extern PFNGLMULTITEXCOORD4IARBPROC nglMultiTexCoord4iARB;
extern PFNGLMULTITEXCOORD4FARBPROC nglMultiTexCoord4fARB;
extern PFNGLMULTITEXCOORD4DARBPROC nglMultiTexCoord4dARB;
extern NEL_PFNGLMULTITEXCOORD1SVARBPROC nglMultiTexCoord1svARB;
extern NEL_PFNGLMULTITEXCOORD1IVARBPROC nglMultiTexCoord1ivARB;
extern NEL_PFNGLMULTITEXCOORD1FVARBPROC nglMultiTexCoord1fvARB;
extern NEL_PFNGLMULTITEXCOORD1DVARBPROC nglMultiTexCoord1dvARB;
extern NEL_PFNGLMULTITEXCOORD2SVARBPROC nglMultiTexCoord2svARB;
extern NEL_PFNGLMULTITEXCOORD2IVARBPROC nglMultiTexCoord2ivARB;
extern NEL_PFNGLMULTITEXCOORD2FVARBPROC nglMultiTexCoord2fvARB;
extern NEL_PFNGLMULTITEXCOORD2DVARBPROC nglMultiTexCoord2dvARB;
extern NEL_PFNGLMULTITEXCOORD3SVARBPROC nglMultiTexCoord3svARB;
extern NEL_PFNGLMULTITEXCOORD3IVARBPROC nglMultiTexCoord3ivARB;
extern NEL_PFNGLMULTITEXCOORD3FVARBPROC nglMultiTexCoord3fvARB;
extern NEL_PFNGLMULTITEXCOORD3DVARBPROC nglMultiTexCoord3dvARB;
extern NEL_PFNGLMULTITEXCOORD4SVARBPROC nglMultiTexCoord4svARB;
extern NEL_PFNGLMULTITEXCOORD4IVARBPROC nglMultiTexCoord4ivARB;
extern NEL_PFNGLMULTITEXCOORD4FVARBPROC nglMultiTexCoord4fvARB;
extern NEL_PFNGLMULTITEXCOORD4DVARBPROC nglMultiTexCoord4dvARB;
extern PFNGLMULTITEXCOORD1SVARBPROC nglMultiTexCoord1svARB;
extern PFNGLMULTITEXCOORD1IVARBPROC nglMultiTexCoord1ivARB;
extern PFNGLMULTITEXCOORD1FVARBPROC nglMultiTexCoord1fvARB;
extern PFNGLMULTITEXCOORD1DVARBPROC nglMultiTexCoord1dvARB;
extern PFNGLMULTITEXCOORD2SVARBPROC nglMultiTexCoord2svARB;
extern PFNGLMULTITEXCOORD2IVARBPROC nglMultiTexCoord2ivARB;
extern PFNGLMULTITEXCOORD2FVARBPROC nglMultiTexCoord2fvARB;
extern PFNGLMULTITEXCOORD2DVARBPROC nglMultiTexCoord2dvARB;
extern PFNGLMULTITEXCOORD3SVARBPROC nglMultiTexCoord3svARB;
extern PFNGLMULTITEXCOORD3IVARBPROC nglMultiTexCoord3ivARB;
extern PFNGLMULTITEXCOORD3FVARBPROC nglMultiTexCoord3fvARB;
extern PFNGLMULTITEXCOORD3DVARBPROC nglMultiTexCoord3dvARB;
extern PFNGLMULTITEXCOORD4SVARBPROC nglMultiTexCoord4svARB;
extern PFNGLMULTITEXCOORD4IVARBPROC nglMultiTexCoord4ivARB;
extern PFNGLMULTITEXCOORD4FVARBPROC nglMultiTexCoord4fvARB;
extern PFNGLMULTITEXCOORD4DVARBPROC nglMultiTexCoord4dvARB;
// ARB_TextureCompression.
//========================
extern NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC nglCompressedTexImage3DARB;
extern NEL_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC nglCompressedTexImage2DARB;
extern NEL_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC nglCompressedTexImage1DARB;
extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC nglCompressedTexSubImage3DARB;
extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC nglCompressedTexSubImage2DARB;
extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC nglCompressedTexSubImage1DARB;
extern NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC nglGetCompressedTexImageARB;
extern PFNGLCOMPRESSEDTEXIMAGE3DARBPROC nglCompressedTexImage3DARB;
extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC nglCompressedTexImage2DARB;
extern PFNGLCOMPRESSEDTEXIMAGE1DARBPROC nglCompressedTexImage1DARB;
extern PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC nglCompressedTexSubImage3DARB;
extern PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC nglCompressedTexSubImage2DARB;
extern PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC nglCompressedTexSubImage1DARB;
extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC nglGetCompressedTexImageARB;
// VertexArrayRangeNV.
//====================
extern NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC nglFlushVertexArrayRangeNV;
extern NEL_PFNGLVERTEXARRAYRANGENVPROC nglVertexArrayRangeNV;
extern PFNGLFLUSHVERTEXARRAYRANGENVPROC nglFlushVertexArrayRangeNV;
extern PFNGLVERTEXARRAYRANGENVPROC nglVertexArrayRangeNV;
#ifdef NL_OS_WINDOWS
extern PFNWGLALLOCATEMEMORYNVPROC nwglAllocateMemoryNV;
extern PFNWGLFREEMEMORYNVPROC nwglFreeMemoryNV;
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
extern NEL_PFNGLXALLOCATEMEMORYNVPROC nglXAllocateMemoryNV;
extern NEL_PFNGLXFREEMEMORYNVPROC nglXFreeMemoryNV;
extern PFNGLXALLOCATEMEMORYNVPROC nglXAllocateMemoryNV;
extern PFNGLXFREEMEMORYNVPROC nglXFreeMemoryNV;
#endif
// FenceNV.
//====================
extern NEL_PFNGLDELETEFENCESNVPROC nglDeleteFencesNV;
extern NEL_PFNGLGENFENCESNVPROC nglGenFencesNV;
extern NEL_PFNGLISFENCENVPROC nglIsFenceNV;
extern NEL_PFNGLTESTFENCENVPROC nglTestFenceNV;
extern NEL_PFNGLGETFENCEIVNVPROC nglGetFenceivNV;
extern NEL_PFNGLFINISHFENCENVPROC nglFinishFenceNV;
extern NEL_PFNGLSETFENCENVPROC nglSetFenceNV;
extern PFNGLDELETEFENCESNVPROC nglDeleteFencesNV;
extern PFNGLGENFENCESNVPROC nglGenFencesNV;
extern PFNGLISFENCENVPROC nglIsFenceNV;
extern PFNGLTESTFENCENVPROC nglTestFenceNV;
extern PFNGLGETFENCEIVNVPROC nglGetFenceivNV;
extern PFNGLFINISHFENCENVPROC nglFinishFenceNV;
extern PFNGLSETFENCENVPROC nglSetFenceNV;
// VertexWeighting.
//==================
extern NEL_PFNGLVERTEXWEIGHTFEXTPROC nglVertexWeightfEXT;
extern NEL_PFNGLVERTEXWEIGHTFVEXTPROC nglVertexWeightfvEXT;
extern NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC nglVertexWeightPointerEXT;
extern PFNGLVERTEXWEIGHTFEXTPROC nglVertexWeightfEXT;
extern PFNGLVERTEXWEIGHTFVEXTPROC nglVertexWeightfvEXT;
extern PFNGLVERTEXWEIGHTPOINTEREXTPROC nglVertexWeightPointerEXT;
// VertexProgramExtension.
//========================
extern NEL_PFNGLAREPROGRAMSRESIDENTNVPROC nglAreProgramsResidentNV;
extern NEL_PFNGLBINDPROGRAMNVPROC nglBindProgramNV;
extern NEL_PFNGLDELETEPROGRAMSNVPROC nglDeleteProgramsNV;
extern NEL_PFNGLEXECUTEPROGRAMNVPROC nglExecuteProgramNV;
extern NEL_PFNGLGENPROGRAMSNVPROC nglGenProgramsNV;
extern NEL_PFNGLGETPROGRAMPARAMETERDVNVPROC nglGetProgramParameterdvNV;
extern NEL_PFNGLGETPROGRAMPARAMETERFVNVPROC nglGetProgramParameterfvNV;
extern NEL_PFNGLGETPROGRAMIVNVPROC nglGetProgramivNV;
extern NEL_PFNGLGETPROGRAMSTRINGNVPROC nglGetProgramStringNV;
extern NEL_PFNGLGETTRACKMATRIXIVNVPROC nglGetTrackMatrixivNV;
extern NEL_PFNGLGETVERTEXATTRIBDVNVPROC nglGetVertexAttribdvNV;
extern NEL_PFNGLGETVERTEXATTRIBFVNVPROC nglGetVertexAttribfvNV;
extern NEL_PFNGLGETVERTEXATTRIBIVNVPROC nglGetVertexAttribivNV;
extern NEL_PFNGLGETVERTEXATTRIBPOINTERVNVPROC nglGetVertexAttribPointervNV;
extern NEL_PFNGLISPROGRAMNVPROC nglIsProgramNV;
extern NEL_PFNGLLOADPROGRAMNVPROC nglLoadProgramNV;
extern NEL_PFNGLPROGRAMPARAMETER4DNVPROC nglProgramParameter4dNV;
extern NEL_PFNGLPROGRAMPARAMETER4DVNVPROC nglProgramParameter4dvNV;
extern NEL_PFNGLPROGRAMPARAMETER4FNVPROC nglProgramParameter4fNV;
extern NEL_PFNGLPROGRAMPARAMETER4FVNVPROC nglProgramParameter4fvNV;
extern NEL_PFNGLPROGRAMPARAMETERS4DVNVPROC nglProgramParameters4dvNV;
extern NEL_PFNGLPROGRAMPARAMETERS4FVNVPROC nglProgramParameters4fvNV;
extern NEL_PFNGLREQUESTRESIDENTPROGRAMSNVPROC nglRequestResidentProgramsNV;
extern NEL_PFNGLTRACKMATRIXNVPROC nglTrackMatrixNV;
extern NEL_PFNGLVERTEXATTRIBPOINTERNVPROC nglVertexAttribPointerNV;
extern NEL_PFNGLVERTEXATTRIB1DNVPROC nglVertexAttrib1dNV;
extern NEL_PFNGLVERTEXATTRIB1DVNVPROC nglVertexAttrib1dvNV;
extern NEL_PFNGLVERTEXATTRIB1FNVPROC nglVertexAttrib1fNV;
extern NEL_PFNGLVERTEXATTRIB1FVNVPROC nglVertexAttrib1fvNV;
extern NEL_PFNGLVERTEXATTRIB1SNVPROC nglVertexAttrib1sNV;
extern NEL_PFNGLVERTEXATTRIB1SVNVPROC nglVertexAttrib1svNV;
extern NEL_PFNGLVERTEXATTRIB2DNVPROC nglVertexAttrib2dNV;
extern NEL_PFNGLVERTEXATTRIB2DVNVPROC nglVertexAttrib2dvNV;
extern NEL_PFNGLVERTEXATTRIB2FNVPROC nglVertexAttrib2fNV;
extern NEL_PFNGLVERTEXATTRIB2FVNVPROC nglVertexAttrib2fvNV;
extern NEL_PFNGLVERTEXATTRIB2SNVPROC nglVertexAttrib2sNV;
extern NEL_PFNGLVERTEXATTRIB2SVNVPROC nglVertexAttrib2svNV;
extern NEL_PFNGLVERTEXATTRIB3DNVPROC nglVertexAttrib3dNV;
extern NEL_PFNGLVERTEXATTRIB3DVNVPROC nglVertexAttrib3dvNV;
extern NEL_PFNGLVERTEXATTRIB3FNVPROC nglVertexAttrib3fNV;
extern NEL_PFNGLVERTEXATTRIB3FVNVPROC nglVertexAttrib3fvNV;
extern NEL_PFNGLVERTEXATTRIB3SNVPROC nglVertexAttrib3sNV;
extern NEL_PFNGLVERTEXATTRIB3SVNVPROC nglVertexAttrib3svNV;
extern NEL_PFNGLVERTEXATTRIB4DNVPROC nglVertexAttrib4dNV;
extern NEL_PFNGLVERTEXATTRIB4DVNVPROC nglVertexAttrib4dvNV;
extern NEL_PFNGLVERTEXATTRIB4FNVPROC nglVertexAttrib4fNV;
extern NEL_PFNGLVERTEXATTRIB4FVNVPROC nglVertexAttrib4fvNV;
extern NEL_PFNGLVERTEXATTRIB4SNVPROC nglVertexAttrib4sNV;
extern NEL_PFNGLVERTEXATTRIB4SVNVPROC nglVertexAttrib4svNV;
extern NEL_PFNGLVERTEXATTRIB4UBVNVPROC nglVertexAttrib4ubvNV;
extern NEL_PFNGLVERTEXATTRIBS1DVNVPROC nglVertexAttribs1dvNV;
extern NEL_PFNGLVERTEXATTRIBS1FVNVPROC nglVertexAttribs1fvNV;
extern NEL_PFNGLVERTEXATTRIBS1SVNVPROC nglVertexAttribs1svNV;
extern NEL_PFNGLVERTEXATTRIBS2DVNVPROC nglVertexAttribs2dvNV;
extern NEL_PFNGLVERTEXATTRIBS2FVNVPROC nglVertexAttribs2fvNV;
extern NEL_PFNGLVERTEXATTRIBS2SVNVPROC nglVertexAttribs2svNV;
extern NEL_PFNGLVERTEXATTRIBS3DVNVPROC nglVertexAttribs3dvNV;
extern NEL_PFNGLVERTEXATTRIBS3FVNVPROC nglVertexAttribs3fvNV;
extern NEL_PFNGLVERTEXATTRIBS3SVNVPROC nglVertexAttribs3svNV;
extern NEL_PFNGLVERTEXATTRIBS4DVNVPROC nglVertexAttribs4dvNV;
extern NEL_PFNGLVERTEXATTRIBS4FVNVPROC nglVertexAttribs4fvNV;
extern NEL_PFNGLVERTEXATTRIBS4SVNVPROC nglVertexAttribs4svNV;
extern NEL_PFNGLVERTEXATTRIBS4UBVNVPROC nglVertexAttribs4ubvNV;
extern PFNGLAREPROGRAMSRESIDENTNVPROC nglAreProgramsResidentNV;
extern PFNGLBINDPROGRAMNVPROC nglBindProgramNV;
extern PFNGLDELETEPROGRAMSNVPROC nglDeleteProgramsNV;
extern PFNGLEXECUTEPROGRAMNVPROC nglExecuteProgramNV;
extern PFNGLGENPROGRAMSNVPROC nglGenProgramsNV;
extern PFNGLGETPROGRAMPARAMETERDVNVPROC nglGetProgramParameterdvNV;
extern PFNGLGETPROGRAMPARAMETERFVNVPROC nglGetProgramParameterfvNV;
extern PFNGLGETPROGRAMIVNVPROC nglGetProgramivNV;
extern PFNGLGETPROGRAMSTRINGNVPROC nglGetProgramStringNV;
extern PFNGLGETTRACKMATRIXIVNVPROC nglGetTrackMatrixivNV;
extern PFNGLGETVERTEXATTRIBDVNVPROC nglGetVertexAttribdvNV;
extern PFNGLGETVERTEXATTRIBFVNVPROC nglGetVertexAttribfvNV;
extern PFNGLGETVERTEXATTRIBIVNVPROC nglGetVertexAttribivNV;
extern PFNGLGETVERTEXATTRIBPOINTERVNVPROC nglGetVertexAttribPointervNV;
extern PFNGLISPROGRAMNVPROC nglIsProgramNV;
extern PFNGLLOADPROGRAMNVPROC nglLoadProgramNV;
extern PFNGLPROGRAMPARAMETER4DNVPROC nglProgramParameter4dNV;
extern PFNGLPROGRAMPARAMETER4DVNVPROC nglProgramParameter4dvNV;
extern PFNGLPROGRAMPARAMETER4FNVPROC nglProgramParameter4fNV;
extern PFNGLPROGRAMPARAMETER4FVNVPROC nglProgramParameter4fvNV;
extern PFNGLPROGRAMPARAMETERS4DVNVPROC nglProgramParameters4dvNV;
extern PFNGLPROGRAMPARAMETERS4FVNVPROC nglProgramParameters4fvNV;
extern PFNGLREQUESTRESIDENTPROGRAMSNVPROC nglRequestResidentProgramsNV;
extern PFNGLTRACKMATRIXNVPROC nglTrackMatrixNV;
extern PFNGLVERTEXATTRIBPOINTERNVPROC nglVertexAttribPointerNV;
extern PFNGLVERTEXATTRIB1DNVPROC nglVertexAttrib1dNV;
extern PFNGLVERTEXATTRIB1DVNVPROC nglVertexAttrib1dvNV;
extern PFNGLVERTEXATTRIB1FNVPROC nglVertexAttrib1fNV;
extern PFNGLVERTEXATTRIB1FVNVPROC nglVertexAttrib1fvNV;
extern PFNGLVERTEXATTRIB1SNVPROC nglVertexAttrib1sNV;
extern PFNGLVERTEXATTRIB1SVNVPROC nglVertexAttrib1svNV;
extern PFNGLVERTEXATTRIB2DNVPROC nglVertexAttrib2dNV;
extern PFNGLVERTEXATTRIB2DVNVPROC nglVertexAttrib2dvNV;
extern PFNGLVERTEXATTRIB2FNVPROC nglVertexAttrib2fNV;
extern PFNGLVERTEXATTRIB2FVNVPROC nglVertexAttrib2fvNV;
extern PFNGLVERTEXATTRIB2SNVPROC nglVertexAttrib2sNV;
extern PFNGLVERTEXATTRIB2SVNVPROC nglVertexAttrib2svNV;
extern PFNGLVERTEXATTRIB3DNVPROC nglVertexAttrib3dNV;
extern PFNGLVERTEXATTRIB3DVNVPROC nglVertexAttrib3dvNV;
extern PFNGLVERTEXATTRIB3FNVPROC nglVertexAttrib3fNV;
extern PFNGLVERTEXATTRIB3FVNVPROC nglVertexAttrib3fvNV;
extern PFNGLVERTEXATTRIB3SNVPROC nglVertexAttrib3sNV;
extern PFNGLVERTEXATTRIB3SVNVPROC nglVertexAttrib3svNV;
extern PFNGLVERTEXATTRIB4DNVPROC nglVertexAttrib4dNV;
extern PFNGLVERTEXATTRIB4DVNVPROC nglVertexAttrib4dvNV;
extern PFNGLVERTEXATTRIB4FNVPROC nglVertexAttrib4fNV;
extern PFNGLVERTEXATTRIB4FVNVPROC nglVertexAttrib4fvNV;
extern PFNGLVERTEXATTRIB4SNVPROC nglVertexAttrib4sNV;
extern PFNGLVERTEXATTRIB4SVNVPROC nglVertexAttrib4svNV;
extern PFNGLVERTEXATTRIB4UBVNVPROC nglVertexAttrib4ubvNV;
extern PFNGLVERTEXATTRIBS1DVNVPROC nglVertexAttribs1dvNV;
extern PFNGLVERTEXATTRIBS1FVNVPROC nglVertexAttribs1fvNV;
extern PFNGLVERTEXATTRIBS1SVNVPROC nglVertexAttribs1svNV;
extern PFNGLVERTEXATTRIBS2DVNVPROC nglVertexAttribs2dvNV;
extern PFNGLVERTEXATTRIBS2FVNVPROC nglVertexAttribs2fvNV;
extern PFNGLVERTEXATTRIBS2SVNVPROC nglVertexAttribs2svNV;
extern PFNGLVERTEXATTRIBS3DVNVPROC nglVertexAttribs3dvNV;
extern PFNGLVERTEXATTRIBS3FVNVPROC nglVertexAttribs3fvNV;
extern PFNGLVERTEXATTRIBS3SVNVPROC nglVertexAttribs3svNV;
extern PFNGLVERTEXATTRIBS4DVNVPROC nglVertexAttribs4dvNV;
extern PFNGLVERTEXATTRIBS4FVNVPROC nglVertexAttribs4fvNV;
extern PFNGLVERTEXATTRIBS4SVNVPROC nglVertexAttribs4svNV;
extern PFNGLVERTEXATTRIBS4UBVNVPROC nglVertexAttribs4ubvNV;
// VertexShaderExtension.
//========================
extern NEL_PFNGLBEGINVERTEXSHADEREXTPROC nglBeginVertexShaderEXT;
extern NEL_PFNGLENDVERTEXSHADEREXTPROC nglEndVertexShaderEXT;
extern NEL_PFNGLBINDVERTEXSHADEREXTPROC nglBindVertexShaderEXT;
extern NEL_PFNGLGENVERTEXSHADERSEXTPROC nglGenVertexShadersEXT;
extern NEL_PFNGLDELETEVERTEXSHADEREXTPROC nglDeleteVertexShaderEXT;
extern NEL_PFNGLSHADEROP1EXTPROC nglShaderOp1EXT;
extern NEL_PFNGLSHADEROP2EXTPROC nglShaderOp2EXT;
extern NEL_PFNGLSHADEROP3EXTPROC nglShaderOp3EXT;
extern NEL_PFNGLSWIZZLEEXTPROC nglSwizzleEXT;
extern NEL_PFNGLWRITEMASKEXTPROC nglWriteMaskEXT;
extern NEL_PFNGLINSERTCOMPONENTEXTPROC nglInsertComponentEXT;
extern NEL_PFNGLEXTRACTCOMPONENTEXTPROC nglExtractComponentEXT;
extern NEL_PFNGLGENSYMBOLSEXTPROC nglGenSymbolsEXT;
extern NEL_PFNGLSETINVARIANTEXTPROC nglSetInvariantEXT;
extern NEL_PFNGLSETLOCALCONSTANTEXTPROC nglSetLocalConstantEXT;
extern NEL_PFNGLVARIANTPOINTEREXTPROC nglVariantPointerEXT;
extern NEL_PFNGLENABLEVARIANTCLIENTSTATEEXTPROC nglEnableVariantClientStateEXT;
extern NEL_PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC nglDisableVariantClientStateEXT;
extern NEL_PFNGLBINDLIGHTPARAMETEREXTPROC nglBindLightParameterEXT;
extern NEL_PFNGLBINDMATERIALPARAMETEREXTPROC nglBindMaterialParameterEXT;
extern NEL_PFNGLBINDTEXGENPARAMETEREXTPROC nglBindTexGenParameterEXT;
extern NEL_PFNGLBINDTEXTUREUNITPARAMETEREXTPROC nglBindTextureUnitParameterEXT;
extern NEL_PFNGLBINDPARAMETEREXTPROC nglBindParameterEXT;
extern NEL_PFNGLISVARIANTENABLEDEXTPROC nglIsVariantEnabledEXT;
extern NEL_PFNGLGETVARIANTBOOLEANVEXTPROC nglGetVariantBooleanvEXT;
extern NEL_PFNGLGETVARIANTINTEGERVEXTPROC nglGetVariantIntegervEXT;
extern NEL_PFNGLGETVARIANTFLOATVEXTPROC nglGetVariantFloatvEXT;
extern NEL_PFNGLGETVARIANTPOINTERVEXTPROC nglGetVariantPointervEXT;
extern NEL_PFNGLGETINVARIANTBOOLEANVEXTPROC nglGetInvariantBooleanvEXT;
extern NEL_PFNGLGETINVARIANTINTEGERVEXTPROC nglGetInvariantIntegervEXT;
extern NEL_PFNGLGETINVARIANTFLOATVEXTPROC nglGetInvariantFloatvEXT;
extern NEL_PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC nglGetLocalConstantBooleanvEXT;
extern NEL_PFNGLGETLOCALCONSTANTINTEGERVEXTPROC nglGetLocalConstantIntegervEXT;
extern NEL_PFNGLGETLOCALCONSTANTFLOATVEXTPROC nglGetLocalConstantFloatvEXT;
extern PFNGLBEGINVERTEXSHADEREXTPROC nglBeginVertexShaderEXT;
extern PFNGLENDVERTEXSHADEREXTPROC nglEndVertexShaderEXT;
extern PFNGLBINDVERTEXSHADEREXTPROC nglBindVertexShaderEXT;
extern PFNGLGENVERTEXSHADERSEXTPROC nglGenVertexShadersEXT;
extern PFNGLDELETEVERTEXSHADEREXTPROC nglDeleteVertexShaderEXT;
extern PFNGLSHADEROP1EXTPROC nglShaderOp1EXT;
extern PFNGLSHADEROP2EXTPROC nglShaderOp2EXT;
extern PFNGLSHADEROP3EXTPROC nglShaderOp3EXT;
extern PFNGLSWIZZLEEXTPROC nglSwizzleEXT;
extern PFNGLWRITEMASKEXTPROC nglWriteMaskEXT;
extern PFNGLINSERTCOMPONENTEXTPROC nglInsertComponentEXT;
extern PFNGLEXTRACTCOMPONENTEXTPROC nglExtractComponentEXT;
extern PFNGLGENSYMBOLSEXTPROC nglGenSymbolsEXT;
extern PFNGLSETINVARIANTEXTPROC nglSetInvariantEXT;
extern PFNGLSETLOCALCONSTANTEXTPROC nglSetLocalConstantEXT;
extern PFNGLVARIANTPOINTEREXTPROC nglVariantPointerEXT;
extern PFNGLENABLEVARIANTCLIENTSTATEEXTPROC nglEnableVariantClientStateEXT;
extern PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC nglDisableVariantClientStateEXT;
extern PFNGLBINDLIGHTPARAMETEREXTPROC nglBindLightParameterEXT;
extern PFNGLBINDMATERIALPARAMETEREXTPROC nglBindMaterialParameterEXT;
extern PFNGLBINDTEXGENPARAMETEREXTPROC nglBindTexGenParameterEXT;
extern PFNGLBINDTEXTUREUNITPARAMETEREXTPROC nglBindTextureUnitParameterEXT;
extern PFNGLBINDPARAMETEREXTPROC nglBindParameterEXT;
extern PFNGLISVARIANTENABLEDEXTPROC nglIsVariantEnabledEXT;
extern PFNGLGETVARIANTBOOLEANVEXTPROC nglGetVariantBooleanvEXT;
extern PFNGLGETVARIANTINTEGERVEXTPROC nglGetVariantIntegervEXT;
extern PFNGLGETVARIANTFLOATVEXTPROC nglGetVariantFloatvEXT;
extern PFNGLGETVARIANTPOINTERVEXTPROC nglGetVariantPointervEXT;
extern PFNGLGETINVARIANTBOOLEANVEXTPROC nglGetInvariantBooleanvEXT;
extern PFNGLGETINVARIANTINTEGERVEXTPROC nglGetInvariantIntegervEXT;
extern PFNGLGETINVARIANTFLOATVEXTPROC nglGetInvariantFloatvEXT;
extern PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC nglGetLocalConstantBooleanvEXT;
extern PFNGLGETLOCALCONSTANTINTEGERVEXTPROC nglGetLocalConstantIntegervEXT;
extern PFNGLGETLOCALCONSTANTFLOATVEXTPROC nglGetLocalConstantFloatvEXT;
// ATI_envmap_bumpmap extension
@ -530,100 +545,100 @@ extern PFNGLGETTEXBUMPPARAMETERFVATIPROC nglGetTexBumpParameterfvATI;
// SecondaryColor extension
//========================
extern NEL_PFNGLSECONDARYCOLOR3BEXTPROC nglSecondaryColor3bEXT;
extern NEL_PFNGLSECONDARYCOLOR3BVEXTPROC nglSecondaryColor3bvEXT;
extern NEL_PFNGLSECONDARYCOLOR3DEXTPROC nglSecondaryColor3dEXT;
extern NEL_PFNGLSECONDARYCOLOR3DVEXTPROC nglSecondaryColor3dvEXT;
extern NEL_PFNGLSECONDARYCOLOR3FEXTPROC nglSecondaryColor3fEXT;
extern NEL_PFNGLSECONDARYCOLOR3FVEXTPROC nglSecondaryColor3fvEXT;
extern NEL_PFNGLSECONDARYCOLOR3IEXTPROC nglSecondaryColor3iEXT;
extern NEL_PFNGLSECONDARYCOLOR3IVEXTPROC nglSecondaryColor3ivEXT;
extern NEL_PFNGLSECONDARYCOLOR3SEXTPROC nglSecondaryColor3sEXT;
extern NEL_PFNGLSECONDARYCOLOR3SVEXTPROC nglSecondaryColor3svEXT;
extern NEL_PFNGLSECONDARYCOLOR3UBEXTPROC nglSecondaryColor3ubEXT;
extern NEL_PFNGLSECONDARYCOLOR3UBVEXTPROC nglSecondaryColor3ubvEXT;
extern NEL_PFNGLSECONDARYCOLOR3UIEXTPROC nglSecondaryColor3uiEXT;
extern NEL_PFNGLSECONDARYCOLOR3UIVEXTPROC nglSecondaryColor3uivEXT;
extern NEL_PFNGLSECONDARYCOLOR3USEXTPROC nglSecondaryColor3usEXT;
extern NEL_PFNGLSECONDARYCOLOR3USVEXTPROC nglSecondaryColor3usvEXT;
extern NEL_PFNGLSECONDARYCOLORPOINTEREXTPROC nglSecondaryColorPointerEXT;
extern PFNGLSECONDARYCOLOR3BEXTPROC nglSecondaryColor3bEXT;
extern PFNGLSECONDARYCOLOR3BVEXTPROC nglSecondaryColor3bvEXT;
extern PFNGLSECONDARYCOLOR3DEXTPROC nglSecondaryColor3dEXT;
extern PFNGLSECONDARYCOLOR3DVEXTPROC nglSecondaryColor3dvEXT;
extern PFNGLSECONDARYCOLOR3FEXTPROC nglSecondaryColor3fEXT;
extern PFNGLSECONDARYCOLOR3FVEXTPROC nglSecondaryColor3fvEXT;
extern PFNGLSECONDARYCOLOR3IEXTPROC nglSecondaryColor3iEXT;
extern PFNGLSECONDARYCOLOR3IVEXTPROC nglSecondaryColor3ivEXT;
extern PFNGLSECONDARYCOLOR3SEXTPROC nglSecondaryColor3sEXT;
extern PFNGLSECONDARYCOLOR3SVEXTPROC nglSecondaryColor3svEXT;
extern PFNGLSECONDARYCOLOR3UBEXTPROC nglSecondaryColor3ubEXT;
extern PFNGLSECONDARYCOLOR3UBVEXTPROC nglSecondaryColor3ubvEXT;
extern PFNGLSECONDARYCOLOR3UIEXTPROC nglSecondaryColor3uiEXT;
extern PFNGLSECONDARYCOLOR3UIVEXTPROC nglSecondaryColor3uivEXT;
extern PFNGLSECONDARYCOLOR3USEXTPROC nglSecondaryColor3usEXT;
extern PFNGLSECONDARYCOLOR3USVEXTPROC nglSecondaryColor3usvEXT;
extern PFNGLSECONDARYCOLORPOINTEREXTPROC nglSecondaryColorPointerEXT;
// BlendColor extension
//========================
extern NEL_PFNGLBLENDCOLOREXTPROC nglBlendColorEXT;
extern PFNGLBLENDCOLOREXTPROC nglBlendColorEXT;
// GL_ATI_vertex_array_object extension
//========================
extern NEL_PFNGLNEWOBJECTBUFFERATIPROC nglNewObjectBufferATI;
extern NEL_PFNGLISOBJECTBUFFERATIPROC nglIsObjectBufferATI;
extern NEL_PFNGLUPDATEOBJECTBUFFERATIPROC nglUpdateObjectBufferATI;
extern NEL_PFNGLGETOBJECTBUFFERFVATIPROC nglGetObjectBufferfvATI;
extern NEL_PFNGLGETOBJECTBUFFERIVATIPROC nglGetObjectBufferivATI;
extern NEL_PFNGLDELETEOBJECTBUFFERATIPROC nglDeleteObjectBufferATI;
extern NEL_PFNGLARRAYOBJECTATIPROC nglArrayObjectATI;
extern NEL_PFNGLGETARRAYOBJECTFVATIPROC nglGetArrayObjectfvATI;
extern NEL_PFNGLGETARRAYOBJECTIVATIPROC nglGetArrayObjectivATI;
extern NEL_PFNGLVARIANTARRAYOBJECTATIPROC nglVariantArrayObjectATI;
extern NEL_PFNGLGETVARIANTARRAYOBJECTFVATIPROC nglGetVariantArrayObjectfvATI;
extern NEL_PFNGLGETVARIANTARRAYOBJECTIVATIPROC nglGetVariantArrayObjectivATI;
extern PFNGLNEWOBJECTBUFFERATIPROC nglNewObjectBufferATI;
extern PFNGLISOBJECTBUFFERATIPROC nglIsObjectBufferATI;
extern PFNGLUPDATEOBJECTBUFFERATIPROC nglUpdateObjectBufferATI;
extern PFNGLGETOBJECTBUFFERFVATIPROC nglGetObjectBufferfvATI;
extern PFNGLGETOBJECTBUFFERIVATIPROC nglGetObjectBufferivATI;
extern PFNGLFREEOBJECTBUFFERATIPROC nglFreeObjectBufferATI;
extern PFNGLARRAYOBJECTATIPROC nglArrayObjectATI;
extern PFNGLGETARRAYOBJECTFVATIPROC nglGetArrayObjectfvATI;
extern PFNGLGETARRAYOBJECTIVATIPROC nglGetArrayObjectivATI;
extern PFNGLVARIANTARRAYOBJECTATIPROC nglVariantArrayObjectATI;
extern PFNGLGETVARIANTARRAYOBJECTFVATIPROC nglGetVariantArrayObjectfvATI;
extern PFNGLGETVARIANTARRAYOBJECTIVATIPROC nglGetVariantArrayObjectivATI;
// GL_ATI_map_object_buffer
//===================================
extern NEL_PFNGLMAPOBJECTBUFFERATIPROC nglMapObjectBufferATI;
extern NEL_PFNGLUNMAPOBJECTBUFFERATIPROC nglUnmapObjectBufferATI;
extern PFNGLMAPOBJECTBUFFERATIPROC nglMapObjectBufferATI;
extern PFNGLUNMAPOBJECTBUFFERATIPROC nglUnmapObjectBufferATI;
// GL_ATI_fragment_shader extension
//===================================
extern NEL_PFNGLGENFRAGMENTSHADERSATIPROC nglGenFragmentShadersATI;
extern NEL_PFNGLBINDFRAGMENTSHADERATIPROC nglBindFragmentShaderATI;
extern NEL_PFNGLDELETEFRAGMENTSHADERATIPROC nglDeleteFragmentShaderATI;
extern NEL_PFNGLBEGINFRAGMENTSHADERATIPROC nglBeginFragmentShaderATI;
extern NEL_PFNGLENDFRAGMENTSHADERATIPROC nglEndFragmentShaderATI;
extern NEL_PFNGLPASSTEXCOORDATIPROC nglPassTexCoordATI;
extern NEL_PFNGLSAMPLEMAPATIPROC nglSampleMapATI;
extern NEL_PFNGLCOLORFRAGMENTOP1ATIPROC nglColorFragmentOp1ATI;
extern NEL_PFNGLCOLORFRAGMENTOP2ATIPROC nglColorFragmentOp2ATI;
extern NEL_PFNGLCOLORFRAGMENTOP3ATIPROC nglColorFragmentOp3ATI;
extern NEL_PFNGLALPHAFRAGMENTOP1ATIPROC nglAlphaFragmentOp1ATI;
extern NEL_PFNGLALPHAFRAGMENTOP2ATIPROC nglAlphaFragmentOp2ATI;
extern NEL_PFNGLALPHAFRAGMENTOP3ATIPROC nglAlphaFragmentOp3ATI;
extern NEL_PFNGLSETFRAGMENTSHADERCONSTANTATIPROC nglSetFragmentShaderConstantATI;
extern PFNGLGENFRAGMENTSHADERSATIPROC nglGenFragmentShadersATI;
extern PFNGLBINDFRAGMENTSHADERATIPROC nglBindFragmentShaderATI;
extern PFNGLDELETEFRAGMENTSHADERATIPROC nglDeleteFragmentShaderATI;
extern PFNGLBEGINFRAGMENTSHADERATIPROC nglBeginFragmentShaderATI;
extern PFNGLENDFRAGMENTSHADERATIPROC nglEndFragmentShaderATI;
extern PFNGLPASSTEXCOORDATIPROC nglPassTexCoordATI;
extern PFNGLSAMPLEMAPATIPROC nglSampleMapATI;
extern PFNGLCOLORFRAGMENTOP1ATIPROC nglColorFragmentOp1ATI;
extern PFNGLCOLORFRAGMENTOP2ATIPROC nglColorFragmentOp2ATI;
extern PFNGLCOLORFRAGMENTOP3ATIPROC nglColorFragmentOp3ATI;
extern PFNGLALPHAFRAGMENTOP1ATIPROC nglAlphaFragmentOp1ATI;
extern PFNGLALPHAFRAGMENTOP2ATIPROC nglAlphaFragmentOp2ATI;
extern PFNGLALPHAFRAGMENTOP3ATIPROC nglAlphaFragmentOp3ATI;
extern PFNGLSETFRAGMENTSHADERCONSTANTATIPROC nglSetFragmentShaderConstantATI;
// GL_ATI_vertex_attrib_array_object
//==================================
extern NEL_PFNGLVERTEXATTRIBARRAYOBJECTATIPROC nglVertexAttribArrayObjectATI;
extern NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC nglGetVertexAttribArrayObjectfvATI;
extern NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC nglGetVertexAttribArrayObjectivATI;
extern PFNGLVERTEXATTRIBARRAYOBJECTATIPROC nglVertexAttribArrayObjectATI;
extern PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC nglGetVertexAttribArrayObjectfvATI;
extern PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC nglGetVertexAttribArrayObjectivATI;
// GL_ARB_fragment_shader_extension
//==================================
extern NEL_PFNGLPROGRAMSTRINGARBPROC nglProgramStringARB;
extern NEL_PFNGLBINDPROGRAMARBPROC nglBindProgramARB;
extern NEL_PFNGLDELETEPROGRAMSARBPROC nglDeleteProgramsARB;
extern NEL_PFNGLGENPROGRAMSARBPROC nglGenProgramsARB;
extern NEL_PFNGLPROGRAMENVPARAMETER4DARBPROC nglProgramEnvParameter4dARB;
extern NEL_PFNGLPROGRAMENVPARAMETER4DVARBPROC nglProgramEnvParameter4dvARB;
extern NEL_PFNGLPROGRAMENVPARAMETER4FARBPROC nglProgramEnvParameter4fARB;
extern NEL_PFNGLPROGRAMENVPARAMETER4FVARBPROC nglProgramEnvParameter4fvARB;
extern NEL_PFNGLPROGRAMLOCALPARAMETER4DARBPROC nglGetProgramLocalParameter4dARB;
extern NEL_PFNGLPROGRAMLOCALPARAMETER4DVARBPROC nglGetProgramLocalParameter4dvARB;
extern NEL_PFNGLPROGRAMLOCALPARAMETER4FARBPROC nglGetProgramLocalParameter4fARB;
extern NEL_PFNGLPROGRAMLOCALPARAMETER4FVARBPROC nglGetProgramLocalParameter4fvARB;
extern NEL_PFNGLGETPROGRAMENVPARAMETERDVARBPROC nglGetProgramEnvParameterdvARB;
extern NEL_PFNGLGETPROGRAMENVPARAMETERFVARBPROC nglGetProgramEnvParameterfvARB;
extern NEL_PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC nglGetProgramLocalParameterdvARB;
extern NEL_PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC nglGetProgramLocalParameterfvARB;
extern NEL_PFNGLGETPROGRAMIVARBPROC nglGetProgramivARB;
extern NEL_PFNGLGETPROGRAMSTRINGARBPROC nglGetProgramStringARB;
extern NEL_PFNGLISPROGRAMARBPROC nglIsProgramARB;
extern PFNGLPROGRAMSTRINGARBPROC nglProgramStringARB;
extern PFNGLBINDPROGRAMARBPROC nglBindProgramARB;
extern PFNGLDELETEPROGRAMSARBPROC nglDeleteProgramsARB;
extern PFNGLGENPROGRAMSARBPROC nglGenProgramsARB;
extern PFNGLPROGRAMENVPARAMETER4DARBPROC nglProgramEnvParameter4dARB;
extern PFNGLPROGRAMENVPARAMETER4DVARBPROC nglProgramEnvParameter4dvARB;
extern PFNGLPROGRAMENVPARAMETER4FARBPROC nglProgramEnvParameter4fARB;
extern PFNGLPROGRAMENVPARAMETER4FVARBPROC nglProgramEnvParameter4fvARB;
extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC nglGetProgramLocalParameter4dARB;
extern PFNGLPROGRAMLOCALPARAMETER4DVARBPROC nglGetProgramLocalParameter4dvARB;
extern PFNGLPROGRAMLOCALPARAMETER4FARBPROC nglGetProgramLocalParameter4fARB;
extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC nglGetProgramLocalParameter4fvARB;
extern PFNGLGETPROGRAMENVPARAMETERDVARBPROC nglGetProgramEnvParameterdvARB;
extern PFNGLGETPROGRAMENVPARAMETERFVARBPROC nglGetProgramEnvParameterfvARB;
extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC nglGetProgramLocalParameterdvARB;
extern PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC nglGetProgramLocalParameterfvARB;
extern PFNGLGETPROGRAMIVARBPROC nglGetProgramivARB;
extern PFNGLGETPROGRAMSTRINGARBPROC nglGetProgramStringARB;
extern PFNGLISPROGRAMARBPROC nglIsProgramARB;
// GL_ARB_vertex_buffer_object
//==================================
@ -708,13 +723,13 @@ extern PFNGLISPROGRAMARBPROC nglIsProgramARB;
// GL_NV_occlusion_query
//==================================
extern NEL_PFNGLGENOCCLUSIONQUERIESNVPROC nglGenOcclusionQueriesNV;
extern NEL_PFNGLDELETEOCCLUSIONQUERIESNVPROC nglDeleteOcclusionQueriesNV;
extern NEL_PFNGLISOCCLUSIONQUERYNVPROC nglIsOcclusionQueryNV;
extern NEL_PFNGLBEGINOCCLUSIONQUERYNVPROC nglBeginOcclusionQueryNV;
extern NEL_PFNGLENDOCCLUSIONQUERYNVPROC nglEndOcclusionQueryNV;
extern NEL_PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
extern NEL_PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
extern PFNGLGENOCCLUSIONQUERIESNVPROC nglGenOcclusionQueriesNV;
extern PFNGLDELETEOCCLUSIONQUERIESNVPROC nglDeleteOcclusionQueriesNV;
extern PFNGLISOCCLUSIONQUERYNVPROC nglIsOcclusionQueryNV;
extern PFNGLBEGINOCCLUSIONQUERYNVPROC nglBeginOcclusionQueryNV;
extern PFNGLENDOCCLUSIONQUERYNVPROC nglEndOcclusionQueryNV;
extern PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
extern PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
@ -745,44 +760,58 @@ extern PFNWGLGETSWAPINTERVALEXTPROC nwglGetSwapIntervalEXT;
// WGL_ARB_extensions_string
extern PFNWGLGETEXTENSIONSSTRINGARBPROC nwglGetExtensionsStringARB;
// WGL_AMD_gpu_association
//========================
extern PFNWGLGETGPUIDSAMDPROC nwglGetGPUIDsAMD;
extern PFNWGLGETGPUINFOAMDPROC nwglGetGPUInfoAMD;
extern PFNWGLGETCONTEXTGPUIDAMDPROC nwglGetContextGPUIDAMD;
extern PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC nwglCreateAssociatedContextAMD;
extern PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC nwglCreateAssociatedContextAttribsAMD;
extern PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC nwglDeleteAssociatedContextAMD;
extern PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurrentAMD;
extern PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
extern PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD;
#elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX)
// Swap control extensions
//===========================
extern NEL_PFNGLXSWAPINTERVALEXTPROC nglXSwapIntervalEXT;
extern PFNGLXSWAPINTERVALEXTPROC nglXSwapIntervalEXT;
extern PFNGLXSWAPINTERVALSGIPROC nglXSwapIntervalSGI;
extern NEL_PFNGLXSWAPINTERVALMESAPROC nglXSwapIntervalMESA;
extern NEL_PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
extern PFNGLXSWAPINTERVALMESAPROC nglXSwapIntervalMESA;
extern PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
#endif
// GL_EXT_framebuffer_object
extern NEL_PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
extern NEL_PFNGLISFRAMEBUFFEREXTPROC nglIsFramebufferEXT;
extern NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC nglCheckFramebufferStatusEXT;
extern NEL_PFNGLGENFRAMEBUFFERSEXTPROC nglGenFramebuffersEXT;
extern NEL_PFNGLBINDFRAMEBUFFEREXTPROC nglBindFramebufferEXT;
extern NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC nglFramebufferTexture2DEXT;
extern NEL_PFNGLGENRENDERBUFFERSEXTPROC nglGenRenderbuffersEXT;
extern NEL_PFNGLBINDRENDERBUFFEREXTPROC nglBindRenderbufferEXT;
extern NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC nglRenderbufferStorageEXT;
extern NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC nglFramebufferRenderbufferEXT;
extern NEL_PFNGLDELETERENDERBUFFERSEXTPROC nglDeleteRenderbuffersEXT;
extern NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC nglDeleteFramebuffersEXT;
extern NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC nglGetRenderbufferParameterivEXT;
extern NEL_PFNGENERATEMIPMAPEXTPROC nglGenerateMipmapEXT;
extern PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
extern PFNGLISFRAMEBUFFEREXTPROC nglIsFramebufferEXT;
extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC nglCheckFramebufferStatusEXT;
extern PFNGLGENFRAMEBUFFERSEXTPROC nglGenFramebuffersEXT;
extern PFNGLBINDFRAMEBUFFEREXTPROC nglBindFramebufferEXT;
extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC nglFramebufferTexture2DEXT;
extern PFNGLGENRENDERBUFFERSEXTPROC nglGenRenderbuffersEXT;
extern PFNGLBINDRENDERBUFFEREXTPROC nglBindRenderbufferEXT;
extern PFNGLRENDERBUFFERSTORAGEEXTPROC nglRenderbufferStorageEXT;
extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC nglFramebufferRenderbufferEXT;
extern PFNGLDELETERENDERBUFFERSEXTPROC nglDeleteRenderbuffersEXT;
extern PFNGLDELETEFRAMEBUFFERSEXTPROC nglDeleteFramebuffersEXT;
extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC nglGetRenderbufferParameterivEXT;
extern PFNGLGENERATEMIPMAPEXTPROC nglGenerateMipmapEXT;
// GL_EXT_framebuffer_blit
extern NEL_PFNGLBLITFRAMEBUFFEREXTPROC nglBlitFramebufferEXT;
extern PFNGLBLITFRAMEBUFFEREXTPROC nglBlitFramebufferEXT;
// GL_EXT_framebuffer_multisample
extern NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMultisampleEXT;
extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMultisampleEXT;
// GL_ARB_multisample
extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB;
extern PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB;
#endif // USE_OPENGLES

View file

@ -25,44 +25,8 @@ extern "C" {
#endif
#ifdef USE_OPENGLES
// OES_mapbuffer
//==============
typedef void* (APIENTRY * NEL_PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
typedef GLboolean (APIENTRY * NEL_PFNGLUNMAPBUFFEROESPROC) (GLenum target);
typedef void (APIENTRY * NEL_PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params);
typedef void (APIENTRY * NEL_PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
// GL_OES_framebuffer_object
//==================================
typedef GLboolean (APIENTRY * NEL_PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
typedef void (APIENTRY * NEL_PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
typedef void (APIENTRY * NEL_PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers);
typedef void (APIENTRY * NEL_PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers);
typedef void (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (APIENTRY * NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params);
typedef GLboolean (APIENTRY * NEL_PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
typedef void (APIENTRY * NEL_PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
typedef void (APIENTRY * NEL_PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers);
typedef void (APIENTRY * NEL_PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers);
typedef GLenum (APIENTRY * NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (APIENTRY * NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
typedef void (APIENTRY * NEL_PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
// GL_OES_texture_cube_map
//==================================
typedef void (APIENTRY * NEL_PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
typedef void (APIENTRY * NEL_PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
typedef void (APIENTRY * NEL_PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
typedef void (APIENTRY * NEL_PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
typedef void (APIENTRY * NEL_PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
// use same defines for OpenGL and OpenGL ES to simplify the code
#define GL_MULTISAMPLE_ARB GL_MULTISAMPLE
#define GL_TEXTURE_CUBE_MAP_ARB GL_TEXTURE_CUBE_MAP_OES
#define GL_NONE 0
@ -86,346 +50,6 @@ typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pnam
#else
// ***************************************************************************
// ***************************************************************************
// The NEL Functions Typedefs.
// Must do it for compatibilities with futures version of gl.h
// eg: version 1.2 does not define PFNGLACTIVETEXTUREARBPROC. Hence, do it now, with our special name
// ***************************************************************************
// ***************************************************************************
#define WGL_COVERAGE_SAMPLES_NV 0x2042
#define WGL_COLOR_SAMPLES_NV 0x20B9
// ARB_multitexture
//=================
typedef void (APIENTRY * NEL_PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
typedef void (APIENTRY * NEL_PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
// ARB_TextureCompression.
//========================
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img);
// VertexArrayRangeNV.
//====================
typedef void (APIENTRY * NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);
typedef void (APIENTRY * NEL_PFNGLVERTEXARRAYRANGENVPROC) (GLsizei size, const GLvoid *pointer);
// FenceNV.
//====================
typedef void (APIENTRY * NEL_PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
typedef void (APIENTRY * NEL_PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
typedef GLboolean (APIENTRY * NEL_PFNGLISFENCENVPROC) (GLuint fence);
typedef GLboolean (APIENTRY * NEL_PFNGLTESTFENCENVPROC) (GLuint fence);
typedef void (APIENTRY * NEL_PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLFINISHFENCENVPROC) (GLuint fence);
typedef void (APIENTRY * NEL_PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
// VertexWeighting.
//==================
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
// VertexProgramExtension.
//========================
typedef GLboolean (APIENTRY * NEL_PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences);
typedef void (APIENTRY * NEL_PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);
typedef void (APIENTRY * NEL_PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
typedef void (APIENTRY * NEL_PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs);
typedef void (APIENTRY * NEL_PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params);
typedef void (APIENTRY * NEL_PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program);
typedef void (APIENTRY * NEL_PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params);
typedef void (APIENTRY * NEL_PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
typedef GLboolean (APIENTRY * NEL_PFNGLISPROGRAMNVPROC) (GLuint id);
typedef void (APIENTRY * NEL_PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
typedef void (APIENTRY * NEL_PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v);
// VertexShaderExtension (EXT)
//============================
typedef void (APIENTRY * NEL_PFNGLBEGINVERTEXSHADEREXTPROC) ( void );
typedef void (APIENTRY * NEL_PFNGLENDVERTEXSHADEREXTPROC) ( void );
typedef void (APIENTRY * NEL_PFNGLBINDVERTEXSHADEREXTPROC) ( GLuint id );
typedef GLuint (APIENTRY * NEL_PFNGLGENVERTEXSHADERSEXTPROC) ( GLuint range );
typedef void (APIENTRY * NEL_PFNGLDELETEVERTEXSHADEREXTPROC) ( GLuint id );
typedef void (APIENTRY * NEL_PFNGLSHADEROP1EXTPROC) ( GLenum op, GLuint res, GLuint arg1 );
typedef void (APIENTRY * NEL_PFNGLSHADEROP2EXTPROC) ( GLenum op, GLuint res, GLuint arg1, GLuint arg2 );
typedef void (APIENTRY * NEL_PFNGLSHADEROP3EXTPROC) ( GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3 );
typedef void (APIENTRY * NEL_PFNGLSWIZZLEEXTPROC) ( GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW );
typedef void (APIENTRY * NEL_PFNGLWRITEMASKEXTPROC) ( GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW );
typedef void (APIENTRY * NEL_PFNGLINSERTCOMPONENTEXTPROC) ( GLuint res, GLuint src, GLuint num );
typedef void (APIENTRY * NEL_PFNGLEXTRACTCOMPONENTEXTPROC) ( GLuint res, GLuint src, GLuint num );
typedef GLuint (APIENTRY * NEL_PFNGLGENSYMBOLSEXTPROC) ( GLenum datatype, GLenum storagetype, GLenum range, GLuint components ) ;
typedef void (APIENTRY * NEL_PFNGLSETINVARIANTEXTPROC) ( GLuint id, GLenum type, void *addr );
typedef void (APIENTRY * NEL_PFNGLSETLOCALCONSTANTEXTPROC) ( GLuint id, GLenum type, void *addr );
typedef void (APIENTRY * NEL_PFNGLVARIANTPOINTEREXTPROC) ( GLuint id, GLenum type, GLuint stride, void *addr );
typedef void (APIENTRY * NEL_PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) ( GLuint id);
typedef void (APIENTRY * NEL_PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) ( GLuint id);
typedef GLuint (APIENTRY * NEL_PFNGLBINDLIGHTPARAMETEREXTPROC) ( GLenum light, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDMATERIALPARAMETEREXTPROC) ( GLenum face, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDTEXGENPARAMETEREXTPROC) ( GLenum unit, GLenum coord, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) ( GLenum unit, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDPARAMETEREXTPROC) ( GLenum value);
typedef GLboolean (APIENTRY * NEL_PFNGLISVARIANTENABLEDEXTPROC) ( GLuint id, GLenum cap);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTBOOLEANVEXTPROC) ( GLuint id, GLenum value, GLboolean *data);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTINTEGERVEXTPROC) ( GLuint id, GLenum value, GLint *data);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTFLOATVEXTPROC) ( GLuint id, GLenum value, GLfloat *data);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTPOINTERVEXTPROC) ( GLuint id, GLenum value, void **data);
typedef void (APIENTRY * NEL_PFNGLGETINVARIANTBOOLEANVEXTPROC) ( GLuint id, GLenum value, GLboolean *data);
typedef void (APIENTRY * NEL_PFNGLGETINVARIANTINTEGERVEXTPROC) ( GLuint id, GLenum value, GLint *data);
typedef void (APIENTRY * NEL_PFNGLGETINVARIANTFLOATVEXTPROC) ( GLuint id, GLenum value, GLfloat *data);
typedef void (APIENTRY * NEL_PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) ( GLuint id, GLenum value, GLboolean *data);
typedef void (APIENTRY * NEL_PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) ( GLuint id, GLenum value, GLint *data);
typedef void (APIENTRY * NEL_PFNGLGETLOCALCONSTANTFLOATVEXTPROC) ( GLuint id, GLenum value, GLfloat *data);
// SecondaryColor extension
//========================
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
// BlendColor extension
//========================
typedef void (APIENTRY * NEL_PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
// GL_ATI_vertex_array_object extension
//========================
typedef GLuint (APIENTRY * NEL_PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage);
typedef GLboolean (APIENTRY * NEL_PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);
typedef void (APIENTRY * NEL_PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve);
typedef void (APIENTRY * NEL_PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLDELETEOBJECTBUFFERATIPROC) (GLuint buffer);
typedef void (APIENTRY * NEL_PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
typedef void (APIENTRY * NEL_PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params);
// GL_ATI_fragment_shader extension
//==================================
typedef GLuint (APIENTRY *NEL_PFNGLGENFRAGMENTSHADERSATIPROC)(GLuint range);
typedef GLvoid (APIENTRY *NEL_PFNGLBINDFRAGMENTSHADERATIPROC)(GLuint id);
typedef GLvoid (APIENTRY *NEL_PFNGLDELETEFRAGMENTSHADERATIPROC)(GLuint id);
typedef GLvoid (APIENTRY *NEL_PFNGLBEGINFRAGMENTSHADERATIPROC)();
typedef GLvoid (APIENTRY *NEL_PFNGLENDFRAGMENTSHADERATIPROC)();
typedef GLvoid (APIENTRY *NEL_PFNGLPASSTEXCOORDATIPROC)(GLuint dst, GLuint coord, GLenum swizzle);
typedef GLvoid (APIENTRY *NEL_PFNGLSAMPLEMAPATIPROC)(GLuint dst, GLuint interp, GLenum swizzle);
typedef GLvoid (APIENTRY *NEL_PFNGLCOLORFRAGMENTOP1ATIPROC)(GLenum op, GLuint dst, GLuint dstMask,
GLuint dstMod, GLuint arg1, GLuint arg1Rep,
GLuint arg1Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLCOLORFRAGMENTOP2ATIPROC)(GLenum op, GLuint dst, GLuint dstMask,
GLuint dstMod, GLuint arg1, GLuint arg1Rep,
GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
GLuint arg2Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLCOLORFRAGMENTOP3ATIPROC)(GLenum op, GLuint dst, GLuint dstMask,
GLuint dstMod, GLuint arg1, GLuint arg1Rep,
GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
GLuint arg2Mod, GLuint arg3, GLuint arg3Rep,
GLuint arg3Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLALPHAFRAGMENTOP1ATIPROC)(GLenum op, GLuint dst, GLuint dstMod,
GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLALPHAFRAGMENTOP2ATIPROC)(GLenum op, GLuint dst, GLuint dstMod,
GLuint arg1, GLuint arg1Rep, GLuint arg1Mod,
GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLALPHAFRAGMENTOP3ATIPROC)(GLenum op, GLuint dst, GLuint dstMod,
GLuint arg1, GLuint arg1Rep, GLuint arg1Mod,
GLuint arg2, GLuint arg2Rep, GLuint arg2Mod,
GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLSETFRAGMENTSHADERCONSTANTATIPROC)(GLuint dst, const GLfloat *value);
// GL_ATI_map_object_buffer
//==================================
typedef void *(APIENTRY * NEL_PFNGLMAPOBJECTBUFFERATIPROC)(GLuint buffer);
typedef void (APIENTRY * NEL_PFNGLUNMAPOBJECTBUFFERATIPROC)(GLuint buffer);
// GL_ATI_vertex_attrib_array_object
//==================================
typedef GLvoid (APIENTRY * NEL_PFNGLVERTEXATTRIBARRAYOBJECTATIPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
typedef GLvoid (APIENTRY * NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC)(GLuint index, GLenum pname, GLfloat *params);
typedef GLvoid (APIENTRY * NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC)(GLuint index, GLenum pname, GLint *params);
// GL_ARB_fragment_program
//==================================
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMSTRINGARBPROC)(GLenum target, GLenum format, GLsizei len,const GLvoid *string);
typedef GLvoid (APIENTRY *NEL_PFNGLBINDPROGRAMARBPROC)(GLenum target, GLuint program);
typedef GLvoid (APIENTRY *NEL_PFNGLDELETEPROGRAMSARBPROC)(GLsizei n, const GLuint *programs);
typedef GLvoid (APIENTRY *NEL_PFNGLGENPROGRAMSARBPROC)(GLsizei n, GLuint *programs);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4DARBPROC)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4DVARBPROC)(GLenum target, GLuint index, const GLdouble *params);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4FARBPROC)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4FVARBPROC)(GLenum target, GLuint index, const GLfloat *params);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4DARBPROC)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)(GLenum target, GLuint index, const GLdouble *params);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4FARBPROC)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)(GLenum target, GLuint index, const GLfloat *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMENVPARAMETERDVARBPROC)(GLenum target, GLuint index, GLdouble *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMENVPARAMETERFVARBPROC)(GLenum target, GLuint index, GLfloat *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)(GLenum target, GLuint index, GLdouble *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)(GLenum target, GLuint index, GLfloat *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMIVARBPROC)(GLenum target, GLenum pname, int *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMSTRINGARBPROC)(GLenum target, GLenum pname, GLvoid *string);
typedef GLboolean (APIENTRY *NEL_PFNGLISPROGRAMARBPROC)(GLuint program);
typedef GLboolean (APIENTRY * NEL_PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
typedef GLboolean (APIENTRY * NEL_PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
typedef GLenum (APIENTRY * NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum pname);
typedef GLvoid (APIENTRY * NEL_PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
typedef GLvoid (APIENTRY * NEL_PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
typedef GLvoid (APIENTRY * NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef GLvoid (APIENTRY * NEL_PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
typedef GLvoid (APIENTRY * NEL_PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
typedef GLvoid (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef GLvoid (APIENTRY * NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef GLvoid (APIENTRY * NEL_PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
typedef GLvoid (APIENTRY * NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
typedef GLvoid (APIENTRY * NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
typedef GLvoid (APIENTRY * NEL_PFNGENERATEMIPMAPEXTPROC) (GLenum target);
typedef GLvoid (APIENTRY * NEL_PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef GLvoid (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
#ifndef NL_GL_NV_occlusion_query
#define NL_GL_NV_occlusion_query 1
typedef GLvoid (APIENTRY * NEL_PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);
typedef GLvoid (APIENTRY * NEL_PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);
typedef GLboolean (APIENTRY * NEL_PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);
typedef GLvoid (APIENTRY * NEL_PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);
typedef GLvoid (APIENTRY * NEL_PFNGLENDOCCLUSIONQUERYNVPROC) ();
typedef GLvoid (APIENTRY * NEL_PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params);
typedef GLvoid (APIENTRY * NEL_PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params);
#endif /* GL_NV_occlusion_query */
#ifndef NL_GL_ARB_multisample
#define NL_GL_ARB_multisample 1
typedef GLvoid (APIENTRY * NEL_PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);
#endif
#if defined(NL_OS_MAC)
// Mac GL extensions
@ -433,18 +57,6 @@ typedef GLvoid (APIENTRY * NEL_PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, G
#elif defined(NL_OS_UNIX)
// GLX extensions
#ifndef NL_GLX_EXT_swap_control
#define NL_GLX_EXT_swap_control 1
#ifndef GLX_EXT_swap_control
#define GLX_SWAP_INTERVAL_EXT 0x20F1
#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
#endif
typedef GLint (APIENTRY * NEL_PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, GLint interval);
#endif // NL_GLX_EXT_swap_control
#ifndef NL_GLX_MESA_swap_control
#define NL_GLX_MESA_swap_control 1

View file

@ -1809,7 +1809,7 @@ void CDriverGL::fenceOnCurVBHardIfNeeded(IVertexBufferHardGL *newVBHard)
#ifndef USE_OPENGLES
// If old is not a VBHard, or if not a NVidia VBHard, no-op.
if( _CurrentVertexBufferHard==NULL || !_CurrentVertexBufferHard->VBType == IVertexBufferHardGL::NVidiaVB)
if( _CurrentVertexBufferHard==NULL || _CurrentVertexBufferHard->VBType != IVertexBufferHardGL::NVidiaVB)
return;
// if we do not activate the same (NB: newVBHard==NULL if not a VBHard).

View file

@ -551,7 +551,7 @@ void CVertexArrayRangeATI::free()
_HeapMemory.reset();
// Free special memory.
nglDeleteObjectBufferATI(_VertexObjectId);
nglFreeObjectBufferATI(_VertexObjectId);
_Allocated= false;
_VertexArraySize= 0;
@ -839,7 +839,7 @@ bool CVertexArrayRangeMapObjectATI::allocate(uint32 size, CVertexBuffer::TPrefer
if (vertexObjectId)
{
// free the object
nglDeleteObjectBufferATI(vertexObjectId);
nglFreeObjectBufferATI(vertexObjectId);
//
_SizeAllocated = size;
_VBType = vbType;
@ -924,7 +924,7 @@ CVertexBufferHardGLMapObjectATI::CVertexBufferHardGLMapObjectATI(CDriverGL *drv,
CVertexBufferHardGLMapObjectATI::~CVertexBufferHardGLMapObjectATI()
{
H_AUTO_OGL(CVertexBufferHardGLMapObjectATI_CVertexBufferHardGLMapObjectATIDtor)
if (_VertexObjectId) nglDeleteObjectBufferATI(_VertexObjectId);
if (_VertexObjectId) nglFreeObjectBufferATI(_VertexObjectId);
#ifdef NL_DEBUG
if (_VertexPtr)
{
@ -1114,7 +1114,7 @@ void CVertexArrayRangeMapObjectATI::updateLostBuffers()
{
nlassert((*it)->_VertexObjectId);
nlassert(nglIsObjectBufferATI((*it)->_VertexObjectId));
nglDeleteObjectBufferATI((*it)->_VertexObjectId);
nglFreeObjectBufferATI((*it)->_VertexObjectId);
(*it)->_VertexObjectId = 0;
(*it)->VB->setLocation(CVertexBuffer::NotResident);
}

View file

@ -14,6 +14,9 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef STDOPENGL_H
#define STDOPENGL_H
#include "nel/misc/types_nl.h"
#include <cstdlib>
@ -67,5 +70,33 @@
#include "nel/misc/mem_stream.h"
#include "nel/misc/time_nl.h"
#include "nel/misc/command.h"
#include "nel/misc/matrix.h"
#include "nel/misc/smart_ptr.h"
#include "nel/misc/rgba.h"
#include "nel/misc/event_emitter.h"
#include "nel/misc/bit_set.h"
#include "nel/misc/hierarchical_timer.h"
#include "nel/misc/bitmap.h"
#include "nel/misc/heap_memory.h"
#include "nel/misc/event_emitter_multi.h"
#include "nel/misc/time_nl.h"
#include "nel/misc/rect.h"
#include "nel/misc/mouse_device.h"
#include "nel/misc/dynloadlib.h"
#include "nel/misc/file.h"
#include "nel/3d/driver.h"
#include "nel/3d/material.h"
#include "nel/3d/vertex_buffer.h"
#include "nel/3d/ptr_set.h"
#include "nel/3d/texture_cube.h"
#include "nel/3d/vertex_program_parse.h"
#include "nel/3d/viewport.h"
#include "nel/3d/scissor.h"
#include "nel/3d/light.h"
#include "nel/3d/occlusion_query.h"
#include "nel/3d/u_driver.h"
#include "nel/3d/light.h"
#include "nel/3d/index_buffer.h"
#endif

View file

@ -29,7 +29,8 @@ using namespace std;
#ifndef NL_DONT_USE_EXTERNAL_CODE
#include <freetype.h>
#include <ft2build.h>
#include FT_FREETYPE_H
// for freetype 2.0
#ifdef FTERRORS_H
@ -51,7 +52,7 @@ int err_code;
const char* err_msg;
} ft_errors[] =
#include <fterrors.h>
#include FT_ERRORS_H
using namespace NLMISC;

View file

@ -791,17 +791,20 @@ void CMeshMultiLod::compileCoarseMeshes()
{
slotRef.CoarseTriangles.resize(slotRef.CoarseNumTris * 3);
TCoarseMeshIndexType *dstPtr= &slotRef.CoarseTriangles[0];
uint totalTris = 0;
for(uint i=0;i<meshGeom->getNbRdrPass(0);i++)
{
const CIndexBuffer &pb= meshGeom->getRdrPassPrimitiveBlock(0, i);
CIndexBufferRead ibaRead;
pb.lock (ibaRead);
uint numTris= pb.getNumIndexes()/3;
totalTris += numTris;
if (pb.getFormat() == CIndexBuffer::Indices16)
{
if (sizeof(TCoarseMeshIndexType) == sizeof(uint16))
{
memcpy(dstPtr, (uint16 *) ibaRead.getPtr(), numTris*3*sizeof(uint16));
dstPtr+= numTris*3;
}
else
{
@ -820,6 +823,7 @@ void CMeshMultiLod::compileCoarseMeshes()
if (sizeof(TCoarseMeshIndexType) == sizeof(uint32))
{
memcpy(dstPtr, (uint32 *) ibaRead.getPtr(), numTris*3*sizeof(uint32));
dstPtr+= numTris*3;
}
else
{
@ -836,8 +840,8 @@ void CMeshMultiLod::compileCoarseMeshes()
}
}
}
dstPtr+= numTris*3;
}
nlassert(totalTris == slotRef.CoarseNumTris);
}
}
}

View file

@ -453,6 +453,7 @@ void CStereoDebugger::listDevices(std::vector<CStereoDeviceInfo> &devicesOut)
devInfo.Manufacturer = "NeL";
devInfo.ProductName = "Stereo Debugger";
devInfo.Serial = "NL-3D-DEBUG";
devInfo.AllowAuto = false;
devicesOut.push_back(devInfo);
}

View file

@ -612,6 +612,7 @@ void CStereoLibVR::listDevices(std::vector<CStereoDeviceInfo> &devicesOut)
deviceInfoOut.Factory = static_cast<IStereoDeviceFactory *>(handle);
deviceInfoOut.Class = CStereoDeviceInfo::StereoHMD;
deviceInfoOut.Library = CStereoDeviceInfo::LibVR;
deviceInfoOut.AllowAuto = true;
//TODO: manufacturer, produc name
//TODO: serial
devicesOut.push_back(deviceInfoOut);

View file

@ -0,0 +1,55 @@
/**
* \file stereo_hmd.cpp
* \brief IStereoNGHMD
* \date 2014-04-01 10:53GMT
* \author Jan Boon (Kaetemi)
* IStereoNGHMD
*/
/*
* Copyright (C) 2014 by authors
*
* This file is part of NL3D.
* NL3D 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.
*
* NL3D 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 NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <nel/misc/types_nl.h>
#include <nel/3d/stereo_ng_hmd.h>
// STL includes
// NeL includes
// #include <nel/misc/debug.h>
// Project includes
using namespace std;
// using namespace NLMISC;
namespace NL3D {
IStereoNGHMD::IStereoNGHMD()
{
}
IStereoNGHMD::~IStereoNGHMD()
{
}
} /* namespace NL3D */
/* end of file */

View file

@ -816,6 +816,7 @@ void CStereoOVR::listDevices(std::vector<CStereoDeviceInfo> &devicesOut)
deviceInfoOut.Library = CStereoDeviceInfo::OVR; // "Oculus SDK";
deviceInfoOut.Manufacturer = deviceInfo.Manufacturer;
deviceInfoOut.ProductName = deviceInfo.ProductName;
deviceInfoOut.AllowAuto = true;
stringstream ser;
ser << id;
deviceInfoOut.Serial = ser.str(); // can't get the real serial from the sdk...

View file

@ -373,7 +373,9 @@ public:
setCPUMask (Thread, _Process);
_ZoneLighter->processCalc (_Process, *_Description);
_ZoneLighter->_ProcessExitedMutex.enter();
_ZoneLighter->_ProcessExited++;
_ZoneLighter->_ProcessExitedMutex.leave();
}
};
@ -649,7 +651,9 @@ void NL3D::CRenderZBuffer::run()
}
// Exit
_ZoneLighter->_ProcessExitedMutex.enter();
_ZoneLighter->_ProcessExited++;
_ZoneLighter->_ProcessExitedMutex.leave();
}
// ***************************************************************************
@ -676,7 +680,9 @@ public:
void run()
{
_ZoneLighter->processLightableShapeCalc(_Process, _ShapesToLit, _FirstShape, _LastShape, *_Description);
_ZoneLighter->_ProcessExitedMutex.enter();
_ZoneLighter->_ProcessExited++;
_ZoneLighter->_ProcessExitedMutex.leave();
}
private:
CZoneLighter *_ZoneLighter;

View file

@ -104,7 +104,7 @@ CForm::~CForm ()
// ***************************************************************************
void CForm::write (xmlDocPtr doc, const char *filename, bool georges4CVS)
void CForm::write (xmlDocPtr doc, const char *filename)
{
// Save the filename
if (filename)
@ -137,7 +137,7 @@ void CForm::write (xmlDocPtr doc, const char *filename, bool georges4CVS)
}
// Header
Header.write (node, georges4CVS);
Header.write (node);
}
// ***************************************************************************
@ -259,14 +259,14 @@ const std::string &CForm::getComment () const
// ***************************************************************************
void CForm::write (class NLMISC::IStream &stream, bool georges4CVS)
void CForm::write (class NLMISC::IStream &stream)
{
// Xml stream
COXml xmlStream;
xmlStream.init (&stream);
// Write the file
write (xmlStream.getDocument (), NULL, georges4CVS);
write (xmlStream.getDocument (), NULL);
}
// ***************************************************************************

View file

@ -41,7 +41,7 @@ void warning (bool exception, const char *format, ... );
// ***************************************************************************
void CFormDfn::write (xmlDocPtr doc, const char *filename, bool georges4CVS)
void CFormDfn::write (xmlDocPtr doc, const char *filename)
{
// Save filename
_Filename = CFile::getFilename (filename);
@ -101,7 +101,7 @@ void CFormDfn::write (xmlDocPtr doc, const char *filename, bool georges4CVS)
}
// Header
Header.write (node, georges4CVS);
Header.write (node);
}
// ***************************************************************************

View file

@ -38,27 +38,16 @@ CFileHeader::CFileHeader ()
MajorVersion = 0;
MinorVersion = 0;
State = Modified;
Revision = "$R";
Revision += "evision$";
}
// ***************************************************************************
void CFileHeader::write (xmlNodePtr node, bool georges4CVS) const
{
// Version for CVS ?
if (georges4CVS)
{
// Georges version system
xmlSetProp (node, (const xmlChar*)"Revision", (const xmlChar*)Revision.c_str ());
}
else
void CFileHeader::write (xmlNodePtr node) const
{
// Georges version system
char tmp[512];
smprintf (tmp, 512, "%d.%d", MajorVersion, MinorVersion);
xmlSetProp (node, (const xmlChar*)"Version", (const xmlChar*)tmp);
}
// State
if (State == Modified)
@ -137,23 +126,6 @@ void CFileHeader::read (xmlNodePtr root)
MinorVersion = 0;
}
// Get the revision
value = (const char*)xmlGetProp (root, (xmlChar*)"Revision");
if (value)
{
// Set the value
Revision = value;
// Delete the value
xmlFree ((void*)value);
}
else
{
// Set default
Revision = "$R";
Revision += "evision$";
}
// Get the version
value = (const char*)xmlGetProp (root, (xmlChar*)"State");
if (value)

View file

@ -54,7 +54,7 @@ CType::~CType ()
// ***************************************************************************
void CType::write (xmlDocPtr doc, bool georges4CVS) const
void CType::write (xmlDocPtr doc) const
{
// Create the first node
xmlNodePtr node = xmlNewDocNode (doc, NULL, (const xmlChar*)"TYPE", NULL);
@ -98,7 +98,7 @@ void CType::write (xmlDocPtr doc, bool georges4CVS) const
}
// Header
Header.write (node, georges4CVS);
Header.write (node);
}
// ***************************************************************************

View file

@ -3857,6 +3857,7 @@ namespace NLGUI
else
{
/* Add our own request terminate handler. Nb: pass as param a UID, not the ptr */
/* FIX ME - every connection is appending a new callback to the list, and its never removed (Vinicius Arroyo)*/
HTNet_addAfter(requestTerminater, NULL, (void*)(size_t)_GroupHtmlUID, HT_ALL, HT_FILTER_LAST);
/* Set the timeout for long we are going to wait for a response */
@ -4003,6 +4004,7 @@ namespace NLGUI
else
{
/* Add our own request terminate handler. Nb: pass as param a UID, not the ptr */
/* FIX ME - every connection is appending a new callback to the list, and its never removed (Vinicius Arroyo)*/
HTNet_addAfter(requestTerminater, NULL, (void*)(size_t)_GroupHtmlUID, HT_ALL, HT_FILTER_LAST);
/* Start the first request */
@ -4089,7 +4091,10 @@ namespace NLGUI
// ***************************************************************************
void CGroupHTML::requestTerminated(HTRequest * /* request */)
void CGroupHTML::requestTerminated(HTRequest * request )
{
// this callback is being called for every request terminated
if (request == _LibWWW->Request)
{
// set the browser as complete
_Browsing = false;
@ -4101,6 +4106,7 @@ namespace NLGUI
setTitle(_TitlePrefix);
}
}
}
// ***************************************************************************

View file

@ -703,6 +703,11 @@ namespace NLGUI
// HTHost_setActiveTimeout (30000);
// HTHost_setPersistTimeout (30000);
// libwww default value is 2000ms for POST/PUT requests on the first and 3000 on the second, smallest allowed value is 21ms
// too small values may create timeout problems but we want it low as possible
// second value is the timeout for the second try to we set that high
HTTP_setBodyWriteDelay(250, 3000);
// Initialized
initialized = true;
}

View file

@ -31,10 +31,10 @@
#include "nel/misc/mutex.h"
#include "nel/misc/report.h"
#include "nel/misc/system_utils.h"
#include "nel/misc/variable.h"
#include "nel/misc/debug.h"
#ifdef NL_OS_WINDOWS
// these defines is for IsDebuggerPresent(). it'll not compile on windows 95
// just comment this and the IsDebuggerPresent to compile on windows 95
@ -57,6 +57,8 @@ using namespace std;
namespace NLMISC
{
CVariable<bool> StdDisplayerColor("nel", "StdDisplayerColor", "Enable colors in std displayer", true, 0, true);
static const char *LogTypeToString[][8] = {
{ "", "ERR", "WRN", "INF", "DBG", "STT", "AST", "UKN" },
{ "", "Error", "Warning", "Information", "Debug", "Statistic", "Assert", "Unknown" },
@ -139,9 +141,20 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess
bool needSpace = false;
//stringstream ss;
string str;
#ifdef NL_OS_UNIX
bool colorSet = false;
#endif
if (args.LogType != CLog::LOG_NO)
{
#ifdef NL_OS_UNIX
if (StdDisplayerColor.get())
{
if (args.LogType == CLog::LOG_ERROR || args.LogType == CLog::LOG_ASSERT) { str += "\e[0;30m\e[41m"; colorSet = true; } // black text, red background
else if (args.LogType == CLog::LOG_WARNING) { str += "\e[0;91m"; colorSet = true; } // bright red text
else if (args.LogType == CLog::LOG_DEBUG) { str += "\e[0;34m"; colorSet = true; } // blue text
}
#endif
//ss << logTypeToString(args.LogType);
str += logTypeToString(args.LogType);
needSpace = true;
@ -218,6 +231,13 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess
}
#endif // NL_OS_WINDOWS
#ifdef NL_OS_UNIX
if (colorSet)
{
str += "\e[0m";
}
#endif
// Printf ?
if (consoleMode)
{

View file

@ -242,11 +242,15 @@ void CSourceXAudio2::updateState()
if (!_AdpcmUtility->getSourceData())
{
_SoundDriver->getXAudio2()->CommitChanges(_OperationSet);
if (!_BufferStreaming)
{
// nldebug(NLSOUND_XAUDIO2_PREFIX "Stop");
if (FAILED(_SourceVoice->Stop(0)))
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED Stop");
_IsPlaying = false;
}
}
}
else
{
XAUDIO2_VOICE_STATE voice_state;
@ -254,6 +258,9 @@ void CSourceXAudio2::updateState()
if (!voice_state.BuffersQueued)
{
_SoundDriver->getXAudio2()->CommitChanges(_OperationSet);
if (!_BufferStreaming)
{
// nldebug(NLSOUND_XAUDIO2_PREFIX "Stop");
if (FAILED(_SourceVoice->Stop(0)))
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED Stop");
_IsPlaying = false;
@ -261,10 +268,13 @@ void CSourceXAudio2::updateState()
}
}
}
}
/// (Internal) Submit a buffer to the XAudio2 source voice.
void CSourceXAudio2::submitBuffer(CBufferXAudio2 *ibuffer)
{
// nldebug(NLSOUND_XAUDIO2_PREFIX "submitBuffer %u", (uint32)(void *)this);
nlassert(_SourceVoice);
nlassert(ibuffer->getFormat() == _Format
&& ibuffer->getChannels() == _Channels
@ -278,9 +288,9 @@ void CSourceXAudio2::submitBuffer(CBufferXAudio2 *ibuffer)
{
XAUDIO2_BUFFER buffer;
buffer.AudioBytes = ibuffer->getSize();
buffer.Flags = _IsLooping || _BufferStreaming ? 0 : XAUDIO2_END_OF_STREAM;
buffer.Flags = (_IsLooping || _BufferStreaming) ? 0 : XAUDIO2_END_OF_STREAM;
buffer.LoopBegin = 0;
buffer.LoopCount = _IsLooping ? XAUDIO2_LOOP_INFINITE : 0;
buffer.LoopCount = (_IsLooping && !_BufferStreaming) ? XAUDIO2_LOOP_INFINITE : 0;
buffer.LoopLength = 0;
buffer.pAudioData = const_cast<BYTE *>(ibuffer->getData());
buffer.pContext = ibuffer;
@ -336,7 +346,25 @@ void CSourceXAudio2::setupVoiceSends()
void CSourceXAudio2::setStreaming(bool streaming)
{
nlassert(!_IsPlaying);
// nldebug(NLSOUND_XAUDIO2_PREFIX "setStreaming %i", (uint32)streaming);
if (_SourceVoice)
{
XAUDIO2_VOICE_STATE voice_state;
_SourceVoice->GetState(&voice_state);
if (!voice_state.BuffersQueued)
{
nlwarning(NLSOUND_XAUDIO2_PREFIX "Switched streaming mode while buffer still queued!?! Flush");
_SoundDriver->getXAudio2()->CommitChanges(_OperationSet);
if (FAILED(_SourceVoice->FlushSourceBuffers()))
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED FlushSourceBuffers");
}
}
_BufferStreaming = streaming;
// nldebug(NLSOUND_XAUDIO2_PREFIX "setStreaming done %i", (uint32)streaming);
}
/// Set the buffer that will be played (no streaming)
@ -344,6 +372,8 @@ void CSourceXAudio2::setStaticBuffer(IBuffer *buffer)
{
nlassert(!_BufferStreaming);
// nldebug(NLSOUND_XAUDIO2_PREFIX "setStaticBuffer");
// if (buffer) // nldebug(NLSOUND_XAUDIO2_PREFIX "setStaticBuffer %s", _SoundDriver->getStringMapper()->unmap(buffer->getName()).c_str());
// else // nldebug(NLSOUND_XAUDIO2_PREFIX "setStaticBuffer NULL");
@ -364,32 +394,20 @@ IBuffer *CSourceXAudio2::getStaticBuffer()
/// Should be called by a thread which checks countStreamingBuffers every 100ms.
void CSourceXAudio2::submitStreamingBuffer(IBuffer *buffer)
{
// nldebug(NLSOUND_XAUDIO2_PREFIX "submitStreamingBuffer");
nlassert(_BufferStreaming);
// allow to change the format if not playing
if (!_IsPlaying)
{
IBuffer::TBufferFormat bufferFormat;
uint8 channels;
uint8 bitsPerSample;
uint32 frequency;
buffer->getFormat(bufferFormat, channels, bitsPerSample, frequency);
// allow to change the format if not playing
if (!_IsPlaying)
{
if (!_SourceVoice)
{
// if no source yet, prepare the format
preparePlay(bufferFormat, channels, bitsPerSample, frequency);
}
else
{
XAUDIO2_VOICE_STATE voice_state;
_SourceVoice->GetState(&voice_state);
// if no buffers queued, prepare the format
if (!voice_state.BuffersQueued)
{
preparePlay(bufferFormat, channels, bitsPerSample, frequency);
}
}
}
submitBuffer(static_cast<CBufferXAudio2 *>(buffer));
}
@ -414,9 +432,10 @@ uint CSourceXAudio2::countStreamingBuffers() const
/// Set looping on/off for future playbacks (default: off)
void CSourceXAudio2::setLooping(bool l)
{
// nldebug(NLSOUND_XAUDIO2_PREFIX "setLooping %u", (uint32)l);
nlassert(!_BufferStreaming);
// nldebug(NLSOUND_XAUDIO2_PREFIX "setLooping %u", (uint32)l);
if (_IsLooping != l)
{
_IsLooping = l;
@ -455,7 +474,7 @@ void CSourceXAudio2::setLooping(bool l)
_SourceVoice->GetState(&voice_state);
if (voice_state.BuffersQueued)
{
nlwarning(NLSOUND_XAUDIO2_PREFIX "not playing but buffer already queued???");
nlwarning(NLSOUND_XAUDIO2_PREFIX "Not playing but buffer already queued while switching loop mode!?! Flush and requeue");
if (FAILED(_SourceVoice->FlushSourceBuffers()))
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED FlushSourceBuffers");
// queue buffer with correct looping parameters
@ -603,6 +622,7 @@ bool CSourceXAudio2::play()
// preparePlay already called,
// stop already called before going into buffer streaming
nlassert(!_IsPlaying);
nlassert(_SourceVoice);
_PlayStart = CTime::getLocalTime();
if (SUCCEEDED(_SourceVoice->Start(0))) _IsPlaying = true;
else nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED Play (_BufferStreaming)");

View file

@ -57,15 +57,15 @@ ADD_DEFINITIONS(-DCORE_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)

View file

@ -40,6 +40,20 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_disp_sheet_id)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_disp_sheet_id.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -38,6 +38,19 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_example)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_example.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -44,9 +44,24 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_georges_editor)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_georges_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(ovqt_plugin_georges_editor ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
ENDIF(WITH_PCH)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_georges_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -364,7 +364,7 @@ namespace GeorgesQt
// ((CForm*)(UForm*)Form)->Header.MinorVersion++;
// }*/
// //((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS);
m_form->write(file, false);
m_form->write(file);
setWindowTitle(windowTitle().remove("*"));
m_modified = false;
// //if (strcmp (xmlStream.getErrorString (), "") != 0)

View file

@ -82,4 +82,18 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_gui_editor)
ADD_DEFINITIONS(-DGUI_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_gui_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -55,5 +55,20 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_landscape_editor)
ADD_DEFINITIONS(-DLANDSCAPE_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
#INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_landscape_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_landscape_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -36,6 +36,20 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_log)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_log.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -46,6 +46,21 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_mission_compiler)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_mission_compiler.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -196,6 +196,21 @@ IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(ovqt_plugin_object_viewer ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
ENDIF(WITH_PCH)
INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_object_viewer.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -29,6 +29,20 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_sheet_builder)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_sheet_builder.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -48,6 +48,19 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_translation_manager)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_translation_manager.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -65,6 +65,19 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_world_editor)
ADD_DEFINITIONS(-DWORLD_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_world_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -42,6 +42,20 @@ NL_ADD_LIB_SUFFIX(ovqt_plugin_zone_painter)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
IF(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ELSE(WIN32)
IF(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ELSE(WITH_INSTALL_LIBRARIES)
INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF(WIN32)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_zone_painter.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d)

View file

@ -4,7 +4,6 @@ ADD_SUBDIRECTORY(nel_patch_converter)
ADD_SUBDIRECTORY(nel_3dsmax_shared)
ADD_SUBDIRECTORY(nel_export)
ADD_SUBDIRECTORY(nel_patch_edit)
ADD_SUBDIRECTORY(nel_patch_edit_adv)
ADD_SUBDIRECTORY(nel_patch_paint)
ADD_SUBDIRECTORY(nel_vertex_tree_paint)
ADD_SUBDIRECTORY(tile_utility)

View file

@ -142,7 +142,7 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time)
{
bool tempBRet = bRet;
bRet = false;
// delete pShape; // FIXME: there is a delete bug with CMeshMultiLod exported from max!!!
delete pShape;
bRet = tempBRet;
}
catch (...)

View file

@ -99,7 +99,7 @@ bool SLightBuild::canConvertFromMaxLight (INode *node, TimeValue tvTime)
return false;
if( deleteIt )
maxLight->MaybeAutoDelete();
maxLight->DeleteThis();
return true;
}
@ -305,7 +305,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime)
this->rSoftShadowConeLength = (float)atof(sTmp.c_str());
if( deleteIt )
maxLight->MaybeAutoDelete();
maxLight->DeleteThis();
}
// ***********************************************************************************************

View file

@ -135,7 +135,7 @@ CCollisionMeshBuild* CExportNel::createCollisionMeshBuild(std::vector<INode *> &
// Delete the triObject if we should...
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
}
}

View file

@ -41,8 +41,10 @@ IShape* CExportNel::buildFlare(INode& node, TimeValue time)
CExportNel::getValueByNameUsingParamBlock2(node, "PersistenceParam", (ParamType2)TYPE_FLOAT, &persistence, 0);
fshape->setPersistence(persistence);
// retrieve spacing of the flare
CExportNel::getValueByNameUsingParamBlock2(node, "Spacing", (ParamType2)TYPE_FLOAT, &spacing, 0);
fshape->setFlareSpacing(spacing);
bool hasSpacing = CExportNel::getValueByNameUsingParamBlock2(node, "Spacing", (ParamType2)TYPE_FLOAT, &spacing, 0)
|| CExportNel::getValueByNameUsingParamBlock2(node, "spacing", (ParamType2)TYPE_FLOAT, &spacing, 0);
if (hasSpacing) fshape->setFlareSpacing(spacing);
else nlwarning("FAILED CFlareShape Spacing");
// retrieve use of radial attenuation
CExportNel::getValueByNameUsingParamBlock2(node, "Attenuable", (ParamType2) TYPE_BOOL, &attenuable, 0);
if (attenuable)

View file

@ -238,7 +238,7 @@ void CExportNel::getLights (std::vector<CLight>& vectLight, TimeValue time, INod
// Delete the GenLight if we should...
if (deleteIt)
maxLight->MaybeAutoDelete();
maxLight->DeleteThis();
}
}

View file

@ -179,7 +179,7 @@ bool CExportNel::buildLodCharacter (NL3D::CLodCharacterShapeBuild& lodBuild, IN
// Delete the triObject if we should...
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
}
}
}

View file

@ -17,6 +17,7 @@
#include "stdafx.h"
#include "export_nel.h"
#include "../tile_utility/tile_utility.h"
#include "nel/misc/path.h"
#include "nel/3d/texture_file.h"
#include "nel/3d/texture_multi_file.h"
#include "nel/3d/texture_cube.h"
@ -1139,9 +1140,9 @@ int CExportNel::getVertMapChannel (Texmap& texmap, Matrix3& channelMatrix, TimeV
}
// get the absolute or relative path from a texture filename
static std::string ConvertTexFileName(const char *src, bool _AbsolutePath)
static std::string ConvertTexFileName(const std::string &path, bool _AbsolutePath)
{
// File name, maxlen 256 under windows
/*// File name, maxlen 256 under windows
char sFileName[512];
strcpy (sFileName, src);
@ -1156,7 +1157,15 @@ static std::string ConvertTexFileName(const char *src, bool _AbsolutePath)
// Make the final path
_makepath (sFileName, NULL, NULL, sName, sExt);
}
return std::string(sFileName);
return std::string(sFileName);*/
if (_AbsolutePath)
{
return path;
}
else
{
return NLMISC::CFile::getFilename(path);
}
}
// Build a NeL texture corresponding with a max Texmap.
@ -1243,7 +1252,7 @@ ITexture* CExportNel::buildATexture (Texmap& texmap, CMaterialDesc &remap3dsTexC
if (l == 1 && !fileName[0].empty())
{
srcTex = new CTextureFile;
static_cast<CTextureFile *>(srcTex)->setFileName (ConvertTexFileName(fileName[0].c_str(), _AbsolutePath));
static_cast<CTextureFile *>(srcTex)->setFileName (ConvertTexFileName(fileName[0], _AbsolutePath));
}
else
{
@ -1253,7 +1262,8 @@ ITexture* CExportNel::buildATexture (Texmap& texmap, CMaterialDesc &remap3dsTexC
if (!fileName[k].empty())
{
/// set the name of the texture after converting it
static_cast<CTextureMultiFile *>(srcTex)->setFileName(k, ConvertTexFileName(fileName[k].c_str(), _AbsolutePath).c_str());
std::string convertMultiTex = ConvertTexFileName(fileName[k], _AbsolutePath);
static_cast<CTextureMultiFile *>(srcTex)->setFileName(k, convertMultiTex.c_str());
}
}
}
@ -1261,7 +1271,8 @@ ITexture* CExportNel::buildATexture (Texmap& texmap, CMaterialDesc &remap3dsTexC
else // standard texture
{
srcTex = new CTextureFile;
static_cast<CTextureFile *>(srcTex)->setFileName (ConvertTexFileName(pBitmap->GetMapName(), _AbsolutePath));
std::string mapName = pBitmap->GetMapName();
static_cast<CTextureFile *>(srcTex)->setFileName (ConvertTexFileName(mapName, _AbsolutePath));
}
// 2) Use this texture 'as it', or duplicate it to create the faces of a cube map
@ -1361,7 +1372,7 @@ NL3D::CTextureCube *CExportNel::buildTextureCubeFromReflectRefract(Texmap &texma
CTextureFile *pT = new CTextureFile();
// Set the file name
pT->setFileName(ConvertTexFileName(names[i].c_str(), _AbsolutePath));
pT->setFileName(ConvertTexFileName(names[i], _AbsolutePath));
// Set the texture
pTextureCube->setTexture(tfNewOrder[i], pT);

View file

@ -110,7 +110,7 @@ CMesh::CMeshBuild* CExportNel::createMeshBuild(INode& node, TimeValue tvTime, CM
// Delete the triObject if we should...
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
tri = NULL;
}
}
@ -449,7 +449,7 @@ NL3D::IShape *CExportNel::buildShape (INode& node, TimeValue time, const TInodeP
// Delete the triObject if we should...
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
tri = NULL;
}
}
@ -1406,7 +1406,7 @@ IMeshGeom *CExportNel::buildMeshGeom (INode& node, TimeValue time, const TInodeP
// Delete the triObject if we should...
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
tri = NULL;
}
}
@ -2058,7 +2058,7 @@ NL3D::IShape *CExportNel::buildWaterShape(INode& node, TimeValue time)
// Delete the triObject if we should...
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
tri = NULL;
nlinfo("WaterShape : build succesful");
return ws;
@ -2100,11 +2100,8 @@ bool CExportNel::buildMeshAABBox(INode &node, NLMISC::CAABBox &dest, TimeValue t
dest.setMinMax(nelMin, nelMax);
//
if (deleteIt)
{
#ifdef NL_DONT_FIND_MAX_CRASH
tri->MaybeAutoDelete();
#endif // NL_DEBUG
}
tri->DeleteThis();
tri = NULL;
return true;
}

View file

@ -180,7 +180,7 @@ bool CMeshInterface::buildFromMaxMesh(INode &node, TimeValue tvTime)
}
//
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
tri = NULL;
return true;
}
@ -362,7 +362,7 @@ static void AddNodeToQuadGrid(const NLMISC::CAABBox &delimiter, TNodeFaceQG &des
nldebug("%d faces where added", numFaceAdded);
//
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
tri = NULL;
}
}
@ -495,7 +495,7 @@ static bool SelectVerticesInMeshFromInterfaces(const std::vector<CMeshInterface>
if (obj != tri)
{
// not a mesh object, so do nothing
tri->MaybeAutoDelete();
tri->DeleteThis();
tri = NULL;
return false;
}

View file

@ -409,7 +409,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName
}
else
{
nldebug("Invalid type specified for pblock2 value with name '%s', given type '%u', found '%u'",
nlwarning("Invalid type specified for pblock2 value with name '%s', given type '%u', found '%u'",
sName, (uint32)type, (uint32)paramType);
}
}
@ -448,7 +448,7 @@ bool CExportNel::getValueByNameUsingParamBlock2 (Animatable& node, const char* s
}
else
{
// nlwarning ("Can't found ParamBlock named %s", sName);
// nlwarning ("FAILED Can't find ParamBlock named '%s'", sName);
return false;
}
}
@ -1272,7 +1272,7 @@ void CExportNel::buildCamera(NL3D::CCameraInfo &cameraInfo, INode& node, TimeVal
cameraInfo.Fov = genCamera->GetFOV(time);
if (deleteIt)
genCamera->MaybeAutoDelete();
genCamera->DeleteThis();
genCamera = NULL;
}
}

View file

@ -1446,7 +1446,7 @@ bool CExportNel::mirrorPhysiqueSelection(INode &node, TimeValue tvTime, const st
// Delete the triObject if we should...
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
tri = NULL;
// ok!

View file

@ -154,7 +154,7 @@ bool CExportNel::buildVegetableShape (NL3D::CVegetableShape& skeletonShape, INo
}
if (deleteIt)
tri->MaybeAutoDelete();
tri->DeleteThis();
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

View file

@ -1,21 +0,0 @@
FILE(GLOB SRC *.cpp *.h *.def)
ADD_LIBRARY(nel_patch_edit_adv SHARED ${SRC} mods.rc)
INCLUDE_DIRECTORIES(${MAXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(nel_patch_edit_adv
nelmisc
nel3d
nel_mesh_lib
nel_patch_lib
nel_3dsmax_shared
${MAXSDK_LIBRARIES}
Version.lib
comctl32.lib)
SET_TARGET_PROPERTIES(nel_patch_edit_adv PROPERTIES SUFFIX ".dlm")
NL_DEFAULT_PROPS(nel_patch_edit_adv "MAX Plugin: NeL Patch Edit (Adv)")
NL_ADD_RUNTIME_FLAGS(nel_patch_edit_adv)
NL_ADD_LIB_SUFFIX(nel_patch_edit_adv)
INSTALL(TARGETS nel_patch_edit_adv RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

View file

@ -1,857 +0,0 @@
/**********************************************************************
*<
FILE: editpat.cpp
DESCRIPTION: Edit Patch OSM
CREATED BY: Tom Hudson, Dan Silva & Rolf Berteig
HISTORY: created 23 June, 1995
IMPORTANT USAGE NOTE:
When you do an operation in edit patch which will change the topology, the form
of the code should look like this code, taken from the vertex deletion:
-----
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
--> RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
int altered = 0;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
PatchMesh *patch = patchData->TempData(this)->GetPatch(t);
if (!patch)
continue;
--> patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->vertSel.NumberSet())
{
altered = holdNeeded = 1;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, "DoVertDelete"));
// Call the vertex delete function
DeleteSelVerts(patch);
--> patchData->UpdateChanges(patch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
--> ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_VERTDELETE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOVERTSSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
-----
The key elements in the "changed topology" case are the calls noted by arrows.
These record special tags inside the object so that after the topology is changed
by the modifier code, the UpdateChanges code can make a new mapping from the old
object topology to the new.
If the operation doesn't change the topology, then the three topology tag calls
aren't needed and the UpdateChanges call becomes:
patchData->UpdateChanges(patch, FALSE);
This tells UpdateChanges not to bother remapping the topology.
*> Copyright(c) 1994, All Rights Reserved.
**********************************************************************/
#include "stdafx.h"
#include "editpat.h"
#include "../nel_patch_lib/vertex_neighborhood.h"
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
// Uncomment this for vert mapper debugging
//#define VMAP_DEBUG 1
// Forward references
INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void ResetVert (PatchMesh *patch);
// A handy zero point
Point3 zeroPoint(0, 0, 0);
// Our temporary prompts last 2 seconds:
#define PROMPT_TIME 2000
// in mods.cpp
extern HINSTANCE hInstance;
// Select by material parameters
int sbmParams[4] = {1, 1, RPO_DEFAULT_TESSEL, RPO_DEFAULT_TESSEL};
// Select by smooth parameters
DWORD sbsParams[3] = {1, 1, 0};
float weldThreshold = 0.1f;
// Checkbox items for rollup pages
int attachReorient = 0;
// This is a special override value which allows us to hit-test on
// any sub-part of a patch
extern int patchHitOverride; // If zero, no override is done
void SetPatchHitOverride(int value)
{
patchHitOverride = value;
}
void ClearPatchHitOverride()
{
patchHitOverride = 0;
}
PatchDeleteUser pDel;
extern PatchRightMenu pMenu;
/*-------------------------------------------------------------------*/
static EditPatchClassDesc editPatchDesc;
extern ClassDesc* GetEditPatchModDesc() { return &editPatchDesc; }
void EditPatchClassDesc::ResetClassParams(BOOL fileReset)
{
sbmParams[0] = 1;
sbmParams[1] = 1;
sbmParams[2] = RPO_DEFAULT_TESSEL;
sbmParams[3] = RPO_DEFAULT_TESSEL;
EditPatchMod::condenseMat = FALSE;
EditPatchMod::attachMat = ATTACHMAT_IDTOMAT;
}
/*-------------------------------------------------------------------*/
int EditPatchMod::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags, ModContext *mc)
{
return 0;
}
void EditPatchMod::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp *vpt, Box3& box, ModContext *mc)
{
box.Init();
}
//---------------------------------------------------------------------
// UI stuff
void EditPatchMod::RecordTopologyTags()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patch->RecordTopologyTags();
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
}
class ChangeNamedSetRestore : public RestoreObj
{
public:
BitArray oldset, newset;
int index;
GenericNamedSelSetList *setList;
ChangeNamedSetRestore(GenericNamedSelSetList *sl, int ix, BitArray *o)
{
setList = sl;
index = ix;
oldset = *o;
}
void Restore(int isUndo)
{
newset = *(setList->sets[index]);
*(setList->sets[index]) = oldset;
}
void Redo()
{
*(setList->sets[index]) = newset;
}
TSTR Description() {return TSTR(_T("Change Named Sel Set"));}
};
// Selection set, misc fixup utility function
// This depends on PatchMesh::RecordTopologyTags being called prior to the topo changes
void EditPatchMod::ResolveTopoChanges()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
// First, the vertex selections
int set;
for (set = 0; set < patchData->vselSet.Count(); ++set)
{
BitArray *oldVS = &patchData->vselSet[set];
BitArray newVS;
newVS.SetSize(patch->numVerts);
for (int vert = 0; vert < patch->numVerts; ++vert)
{
// Get the knot's previous location, then copy that selection into the new set
int tag = patch->verts[vert].aux1;
if (tag >= 0)
newVS.Set(vert, (*oldVS)[tag]);
else
newVS.Clear(vert);
}
if (theHold.Holding())
theHold.Put(new ChangeNamedSetRestore(&patchData->vselSet, set, oldVS));
patchData->vselSet[set] = newVS;
}
// Now the edge selections
for (set = 0; set < patchData->eselSet.Count(); ++set)
{
BitArray *oldES = &patchData->eselSet[set];
BitArray newES;
newES.SetSize(patch->numEdges);
for (int edge = 0; edge < patch->numEdges; ++edge)
{
// Get the knot's previous location, then copy that selection into the new set
int tag = patch->edges[edge].aux1;
if (tag >= 0)
newES.Set(edge, (*oldES)[tag]);
else
newES.Clear(edge);
}
if (theHold.Holding())
theHold.Put(new ChangeNamedSetRestore(&patchData->eselSet, set, oldES));
patchData->eselSet[set] = newES;
}
// Now the patch selections
for (set = 0; set < patchData->pselSet.Count(); ++set)
{
BitArray *oldPS = &patchData->pselSet[set];
BitArray newPS;
newPS.SetSize(patch->numPatches);
for (int p = 0; p < patch->numPatches; ++p)
{
// Get the knot's previous location, then copy that selection into the new set
int tag = patch->patches[p].aux1;
if (tag >= 0)
newPS.Set(p, (*oldPS)[tag]);
else
newPS.Clear(p);
}
if (theHold.Holding())
theHold.Put(new ChangeNamedSetRestore(&patchData->pselSet, set, oldPS));
patchData->pselSet[set] = newPS;
}
// watje 4-16-99
patch->HookFixTopology();
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
}
class EPModContextEnumProc : public ModContextEnumProc
{
float f;
public:
EPModContextEnumProc(float f) { this->f = f; }
BOOL proc(ModContext *mc); // Return FALSE to stop, TRUE to continue.
};
BOOL EPModContextEnumProc::proc(ModContext *mc)
{
EditPatchData *patchData =(EditPatchData*)mc->localData;
if (patchData)
patchData->RescaleWorldUnits(f);
return TRUE;
}
// World scaling
void EditPatchMod::RescaleWorldUnits(float f)
{
if (TestAFlag(A_WORK1))
return;
SetAFlag(A_WORK1);
// rescale all our references
for (int i = 0; i < NumRefs(); i++)
{
ReferenceMaker *srm = GetReference(i);
if (srm)
srm->RescaleWorldUnits(f);
}
// Now rescale stuff inside our data structures
EPModContextEnumProc proc(f);
EnumModContexts(&proc);
NotifyDependents(FOREVER, PART_GEOM, REFMSG_CHANGE);
}
void EditPatchMod::InvalidateSurfaceUI()
{
if (hSurfPanel && selLevel == EP_PATCH)
{
InvalidateRect(hSurfPanel, NULL, FALSE);
patchUIValid = FALSE;
}
}
void EditPatchMod::InvalidateTileUI()
{
if (hTilePanel && selLevel == EP_TILE)
{
InvalidateRect(hTilePanel, NULL, FALSE);
tileUIValid = FALSE;
}
}
void EditPatchMod::InvalidateEdgeUI()
{
if (hEdgePanel && selLevel == EP_EDGE)
{
InvalidateRect(hEdgePanel, NULL, FALSE);
edgeUIValid = FALSE;
}
}
BitArray *EditPatchMod::GetLevelSelectionSet(PatchMesh *patch, RPatchMesh *rpatch)
{
switch (selLevel)
{
case EP_VERTEX:
return &patch->vertSel;
case EP_PATCH:
return &patch->patchSel;
case EP_EDGE:
return &patch->edgeSel;
case EP_TILE:
return &rpatch->tileSel;
}
nlassert(0);
return NULL;
}
void EditPatchMod::UpdateSelectDisplay()
{
TSTR buf;
int num, j;
if (!hSelectPanel)
return;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
switch (GetSubobjectLevel())
{
case EP_OBJECT:
buf.printf(GetString(IDS_TH_OBJECT_SEL));
break;
case EP_VERTEX:
{
num = 0;
PatchMesh *thePatch = NULL;
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->tempData && patchData->TempData(this)->PatchCached(ip->GetTime()))
{
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(), rpatch);
if (!patch)
continue;
int thisNum = patch->vertSel.NumberSet();
if (thisNum)
{
num += thisNum;
thePatch = patch;
}
}
}
if (num == 1)
{
for (j = 0; j < thePatch->vertSel.GetSize(); j++)
if (thePatch->vertSel[j])
break;
buf.printf(GetString(IDS_TH_NUMVERTSEL), j + 1);
}
else
buf.printf(GetString(IDS_TH_NUMVERTSELP), num);
}
break;
case EP_PATCH:
{
num = 0;
PatchMesh *thePatch = NULL;
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->tempData && patchData->TempData(this)->PatchCached(ip->GetTime()))
{
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(), rpatch);
if (!patch)
continue;
int thisNum = patch->patchSel.NumberSet();
if (thisNum)
{
num += thisNum;
thePatch = patch;
}
}
}
if (num == 1)
{
for (j = 0; j < thePatch->patchSel.GetSize(); j++)
if (thePatch->patchSel[j])
break;
buf.printf(GetString(IDS_TH_NUMPATCHSEL), j + 1);
}
else
buf.printf(GetString(IDS_TH_NUMPATCHSELP), num);
}
break;
case EP_EDGE:
{
num = 0;
PatchMesh *thePatch = NULL;
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->tempData && patchData->TempData(this)->PatchCached(ip->GetTime()))
{
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(), rpatch);
if (!patch)
continue;
int thisNum = patch->edgeSel.NumberSet();
if (thisNum)
{
num += thisNum;
thePatch = patch;
}
}
}
if (num == 1)
{
for (j = 0; j < thePatch->edgeSel.GetSize(); j++)
if (thePatch->edgeSel[j])
break;
buf.printf(GetString(IDS_TH_NUMEDGESEL), j + 1);
}
else
buf.printf(GetString(IDS_TH_NUMEDGESELP), num);
}
break;
case EP_TILE:
{
num = 0;
RPatchMesh *thePatch = NULL;
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->tempData && patchData->TempData(this)->PatchCached(ip->GetTime()))
{
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(), rpatch);
if (!patch)
continue;
int thisNum = rpatch->tileSel.NumberSet();
if (thisNum)
{
num += thisNum;
thePatch = rpatch;
}
}
}
if (num == 1)
{
for (j = 0; j < thePatch->tileSel.GetSize(); j++)
if (thePatch->tileSel[j])
break;
buf.printf("Tile %d Selected", j + 1);
}
else
buf.printf("%d Tiles Selected", num);
}
break;
}
nodes.DisposeTemporary();
SetDlgItemText(hSelectPanel, IDC_NUMSEL_LABEL, buf);
}
void EditPatchMod::DoVertWeld()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
int holdNeeded = 0;
BOOL hadSel = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->vertSel.NumberSet() > 1)
{
hadSel = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoVertWeld"));
// Call the patch weld function
if (patch->Weld(weldThreshold))
{
rpatch->Weld (patch);
altered = holdNeeded = TRUE;
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_VERTWELD));
}
else
{
if (!hadSel)
ip->DisplayTempPrompt(GetString(IDS_TH_NOVERTSSEL), PROMPT_TIME);
else
ip->DisplayTempPrompt(GetString(IDS_TH_NOWELDPERFORMED), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
void EditPatchMod::DoVertReset ()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
int holdNeeded = 0;
BOOL hadSel = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->vertSel.NumberSet() > 0)
{
hadSel = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoVertReset"));
// Call the patch weld function
ResetVert (patch);
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_GEOM);
/*if (patch->Weld(weldThreshold))
{
rpatch->Weld (patch);
altered = holdNeeded = TRUE;
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}*/
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
ResolveTopoChanges();
theHold.Accept("Reset Vertex");
/*if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_VERTWELD));
}
else
{
if (!hadSel)
ip->DisplayTempPrompt(GetString(IDS_TH_NOVERTSSEL), PROMPT_TIME);
else
ip->DisplayTempPrompt(GetString(IDS_TH_NOWELDPERFORMED), PROMPT_TIME);
theHold.End();
}*/
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_GEOM, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
void EditPatchMod::PatchSelChanged()
{
SelectionChanged();
if (hSurfPanel && selLevel == EP_PATCH)
InvalidateSurfaceUI();
if (hTilePanel && selLevel == EP_TILE)
InvalidateTileUI();
if (hEdgePanel && selLevel == EP_EDGE)
InvalidateEdgeUI();
}
/*
class AdvParams
{
public:
TessSubdivStyle mStyle;
int mMin, mMax;
int mTris;
};
*/
void EditPatchMod::LocalDataChanged()
{
}
int GetPointIndex (int nVertex, int nPatch, PatchMesh* patch)
{
for (int n=0; n<4; n++)
{
if (patch->patches[nPatch].v[n]==nVertex)
return n;
}
nlassert (0);
return 0;
}
Point3 GetInterior (int nPatch, int nInt, PatchMesh* patch)
{
return patch->vecs[patch->patches[nPatch].interior[nInt]].p;
}
void ResetVert (PatchMesh *patch)
{
// Make a edge table
// Static table to avoid alloc prb
CVertexNeighborhood& edgeTab=vertexNeighborhoodGlobal;
edgeTab.build (*patch);
// For each vertices
for (int nV=0; nV<patch->numVerts; nV++)
{
// Selected ?
if (patch->vertSel[nV])
{
Point3 vert=patch->verts[nV].p;
Point3 normal (0,0,0);
// Count of neigbor for vertex n
uint listSize=edgeTab.getNeighborCount (nV);
// List of neigbor
const uint* pList=edgeTab.getNeighborList (nV);
// For each neigbor
uint nn;
for (nn=0; nn<listSize; nn++)
{
#if (MAX_RELEASE < 4000)
// Compute average plane
if (patch->edges[pList[nn]].patch1!=-1)
normal+=patch->PatchNormal(patch->edges[pList[nn]].patch1);
if (patch->edges[pList[nn]].patch2!=-1)
normal+=patch->PatchNormal(patch->edges[pList[nn]].patch2);
#else // (MAX_RELEASE <= 4000)
// Compute average plane
if (patch->edges[pList[nn]].patches[0]!=-1)
normal+=patch->PatchNormal(patch->edges[pList[nn]].patches[0]);
if (patch->edges[pList[nn]].patches[1]!=-1)
normal+=patch->PatchNormal(patch->edges[pList[nn]].patches[1]);
#endif // (MAX_RELEASE <= 4000)
}
// Normalize
normal=normal.Normalize();
// Plane
float fD=-DotProd(normal, vert);
// Reset normales
float fNorme=0.f;
// For each neigbor
for (nn=0; nn<listSize; nn++)
{
Point3 vect2=patch->verts[(patch->edges[pList[nn]].v1==nV)?patch->edges[pList[nn]].v2:patch->edges[pList[nn]].v1].p;
vect2-=vert;
vect2/=3.f;
Point3 tmp1=CrossProd (vect2, normal);
tmp1=CrossProd (normal, tmp1);
tmp1=Normalize(tmp1);
int nTang=(patch->edges[pList[nn]].v1==nV)?patch->edges[pList[nn]].vec12:patch->edges[pList[nn]].vec21;
patch->vecs[nTang].p=vert+tmp1*DotProd (tmp1,vect2);
tmp1=patch->vecs[nTang].p;
tmp1-=vert;
fNorme+=tmp1.Length();
}
// Renorme new normal
/*fNorme/=(float)edgeTab[nV].size();
ite=edgeTab[nV].begin();
while (ite!=edgeTab[nV].end())
{
int nTang=(patch->edges[pList[nn]].v1==nV)?patch->edges[pList[nn]].vec12:patch->edges[pList[nn]].vec21;
patch->vecs[nTang].p=fNorme*(Normalize(patch->vecs[nTang].p-vert))+vert;
ite++;
}*/
}
}
patch->computeInteriors();
patch->InvalidateGeomCache ();
}

View file

@ -1,425 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern int attachReorient;
// ------------------------------------------------------------------------------------------------------------------------------------------------------
static void AddPatches(int type, PatchMesh *patch, RPatchMesh *rpatch, BOOL postWeld)
{
if (!patch->edgeSel.NumberSet())
return; // Nothing to do!
int lastVert = patch->getNumVerts();
int edges = patch->getNumEdges();
if (type==PATCH_TRI)
MessageBox (NULL, "Rykol tools", "C'est pas cool les tripatches...", MB_OK|MB_ICONEXCLAMATION);
// Add a patch of the desired type to each selected edge that doesn't have two patches atatched!
for (int i = 0; i < edges; ++i)
{
if (patch->edgeSel[i])
{
PatchEdge &edge = patch->edges[i];
#if (MAX_RELEASE < 4000)
int nFirstPatch=edge.patch1;
if (edge.patch2 < 0)
#else // (MAX_RELEASE < 4000)
int nFirstPatch=edge.patches[0];
if (edge.patches[1] < 0)
#endif // (MAX_RELEASE < 4000)
{
int verts = patch->getNumVerts();
int vecs = patch->getNumVecs();
int patches = patch->getNumPatches();
patch->setNumPatches(patches + 1, TRUE); // Add a patch
patch->patches[patches].SetType(type); // Make it the type we want
patch->setNumVerts(verts + type - 2, TRUE); // Add the appropriate number of verts
rpatch->SetNumVerts(verts + type - 2); // And the appropriate vector count
patch->setNumVecs(vecs +(type - 1) * 2 + type, TRUE); // And the appropriate vector count
Point3 p1 = patch->verts[edge.v1].p;
Point3 p2 = patch->verts[edge.v2].p;
Point3 v12 = patch->vecs[edge.vec12].p;
Point3 v21 = patch->vecs[edge.vec21].p;
Point3 edgeCenter =(p1 + p2) / 2.0f;
// Load up the patch with the correct vert/vector indices
#if (MAX_RELEASE < 4000)
Patch &spatch = patch->patches[edge.patch1];
#else // (MAX_RELEASE < 4000)
Patch &spatch = patch->patches[edge.patches[0]];
#endif // (MAX_RELEASE < 4000)
Patch &dpatch = patch->patches[patches];
switch (type)
{
case PATCH_TRI:
dpatch.setVerts(edge.v2, edge.v1, verts);
dpatch.setVecs(edge.vec21, edge.vec12, vecs, vecs + 1, vecs + 2, vecs + 3);
dpatch.setInteriors(vecs + 4, vecs + 5, vecs + 6);
switch (spatch.type)
{
case PATCH_TRI:
{ // Tri from Tri
// Find the opposite vertex in the source triangle
int opposite, o2a, o1a;
if (spatch.edge[0] == i)
{
opposite = 2;
o1a = 5;
o2a = 2;
}
else
if (spatch.edge[1] == i)
{
opposite = 0;
o1a = 1;
o2a = 4;
}
else
{
opposite = 1;
o1a = 3;
o2a = 0;
}
// Compute the new vert position
Point3 oppVec = edgeCenter - patch->verts[spatch.v[opposite]].p;
float oppLen = Length(oppVec);
if (oppLen == 0.0f)
{
oppVec = Point3(0, 0, 1);
oppLen = 1.0f;
}
Point3 v1a = patch->vecs[spatch.vec[o1a]].p - p1;
Point3 v2a = patch->vecs[spatch.vec[o2a]].p - p2;
Point3 n1a, n2a;
if (Length(v1a) > 0.0f)
n1a = Normalize(v1a);
else
n1a = Normalize(oppVec);
if (Length(v2a) > 0.0f)
n2a = Normalize(v2a);
else
n2a = Normalize(oppVec);
// Build a composite vector based on the two edge vectors
Point3 compVec = Normalize((n1a + n2a) / 2.0f);
// Create the new vertex
Point3 newPos = edgeCenter - compVec * oppLen;
patch->verts[verts].p = newPos;
// Compute the vectors
patch->vecs[vecs].p = p1 - v1a;
patch->vecs[vecs + 1].p = newPos -(newPos - p1) / 3.0f;
patch->vecs[vecs + 2].p = newPos -(newPos - p2) / 3.0f;
patch->vecs[vecs + 3].p = p2 - v2a;
}
break;
case PATCH_QUAD:
{ // Tri from Quad
// Find the opposite edge verts in the source quad
int opposite1, opposite2, o1a, o2a;
if (spatch.edge[0] == i)
{
opposite1 = 2;
opposite2 = 3;
o1a = 7;
o2a = 2;
}
else
if (spatch.edge[1] == i)
{
opposite1 = 3;
opposite2 = 0;
o1a = 1;
o2a = 4;
}
else
if (spatch.edge[2] == i)
{
opposite1 = 0;
opposite2 = 1;
o1a = 3;
o2a = 6;
}
else
{
opposite1 = 1;
opposite2 = 2;
o1a = 5;
o2a = 0;
}
// Compute the new vert position
Point3 otherCenter =(patch->verts[spatch.v[opposite1]].p + patch->verts[spatch.v[opposite2]].p) / 2.0f;
Point3 oppVec = edgeCenter - otherCenter;
float oppLen = Length(oppVec);
if (oppLen == 0.0f)
{
oppVec = Point3(0, 0, 1);
oppLen = 1.0f;
}
Point3 v1a = patch->vecs[spatch.vec[o1a]].p - p1;
Point3 v2a = patch->vecs[spatch.vec[o2a]].p - p2;
Point3 n1a, n2a;
if (Length(v1a) > 0.0f)
n1a = Normalize(v1a);
else
n1a = Normalize(oppVec);
if (Length(v2a) > 0.0f)
n2a = Normalize(v2a);
else
n2a = Normalize(oppVec);
// Build a composite vector based on the two edge vectors
Point3 compVec = Normalize((n1a + n2a) / 2.0f);
// Create the new vertex
Point3 newPos = edgeCenter - compVec * oppLen;
patch->verts[verts].p = newPos;
// Compute the vectors
patch->vecs[vecs].p = p1 - v1a;
patch->vecs[vecs + 1].p = newPos -(newPos - p1) / 3.0f;
patch->vecs[vecs + 2].p = newPos -(newPos - p2) / 3.0f;
patch->vecs[vecs + 3].p = p2 - v2a;
}
break;
}
break;
case PATCH_QUAD:
dpatch.setVerts(edge.v2, edge.v1, verts, verts + 1);
dpatch.setVecs(edge.vec21, edge.vec12, vecs, vecs + 1, vecs + 2, vecs + 3, vecs + 4, vecs + 5);
dpatch.setInteriors(vecs + 6, vecs + 7, vecs + 8, vecs + 9);
switch (spatch.type)
{
case PATCH_TRI:
{ // Quad from Tri
// Find the opposite vertex in the source triangle
int opposite, o2a, o1a;
if (spatch.edge[0] == i)
{
opposite = 2;
o1a = 5;
o2a = 2;
}
else
if (spatch.edge[1] == i)
{
opposite = 0;
o1a = 1;
o2a = 4;
}
else
{
opposite = 1;
o1a = 3;
o2a = 0;
}
Point3 oppVec = edgeCenter - patch->verts[spatch.v[opposite]].p;
float oppLen = Length(oppVec);
if (oppLen == 0.0f)
{
oppVec = Point3(0, 0, 1);
oppLen = 1.0f;
}
Point3 v1a = patch->vecs[spatch.vec[o1a]].p - p1;
Point3 v2a = patch->vecs[spatch.vec[o2a]].p - p2;
Point3 n1a, n2a;
if (Length(v1a) > 0.0f)
n1a = Normalize(v1a);
else
n1a = Normalize(oppVec);
if (Length(v2a) > 0.0f)
n2a = Normalize(v2a);
else
n2a = Normalize(oppVec);
// Compute the new vert positions
Point3 newPos1 = p1 - n1a * oppLen;
Point3 newPos2 = p2 - n2a * oppLen;
patch->verts[verts].p = newPos1;
patch->verts[verts + 1].p = newPos2;
// Compute the vectors
patch->vecs[vecs].p = p1 - v1a;
patch->vecs[vecs + 1].p = newPos1 -(newPos1 - p1) / 3.0f;
patch->vecs[vecs + 2].p = newPos1 +(v12 - p1);
patch->vecs[vecs + 3].p = newPos2 +(v21 - p2);
patch->vecs[vecs + 4].p = newPos2 +(p2 - newPos2) / 3.0f;
patch->vecs[vecs + 5].p = p2 - v2a;
}
break;
case PATCH_QUAD:
{ // Quad from Quad
// Find the opposite edge verts in the source quad
int opposite1, opposite2, o1a, o2a;
if (spatch.edge[0] == i)
{
opposite1 = 2;
opposite2 = 3;
o1a = 7;
o2a = 2;
}
else
if (spatch.edge[1] == i)
{
opposite1 = 3;
opposite2 = 0;
o1a = 1;
o2a = 4;
}
else
if (spatch.edge[2] == i)
{
opposite1 = 0;
opposite2 = 1;
o1a = 3;
o2a = 6;
}
else
{
opposite1 = 1;
opposite2 = 2;
o1a = 5;
o2a = 0;
}
Point3 otherCenter =(patch->verts[spatch.v[opposite1]].p + patch->verts[spatch.v[opposite2]].p) / 2.0f;
Point3 oppVec = edgeCenter - otherCenter;
float oppLen = Length(oppVec);
if (oppLen == 0.0f)
{
oppVec = Point3(0, 0, 1);
oppLen = 1.0f;
}
Point3 v1a = patch->vecs[spatch.vec[o1a]].p - p1;
Point3 v2a = patch->vecs[spatch.vec[o2a]].p - p2;
Point3 n1a, n2a;
if (Length(v1a) > 0.0f)
n1a = Normalize(v1a);
else
n1a = Normalize(oppVec);
if (Length(v2a) > 0.0f)
n2a = Normalize(v2a);
else
n2a = Normalize(oppVec);
// Compute the new vert position
Point3 newPos1 = p1 - n1a * oppLen;
Point3 newPos2 = p2 - n2a * oppLen;
patch->verts[verts].p = newPos1;
patch->verts[verts + 1].p = newPos2;
// Compute the vectors
patch->vecs[vecs].p = p1 - v1a;
patch->vecs[vecs + 1].p = newPos1 -(newPos1 - p1) / 3.0f;
patch->vecs[vecs + 2].p = newPos1 +(v12 - p1);
patch->vecs[vecs + 3].p = newPos2 +(v21 - p2);
patch->vecs[vecs + 4].p = newPos2 +(p2 - newPos2) / 3.0f;
patch->vecs[vecs + 5].p = p2 - v2a;
}
break;
}
break;
}
rpatch->AddPatch (i, nFirstPatch, patch);
}
}
}
patch->computeInteriors();
patch->buildLinkages();
// This step welds all new identical verts
if (postWeld &&(patch->getNumVerts() != lastVert))
patch->Weld(0.0f, TRUE, lastVert);
}
// ---------------------------------------------------------------------------
BOOL PatchAddRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
{
oldPatch = *patch;
roldPatch = *rpatch;
}
AddPatches(type, patch, rpatch, postWeld);
return TRUE;
}
// ---------------------------------------------------------------------------
void EditPatchMod::DoPatchAdd(int type)
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
int holdNeeded = 0;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
int altered = 0;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->edgeSel.NumberSet())
{
altered = holdNeeded = 1;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchAdd"));
// Call the patch add function
AddPatches(type, patch, rpatch, TRUE);
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHADD));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOVALIDEDGESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}

View file

@ -1,276 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern int attachReorient;
// ------------------------------------------------------------------------------------------------------------------------------------------------------
int EditPatchMod::DoAttach(INode *node, PatchMesh *attPatch, RPatchMesh *rattPatch, bool & canUndo)
{
ModContextList mcList;
INodeTab nodes;
if (!ip)
return 0;
ip->GetModContexts(mcList, nodes);
if (mcList.Count() != 1)
{
nodes.DisposeTemporary();
return 0;
}
EditPatchData *patchData =(EditPatchData*)mcList[0]->localData;
if (!patchData)
{
nodes.DisposeTemporary();
return 0;
}
patchData->BeginEdit(ip->GetTime());
// If the mesh isn't yet cached, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(), rpatch);
if (!patch)
{
nodes.DisposeTemporary();
return 0;
}
patchData->RecordTopologyTags(patch);
RecordTopologyTags();
// Transform the shape for attachment:
// If reorienting, just translate to align pivots
// Otherwise, transform to match our transform
Matrix3 attMat(1);
if (attachReorient)
{
Matrix3 thisTM = nodes[0]->GetNodeTM(ip->GetTime());
Matrix3 thisOTMBWSM = nodes[0]->GetObjTMBeforeWSM(ip->GetTime());
Matrix3 thisPivTM = thisTM * Inverse(thisOTMBWSM);
Matrix3 otherTM = node->GetNodeTM(ip->GetTime());
Matrix3 otherOTMBWSM = node->GetObjTMBeforeWSM(ip->GetTime());
Matrix3 otherPivTM = otherTM * Inverse(otherOTMBWSM);
Point3 otherObjOffset = node->GetObjOffsetPos();
attMat = Inverse(otherPivTM) * thisPivTM;
}
else
{
attMat = node->GetObjectTM(ip->GetTime()) *
Inverse(nodes[0]->GetObjectTM(ip->GetTime()));
}
// RB 3-17-96 : Check for mirroring
AffineParts parts;
decomp_affine(attMat, &parts);
if (parts.f < 0.0f)
{
int v[8], ct, ct2, j;
Point3 p[9];
for (int i = 0; i < attPatch->numPatches; i++)
{
// Re-order rpatch
if (attPatch->patches[i].type == PATCH_QUAD)
{
UI_PATCH rpatch=rattPatch->getUIPatch (i);
int ctU=rpatch.NbTilesU<<1;
int ctV=rpatch.NbTilesV<<1;
int nU;
for (nU=0; nU<ctU; nU++)
{
for (int nV=0; nV<ctV; nV++)
{
rattPatch->getUIPatch (i).getTileDesc (nU+nV*ctU)=rpatch.getTileDesc (ctU-1-nU+(ctV-1-nV)*ctU);
}
}
for (nU=0; nU<ctU+1; nU++)
{
for (int nV=0; nV<ctV+1; nV++)
{
rattPatch->getUIPatch (i).setColor (nU+nV*(ctU+1), rpatch.getColor (ctU-nU+(ctV-nV)*ctU));
}
}
}
// Re-order vertices
ct = attPatch->patches[i].type == PATCH_QUAD ? 4 : 3;
for (j = 0; j < ct; j++)
{
v[j] = attPatch->patches[i].v[j];
}
for (j = 0; j < ct; j++)
{
attPatch->patches[i].v[j] = v[ct - j - 1];
}
// Re-order vecs
ct = attPatch->patches[i].type == PATCH_QUAD ? 8 : 6;
ct2 = attPatch->patches[i].type == PATCH_QUAD ? 5 : 3;
for (j = 0; j < ct; j++)
{
v[j] = attPatch->patches[i].vec[j];
}
for (j = 0; j < ct; j++, ct2--)
{
if (ct2 < 0)
ct2 = ct - 1;
attPatch->patches[i].vec[j] = v[ct2];
}
// Re-order enteriors
if (attPatch->patches[i].type == PATCH_QUAD)
{
ct = 4;
for (j = 0; j < ct; j++)
{
v[j] = attPatch->patches[i].interior[j];
}
for (j = 0; j < ct; j++)
{
attPatch->patches[i].interior[j] = v[ct - j - 1];
}
}
// Re-order aux
if (attPatch->patches[i].type == PATCH_TRI)
{
ct = 9;
for (j = 0; j < ct; j++)
{
p[j] = attPatch->patches[i].aux[j];
}
for (j = 0; j < ct; j++)
{
attPatch->patches[i].aux[j] = p[ct - j - 1];
}
}
// Re-order TV faces if present
for (int chan = 0; chan < patch->getNumMaps(); ++chan)
{
if (attPatch->tvPatches[chan])
{
ct = 4;
for (j = 0; j < ct; j++)
{
v[j] = attPatch->tvPatches[chan][i].tv[j];
}
for (j = 0; j < ct; j++)
{
attPatch->tvPatches[chan][i].tv[j] = v[ct - j - 1];
}
}
}
}
}
int i;
for (i = 0; i < attPatch->numVerts; ++i)
attPatch->verts[i].p = attPatch->verts[i].p * attMat;
for (i = 0; i < attPatch->numVecs; ++i)
attPatch->vecs[i].p = attPatch->vecs[i].p * attMat;
attPatch->computeInteriors();
theHold.Begin();
// Combine the materials of the two nodes.
int mat2Offset = 0;
Mtl *m1 = nodes[0]->GetMtl();
Mtl *m2 = node->GetMtl();
bool condenseMe = FALSE;
if (m1 && m2 &&(m1 != m2))
{
if (attachMat == ATTACHMAT_IDTOMAT)
{
int ct = 1;
if (m1->IsMultiMtl())
ct = m1->NumSubMtls();
for (int i = 0; i < patch->numPatches; ++i)
{
int mtid = patch->getPatchMtlIndex(i);
if (mtid >= ct)
patch->setPatchMtlIndex(i, mtid % ct);
}
FitPatchIDsToMaterial(*attPatch, m2);
if (condenseMat)
condenseMe = TRUE;
}
// the theHold calls here were a vain attempt to make this all undoable.
// This should be revisited in the future so we don't have to use the SYSSET_CLEAR_UNDO.
theHold.Suspend();
if (attachMat == ATTACHMAT_MATTOID)
{
m1 = FitMaterialToPatchIDs(*patch, m1);
m2 = FitMaterialToPatchIDs(*attPatch, m2);
}
Mtl *multi = CombineMaterials(m1, m2, mat2Offset);
if (attachMat == ATTACHMAT_NEITHER)
mat2Offset = 0;
theHold.Resume();
// We can't be in face subobject mode, else we screw up the materials:
DWORD oldSL = patch->selLevel;
DWORD roldSL = patch->selLevel;
patch->selLevel = PATCH_OBJECT;
rpatch->SetSelLevel (EP_OBJECT);
nodes[0]->SetMtl(multi);
patch->selLevel = oldSL;
rpatch->SetSelLevel (roldSL);
m1 = multi;
canUndo = FALSE; // Absolutely cannot undo material combinations.
}
if (!m1 && m2)
{
// We can't be in face subobject mode, else we screw up the materials:
DWORD oldSL = patch->selLevel;
DWORD roldSL = rpatch->GetSelLevel();
patch->selLevel = PATCH_OBJECT;
rpatch->SetSelLevel (EP_OBJECT);
nodes[0]->SetMtl(m2);
patch->selLevel = oldSL;
rpatch->SetSelLevel (roldSL);
m1 = m2;
}
// Start a restore object...
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoAttach"));
// Do the attach
patch->Attach(attPatch, mat2Offset);
rpatch->Attach(rattPatch, *patch);
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO | PART_GEOM);
// Get rid of the original node
ip->DeleteNode(node);
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_ATTACH));
if (m1 && condenseMe)
{
// Following clears undo stack.
patch = patchData->TempData(this)->GetPatch(ip->GetTime(), rpatch);
m1 = CondenseMatAssignments(*patch, m1);
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO | PART_GEOM, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
return 1;
}

View file

@ -1,382 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
int EPM_BevelMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2 m)
{
ViewExp *vpt = ip->GetViewport(hwnd);
Point3 p0, p1;
ISpinnerControl *spin;
int ln, ln2;
IPoint2 m2;
float amount;
switch (msg)
{
case MOUSE_PROPCLICK:
ip->SetStdCommandMode(CID_OBJMOVE);
break;
case MOUSE_POINT:
if (point == 0)
{
po->BeginExtrude(ip->GetTime());
om = m;
}
else if (point == 1)
{
po->EndExtrude(ip->GetTime(), TRUE);
po->BeginBevel(ip->GetTime());
om = m;
}
else
{
ip->RedrawViews(ip->GetTime(), REDRAW_END);
po->EndBevel(ip->GetTime(), TRUE);
}
break;
case MOUSE_MOVE:
if (point == 1)
{
p0 = vpt->MapScreenToView(om, float(-200));
// sca 1999.02.24: find worldspace point with om's x value and m's y value
m2.x = om.x;
m2.y = m.y;
p1 = vpt->MapScreenToView(m2, float(-200));
amount = Length(p1 - p0);
ln = IsDlgButtonChecked(po->hOpsPanel, IDC_EM_EXTYPE_B);
if (om.y < m.y)
amount *= -1.0f;
po->Extrude(ip->GetTime(), amount, ln);
spin = GetISpinner(GetDlgItem(po->hOpsPanel, IDC_EP_EXTRUDESPINNER));
if (spin)
{
spin->SetValue(amount, FALSE);
ReleaseISpinner(spin);
}
ip->RedrawViews(ip->GetTime(), REDRAW_INTERACTIVE);
}
else if (point == 2)
{
p0 = vpt->MapScreenToView(om, float(-200));
// sca 1999.02.24: find worldspace point with om's x value and m's y value
m2.x = om.x;
m2.y = m.y;
p1 = vpt->MapScreenToView(m2, float(-200));
if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH))
ln = 0;
else if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH2))
ln = 1;
else if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH3))
ln = 2;
if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH4))
ln2 = 0;
else if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH5))
ln2 = 1;
else if (IsDlgButtonChecked(po->hOpsPanel, IDC_EP_SM_SMOOTH6))
ln2 = 2;
amount = Length(p1 - p0);
if (om.y < m.y)
amount *= -1.0f;
po->Bevel(ip->GetTime(), amount, ln, ln2);
spin = GetISpinner(GetDlgItem(po->hOpsPanel, IDC_EP_OUTLINESPINNER));
if (spin)
{
spin->SetValue(amount, FALSE);
ReleaseISpinner(spin);
}
ip->RedrawViews(ip->GetTime(), REDRAW_INTERACTIVE);
}
break;
case MOUSE_ABORT:
if (point == 1)
po->EndExtrude(ip->GetTime(), FALSE);
else if (point>1)
po->EndBevel(ip->GetTime(), FALSE);
ip->RedrawViews(ip->GetTime(), REDRAW_END);
break;
}
if (vpt)
ip->ReleaseViewport(vpt);
return TRUE;
}
// --------------------------------------------------------------------------------
HCURSOR EPM_BevelSelectionProcessor::GetTransformCursor()
{
static HCURSOR hCur = NULL;
if (!hCur)
hCur = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_BEVEL));
return hCur;
}
// --------------------------------------------------------------------------------
void EPM_BevelCMode::EnterMode()
{
if (!po->hOpsPanel)
return;
ICustButton *but = GetICustButton(GetDlgItem(po->hOpsPanel, IDC_EP_BEVEL));
but->SetCheck(TRUE);
ReleaseICustButton(but);
}
// --------------------------------------------------------------------------------
void EPM_BevelCMode::ExitMode()
{
if (!po->hOpsPanel)
return;
ICustButton *but = GetICustButton(GetDlgItem(po->hOpsPanel, IDC_EP_BEVEL));
but->SetCheck(FALSE);
ReleaseICustButton(but);
ISpinnerControl *spin;
spin = GetISpinner(GetDlgItem(po->hOpsPanel, IDC_EP_OUTLINESPINNER));
if (spin)
{
spin->SetValue(0.0f, FALSE);
ReleaseISpinner(spin);
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::DoBevel()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->patchSel.NumberSet())
{
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
patch->CreateBevel();
// patch->CreateExtrusion();
// patch->InvalidateGeomCache();
// InvalidateMesh();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
/*
theHold.Begin();
patch.RecordTopologyTags();
POPatchGenRecord *rec = new POPatchGenRecord(this);
if (theHold.Holding())
theHold.Put(new PatchObjectRestore(this, rec));
patch.CreateBevel();
ResolveTopoChanges();
theHold.Accept(GetResString(IDS_TH_PATCHADD));
patch.InvalidateGeomCache();
InvalidateMesh();
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
*/
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::BeginBevel(TimeValue t)
{
if (inBevel)
return;
inBevel = TRUE;
theHold.SuperBegin();
DoBevel();
// PlugControllersSel(t,sel);
theHold.Begin();
}
void EditPatchMod::EndBevel(TimeValue t, BOOL accept)
{
if (!ip)
return;
if (!inBevel)
return;
inBevel = FALSE;
// TempData()->freeBevelInfo();
ISpinnerControl *spin;
spin = GetISpinner(GetDlgItem(hOpsPanel, IDC_EP_OUTLINESPINNER));
if (spin)
{
spin->SetValue(0, FALSE);
ReleaseISpinner(spin);
}
theHold.Accept(GetString(IDS_EM_BEVEL));
if (accept)
theHold.SuperAccept(GetString(IDS_EM_BEVEL));
else theHold.SuperCancel();
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::Bevel(TimeValue t, float amount, BOOL smoothStart, BOOL smoothEnd)
{
if (!inBevel)
return;
ModContextList mcList;
INodeTab nodes;
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
// theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->patchSel.NumberSet())
{
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
patch->Bevel(amount, smoothStart, smoothEnd);
// patch->MoveNormal(amount,useLocalNorms);
// patch->InvalidateGeomCache();
// InvalidateMesh();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
/*
theHold.Restore();
patch.Bevel(amount, smoothStart, smoothEnd);
patch.InvalidateGeomCache();
InvalidateMesh();
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
*/
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -1,541 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern void DeletePatchParts(PatchMesh *patch, RPatchMesh *rpatch, BitArray &delVerts, BitArray &delPatches);
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::DoDeleteSelected()
{
switch (GetSubobjectLevel())
{
case EP_VERTEX:
DoVertDelete();
break;
case EP_EDGE:
DoEdgeDelete();
break;
case EP_PATCH:
DoPatchDelete();
break;
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
static void DeleteSelPatches(PatchMesh *patch, RPatchMesh *rpatch)
{
if (!patch->patchSel.NumberSet())
return; // Nothing to do!
int patches = patch->getNumPatches();
int verts = patch->getNumVerts();
// Tag the patches that are selected
BitArray delPatches(patches);
delPatches = patch->patchSel;
BitArray delVerts(verts);
delVerts.ClearAll();
DeletePatchParts(patch, rpatch, delVerts, delPatches);
patch->computeInteriors();
}
// ---------------------------------------------------------------------------
BOOL PatchDeleteRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
{
oldPatch = *patch;
roldPatch = *rpatch;
}
DeleteSelPatches(patch, rpatch);
return TRUE;
}
// ---------------------------------------------------------------------------
void EditPatchMod::DoPatchDelete()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
int holdNeeded = 0;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
int altered = 0;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->patchSel.NumberSet())
{
altered = holdNeeded = 1;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchDelete"));
// Call the patch delete function
DeleteSelPatches(patch, rpatch);
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHDELETE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void DeleteSelVerts(PatchMesh *patch, RPatchMesh *rpatch)
{
if (!patch->vertSel.NumberSet())
return; // Nothing to do!
int patches = patch->getNumPatches();
int verts = patch->getNumVerts();
// Tag the patches that use selected vertices
BitArray delPatches(patches);
delPatches.ClearAll();
for (int i = 0; i < patches; ++i)
{
Patch& p = patch->patches[i];
for (int j = 0; j < p.type; ++j)
{
if (patch->vertSel[p.v[j]])
{
delPatches.Set(i);
goto next_patch;
}
}
next_patch:;
}
BitArray delVerts(verts);
delVerts = patch->vertSel;
DeletePatchParts(patch, rpatch, delVerts, delPatches);
patch->computeInteriors();
}
// ---------------------------------------------------------------------------
// Vertex Delete modifier method
void EditPatchMod::DoVertDelete()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
int holdNeeded = 0;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
int altered = 0;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->vertSel.NumberSet())
{
altered = holdNeeded = 1;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoVertDelete"));
// Call the vertex delete function
DeleteSelVerts(patch, rpatch);
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_VERTDELETE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOVERTSSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// Edger Delete modifier method
void EditPatchMod::DoEdgeDelete()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
int holdNeeded = 0;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
int altered = 0;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->edgeSel.NumberSet())
{
altered = holdNeeded = 1;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoEdgeDelete"));
int edges = patch->getNumEdges();
int patches = patch->getNumPatches();
int verts = patch->getNumVerts();
// Tag the patches that are attached to selected edges
BitArray delPatches(patches);
delPatches.ClearAll();
for (int i = 0; i < edges; ++i)
{
if (patch->edgeSel[i])
{
#if (MAX_RELEASE < 4000)
if (patch->edges[i].patch1 >= 0)
delPatches.Set(patch->edges[i].patch1);
if (patch->edges[i].patch2 >= 0)
delPatches.Set(patch->edges[i].patch2);
#else // (MAX_RELEASE < 4000)
if (patch->edges[i].patches[0] >= 0)
delPatches.Set(patch->edges[i].patches[0]);
if (patch->edges[i].patches[1] >= 0)
delPatches.Set(patch->edges[i].patches[1]);
#endif // (MAX_RELEASE < 4000)
}
}
BitArray delVerts(verts);
delVerts.ClearAll();
DeletePatchParts(patch, rpatch, delVerts, delPatches);
patch->computeInteriors();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_EDGEDELETE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOEDGESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// Deletes any vertices tagged, also any patches tagged. Automatically deletes the vectors that
// are deleted as a result of the patch deletion and sweeps any vertices floating in space.
void DeletePatchParts(PatchMesh *patch, RPatchMesh *rpatch, BitArray &delVerts, BitArray &delPatches)
{
int patches = patch->getNumPatches();
int verts = patch->getNumVerts();
int vecs = patch->getNumVecs();
int dest;
// We treat vectors specially in order to clean up after welds. First, we tag 'em all,
// then untag only those on unselected patches so that any dangling vectors will be deleted.
BitArray delVectors(vecs);
delVectors.SetAll();
// Untag vectors that are on nondeleted patches
int i;
for (i = 0; i < patches; ++i)
{
if (!delPatches[i])
{
Patch& p = patch->patches[i];
int j;
for (j = 0; j <(p.type * 2); ++j)
{
delVectors.Clear(p.vec[j]);
}
for (j = 0; j < p.type; ++j)
delVectors.Clear(p.interior[j]);
}
}
// Make a table of vertices that are still in use -- Used to
// delete those vertices which are floating, unused, in space.
BitArray usedVerts(verts);
usedVerts.ClearAll();
for (i = 0; i < patches; ++i)
{
if (!delPatches[i])
{
Patch& p = patch->patches[i];
for (int j = 0; j < p.type; ++j)
{
usedVerts.Set(p.v[j]);
}
}
}
for (i = 0; i < verts; ++i)
{
if (!usedVerts[i])
delVerts.Set(i);
}
// If we have texture vertices, handle them, too
for (int chan = 0; chan < patch->getNumMaps(); ++chan)
{
int tverts = patch->numTVerts[chan];
if (tverts && patch->tvPatches[chan])
{
BitArray delTVerts(tverts);
delTVerts.SetAll();
for (i = 0; i < patches; ++i)
{
if (!delPatches[i])
{
Patch& p = patch->patches[i];
TVPatch& tp = patch->tvPatches[chan][i];
for (int j = 0; j < p.type; ++j)
delTVerts.Clear(tp.tv[j]);
}
}
// Got the list of tverts to delete -- now delete 'em
// Build a table of redirected texture vertex indices
int newTVerts = tverts - delTVerts.NumberSet();
IntTab tVertIndex;
tVertIndex.SetCount(tverts);
UVVert *newTVertArray = new UVVert[newTVerts];
dest = 0;
for (i = 0; i < tverts; ++i)
{
if (!delTVerts[i])
{
newTVertArray[dest] = patch->tVerts[chan][i];
tVertIndex[i] = dest++;
}
}
delete[] patch->tVerts[chan];
#if MAX_RELEASE <= 3100
patch->tVerts[chan] = newTVertArray;
#else
*(patch->tVerts[chan]) = *newTVertArray;
#endif
patch->numTVerts[chan] = newTVerts;
// Now, copy the untagged texture patches to a new array
// While you're at it, redirect the vertex indices
int newTVPatches = patches - delPatches.NumberSet();
TVPatch *newArray = new TVPatch[newTVPatches];
dest = 0;
for (i = 0; i < patches; ++i)
{
if (!delPatches[i])
{
Patch& p = patch->patches[i];
TVPatch& tp = newArray[dest++];
tp = patch->tvPatches[chan][i];
for (int j = 0; j < p.type; ++j)
tp.tv[j] = tVertIndex[tp.tv[j]];
}
}
delete[] patch->tvPatches[chan];
patch->tvPatches[chan] = newArray;;
}
}
// Build a table of redirected vector indices
IntTab vecIndex;
vecIndex.SetCount(vecs);
int newVectors = vecs - delVectors.NumberSet();
PatchVec *newVecArray = new PatchVec[newVectors];
dest = 0;
for (i = 0; i < vecs; ++i)
{
if (!delVectors[i])
{
newVecArray[dest] = patch->vecs[i];
vecIndex[i] = dest++;
}
else
vecIndex[i] = -1;
}
delete[] patch->vecs;
patch->vecs = newVecArray;
patch->numVecs = newVectors;
// Build a table of redirected vertex indices
int newVerts = verts - delVerts.NumberSet();
IntTab vertIndex;
vertIndex.SetCount(verts);
PatchVert *newVertArray = new PatchVert[newVerts];
BitArray newVertSel(newVerts);
newVertSel.ClearAll();
dest = 0;
for (i = 0; i < verts; ++i)
{
if (!delVerts[i])
{
newVertArray[dest] = patch->verts[i];
newVertSel.Set(dest, patch->vertSel[i]);
// redirect & adjust attached vector list
PatchVert& v = newVertArray[dest];
for (int j = 0; j < v.vectors.Count(); ++j)
{
v.vectors[j] = vecIndex[v.vectors[j]];
if (v.vectors[j] < 0)
{
v.vectors.Delete(j, 1);
j--; // realign index
}
}
vertIndex[i] = dest++;
}
}
delete[] patch->verts;
patch->verts = newVertArray;
patch->numVerts = newVerts;
patch->vertSel = newVertSel;
// Now, copy the untagged patches to a new array
// While you're at it, redirect the vertex and vector indices
int newPatches = patches - delPatches.NumberSet();
Patch *newArray = new Patch[newPatches];
BitArray newPatchSel(newPatches);
newPatchSel.ClearAll();
dest = 0;
for (i = 0; i < patches; ++i)
{
if (!delPatches[i])
{
newArray[dest] = patch->patches[i];
Patch& p = newArray[dest];
int j;
for (j = 0; j < p.type; ++j)
p.v[j] = vertIndex[p.v[j]];
for (j = 0; j <(p.type * 2); ++j)
p.vec[j] = vecIndex[p.vec[j]];
for (j = 0; j < p.type; ++j)
p.interior[j] = vecIndex[p.interior[j]];
newPatchSel.Set(dest++, patch->patchSel[i]);
}
}
// Rebuild info in rpatch
rpatch->DeleteAndSweep (delVerts, delPatches, *patch);
delete[] patch->patches;
patch->patches = newArray;;
patch->numPatches = newPatches;
patch->patchSel.SetSize(newPatches, TRUE);
patch->patchSel = newPatchSel;
patch->buildLinkages();
}

View file

@ -1,297 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern void DeletePatchParts(PatchMesh *patch, RPatchMesh *rpatch, BitArray &delVerts, BitArray &delPatches);
// ------------------------------------------------------------------------------------------------------------------------------------------------------
static TSTR detachName;
static BOOL CALLBACK DetachDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
TCHAR tempName[256];
switch (message)
{
case WM_INITDIALOG:
SetDlgItemText(hDlg, IDC_DETACH_NAME, detachName);
SetFocus(GetDlgItem(hDlg, IDC_DETACH_NAME));
return FALSE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
GetDlgItemText(hDlg, IDC_DETACH_NAME, tempName, 255);
detachName = TSTR(tempName);
EndDialog(hDlg, 1);
return TRUE;
case IDCANCEL:
EndDialog(hDlg, 0);
return TRUE;
}
}
return FALSE;
}
// ---------------------------------------------------------------------------
static int GetDetachOptions(IObjParam *ip, TSTR& newName)
{
detachName = newName;
ip->MakeNameUnique(detachName);
if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_DETACH), ip->GetMAXHWnd(), (DLGPROC)DetachDialogProc) == 1)
{
newName = detachName;
return 1;
}
return 0;
}
// ---------------------------------------------------------------------------
static void MakeDummyMapPatches(int channel, PatchMesh *patch)
{
patch->setNumMapVerts(channel, 1);
patch->tVerts[channel][0] = UVVert(0, 0, 0);
patch->setNumMapPatches(channel, patch->numPatches);
for (int i = 0; i < patch->numPatches; ++i)
{
Patch &p = patch->patches[i];
TVPatch &tp = patch->tvPatches[channel][i];
tp.Init(); // Sets all indices to zero
}
}
// ---------------------------------------------------------------------------
// Detach all selected patches
void EditPatchMod::DoPatchDetach(int copy, int reorient)
{
int dialoged = 0;
TSTR newName(GetString(IDS_TH_PATCH));
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
int holdNeeded = 0;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
// Create a patch mesh object
RPO *patchOb = new RPO;
patchOb->rpatch = new RPatchMesh;
PatchMesh &pmesh = patchOb->patch;
RPatchMesh &prmesh = *patchOb->rpatch;
int verts = 0;
int vecs = 0;
int patches = 0;
int multipleObjects =(mcList.Count() > 1) ? 1 : 0;
for (int i = 0; i < mcList.Count(); i++)
{
int altered = 0;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any patches selected, we'll need to process this one
if (patch->patchSel.NumberSet())
{
if (!dialoged)
{
dialoged = 1;
if (!GetDetachOptions(ip, newName))
goto bail_out;
}
// Save the unmodified info.
if (theHold.Holding())
{
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchDetach"));
}
PatchMesh wpatch = *patch;
RPatchMesh wrpatch = *rpatch;
BitArray vdel(wpatch.numVerts);
vdel.ClearAll();
BitArray pdel = wpatch.patchSel; // Get inverse selection set
// If not copying, delete the patches from this object
if (!copy)
DeletePatchParts(patch, rpatch, vdel, pdel);
pdel = ~wpatch.patchSel; // Get inverse selection set
if (pdel.NumberSet())
{
vdel.ClearAll();
DeletePatchParts(&wpatch, &wrpatch, vdel, pdel);
}
// RPatchMesh validity
wrpatch.Validity (wpatch, true);
// We've deleted everything that wasn't selected -- Now add this to the patch object accumulator
int oldVerts = pmesh.numVerts;
int oldVecs = pmesh.numVecs;
int oldPatches = pmesh.numPatches;
int newVerts = oldVerts + wpatch.numVerts;
int newVecs = oldVecs + wpatch.numVecs;
int newPatches = oldPatches + wpatch.numPatches;
pmesh.setNumVerts(newVerts, TRUE);
pmesh.setNumVecs(newVecs, TRUE);
pmesh.setNumPatches(newPatches, TRUE);
prmesh.SetNumVerts (newVerts);
prmesh.SetNumPatches (newPatches);
altered = holdNeeded = 1;
Matrix3 tm(1);
if (multipleObjects && !reorient)
tm = nodes[i]->GetObjectTM(t);
int i, i2;
for (i = 0, i2 = oldVerts; i < wpatch.numVerts; ++i, ++i2)
{
pmesh.verts[i2] = wpatch.verts[i];
pmesh.verts[i2].p = pmesh.verts[i2].p * tm;
// Copy rpatch info
prmesh.getUIVertex (i2)=wrpatch.getUIVertex (i);
}
for (i = 0, i2 = oldVecs; i < wpatch.numVecs; ++i, ++i2)
{
pmesh.vecs[i2] = wpatch.vecs[i];
pmesh.vecs[i2].p = pmesh.vecs[i2].p * tm;
}
for (i = 0, i2 = oldPatches; i < wpatch.numPatches; ++i, ++i2)
{
Patch &p = wpatch.patches[i];
Patch &p2 = pmesh.patches[i2];
p2 = p;
int j;
for (j = 0; j < p2.type; ++j)
{
// Adjust vertices and interior vectors
p2.v[j] += oldVerts;
p2.interior[j] += oldVecs;
}
for (j = 0; j <(p2.type * 2); ++j) // Adjust edge vectors
p2.vec[j] += oldVecs;
// Copy rpatch info
prmesh.getUIPatch (i2)=wrpatch.getUIPatch (i);
}
// Now copy over mapping information
int dmaps = pmesh.getNumMaps();
int smaps = wpatch.getNumMaps();
int maxMaps = dmaps > smaps ? dmaps : smaps;
if (maxMaps != dmaps)
pmesh.setNumMaps(maxMaps, TRUE);
if (maxMaps != smaps)
wpatch.setNumMaps(maxMaps, TRUE);
// Then make sure any active maps are active in both:
int chan;
for (chan = 0; chan < maxMaps; ++chan)
{
if (pmesh.tvPatches[chan] || wpatch.tvPatches[chan])
{
if (!pmesh.tvPatches[chan])
MakeDummyMapPatches(chan, &pmesh);
if (!wpatch.tvPatches[chan])
MakeDummyMapPatches(chan, &wpatch);
}
}
for (chan = 0; chan < pmesh.getNumMaps(); ++chan)
{
if (chan < wpatch.getNumMaps())
{
int oldTVerts = pmesh.numTVerts[chan];
int newTVerts = oldTVerts + wpatch.numTVerts[chan];
pmesh.setNumMapVerts(chan, newTVerts, TRUE);
for (i = 0, i2 = oldTVerts; i < wpatch.numTVerts[chan]; ++i, ++i2)
pmesh.tVerts[chan][i2] = wpatch.tVerts[chan][i];
if (pmesh.tvPatches[chan])
{
for (i = 0, i2 = oldPatches; i < wpatch.numPatches; ++i, ++i2)
{
Patch &p = wpatch.patches[i];
TVPatch &tp = wpatch.tvPatches[chan][i];
TVPatch &tp2 = pmesh.tvPatches[chan][i2];
tp2 = tp;
for (int j = 0; j < p.type; ++j) // Adjust vertices
tp2.tv[j] += oldTVerts;
}
}
}
}
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
bail_out:
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
pmesh.computeInteriors();
pmesh.buildLinkages();
INode *newNode = ip->CreateObjectNode(patchOb);
newNode->SetMtl(nodes[0]->GetMtl());
newNode->SetName(newName.data());
patchOb->patch.InvalidateGeomCache();
if (!multipleObjects)
{
// Single input object?
if (!reorient)
{
Matrix3 tm = nodes[0]->GetObjectTM(t);
newNode->SetNodeTM(t, tm); // Use this object's TM.
}
}
else
{
if (!reorient)
{
Matrix3 matrix;
matrix.IdentityMatrix();
newNode->SetNodeTM(t, matrix); // Use identity TM
}
}
newNode->FlagForeground(t); // WORKAROUND!
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_DETACHPATCH));
}
else
{
delete patchOb; // Didn't need it after all!
if (!dialoged)
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(t, REDRAW_NORMAL);
}

View file

@ -1,341 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
int EPM_ExtrudeMouseProc::proc(HWND hwnd, int msg, int point, int flags, IPoint2 m)
{
ViewExp *vpt = ip->GetViewport(hwnd);
Point3 p0, p1;
ISpinnerControl *spin;
BOOL ln;
IPoint2 m2;
float amount;
switch (msg)
{
case MOUSE_PROPCLICK:
ip->SetStdCommandMode(CID_OBJMOVE);
break;
case MOUSE_POINT:
if (!point)
{
po->BeginExtrude(ip->GetTime());
om = m;
} else
{
ip->RedrawViews(ip->GetTime(), REDRAW_END);
po->EndExtrude(ip->GetTime(), TRUE);
}
break;
case MOUSE_MOVE:
p0 = vpt->MapScreenToView(om, float(-200));
// sca 1999.02.24: Find m's projection in om's vertical axis:
m2.x = om.x;
m2.y = m.y;
p1 = vpt->MapScreenToView(m2, float(-200));
amount = Length(p1 - p0);
if (m.y > om.y)
amount *= -1.0f;
ln = IsDlgButtonChecked(po->hOpsPanel, IDC_EM_EXTYPE_B);
po->Extrude(ip->GetTime(), amount, ln);
spin = GetISpinner(GetDlgItem(po->hOpsPanel, IDC_EP_EXTRUDESPINNER));
if (spin)
{
spin->SetValue(amount, FALSE); // sca - use signed value here too.
ReleaseISpinner(spin);
}
ip->RedrawViews(ip->GetTime(), REDRAW_INTERACTIVE);
break;
case MOUSE_ABORT:
po->EndExtrude(ip->GetTime(), FALSE);
ip->RedrawViews(ip->GetTime(), REDRAW_END);
break;
}
if (vpt)
ip->ReleaseViewport(vpt);
return TRUE;
}
// --------------------------------------------------------------------------------
HCURSOR EPM_ExtrudeSelectionProcessor::GetTransformCursor()
{
static HCURSOR hCur = NULL;
if (!hCur)
hCur = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_EXTRUDECUR));
return hCur;
}
// --------------------------------------------------------------------------------
void EPM_ExtrudeCMode::EnterMode()
{
if (!po->hOpsPanel)
return;
ICustButton *but = GetICustButton(GetDlgItem(po->hOpsPanel, IDC_EP_EXTRUDE));
but->SetCheck(TRUE);
ReleaseICustButton(but);
}
// --------------------------------------------------------------------------------
void EPM_ExtrudeCMode::ExitMode()
{
if (!po->hOpsPanel)
return;
ICustButton *but = GetICustButton(GetDlgItem(po->hOpsPanel, IDC_EP_EXTRUDE));
but->SetCheck(FALSE);
ReleaseICustButton(but);
ISpinnerControl *spin;
spin = GetISpinner(GetDlgItem(po->hOpsPanel, IDC_EP_EXTRUDESPINNER));
if (spin)
{
spin->SetValue(0.0f, FALSE);
ReleaseISpinner(spin);
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::DoExtrude()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->patchSel.NumberSet())
{
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
patch->CreateExtrusion();
rpatch->CreateExtrusion(patch);
// patch->InvalidateGeomCache();
// InvalidateMesh();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
/*
theHold.Begin();
patch.RecordTopologyTags();
POPatchGenRecord *rec = new POPatchGenRecord(this);
if (theHold.Holding())
theHold.Put(new PatchObjectRestore(this, rec));
patch.CreateExtrusion();
ResolveTopoChanges();
theHold.Accept(GetResString(IDS_TH_PATCHADD));
patch.InvalidateGeomCache();
InvalidateMesh();
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
*/
}
void EditPatchMod::BeginExtrude(TimeValue t)
{
if (inExtrude)
return;
inExtrude = TRUE;
theHold.SuperBegin();
DoExtrude();
// PlugControllersSel(t,sel);
theHold.Begin();
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::EndExtrude(TimeValue t, BOOL accept)
{
if (!ip)
return;
if (!inExtrude)
return;
ISpinnerControl *spin;
inExtrude = FALSE;
spin = GetISpinner(GetDlgItem(hOpsPanel, IDC_EP_EXTRUDESPINNER));
if (spin)
{
spin->SetValue(0, FALSE);
ReleaseISpinner(spin);
}
// TempData()->freeBevelInfo();
theHold.Accept(GetString(IDS_RB_EXTRUDE));
if (accept)
theHold.SuperAccept(GetString(IDS_RB_EXTRUDE));
else theHold.SuperCancel();
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::Extrude(TimeValue t, float amount, BOOL useLocalNorms)
{
if (!inExtrude)
return;
ModContextList mcList;
INodeTab nodes;
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
// theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->patchSel.NumberSet())
{
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
#if (MAX_RELEASE < 4000)
patch->MoveNormal(amount, useLocalNorms);
#else
patch->MoveNormal(amount, useLocalNorms, PATCH_PATCH);
#endif
patch->InvalidateGeomCache();
//InvalidateMesh();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
/* theHold.Restore();
patch.MoveNormal(amount, useLocalNorms);
patch.InvalidateGeomCache();
InvalidateMesh();
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
*/
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -1,326 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define OLD_SEL_LEVEL_CHUNK 0x1000 // Original backwards ordering
#define SEL_LEVEL_CHUNK 0x1001
#define DISP_LATTICE_CHUNK 0x1010
#define DISP_SURFACE_CHUNK 0x1020
#define DISP_VERTS_CHUNK 0x1030
#define EPM_MESH_ATTRIB_CHUNK 0x1040
#define EPM_VTESS_ATTRIB_CHUNK 0x1090
#define EPM_PTESS_ATTRIB_CHUNK 0x10a0
#define EPM_DTESS_ATTRIB_CHUNK 0x10b0
#define EPM_NORMAL_TESS_ATTRIB_CHUNK 0x10c0
#define EPM_WELD_TESS_ATTRIB_CHUNK 0x10d0
#define EPM_RENDERSTEPS_CHUNK 0x10e0
#define EPM_SHOWINTERIOR_CHUNK 0x10f0
// The following chunk is written on r3 and later files
// If not present, named selection data structures need fixup
#define EPM_SEL_NAMES_OK 0x1100
// Names of named selection sets
#define NAMEDVSEL_NAMES_CHUNK 0x1050
#define NAMEDESEL_NAMES_CHUNK 0x1060
#define NAMEDPSEL_NAMES_CHUNK 0x1070
#define NAMEDSEL_STRING_CHUNK 0x1080
#define RPO_MODE_TILE 0x2000
#define RPO_MODE_TILE_TRANSITION 0x2001
#define RPO_INCLUDE_MESHES 0x2002
static int namedSelID[] =
{
NAMEDVSEL_NAMES_CHUNK,
NAMEDESEL_NAMES_CHUNK,
NAMEDPSEL_NAMES_CHUNK
};
// ------------------------------------------------------------------------------------------------------------------------------------------------------
IOResult EditPatchMod::Save(ISave *isave)
{
Modifier::Save(isave);
Interval valid;
ULONG nb;
// In r3 and later, if the named sel names are OK, write this chunk
if (!namedSelNeedsFixup)
{
isave->BeginChunk(EPM_SEL_NAMES_OK);
isave->EndChunk();
}
isave->BeginChunk(SEL_LEVEL_CHUNK);
isave->Write(&selLevel, sizeof(int), &nb);
isave-> EndChunk();
isave->BeginChunk(DISP_LATTICE_CHUNK);
isave->Write(&displayLattice, sizeof(BOOL), &nb);
isave-> EndChunk();
isave->BeginChunk(DISP_SURFACE_CHUNK);
isave->Write(&displaySurface, sizeof(BOOL), &nb);
isave-> EndChunk();
isave->BeginChunk(EPM_MESH_ATTRIB_CHUNK);
isave->Write(&meshSteps, sizeof(int), &nb);
// Future use (Not used now)
BOOL fakeAdaptive = FALSE;
isave->Write(&fakeAdaptive, sizeof(BOOL), &nb);
// isave->Write(&meshAdaptive,sizeof(BOOL),&nb); // Future use (Not used now)
isave-> EndChunk();
// 3-18-99 to suport render steps and removal of the mental tesselator
isave->BeginChunk(EPM_RENDERSTEPS_CHUNK);
if ((meshStepsRender < 0) ||(meshStepsRender > 100))
{
meshStepsRender = 5;
nlassert(0);
}
isave->Write(&meshStepsRender, sizeof(int), &nb);
isave-> EndChunk();
isave->BeginChunk(EPM_SHOWINTERIOR_CHUNK);
isave->Write(&showInterior, sizeof(BOOL), &nb);
isave-> EndChunk();
isave->BeginChunk(EPM_VTESS_ATTRIB_CHUNK);
viewTess.Save(isave);
isave-> EndChunk();
isave->BeginChunk(EPM_PTESS_ATTRIB_CHUNK);
prodTess.Save(isave);
isave-> EndChunk();
isave->BeginChunk(EPM_DTESS_ATTRIB_CHUNK);
dispTess.Save(isave);
isave-> EndChunk();
// Tile mode
isave->BeginChunk(RPO_MODE_TILE);
isave->Write(&tileMode, sizeof(tileMode), &nb);
isave->Write(&tileLevel, sizeof(tileLevel), &nb);
isave->Write(&keepMapping, sizeof(keepMapping), &nb);
isave-> EndChunk();
// Tile mode
isave->BeginChunk(RPO_INCLUDE_MESHES);
isave->Write(&includeMeshes, sizeof(includeMeshes), &nb);
isave-> EndChunk();
// Tile mode
isave->BeginChunk(RPO_MODE_TILE_TRANSITION);
isave->Write(&transitionType, sizeof(transitionType), &nb);
isave-> EndChunk();
isave->BeginChunk(EPM_NORMAL_TESS_ATTRIB_CHUNK);
isave->Write(&mViewTessNormals, sizeof(BOOL), &nb);
isave->Write(&mProdTessNormals, sizeof(BOOL), &nb);
isave-> EndChunk();
isave->BeginChunk(EPM_WELD_TESS_ATTRIB_CHUNK);
isave->Write(&mViewTessWeld, sizeof(BOOL), &nb);
isave->Write(&mProdTessWeld, sizeof(BOOL), &nb);
isave-> EndChunk();
// Save names of named selection sets
for (int j = 0; j < 3; j++)
{
if (namedSel[j].Count())
{
isave->BeginChunk(namedSelID[j]);
for (int i = 0; i < namedSel[j].Count(); i++)
{
isave->BeginChunk(NAMEDSEL_STRING_CHUNK);
isave->WriteWString(*namedSel[j][i]);
isave->EndChunk();
}
isave->EndChunk();
}
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
IOResult EditPatchMod::LoadNamedSelChunk(ILoad *iload, int level)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case NAMEDSEL_STRING_CHUNK:
{
TCHAR *name;
res = iload->ReadWStringChunk(&name);
// Set the name in the modifier
AddSet(TSTR(name), level + 1);
break;
}
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
IOResult EditPatchMod::Load(ILoad *iload)
{
Modifier::Load(iload);
IOResult res;
ULONG nb;
namedSelNeedsFixup = TRUE; // Pre-r3 default
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case EPM_SEL_NAMES_OK:
namedSelNeedsFixup = FALSE;
break;
case NAMEDVSEL_NAMES_CHUNK:
{
res = LoadNamedSelChunk(iload, 0);
break;
}
case NAMEDESEL_NAMES_CHUNK:
{
res = LoadNamedSelChunk(iload, 1);
break;
}
case NAMEDPSEL_NAMES_CHUNK:
{
res = LoadNamedSelChunk(iload, 2);
break;
}
case OLD_SEL_LEVEL_CHUNK: // Correct backwards ordering
{
short sl;
res = iload->Read(&sl, sizeof(short), &nb);
selLevel = sl;
switch (selLevel)
{
case 1:
selLevel = EP_PATCH;
break;
case 3:
selLevel = EP_VERTEX;
break;
}
}
break;
case SEL_LEVEL_CHUNK:
res = iload->Read(&selLevel, sizeof(int), &nb);
break;
case DISP_LATTICE_CHUNK:
res = iload->Read(&displayLattice, sizeof(BOOL), &nb);
break;
case DISP_SURFACE_CHUNK:
res = iload->Read(&displaySurface, sizeof(BOOL), &nb);
break;
case DISP_VERTS_CHUNK:
iload->SetObsolete();
break;
case EPM_MESH_ATTRIB_CHUNK:
res = iload->Read(&meshSteps, sizeof(int), &nb);
res = iload->Read(&meshAdaptive, sizeof(BOOL), &nb);
break;
// 3-18-99 to suport render steps and removal of the mental tesselator
case EPM_RENDERSTEPS_CHUNK:
res = iload->Read(&meshStepsRender, sizeof(int), &nb);
if ((meshStepsRender < 0) ||(meshStepsRender > 100))
{
meshStepsRender = 5;
nlassert(0);
}
break;
case EPM_SHOWINTERIOR_CHUNK:
res = iload->Read(&showInterior, sizeof(BOOL), &nb);
break;
case EPM_VTESS_ATTRIB_CHUNK:
viewTess.Load(iload);
break;
case EPM_PTESS_ATTRIB_CHUNK:
prodTess.Load(iload);
break;
case EPM_DTESS_ATTRIB_CHUNK:
dispTess.Load(iload);
break;
case EPM_NORMAL_TESS_ATTRIB_CHUNK:
res = iload->Read(&mViewTessNormals, sizeof(BOOL), &nb);
res = iload->Read(&mProdTessNormals, sizeof(BOOL), &nb);
break;
case EPM_WELD_TESS_ATTRIB_CHUNK:
res = iload->Read(&mViewTessWeld, sizeof(BOOL), &nb);
res = iload->Read(&mProdTessWeld, sizeof(BOOL), &nb);
break;
case RPO_MODE_TILE:
res = iload->Read(&tileMode, sizeof(tileMode), &nb);
res = iload->Read(&tileLevel, sizeof(tileLevel), &nb);
res = iload->Read(&keepMapping, sizeof(keepMapping), &nb);
break;
case RPO_INCLUDE_MESHES:
res = iload->Read(&includeMeshes, sizeof(includeMeshes), &nb);
break;
case RPO_MODE_TILE_TRANSITION:
res = iload->Read(&transitionType, sizeof(transitionType), &nb);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define EDITPATCHDATA_CHUNK 0x1000
IOResult EditPatchMod::SaveLocalData(ISave *isave, LocalModData *ld)
{
EditPatchData *ep =(EditPatchData *)ld;
isave->BeginChunk(EDITPATCHDATA_CHUNK);
ep->Save(isave);
isave->EndChunk();
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
IOResult EditPatchMod::LoadLocalData(ILoad *iload, LocalModData **pld)
{
IOResult res;
EditPatchData *ep;
if (*pld == NULL)
{
*pld =(LocalModData *) new EditPatchData(this);
}
ep =(EditPatchData *)*pld;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case EDITPATCHDATA_CHUNK:
res = ep->Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}

View file

@ -1,161 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern HIMAGELIST hFaceImages;
int patchHitOverride = 0; // If zero, no override is done
// ------------------------------------------------------------------------------------------------------------------------------------------------------
class EPImageListDestroyer
{
~EPImageListDestroyer()
{
if (hFaceImages)
ImageList_Destroy(hFaceImages);
}
};
PatchRightMenu pMenu;
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void LoadImages()
{
if (hFaceImages)
return;
HBITMAP hBitmap, hMask;
hFaceImages = ImageList_Create(24, 23, ILC_COLOR | ILC_MASK, 6, 0);
hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PATCHSELTYPES));
hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PATCHSELMASK));
ImageList_Add(hFaceImages, hBitmap, hMask);
DeleteObject(hBitmap);
DeleteObject(hMask);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void PatchRightMenu::Init(RightClickMenuManager* manager, HWND hWnd, IPoint2 m)
{
switch (ep->GetSubobjectLevel())
{
case EP_VERTEX:
if (ep->RememberVertThere(hWnd, m))
{
int oldType = -1;
int flags1, flags2;
flags1 = flags2 = MF_STRING;
switch (ep->rememberedData)
{
case PVERT_COPLANAR:
flags1 |= MF_CHECKED;
break;
case 0:
flags2 |= MF_CHECKED;
break;
}
manager->AddMenu(this, MF_SEPARATOR, 0, NULL);
manager->AddMenu(this, flags1, PVERT_COPLANAR, GetString(IDS_TH_COPLANAR));
manager->AddMenu(this, flags2, 0, GetString(IDS_TH_CORNER));
}
break;
case EP_PATCH:
if (ep->RememberPatchThere(hWnd, m))
{
int oldType = -1;
int flags1, flags2;
flags1 = flags2 = MF_STRING;
switch (ep->rememberedData)
{
case PATCH_AUTO:
flags1 |= MF_CHECKED;
break;
case 0:
flags2 |= MF_CHECKED;
break;
}
manager->AddMenu(this, MF_SEPARATOR, 0, NULL);
manager->AddMenu(this, flags1, PATCH_AUTO, GetString(IDS_TH_AUTOINTERIOR));
manager->AddMenu(this, flags2, 0, GetString(IDS_TH_MANUALINTERIOR));
}
break;
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void PatchRightMenu::Selected(UINT id)
{
switch (ep->GetSubobjectLevel())
{
case EP_VERTEX:
ep->SetRememberedVertType((int)id);
break;
case EP_PATCH:
ep->SetRememberedPatchType((int)id);
break;
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
int EditPatchMod::HitTest(TimeValue t, INode* inode, int type, int crossing,
int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc)
{
Interval valid;
int savedLimits, res = 0;
GraphicsWindow *gw = vpt->getGW();
HitRegion hr;
MakeHitRegion(hr, type, crossing, 4, p);
gw->setHitRegion(&hr);
Matrix3 mat = inode->GetObjectTM(t);
gw->setTransform(mat);
gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
gw->clearHitCode();
if (mc->localData)
{
EditPatchData *patchData =(EditPatchData*)mc->localData;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(), rpatch);
if (!patch)
return FALSE;
SubPatchHitList hitList;
PatchSubHitRec *rec;
rpatch->UpdateBinding (*patch, t);
if (selLevel!=EP_TILE)
{
res = patch->SubObjectHitTest(gw, gw->getMaterial(), &hr,
flags | ((patchHitOverride) ? patchHitLevel[patchHitOverride] : patchHitLevel[selLevel]), hitList);
}
else
{
res = rpatch->SubObjectHitTest(gw, gw->getMaterial(), &hr,
flags | ((patchHitOverride) ? patchHitLevel[patchHitOverride] : patchHitLevel[selLevel]), hitList,
t, *patch);
}
rec = hitList.First();
while (rec)
{
vpt->LogHit(inode, mc, rec->dist, 123456, new PatchHitData(rec->patch, rec->index, rec->type));
rec = rec->Next();
}
}
gw->setRndLimits(savedLimits);
return res;
}

View file

@ -1,464 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// watje unhide all
static void UnHidePatches(PatchMesh *patch)
{
// If positive vertex number, do it to just one vertex
int patches = patch->numPatches;
int i;
for (i = 0; i < patches; i++)
{
if (patch->patches[i].IsHidden())
patch->patches[i].SetHidden(FALSE);
}
int verts = patch->numVerts;
for (i = 0; i < verts; i++)
{
if (patch->verts[i].IsHidden())
patch->verts[i].SetHidden(FALSE);
}
}
// --------------------------------------------------------------------------------
// watje 12-10-98
void EditPatchMod::DoUnHide() {
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
// if(patch->patchSel.NumberSet()) {
if (1)
{
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
UnHidePatches(patch);
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::DoHide(int type)
{
switch (type)
{
case EP_VERTEX:
DoVertHide();
break;
case EP_EDGE:
DoEdgeHide();
break;
case EP_PATCH:
DoPatchHide();
break;
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// watje
static void FixUpVerts(PatchMesh *patch)
{
int patches = patch->numPatches;
for (int i = 0; i < patches; i++)
{
if (!(patch->patches[i].IsHidden()))
{
int ct = 4;
if (patch->patches[i].type == PATCH_TRI)
ct = 3;
for (int k = 0; k < ct; k++)
{
int a = patch->patches[i].v[k];
patch->verts[a].SetHidden(FALSE);
}
}
}
}
// --------------------------------------------------------------------------------
// watje hide patch
static void HidePatches(PatchMesh *patch)
{
// If positive vertex number, do it to just one vertex
int patches = patch->numPatches;
BitArray &psel = patch->patchSel;
for (int i = 0; i < patches; i++)
{
if (psel[i])
{
patch->patches[i].SetHidden(TRUE);
// hide all
int ct = 4;
if (patch->patches[i].type == PATCH_TRI)
ct = 3;
for (int k = 0; k < ct; k++)
{
int a = patch->patches[i].v[k];
patch->verts[a].SetHidden(TRUE);
}
}
}
FixUpVerts(patch);
}
// --------------------------------------------------------------------------------
void EditPatchMod::DoPatchHide()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->patchSel.NumberSet())
{
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
HidePatches(patch);
patch->patchSel.ClearAll();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// watje hide patches by verts
static void HideVerts(PatchMesh *patch)
{
// If positive vertex number, do it to just one vertex
int patches = patch->numPatches;
BitArray &vsel = patch->vertSel;
int i;
for (i = 0; i < patches; i++)
{
int ct = 4;
if (patch->patches[i].type == PATCH_TRI)
ct = 3;
for (int k = 0; k < ct; k++)
{
int a = patch->patches[i].v[k];
if (vsel[a])
{
patch->patches[i].SetHidden(TRUE);
}
}
}
for (i = 0; i < patches; i++)
{
if (patch->patches[i].IsHidden())
{
// hide all
int ct = 4;
if (patch->patches[i].type == PATCH_TRI)
ct = 3;
for (int k = 0; k < ct; k++)
{
int a = patch->patches[i].v[k];
patch->verts[a].SetHidden(TRUE);
}
}
}
FixUpVerts(patch);
}
// --------------------------------------------------------------------------------
void EditPatchMod::DoVertHide()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->vertSel.NumberSet())
{
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
HideVerts(patch);
patch->vertSel.ClearAll();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// watje hide patches by verts
static void HideEdges(PatchMesh *patch)
{
// If positive vertex number, do it to just one vertex
int edges = patch->numEdges;
BitArray &esel = patch->edgeSel;
int i;
for (i = 0; i < edges; i++)
{
if (esel[i])
{
#if (MAX_RELEASE < 4000)
int a = patch->edges[i].patch1;
int b = patch->edges[i].patch2;
#else // (MAX_RELEASE < 4000)
int a = patch->edges[i].patches[0];
int b = patch->edges[i].patches[1];
#endif // (MAX_RELEASE < 4000)
if (a>0)
patch->patches[a].SetHidden(TRUE);
if (b>0)
patch->patches[b].SetHidden(TRUE);
}
}
int patches = patch->numPatches;
for (i = 0; i < patches; i++)
{
if (patch->patches[i].IsHidden())
{
// hide all
int ct = 4;
if (patch->patches[i].type == PATCH_TRI)
ct = 3;
for (int k = 0; k < ct; k++)
{
int a = patch->patches[i].v[k];
patch->verts[a].SetHidden(TRUE);
}
}
}
FixUpVerts(patch);
}
// --------------------------------------------------------------------------------
void EditPatchMod::DoEdgeHide()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->edgeSel.NumberSet())
{
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
HideEdges(patch);
patch->edgeSel.ClearAll();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}

View file

@ -1,203 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::DoAddHook(PatchMesh *pMesh, int vert0, int vert1, int vert2, int seg, int config)
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
if (mcList.Count() != 1)
return;
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
// RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if ((!patch) ||(patch != pMesh))
continue;
// patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
// if(patch->vertSel.NumberSet()) {
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
// ** Hulud bug hack for hooking my way \\\\\\\\\///////////
//patch->AddHook(vert1, seg);
// Config 0
switch (config)
{
case 0:
rpatch->AddHook (vert1, seg, *patch);
break;
case 1:
rpatch->AddHook (vert0, vert1, vert2, seg, *patch);
break;
default:
nlassert (0);
}
// ** //////////\\\\\\\\\\
// patch->UpdateHooks();
// InvalidateMesh();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
// }
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
// ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
/* // If any bits are set in the selection set, let's DO IT!!
if (!ip)
return;
theHold.Begin();
POPatchGenRecord *rec = new POPatchGenRecord(this);
if (theHold.Holding())
theHold.Put(new PatchObjectRestore(this, rec));
// Call the patch type change function
patch.AddHook();
patch.InvalidateGeomCache();
InvalidateMesh();
theHold.Accept(GetResString(IDS_TH_PATCHCHANGE));
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
*/
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::DoRemoveHook()
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
BOOL holdNeeded = FALSE;
BOOL hadSelected = FALSE;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
RecordTopologyTags();
for (int i = 0; i < mcList.Count(); i++)
{
BOOL altered = FALSE;
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
patchData->RecordTopologyTags(patch);
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
// If any bits are set in the selection set, let's DO IT!!
if (patch->vertSel.NumberSet())
{
altered = holdNeeded = TRUE;
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch));
// Call the vertex type change function
// Modif by Hulud
//patch->RemoveHook();
rpatch->RemoveHook (*patch);
// patch->InvalidateGeomCache();
// InvalidateMesh();
patchData->UpdateChanges(patch, rpatch);
patchData->TempData(this)->Invalidate(PART_TOPO);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
if (holdNeeded)
{
ResolveTopoChanges();
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
}
else
{
ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME);
theHold.End();
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -1,321 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern void ChangePatchType(PatchMesh *patch, int index, int type);
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------------------------
int EditPatchMod::RememberPatchThere(HWND hWnd, IPoint2 m)
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
// Initialize so there isn't any remembered patch
rememberedPatch = NULL;
if (!ip)
return 0;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
// See if we're over a patch
ViewExp *vpt = ip->GetViewport(hWnd);
GraphicsWindow *gw = vpt->getGW();
HitRegion hr;
MakeHitRegion(hr, HITTYPE_POINT, 1, 4, &m);
gw->setHitRegion(&hr);
SubPatchHitList hitList;
int result = 0;
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
INode *inode = nodes[i];
Matrix3 mat = inode->GetObjectTM(t);
gw->setTransform(mat);
patch->SubObjectHitTest(gw, gw->getMaterial(), &hr, SUBHIT_PATCH_PATCHES/* | HIT_ABORTONHIT*/, hitList);
PatchSubHitRec *hit = hitList.First();
if (hit)
{
result = 1;
// Go thru the list and see if we have one that's selected
// If more than one selected and they're different types, set unknown type
hit = hitList.First();
while (hit)
{
if (patch->patchSel[hit->index])
{
if (patch->SelPatchesSameType())
{
rememberedPatch = NULL;
rememberedData = patch->patches[hit->index].flags &(~PATCH_INTERIOR_MASK);
goto finish;
}
// Selected patches not all the same type!
rememberedPatch = NULL;
rememberedData = -1; // Not all the same!
goto finish;
}
hit = hit->Next();
}
if (ip->SelectionFrozen())
goto finish;
// Select just this patch
hit = hitList.First();
theHold.Begin();
if (theHold.Holding())
theHold.Put(new PatchSelRestore(patchData, this, patch));
patch->patchSel.ClearAll();
patch->patchSel.Set(hit->index);
patchData->UpdateChanges(patch, rpatch, FALSE);
theHold.Accept(GetString(IDS_DS_SELECT));
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
PatchSelChanged();
rememberedPatch = patch;
rememberedIndex = hit->index;
rememberedData = patch->patches[rememberedIndex].flags &(~PATCH_INTERIOR_MASK);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
finish:
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
if (vpt)
ip->ReleaseViewport(vpt);
return result;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::ChangeRememberedPatch(int type)
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
if (patch == rememberedPatch)
{
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
theHold.Begin();
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeRememberedPatch"));
// Call the patch type change function
ChangePatchType(patch, rememberedIndex, type);
patchData->UpdateChanges(patch, rpatch, FALSE);
patchData->TempData(this)->Invalidate(PART_TOPO);
theHold.Accept(GetString(IDS_TH_PATCHCHANGE));
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
nodes.DisposeTemporary();
return;
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
int EditPatchMod::RememberVertThere(HWND hWnd, IPoint2 m)
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
// Initialize so there isn't any remembered patch
rememberedPatch = NULL;
if (!ip)
return 0;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
// See if we're over a vertex
ViewExp *vpt = ip->GetViewport(hWnd);
GraphicsWindow *gw = vpt->getGW();
HitRegion hr;
MakeHitRegion(hr, HITTYPE_POINT, 1, 4, &m);
gw->setHitRegion(&hr);
SubPatchHitList hitList;
int result = 0;
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
INode *inode = nodes[i];
Matrix3 mat = inode->GetObjectTM(t);
gw->setTransform(mat);
patch->SubObjectHitTest(gw, gw->getMaterial(), &hr, SUBHIT_PATCH_VERTS/* | HIT_ABORTONHIT*/, hitList);
PatchSubHitRec *hit = hitList.First();
if (hit)
{
result = 1;
// Go thru the list and see if we have one that's selected
// If more than one selected and they're different types, set unknown type
hit = hitList.First();
while (hit)
{
if (patch->vertSel[hit->index])
{
if (patch->SelVertsSameType())
{
rememberedPatch = NULL;
rememberedData = patch->verts[hit->index].flags &(~PVERT_TYPE_MASK);
goto finish;
}
// Selected verts not all the same type!
rememberedPatch = NULL;
rememberedData = -1; // Not all the same!
goto finish;
}
hit = hit->Next();
}
if (ip->SelectionFrozen())
goto finish;
// Select just this vertex
hit = hitList.First();
theHold.Begin();
if (theHold.Holding())
theHold.Put(new PatchSelRestore(patchData, this, patch));
patch->vertSel.ClearAll();
patch->vertSel.Set(hit->index);
patchData->UpdateChanges(patch, rpatch, FALSE);
theHold.Accept(GetString(IDS_DS_SELECT));
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
PatchSelChanged();
rememberedPatch = patch;
rememberedIndex = hit->index;
rememberedData = patch->verts[rememberedIndex].flags &(~PVERT_TYPE_MASK);
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
finish:
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
if (vpt)
ip->ReleaseViewport(vpt);
return result;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::ChangeRememberedVert(int type)
{
ModContextList mcList;
INodeTab nodes;
TimeValue t = ip->GetTime();
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
// If the mesh isn't yet cache, this will cause it to get cached.
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
continue;
if (patch == rememberedPatch)
{
// If this is the first edit, then the delta arrays will be allocated
patchData->BeginEdit(t);
theHold.Begin();
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeRememberedVert"));
// Call the vertex type change function
patch->ChangeVertType(rememberedIndex, type);
patchData->UpdateChanges(patch, rpatch, FALSE);
patchData->TempData(this)->Invalidate(PART_TOPO);
theHold.Accept(GetString(IDS_TH_VERTCHANGE));
ClearPatchDataFlag(mcList, EPD_BEENDONE);
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
nodes.DisposeTemporary();
return;
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
nodes.DisposeTemporary();
ClearPatchDataFlag(mcList, EPD_BEENDONE);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -1,789 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern int sbmParams[4];
extern DWORD sbsParams[3];
// ------------------------------------------------------------------------------------------------------------------------------------------------------
INT_PTR CALLBACK SelectByMatDlgProc(
HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int *param;
switch (msg)
{
case WM_INITDIALOG:
param =(int*)lParam;
SetupIntSpinner(hWnd, IDC_MAT_IDSPIN, IDC_MAT_ID, 1, MAX_MATID, param[0]);
CheckDlgButton(hWnd, IDC_CLEARSELECTION, param[1]);
/*SetupIntSpinner(hWnd, IDC_TESS_U_SPIN, IDC_TESS_U2, 1, RPO_DEFAULT_TESSEL, param[2]);
SetupIntSpinner(hWnd, IDC_TESS_V_SPIN, IDC_TESS_V2, 1, RPO_DEFAULT_TESSEL, param[3]);*/
CenterWindow(hWnd, GetParent(hWnd));
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
{
ISpinnerControl *spin = GetISpinner(GetDlgItem(hWnd, IDC_MAT_IDSPIN));
param[0] = spin->GetIVal();
param[1] = IsDlgButtonChecked(hWnd, IDC_CLEARSELECTION);
ReleaseISpinner(spin);
EndDialog(hWnd, 1);
break;
}
case IDCANCEL:
EndDialog(hWnd, 0);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void SetSmoothButtonState(HWND hWnd, DWORD bits, DWORD invalid, DWORD unused = 0)
{
for (int i = IDC_SMOOTH_GRP1; i < IDC_SMOOTH_GRP1 + 32; i++)
{
if ((unused&(1 << (i - IDC_SMOOTH_GRP1))))
{
ShowWindow(GetDlgItem(hWnd, i), SW_HIDE);
continue;
}
if ((invalid&(1 << (i - IDC_SMOOTH_GRP1))))
{
SetWindowText(GetDlgItem(hWnd, i), NULL);
SendMessage(GetDlgItem(hWnd, i), CC_COMMAND, CC_CMD_SET_STATE, FALSE);
} else
{
TSTR buf;
buf.printf(_T("%d"), i - IDC_SMOOTH_GRP1 + 1);
SetWindowText(GetDlgItem(hWnd, i), buf);
SendMessage(GetDlgItem(hWnd, i), CC_COMMAND, CC_CMD_SET_STATE,(bits&(1 << (i - IDC_SMOOTH_GRP1)))?TRUE:FALSE);
}
InvalidateRect(GetDlgItem(hWnd, i), NULL, TRUE);
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
INT_PTR CALLBACK SelectBySmoothDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static DWORD *param;
switch (msg)
{
case WM_INITDIALOG:
param =(DWORD*)lParam;
int i;
for (i = IDC_SMOOTH_GRP1; i < IDC_SMOOTH_GRP1 + 32; i++)
SendMessage(GetDlgItem(hWnd, i), CC_COMMAND, CC_CMD_SET_TYPE, CBT_CHECK);
SetSmoothButtonState(hWnd, param[0], 0, param[2]);
CheckDlgButton(hWnd, IDC_CLEARSELECTION, param[1]);
CenterWindow(hWnd, GetParent(hWnd));
break;
case WM_COMMAND:
if (LOWORD(wParam) >= IDC_SMOOTH_GRP1 &&
LOWORD(wParam) <= IDC_SMOOTH_GRP32)
{
ICustButton *iBut = GetICustButton(GetDlgItem(hWnd, LOWORD(wParam)));
int shift = LOWORD(wParam) - IDC_SMOOTH_GRP1;
if (iBut->IsChecked())
{
param[0] |= 1 << shift;
} else
{
param[0] &= ~(1 << shift);
}
ReleaseICustButton(iBut);
break;
}
switch (LOWORD(wParam))
{
case IDOK:
param[1] = IsDlgButtonChecked(hWnd, IDC_CLEARSELECTION);
EndDialog(hWnd, 1);
break;
case IDCANCEL:
EndDialog(hWnd, 0);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
INT_PTR CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
if (!ep && message != WM_INITDIALOG)
return FALSE;
switch (message)
{
case WM_INITDIALOG:
{
ep =(EditPatchMod *)lParam;
ep->hTilePanel = hDlg;
SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep);
ep->tileNum = SetupIntSpinner(hDlg, IDC_TILE_MAT_SPIN, IDC_TILE_MAT, 0, 65535, 0);
ep->tileRot = SetupIntSpinner(hDlg, IDC_TILE_ROT_SPIN, IDC_TILE_ROT, 0, 3, 0);
ep->SetTileDlgEnables();
return TRUE;
}
case WM_DESTROY:
if (ep->tileNum)
{
ReleaseISpinner(ep->tileNum);
ep->tileNum = NULL;
}
if (ep->tileRot)
{
ReleaseISpinner(ep->tileRot);
ep->tileRot = NULL;
}
return FALSE;
case CC_SPINNER_CHANGE:
/*switch (LOWORD(wParam))
{
case IDC_TILE_MAT_SPIN:
if (HIWORD(wParam))
break; // No interactive action
ep->SetTileNum (ep->tileNum->GetIVal());
break;
case IDC_TILE_ROT_SPIN:
if (HIWORD(wParam))
break; // No interactive action
ep->SetTileRot (ep->tileRot->GetIVal());
break;
}*/
break;
case CC_SPINNER_BUTTONUP:
/*switch (LOWORD(wParam))
{
case IDC_TILE_MAT_SPIN:
ep->SetTileNum (ep->tileNum->GetIVal());
ep->ip->RedrawViews(ep->ip->GetTime(), REDRAW_END);
break;
case IDC_TILE_ROT_SPIN:
ep->SetTileRot (ep->tileRot->GetIVal());
ep->ip->RedrawViews(ep->ip->GetTime(), REDRAW_END);
break;
}*/
break;
case WM_PAINT:
if (!ep->tileUIValid)
{
// Tilenum
/*ULONG u = ep->GetTileNum();
if (u == 0xffffffff)
{
ep->tileNum->SetIndeterminate(TRUE);
}
else
{
ep->tileNum->SetIndeterminate(FALSE);
ep->tileNum->SetValue((int)u, FALSE);
}
// Tilerot
int v = ep->GetTileRot();
if (v == -1)
{
ep->tileRot->SetIndeterminate(TRUE);
}
else
{
ep->tileRot->SetIndeterminate(FALSE);
ep->tileRot->SetValue(v, FALSE);
}*/
ep->patchUIValid = TRUE;
}
return FALSE;
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
ep->ip->RollupMouseMessage(hDlg, message, wParam, lParam);
return FALSE;
case WM_COMMAND:
/*switch (LOWORD(wParam))
{
}*/
break;
}
return FALSE;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
INT_PTR CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
if (!ep && message != WM_INITDIALOG)
return FALSE;
switch (message)
{
case WM_INITDIALOG:
{
ep =(EditPatchMod *)lParam;
ep->hEdgePanel = hDlg;
SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep);
ep->SetEdgeDlgEnables();
return TRUE;
}
case WM_DESTROY:
return FALSE;
case WM_PAINT:
if (!ep->edgeUIValid)
{
// No smooth active ?
HWND hButton=GetDlgItem (hDlg, IDC_NO_SMOOTH);
nlassert (hButton);
if (IsWindowEnabled (hButton))
{
// Get its value
switch (ep->getSmoothFlags ())
{
case 0:
CheckDlgButton (hDlg, IDC_NO_SMOOTH, BST_UNCHECKED);
break;
case 1:
CheckDlgButton (hDlg, IDC_NO_SMOOTH, BST_CHECKED);
break;
case 2:
CheckDlgButton (hDlg, IDC_NO_SMOOTH, BST_INDETERMINATE);
break;
}
}
// Valid now
ep->edgeUIValid = TRUE;
}
return FALSE;
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
ep->ip->RollupMouseMessage(hDlg, message, wParam, lParam);
return FALSE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_NO_SMOOTH:
// 3 states management
if (IsDlgButtonChecked(hDlg, IDC_NO_SMOOTH)==BST_INDETERMINATE)
CheckDlgButton (hDlg, IDC_NO_SMOOTH, BST_UNCHECKED);
// Set the smooth flag for selected edges if state is checked or indeterminate
ep->setSmoothFlags (IsDlgButtonChecked(hDlg, IDC_NO_SMOOTH)==BST_CHECKED);
break;
}
break;
}
return FALSE;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
INT_PTR CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
if (!ep && message != WM_INITDIALOG)
return FALSE;
switch (message)
{
case WM_INITDIALOG:
{
ep = (EditPatchMod *)lParam;
ep->hSurfPanel = hDlg;
for (int i = IDC_SMOOTH_GRP1; i < IDC_SMOOTH_GRP1 + 32; i++)
SendMessage(GetDlgItem(hDlg, i), CC_COMMAND, CC_CMD_SET_TYPE, CBT_CHECK);
SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep);
ep->matSpin = SetupIntSpinner(hDlg, IDC_MAT_IDSPIN, IDC_MAT_ID, 1, MAX_MATID, 0);
ep->tessUSpin = SetupIntSpinner(hDlg, IDC_TESS_U_SPIN, IDC_TESS_U2, 1, 4, RPO_DEFAULT_TESSEL);
ep->tessVSpin = SetupIntSpinner(hDlg, IDC_TESS_V_SPIN, IDC_TESS_V2, 1, 4, RPO_DEFAULT_TESSEL);
ep->SetSurfDlgEnables();
return TRUE;
}
case WM_DESTROY:
if (ep->matSpin)
{
ReleaseISpinner(ep->matSpin);
ep->matSpin = NULL;
}
if (ep->tessUSpin)
{
ReleaseISpinner(ep->tessUSpin);
ep->tessUSpin = NULL;
}
if (ep->tessVSpin)
{
ReleaseISpinner(ep->tessVSpin);
ep->tessVSpin = NULL;
}
return FALSE;
case CC_SPINNER_CHANGE:
switch (LOWORD(wParam))
{
case IDC_MAT_IDSPIN:
if (HIWORD(wParam))
break; // No interactive action
ep->SetSelMatIndex(ep->matSpin->GetIVal() - 1);
break;
case IDC_TESS_U_SPIN:
case IDC_TESS_V_SPIN:
if (HIWORD(wParam))
break; // No interactive action
ep->SetSelTess(ep->tessUSpin->GetIVal(), ep->tessVSpin->GetIVal());
break;
}
break;
case CC_SPINNER_BUTTONUP:
switch (LOWORD(wParam))
{
case IDC_MAT_IDSPIN:
ep->SetSelMatIndex(ep->matSpin->GetIVal() - 1);
ep->ip->RedrawViews(ep->ip->GetTime(), REDRAW_END);
break;
case IDC_TESS_U_SPIN:
case IDC_TESS_V_SPIN:
ep->SetSelTess(ep->tessUSpin->GetIVal(), ep->tessVSpin->GetIVal());
ep->ip->RedrawViews(ep->ip->GetTime(), REDRAW_END);
break;
}
break;
case WM_PAINT:
if (!ep->patchUIValid)
{
// Material index
int mat = ep->GetSelMatIndex();
if (mat == -1)
{
ep->matSpin->SetIndeterminate(TRUE);
}
else
{
ep->matSpin->SetIndeterminate(FALSE);
ep->matSpin->SetValue(mat + 1, FALSE);
}
// Smoothing groups
DWORD invalid, bits;
bits = ep->GetSelSmoothBits(invalid);
SetSmoothButtonState(hDlg, bits, invalid);
// U tess index
int u = ep->GetSelTessU();
if (u == -1)
{
ep->tessUSpin->SetIndeterminate(TRUE);
}
else
{
ep->tessUSpin->SetIndeterminate(FALSE);
ep->tessUSpin->SetValue(u, FALSE);
}
// V tess index
int v = ep->GetSelTessV();
if (v == -1)
{
ep->tessVSpin->SetIndeterminate(TRUE);
}
else
{
ep->tessVSpin->SetIndeterminate(FALSE);
ep->tessVSpin->SetValue(v, FALSE);
}
ep->patchUIValid = TRUE;
}
return FALSE;
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
ep->ip->RollupMouseMessage(hDlg, message, wParam, lParam);
return FALSE;
case WM_COMMAND:
if (LOWORD(wParam) >= IDC_SMOOTH_GRP1 &&
LOWORD(wParam) <= IDC_SMOOTH_GRP32)
{
ICustButton *iBut = GetICustButton(GetDlgItem(hDlg, LOWORD(wParam)));
int bit = iBut->IsChecked() ? 1 : 0;
int shift = LOWORD(wParam) - IDC_SMOOTH_GRP1;
ep->SetSelSmoothBits(bit << shift, 1 << shift);
ReleaseICustButton(iBut);
break;
}
switch (LOWORD(wParam))
{
// Material
case IDC_SELECT_BYID:
{
if (DialogBoxParam(
hInstance,
MAKEINTRESOURCE(IDD_SELECTBYMAT),
ep->ip->GetMAXHWnd(),
SelectByMatDlgProc,
(LPARAM)sbmParams))
{
ep->SelectByMat(sbmParams[0] - 1/*index*/, sbmParams[1]/*clear*/);
}
break;
}
// Smoothing groups
case IDC_SELECTBYSMOOTH:
{
sbsParams[2] = ~ep->GetUsedSmoothBits();
if (DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EM_SELECTBYSMOOTH),
ep->ip->GetMAXHWnd(), SelectBySmoothDlgProc, (LPARAM)sbsParams))
{
ep->SelectBySmoothGroup(sbsParams[0], (BOOL)sbsParams[1]);
}
break;
}
case IDC_SMOOTH_CLEAR:
ep->SetSelSmoothBits(0, 0xffffffff);
break;
// Balance button
case IDC_BALANCE_SELECTED:
{
ep->BalanceSelPatch ();
ep->ip->RedrawViews(ep->ip->GetTime(), REDRAW_END);
}
break;
}
break;
}
return FALSE;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetSurfDlgEnables()
{
if (!hSurfPanel)
return;
nlassert(ip);
BOOL oType =(GetSubobjectLevel() == EP_OBJECT) ? TRUE : FALSE;
BOOL pType =(GetSubobjectLevel() == EP_PATCH) ? TRUE : FALSE;
if (oType)
return;
if (!pType)
return;
ICustButton *but;
ISpinnerControl *spin;
but = GetICustButton(GetDlgItem(hSurfPanel, IDC_SELECT_BYID));
but->Enable(pType);
ReleaseICustButton(but);
spin = GetISpinner(GetDlgItem(hSurfPanel, IDC_MAT_IDSPIN));
spin->Enable(pType);
ReleaseISpinner(spin);
for (int i = 0; i < 32; ++i)
{
but = GetICustButton(GetDlgItem(hSurfPanel, IDC_SMOOTH_GRP1 + i));
but->Enable(pType);
ReleaseICustButton(but);
}
but = GetICustButton(GetDlgItem(hSurfPanel, IDC_SELECTBYSMOOTH));
but->Enable(pType);
ReleaseICustButton(but);
but = GetICustButton(GetDlgItem(hSurfPanel, IDC_SMOOTH_CLEAR));
but->Enable(pType);
ReleaseICustButton(but);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetTileDlgEnables()
{
if (!hTilePanel)
return;
nlassert(ip);
BOOL oType =(GetSubobjectLevel() == EP_OBJECT) ? TRUE : FALSE;
BOOL pType =(GetSubobjectLevel() == EP_TILE) ? TRUE : FALSE;
if (oType)
return;
if (!pType)
return;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetEdgeDlgEnables()
{
if (!hEdgePanel)
return;
nlassert(ip);
BOOL oType =(GetSubobjectLevel() == EP_OBJECT) ? TRUE : FALSE;
BOOL pType =(GetSubobjectLevel() == EP_TILE) ? TRUE : FALSE;
if (oType)
return;
if (!pType)
return;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
DWORD EditPatchMod::GetSelSmoothBits(DWORD &invalid)
{
BOOL first = 1;
DWORD bits = 0;
invalid = 0;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return 0;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
patchData->BeginEdit(ip->GetTime());
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(), rpatch);
if (!patch)
continue;
for (int j = 0; j < patch->getNumPatches(); j++)
{
if (patch->patchSel[j])
{
if (first)
{
first = FALSE;
bits = patch->patches[j].smGroup;
} else
{
if (patch->patches[j].smGroup != bits)
{
invalid |= patch->patches[j].smGroup^bits;
}
}
}
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
nodes.DisposeTemporary();
return bits;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
DWORD EditPatchMod::GetUsedSmoothBits()
{
DWORD bits = 0;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return 0;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
patchData->BeginEdit(ip->GetTime());
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
for (int j = 0; j < patch->getNumPatches(); j++)
{
bits |= patch->patches[j].smGroup;
}
patchData->SetFlag(EPD_BEENDONE, TRUE);
}
nodes.DisposeTemporary();
return bits;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SelectBySmoothGroup(DWORD bits, BOOL clear)
{
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
patchData->BeginEdit(ip->GetTime());
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
// Start a restore object...
if (theHold.Holding())
{
theHold.Put(new PatchSelRestore(patchData, this, patch));
}
if (clear)
patch->patchSel.ClearAll();
for (int j = 0; j < patch->getNumPatches(); j++)
{
if (patch->patches[j].smGroup & bits)
{
patch->patchSel.Set(j);
}
}
patchData->UpdateChanges(patch, rpatch, FALSE);
patchData->SetFlag(EPD_BEENDONE, TRUE);
patchData->TempData(this)->Invalidate(PART_SELECT);
}
PatchSelChanged();
theHold.Accept(GetString(IDS_RB_SELECTBYSMOOTH));
nodes.DisposeTemporary();
NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime());
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetSelSmoothBits(DWORD bits, DWORD which)
{
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
ClearPatchDataFlag(mcList, EPD_BEENDONE);
theHold.Begin();
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
if (patchData->GetFlag(EPD_BEENDONE))
continue;
patchData->BeginEdit(ip->GetTime());
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
// Start a restore object...
if (theHold.Holding())
{
theHold.Put(new PatchSelRestore(patchData, this, patch));
}
for (int j = 0; j < patch->getNumPatches(); j++)
{
if (patch->patchSel[j])
{
patch->patches[j].smGroup &= ~which;
patch->patches[j].smGroup |= bits&which;
}
}
patchData->UpdateChanges(patch, rpatch, FALSE);
patchData->SetFlag(EPD_BEENDONE, TRUE);
patchData->TempData(this)->Invalidate(PART_SELECT);
}
PatchSelChanged();
theHold.Accept(GetString(IDS_RB_SETSMOOTHGROUP));
nodes.DisposeTemporary();
NotifyDependents(FOREVER, PART_TOPO, REFMSG_CHANGE);
InvalidateSurfaceUI();
ip->RedrawViews(ip->GetTime());
}

View file

@ -1,956 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
extern AdvParams sParams;
INT_PTR CALLBACK AdvParametersDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetTessUI(HWND hDlg, TessApprox *tess)
{
EnableWindow(GetDlgItem(hDlg, IDC_TESS_U), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_U_SPINNER), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_V), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_V_SPINNER), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_EDGE), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_EDGE_SPINNER), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_DIST), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_DIST_SPINNER), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_ANG), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_ANG_SPINNER), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_ADVANCED_PARAMETERS), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_NORMALS), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_WELDTESS), FALSE);
CheckDlgButton(hDlg, IDC_TESS_SET, FALSE);
CheckDlgButton(hDlg, IDC_TESS_REGULAR, FALSE);
CheckDlgButton(hDlg, IDC_TESS_PARAM, FALSE);
CheckDlgButton(hDlg, IDC_TESS_SPATIAL, FALSE);
CheckDlgButton(hDlg, IDC_TESS_CURV, FALSE);
CheckDlgButton(hDlg, IDC_TESS_LDA, FALSE);
ShowWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, IDC_TESS_NORMALS), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, IDC_WELDTESS), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, IDC_MESH), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, IDC_DISP), SW_HIDE);
// watje 12-10-98
if (tess->showInteriorFaces)
CheckDlgButton(hDlg, IDC_SHOW_INTERIOR_FACES, TRUE);
else CheckDlgButton(hDlg, IDC_SHOW_INTERIOR_FACES, FALSE);
if (tileMode)
{
CheckDlgButton(hDlg, IDC_TILE_MODE, TRUE);
}
else
{
CheckDlgButton(hDlg, IDC_TILE_MODE, FALSE);
}
// Old
BOOL bCheck=(IsDlgButtonChecked(hDlg, IDC_TILE_MODE)==BST_CHECKED);
EnableWindow (GetDlgItem (hDlg, IDC_STEPS), !bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_STEPSSPINNER), !bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_STEPS_RENDER), !bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_STEPSRENDERSPINNER), !bCheck);
// New
EnableWindow (GetDlgItem (hDlg, IDC_TILESTEPS), bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_TILESTEPSSPINNER), bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_TRANSITION), bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_TRANSITIONSPINNER), bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_KEEP_MAPPING), bCheck);
if (keepMapping)
CheckDlgButton(hDlg, IDC_KEEP_MAPPING, TRUE);
else
CheckDlgButton(hDlg, IDC_KEEP_MAPPING, FALSE);
switch (tess->type)
{
case TESS_SET:
CheckDlgButton(hDlg, IDC_TESS_SET, TRUE);
mergeSpin->Disable();
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), TRUE);
break;
case TESS_REGULAR:
CheckDlgButton(hDlg, IDC_TESS_REGULAR, TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_U), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_U_SPINNER), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_V), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_V_SPINNER), TRUE);
ShowWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), SW_HIDE);
mergeSpin->Enable();
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), FALSE);
break;
case TESS_PARAM:
CheckDlgButton(hDlg, IDC_TESS_PARAM, TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_U), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_U_SPINNER), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_V), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_V_SPINNER), TRUE);
mergeSpin->Enable();
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), FALSE);
break;
case TESS_SPATIAL:
CheckDlgButton(hDlg, IDC_TESS_SPATIAL, TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_EDGE), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_EDGE_SPINNER), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), !settingViewportTess);
ShowWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), settingViewportTess?SW_HIDE:SW_SHOW);
EnableWindow(GetDlgItem(hDlg, IDC_ADVANCED_PARAMETERS), TRUE);
mergeSpin->Enable();
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), FALSE);
break;
case TESS_CURVE:
CheckDlgButton(hDlg, IDC_TESS_CURV, TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_DIST), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_DIST_SPINNER), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_ANG), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_ANG_SPINNER), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), !settingViewportTess);
ShowWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), settingViewportTess?SW_HIDE:SW_SHOW);
EnableWindow(GetDlgItem(hDlg, IDC_ADVANCED_PARAMETERS), TRUE);
mergeSpin->Enable();
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), FALSE);
break;
case TESS_LDA:
CheckDlgButton(hDlg, IDC_TESS_LDA, TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_EDGE), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_EDGE_SPINNER), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_DIST), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_DIST_SPINNER), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_ANG), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_ANG_SPINNER), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), !settingViewportTess);
ShowWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), settingViewportTess?SW_HIDE:SW_SHOW);
EnableWindow(GetDlgItem(hDlg, IDC_ADVANCED_PARAMETERS), TRUE);
mergeSpin->Enable();
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), FALSE);
break;
}
if (settingViewportTess)
{
ShowWindow(GetDlgItem(hDlg, IDC_TESS_SET), SW_SHOW);
if (tess->type != TESS_SET)
{
ShowWindow(GetDlgItem(hDlg, IDC_TESS_NORMALS), SW_SHOW);
ShowWindow(GetDlgItem(hDlg, IDC_WELDTESS), SW_SHOW);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_NORMALS), !GetViewTessWeld());
EnableWindow(GetDlgItem(hDlg, IDC_WELDTESS), tess->merge > 0.0f);
}
} else
{
if (settingDisp)
{
ShowWindow(GetDlgItem(hDlg, IDC_MESH), SW_SHOW);
ShowWindow(GetDlgItem(hDlg, IDC_DISP), SW_SHOW);
} else
{
if (tess->type != TESS_SET)
{
ShowWindow(GetDlgItem(hDlg, IDC_MESH), SW_SHOW);
ShowWindow(GetDlgItem(hDlg, IDC_DISP), SW_SHOW);
ShowWindow(GetDlgItem(hDlg, IDC_TESS_NORMALS), SW_SHOW);
ShowWindow(GetDlgItem(hDlg, IDC_WELDTESS), SW_SHOW);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_NORMALS), !GetProdTessWeld());
EnableWindow(GetDlgItem(hDlg, IDC_WELDTESS), tess->merge > 0.0f);
CheckDlgButton(hDlg, IDC_MESH, TRUE);
}
ShowWindow(GetDlgItem(hDlg, IDC_TESS_SET), SW_SHOW);
}
}
// now set all the settings
uSpin->SetValue(tess->u, FALSE);
vSpin->SetValue(tess->v, FALSE);
edgeSpin->SetValue(tess->edge, FALSE);
distSpin->SetValue(tess->dist, FALSE);
angSpin->SetValue(tess->ang, FALSE);
mergeSpin->SetValue(tess->merge, FALSE);
CheckDlgButton(hDlg, IDC_TESS_VIEW_DEP, tess->view);
if (settingViewportTess)
{
CheckDlgButton(hDlg, IDC_TESS_VIEW, TRUE);
CheckDlgButton(hDlg, IDC_TESS_RENDERER, FALSE);
CheckDlgButton(hDlg, IDC_TESS_NORMALS, GetViewTessNormals());
CheckDlgButton(hDlg, IDC_WELDTESS, GetViewTessWeld());
} else
{
CheckDlgButton(hDlg, IDC_TESS_VIEW, FALSE);
CheckDlgButton(hDlg, IDC_TESS_RENDERER, TRUE);
CheckDlgButton(hDlg, IDC_TESS_NORMALS, GetProdTessNormals());
CheckDlgButton(hDlg, IDC_WELDTESS, GetProdTessWeld());
}
CheckDlgButton(hDlg, IDC_DISP, settingDisp);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
INT_PTR CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
if (!ep && message != WM_INITDIALOG)
return FALSE;
switch (message)
{
case WM_INITDIALOG:
{
ep =(EditPatchMod *)lParam;
ep->hSurfPanel = hDlg;
SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep);
if (!ep->settingViewportTess && ep->settingDisp && ep->GetProdTess().type == TESS_SET)
ep->settingDisp = FALSE;
TessApprox t;
if (ep->settingViewportTess)
{
t = ep->GetViewTess();
} else
{
if (ep->settingDisp)
t = ep->GetDispTess();
else
t = ep->GetProdTess();
}
ep->uSpin = SetupIntSpinner(hDlg, IDC_TESS_U_SPINNER, IDC_TESS_U, 1, 100, t.u);
ep->vSpin = SetupIntSpinner(hDlg, IDC_TESS_V_SPINNER, IDC_TESS_V, 1, 100, t.v);
#define MAX_F 1000.0f
ep->edgeSpin = SetupFloatSpinner(hDlg, IDC_TESS_EDGE_SPINNER, IDC_TESS_EDGE, 0.0f, MAX_F, t.edge);
ep->distSpin = SetupFloatSpinner(hDlg, IDC_TESS_DIST_SPINNER, IDC_TESS_DIST, 0.0f, MAX_F, t.dist);
ep->angSpin = SetupFloatSpinner(hDlg, IDC_TESS_ANG_SPINNER, IDC_TESS_ANG, 0.0f, MAX_F, t.ang);
ep->mergeSpin = SetupFloatSpinner(hDlg, IDC_MERGE_SPINNER, IDC_MERGE, 0.000f, MAX_F, t.merge);
ep->SetTessUI(hDlg, &t);
ep->SetSurfDlgEnables();
ep->SetTileDlgEnables();
return TRUE;
}
case WM_DESTROY:
if (ep->uSpin)
{
ReleaseISpinner(ep->uSpin);
ep->uSpin = NULL;
}
if (ep->vSpin)
{
ReleaseISpinner(ep->vSpin);
ep->vSpin = NULL;
}
if (ep->edgeSpin)
{
ReleaseISpinner(ep->edgeSpin);
ep->edgeSpin = NULL;
}
if (ep->distSpin)
{
ReleaseISpinner(ep->distSpin);
ep->distSpin = NULL;
}
if (ep->angSpin)
{
ReleaseISpinner(ep->angSpin);
ep->angSpin = NULL;
}
if (ep->mergeSpin)
{
ReleaseISpinner(ep->mergeSpin);
ep->mergeSpin = NULL;
}
return FALSE;
case CC_SPINNER_BUTTONUP:
{
TessApprox tess;
if (ep->settingViewportTess)
{
tess = ep->GetViewTess();
} else
{
if (ep->settingDisp)
tess = ep->GetDispTess();
else
tess = ep->GetProdTess();
}
ep->SetTessUI(hDlg, &tess);
}
break;
case CC_SPINNER_CHANGE:
switch (LOWORD(wParam))
{
case IDC_TESS_U_SPINNER:
case IDC_TESS_V_SPINNER:
case IDC_TESS_EDGE_SPINNER:
case IDC_TESS_DIST_SPINNER:
case IDC_TESS_ANG_SPINNER:
case IDC_MERGE_SPINNER:
{
TessApprox tess;
if (ep->settingViewportTess)
{
tess = ep->GetViewTess();
} else
{
if (ep->settingDisp)
tess = ep->GetDispTess();
else
tess = ep->GetProdTess();
}
switch (LOWORD(wParam))
{
case IDC_TESS_U_SPINNER:
tess.u = ep->uSpin->GetIVal();
break;
case IDC_TESS_V_SPINNER:
tess.v = ep->vSpin->GetIVal();
break;
case IDC_TESS_EDGE_SPINNER:
tess.edge = ep->edgeSpin->GetFVal();
break;
case IDC_TESS_DIST_SPINNER:
tess.dist = ep->distSpin->GetFVal();
break;
case IDC_TESS_ANG_SPINNER:
tess.ang = ep->angSpin->GetFVal();
break;
case IDC_MERGE_SPINNER:
tess.merge = ep->mergeSpin->GetFVal();
break;
}
if (ep->settingViewportTess)
{
ep->SetViewTess(tess);
} else
{
if (ep->settingDisp)
ep->SetDispTess(tess);
else
ep->SetProdTess(tess);
}
if (!HIWORD(wParam))
ep->SetTessUI(hDlg, &tess);
break;
}
}
break;
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
ep->ip->RollupMouseMessage(hDlg, message, wParam, lParam);
return FALSE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
// Tessellation
case IDC_TESS_VIEW:
{
ep->settingViewportTess = TRUE;
TessApprox t = ep->GetViewTess();
ep->SetTessUI(hDlg, &t);
EnableWindow(GetDlgItem(hDlg, IDC_TESS_VIEW_DEP), FALSE); // always off here
break;
}
case IDC_TESS_RENDERER:
{
ep->settingViewportTess = FALSE;
if (ep->settingDisp)
{
TessApprox t = ep->GetDispTess();
ep->SetTessUI(hDlg, &t);
} else
{
TessApprox t = ep->GetProdTess();
ep->SetTessUI(hDlg, &t);
}
break;
}
case IDC_MESH:
ep->settingDisp = FALSE;
ep->SetTessUI(hDlg, &ep->GetProdTess());
break;
case IDC_DISP:
ep->settingDisp = TRUE;
ep->SetTessUI(hDlg, &ep->GetDispTess());
break;
case IDC_TILE_MODE:
{
BOOL bCheck=(IsDlgButtonChecked(hDlg, IDC_TILE_MODE)==BST_CHECKED);
ep->SetTileMode (bCheck!=0);
// Old
EnableWindow (GetDlgItem (hDlg, IDC_STEPS), !bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_STEPSSPINNER), !bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_STEPS_RENDER), !bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_STEPSRENDERSPINNER), !bCheck);
// New
EnableWindow (GetDlgItem (hDlg, IDC_TILESTEPS), bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_TILESTEPSSPINNER), bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_TRANSITION), bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_TRANSITIONSPINNER), bCheck);
EnableWindow (GetDlgItem (hDlg, IDC_KEEP_MAPPING), bCheck);
ep->SetTessUI(hDlg, &ep->GetDispTess());
}
break;
case IDC_KEEP_MAPPING:
ep->SetKeepMapping (IsDlgButtonChecked(hDlg, IDC_KEEP_MAPPING)!=0);
ep->SetTessUI(hDlg, &ep->GetDispTess());
break;
// watje 12-10-98
case IDC_SHOW_INTERIOR_FACES:
case IDC_TESS_SET:
case IDC_TESS_REGULAR:
case IDC_TESS_PARAM:
case IDC_TESS_SPATIAL:
case IDC_TESS_CURV:
case IDC_TESS_LDA:
{
TessApprox tess;
if (ep->settingViewportTess)
{
tess = ep->GetViewTess();
} else
{
if (ep->settingDisp)
tess = ep->GetDispTess();
else
tess = ep->GetProdTess();
}
switch (LOWORD(wParam))
{
// watje 12-10-98
case IDC_SHOW_INTERIOR_FACES:
tess.showInteriorFaces = IsDlgButtonChecked(hDlg, IDC_SHOW_INTERIOR_FACES);
break;
case IDC_TESS_SET:
tess.type = TESS_SET;
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), TRUE);
break;
case IDC_TESS_REGULAR:
tess.type = TESS_REGULAR;
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), TRUE);
break;
case IDC_TESS_PARAM:
tess.type = TESS_PARAM;
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), TRUE);
break;
case IDC_TESS_SPATIAL:
tess.type = TESS_SPATIAL;
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), TRUE);
break;
case IDC_TESS_CURV:
tess.type = TESS_CURVE;
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), TRUE);
break;
case IDC_TESS_LDA:
tess.type = TESS_LDA;
EnableWindow(GetDlgItem(hDlg, IDC_SHOW_INTERIOR_FACES), TRUE);
break;
}
if (ep->settingViewportTess)
{
ep->SetViewTess(tess);
} else
{
if (ep->settingDisp)
ep->SetDispTess(tess);
else
ep->SetProdTess(tess);
}
ep->SetTessUI(hDlg, &tess);
}
break;
case IDC_TESS_VIEW_DEP:
{
TessApprox tess;
tess = ep->GetProdTess();
tess.view = IsDlgButtonChecked(hDlg, IDC_TESS_VIEW_DEP);
if (ep->settingDisp)
ep->SetDispTess(tess);
else
ep->SetProdTess(tess);
}
break;
case IDC_TESS_NORMALS:
if (ep->settingViewportTess)
{
ep->SetViewTessNormals(IsDlgButtonChecked(hDlg, IDC_TESS_NORMALS));
ep->SetTessUI(hDlg, &ep->GetViewTess());
} else
{
ep->SetProdTessNormals(IsDlgButtonChecked(hDlg, IDC_TESS_NORMALS));
if (ep->settingDisp)
ep->SetTessUI(hDlg, &ep->GetDispTess());
else
ep->SetTessUI(hDlg, &ep->GetProdTess());
}
break;
case IDC_WELDTESS:
if (ep->settingViewportTess)
{
ep->SetViewTessWeld(IsDlgButtonChecked(hDlg, IDC_WELDTESS));
ep->SetTessUI(hDlg, &ep->GetViewTess());
} else
{
ep->SetProdTessWeld(IsDlgButtonChecked(hDlg, IDC_WELDTESS));
if (ep->settingDisp)
ep->SetTessUI(hDlg, &ep->GetDispTess());
else
ep->SetTessUI(hDlg, &ep->GetProdTess());
}
break;
case IDC_ADVANCED_PARAMETERS:
{
TessApprox tess;
if (ep->settingViewportTess)
{
tess = ep->GetViewTess();
} else
{
if (ep->settingDisp)
tess = ep->GetDispTess();
else
tess = ep->GetProdTess();
}
sParams.mStyle = tess.subdiv;
sParams.mMin = tess.minSub;
sParams.mMax = tess.maxSub;
sParams.mTris = tess.maxTris;
int retval = DialogBox(hInstance,
MAKEINTRESOURCE(IDD_SURF_APPROX_ADV),
ep->ip->GetMAXHWnd(), AdvParametersDialogProc);
if (retval == 1)
{
BOOL confirm = FALSE;
if ((sParams.mStyle == SUBDIV_DELAUNAY && sParams.mTris > 200000) ||
(sParams.mStyle != SUBDIV_DELAUNAY && sParams.mMax > 5))
{
// warning!
TSTR title = GetString(IDS_ADV_SURF_APPROX_WARNING_TITLE),
warning = GetString(IDS_ADV_SURF_APPROX_WARNING);
if (MessageBox(hDlg, warning, title,
MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDYES)
confirm = TRUE;
} else
confirm = TRUE;
if (confirm)
{
// do it, they've been warned!
tess.subdiv = sParams.mStyle;
tess.minSub = sParams.mMin;
tess.maxSub = sParams.mMax;
tess.maxTris = sParams.mTris;
if (ep->settingViewportTess)
{
ep->SetViewTess(tess);
} else
{
if (ep->settingDisp)
ep->SetDispTess(tess);
else
ep->SetProdTess(tess);
}
}
}
break;
}
}
break;
}
return FALSE;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
AdvParams sParams;
static ISpinnerControl* psMinSpin = NULL;
static ISpinnerControl* psMaxSpin = NULL;
static ISpinnerControl* psMaxTrisSpin = NULL;
// this max matches the MI max.
#define MAX_SUBDIV 7
static BOOL initing = FALSE; // this is a hack but CenterWindow causes bad commands
INT_PTR CALLBACK
AdvParametersDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
initing = TRUE;
CenterWindow(hDlg, GetCOREInterface()->GetMAXHWnd());
initing = FALSE;
psMinSpin = SetupIntSpinner(hDlg, IDC_TESS_MIN_REC_SPINNER, IDC_TESS_MIN_REC, 0, sParams.mMax, sParams.mMin);
psMaxSpin = SetupIntSpinner(hDlg, IDC_TESS_MAX_REC_SPINNER, IDC_TESS_MAX_REC, sParams.mMin, MAX_SUBDIV, sParams.mMax);
psMaxTrisSpin = SetupIntSpinner(hDlg, IDC_TESS_MAX_TRIS_SPINNER, IDC_TESS_MAX_TRIS, 0, 2000000, sParams.mTris);
switch (sParams.mStyle)
{
case SUBDIV_GRID:
CheckDlgButton(hDlg, IDC_GRID, TRUE);
CheckDlgButton(hDlg, IDC_TREE, FALSE);
CheckDlgButton(hDlg, IDC_DELAUNAY, FALSE);
break;
case SUBDIV_TREE:
CheckDlgButton(hDlg, IDC_GRID, FALSE);
CheckDlgButton(hDlg, IDC_TREE, TRUE);
CheckDlgButton(hDlg, IDC_DELAUNAY, FALSE);
break;
case SUBDIV_DELAUNAY:
CheckDlgButton(hDlg, IDC_GRID, FALSE);
CheckDlgButton(hDlg, IDC_TREE, FALSE);
CheckDlgButton(hDlg, IDC_DELAUNAY, TRUE);
break;
}
break;
}
case WM_COMMAND:
if (initing)
return FALSE;
switch (LOWORD(wParam))
{
case IDOK:
EndDialog(hDlg, 1);
break;
case IDCANCEL:
EndDialog(hDlg, 0);
break;
case IDC_GRID:
sParams.mStyle = SUBDIV_GRID;
CheckDlgButton(hDlg, IDC_GRID, TRUE);
CheckDlgButton(hDlg, IDC_TREE, FALSE);
CheckDlgButton(hDlg, IDC_DELAUNAY, FALSE);
break;
case IDC_TREE:
sParams.mStyle = SUBDIV_TREE;
CheckDlgButton(hDlg, IDC_GRID, FALSE);
CheckDlgButton(hDlg, IDC_TREE, TRUE);
CheckDlgButton(hDlg, IDC_DELAUNAY, FALSE);
break;
case IDC_DELAUNAY:
sParams.mStyle = SUBDIV_DELAUNAY;
CheckDlgButton(hDlg, IDC_GRID, FALSE);
CheckDlgButton(hDlg, IDC_TREE, FALSE);
CheckDlgButton(hDlg, IDC_DELAUNAY, TRUE);
break;
}
break;
case CC_SPINNER_CHANGE:
switch (LOWORD(wParam))
{
case IDC_TESS_MIN_REC_SPINNER:
sParams.mMin = psMinSpin->GetIVal();
psMinSpin->SetLimits(0, sParams.mMax, FALSE);
psMaxSpin->SetLimits(sParams.mMin, MAX_SUBDIV, FALSE);
break;
case IDC_TESS_MAX_REC_SPINNER:
sParams.mMax = psMaxSpin->GetIVal();
psMinSpin->SetLimits(0, sParams.mMax, FALSE);
psMaxSpin->SetLimits(sParams.mMin, MAX_SUBDIV, FALSE);
break;
case IDC_TESS_MAX_TRIS_SPINNER:
sParams.mTris = psMaxTrisSpin->GetIVal();
break;
}
break;
case WM_DESTROY:
if (psMinSpin)
{
ReleaseISpinner(psMinSpin);
psMinSpin = NULL;
}
if (psMaxSpin)
{
ReleaseISpinner(psMaxSpin);
psMaxSpin = NULL;
}
if (psMaxTrisSpin)
{
ReleaseISpinner(psMaxTrisSpin);
psMaxTrisSpin = NULL;
}
break;
}
return FALSE;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetViewTess(TessApprox &tess)
{
viewTess = tess;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
patch->SetViewTess(tess);
patchData->viewTess = tess;
//rpatch->rTess = rTess;
if (patchData->tempData)
{
patchData->TempData(this)->Invalidate(PART_DISPLAY);
}
}
nodes.DisposeTemporary();
NotifyDependents(FOREVER, PART_DISPLAY, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetProdTess(TessApprox &tess)
{
prodTess = tess;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
patch->SetProdTess(tess);
patchData->prodTess = tess;
if (patchData->tempData)
{
patchData->TempData(this)->Invalidate(PART_DISPLAY);
}
}
nodes.DisposeTemporary();
NotifyDependents(FOREVER, PART_DISPLAY, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetDispTess(TessApprox &tess)
{
dispTess = tess;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
patch->SetDispTess(tess);
patchData->dispTess = tess;
if (patchData->tempData)
{
patchData->TempData(this)->Invalidate(PART_DISPLAY);
}
}
nodes.DisposeTemporary();
NotifyDependents(FOREVER, PART_DISPLAY, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetViewTessNormals(BOOL use)
{
mViewTessNormals = use;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
patch->SetViewTessNormals(use);
patchData->mViewTessNormals = use;
if (patchData->tempData)
{
patchData->TempData(this)->Invalidate(PART_DISPLAY);
}
}
nodes.DisposeTemporary();
NotifyDependents(FOREVER, PART_DISPLAY, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetProdTessNormals(BOOL use)
{
mProdTessNormals = use;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
patch->SetProdTessNormals(use);
patchData->mProdTessNormals = use;
if (patchData->tempData)
{
patchData->TempData(this)->Invalidate(PART_DISPLAY);
}
}
nodes.DisposeTemporary();
NotifyDependents(FOREVER, PART_DISPLAY, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetViewTessWeld(BOOL weld)
{
mViewTessWeld = weld;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
patch->SetViewTessWeld(weld);
patchData->mViewTessWeld = weld;
if (patchData->tempData)
{
patchData->TempData(this)->Invalidate(PART_DISPLAY);
}
}
nodes.DisposeTemporary();
NotifyDependents(FOREVER, PART_DISPLAY, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SetProdTessWeld(BOOL weld)
{
mProdTessWeld = weld;
ModContextList mcList;
INodeTab nodes;
if (!ip)
return;
ip->GetModContexts(mcList, nodes);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
continue;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(ip->GetTime(),rpatch);
if (!patch)
continue;
patch->SetProdTessWeld(weld);
patchData->mProdTessWeld = weld;
if (patchData->tempData)
{
patchData->TempData(this)->Invalidate(PART_DISPLAY);
}
}
nodes.DisposeTemporary();
NotifyDependents(FOREVER, PART_DISPLAY, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -1,301 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern Point3 zeroPoint;
// ------------------------------------------------------------------------------------------------------------------------------------------------------
EPVertMapper::~EPVertMapper()
{
if (vertMap)
{
delete[] vertMap;
vertMap = NULL;
}
if (vecMap)
{
delete[] vecMap;
vecMap = NULL;
}
}
void EPVertMapper::Build(PatchMesh &patch)
{
verts = patch.numVerts;
if (vertMap)
delete[] vertMap;
vertMap = new EPMapVert[verts];
vecs = patch.numVecs;
if (vecMap)
delete[] vecMap;
vecMap = new EPMapVert[vecs];
int i;
for (i = 0; i < verts; ++i)
vertMap[i] = EPMapVert(i, patch.verts[i].p, zeroPoint);
for (i = 0; i < vecs; ++i)
vecMap[i] = EPMapVert(i, patch.vecs[i].p, zeroPoint);
}
void EPVertMapper::RecordTopologyTags(PatchMesh &patch)
{
int i;
for (i = 0; i < verts; ++i)
{
// If it's still mapped, record it!
if (vertMap[i].vert >= 0)
patch.verts[vertMap[i].vert].aux1 = i;
}
for (i = 0; i < vecs; ++i)
{
// If it's still mapped, record it!
if (vecMap[i].vert >= 0)
patch.vecs[vecMap[i].vert].aux1 = i;
}
}
void EPVertMapper::UpdateMapping(PatchMesh &patch)
{
// Flush existing mapping
int i;
for (i = 0; i < verts; ++i)
vertMap[i].vert = -1;
for (i = 0; i < vecs; ++i)
vecMap[i].vert = -1;
// Build the new mapping
int verts = patch.numVerts;
for (int vert = 0; vert < verts; ++vert)
{
int aux = patch.verts[vert].aux1;
if (aux != 0xffffffff)
vertMap[aux].vert = vert;
}
int vecs = patch.numVecs;
for (int vec = 0; vec < vecs; ++vec)
{
int aux = patch.vecs[vec].aux1;
if (aux != 0xffffffff)
vecMap[aux].vert = vec;
}
}
void EPVertMapper::RecomputeDeltas(PatchMesh &patch)
{
int i;
for (i = 0; i < verts; ++i)
{
EPMapVert &map = vertMap[i];
if (map.vert >= 0 && map.originalStored)
{
Point3 pnew = patch.verts[map.vert].p;
#ifdef VMAP_DEBUG
Point3 oldDelta = map.delta;
#endif
map.delta = pnew - map.original;
#ifdef VMAP_DEBUG
if (map.delta != oldDelta)
DebugPrint("Vert %d delta changed from %.2f %.2f %.2f to %.2 %.2f %.2f\n", i, oldDelta.x, oldDelta.y, oldDelta.z, map.delta.x, map.delta.y, map.delta.z);
#endif
}
}
for (i = 0; i < vecs; ++i)
{
EPMapVert &map = vecMap[i];
if (map.vert >= 0 && map.originalStored)
{
Point3 pnew = patch.vecs[map.vert].p;
#ifdef VMAP_DEBUG
Point3 oldDelta = map.delta;
#endif
map.delta = pnew - map.original;
#ifdef VMAP_DEBUG
if (map.delta != oldDelta)
DebugPrint("Vec %d delta changed from %.2f %.2f %.2f to %.2 %.2f %.2f\n", i, oldDelta.x, oldDelta.y, oldDelta.z, map.delta.x, map.delta.y, map.delta.z);
#endif
}
}
}
void EPVertMapper::UpdateAndApplyDeltas(PatchMesh &inPatch, PatchMesh &outPatch)
{
// watje 4-27-99 here to handle 0 patch situations
if (inPatch.numPatches == 0)
{
// outPatch.setNumVerts(0,TRUE);
return;
}
// Update the original point locations
int i;
for (i = 0; i < verts; ++i)
{
// If this table has more in it than we need, forget the rest
// This can happen if the input object changes to fewer verts
if (i >= inPatch.numVerts)
break;
// If it's still mapped, update it!
if (vertMap[i].vert >= 0)
{
vertMap[i].original = inPatch.verts[i].p;
vertMap[i].originalStored = TRUE;
}
}
for (i = 0; i < vecs; ++i)
{
// If this table has more in it than we need, forget the rest
// This can happen if the input object changes to fewer vecs
if (i >= inPatch.numVecs)
break;
// If it's still mapped, update it!
if (vecMap[i].vert >= 0)
{
vecMap[i].original = inPatch.vecs[i].p;
vecMap[i].originalStored = TRUE;
}
}
// Now apply to output
for (i = 0; i < verts; ++i)
{
EPMapVert &pv = vertMap[i];
if (pv.vert >= 0 && pv.originalStored)
{
// nlassert(pv.vert >= 0 && pv.vert < outPatch.numVerts);
// watje 4-27-99 instead just throwing an nlassert it pops a message box up and troes to recover
if (!(pv.vert >= 0 && pv.vert < outPatch.numVerts))
{
outPatch.setNumVerts(pv.vert + 1, TRUE);
TSTR title = GetString(IDS_TH_EDITPATCH_CLASS),
warning = GetString(IDS_PW_SURFACEERROR);
MessageBox(GetCOREInterface()->GetMAXHWnd(),
warning, title, MB_OK | MB_APPLMODAL);
}
if (i >= inPatch.numVerts)
outPatch.verts[pv.vert].p = zeroPoint;
else
outPatch.verts[pv.vert].p = pv.original + pv.delta;
#ifdef VMAP_DEBUG
if (pv.delta != zeroPoint)
DebugPrint("Vert %d applied delta of %.2f %.2f %.2f\n", i, pv.delta.x, pv.delta.y, pv.delta.z);
#endif
}
}
for (i = 0; i < vecs; ++i)
{
EPMapVert &pv = vecMap[i];
if (pv.vert >= 0 && pv.originalStored)
{
// nlassert(pv.vert >= 0 && pv.vert < outPatch.numVecs);
// watje 4-27-99 instead just throwing an nlassert it pops a message box up and troes to recover
if (!(pv.vert >= 0 && pv.vert < outPatch.numVecs))
{
outPatch.setNumVecs(pv.vert + 1, TRUE);
TSTR title = GetString(IDS_TH_EDITPATCH_CLASS),
warning = GetString(IDS_PW_SURFACEERROR);
MessageBox(GetCOREInterface()->GetMAXHWnd(),
warning, title, MB_OK | MB_APPLMODAL);
}
if (i >= inPatch.numVecs)
outPatch.vecs[pv.vert].p = zeroPoint;
else
outPatch.vecs[pv.vert].p = pv.original + pv.delta;
#ifdef VMAP_DEBUG
if (pv.delta != zeroPoint)
DebugPrint("Vec %d applied delta of %.2f %.2f %.2f\n", i, pv.delta.x, pv.delta.y, pv.delta.z);
#endif
}
}
}
EPVertMapper& EPVertMapper::operator=(EPVertMapper &from)
{
if (vertMap)
delete[] vertMap;
verts = from.verts;
vertMap = new EPMapVert[verts];
int i;
for (i = 0; i < verts; ++i)
vertMap[i] = from.vertMap[i];
if (vecMap)
delete[] vecMap;
vecs = from.vecs;
vecMap = new EPMapVert[vecs];
for (i = 0; i < vecs; ++i)
vecMap[i] = from.vecMap[i];
return *this;
}
void EPVertMapper::RescaleWorldUnits(float f)
{
int i;
for (i = 0; i < verts; ++i)
{
vertMap[i].delta *= f;
if (vertMap[i].originalStored)
vertMap[i].original *= f;
}
for (i = 0; i < vecs; ++i)
{
vecMap[i].delta *= f;
if (vecMap[i].originalStored)
vecMap[i].original *= f;
}
}
#define EPVM_DATA_CHUNK 0x1000
IOResult EPVertMapper::Save(ISave *isave)
{
ULONG nb;
isave->BeginChunk(EPVM_DATA_CHUNK);
isave->Write(&verts, sizeof(int), &nb);
isave->Write(vertMap, sizeof(EPMapVert) * verts, &nb);
isave->Write(&vecs, sizeof(int), &nb);
isave->Write(vecMap, sizeof(EPMapVert) * vecs, &nb);
isave->EndChunk();
return IO_OK;
}
IOResult EPVertMapper::Load(ILoad *iload)
{
IOResult res;
ULONG nb;
int index = 0;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case EPVM_DATA_CHUNK:
res = iload->Read(&verts, sizeof(int), &nb);
if (vertMap)
delete[] vertMap;
vertMap = new EPMapVert[verts];
res = iload->Read(vertMap, sizeof(EPMapVert) * verts, &nb);
res = iload->Read(&vecs, sizeof(int), &nb);
if (vecMap)
delete[] vecMap;
vecMap = new EPMapVert[vecs];
res = iload->Read(vecMap, sizeof(EPMapVert) * vecs, &nb);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}

View file

@ -1,714 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
#include "nel/misc/time_nl.h"
using namespace NLMISC;
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
// ------------------------------------------------------------------------------------------------------------------------------------------------------
class EPVertMapRestore : public RestoreObj
{
public:
BOOL gotRedo;
EPVertMapper undo;
EPVertMapper redo;
EditPatchData *epd;
EPVertMapRestore(EditPatchData *d)
{
undo = d->vertMap;
epd = d;
gotRedo = FALSE;
}
void Restore(int isUndo)
{
if (!gotRedo)
{
gotRedo = TRUE;
redo = epd->vertMap;
}
epd->vertMap = undo;
}
void Redo()
{
epd->vertMap = redo;
}
int Size() { return 1; }
void EndHold() { }
TSTR Description() { return TSTR(_T("EPVertMapRestore")); }
};
// --------------------------------------------------------------------------------------
class FinalPatchRestore : public RestoreObj
{
public:
BOOL gotRedo;
PatchMesh undo;
PatchMesh redo;
PatchMesh *patch;
RPatchMesh *rundo;
RPatchMesh *rredo;
RPatchMesh *rpatch;
FinalPatchRestore(PatchMesh *s, RPatchMesh *rs)
{
rundo = NULL;
rredo = NULL;
undo = *s;
if (rs)
{
rundo=new RPatchMesh();
*rundo = *rs;
}
patch = s;
rpatch = rs;
gotRedo = FALSE;
}
virtual ~FinalPatchRestore()
{
if (rundo)
delete rundo;
if (rredo)
delete rredo;
}
void Restore(int isUndo)
{
if (!gotRedo)
{
gotRedo = TRUE;
redo = *patch;
if (rpatch)
{
if (rredo==NULL)
rredo=new RPatchMesh();
*rredo = *rpatch;
}
}
*patch = undo;
if (rundo)
*rpatch = *rundo;
}
void Redo()
{
*patch = redo;
if (rredo)
*rpatch = *rredo;
}
int Size() { return 1; }
void EndHold() { }
TSTR Description() { return TSTR(_T("FinalPatchRestore")); }
};
// ------------------------------------------------------------------------------------------------------------------------------------------------------
EditPatchData::EditPatchData(EditPatchMod *mod)
{
meshSteps = mod->meshSteps;
// 3-18-99 to suport render steps and removal of the mental tesselator
meshStepsRender = mod->meshStepsRender;
showInterior = mod->showInterior;
// meshAdaptive = mod->meshAdaptive; // Future use (Not used now)
viewTess = mod->viewTess;
prodTess = mod->prodTess;
dispTess = mod->dispTess;
tileLevel = mod->tileLevel;
tileMode = mod->tileMode;
includeMeshes = mod->includeMeshes;
transitionType = mod->transitionType;
keepMapping = mod->keepMapping;
mViewTessNormals = mod->mViewTessNormals;
mProdTessNormals = mod->mProdTessNormals;
mViewTessWeld = mod->mViewTessWeld;
mProdTessWeld = mod->mProdTessWeld;
displayLattice = mod->displayLattice;
displaySurface = mod->displaySurface;
flags = 0;
tempData = NULL;
}
EditPatchData::EditPatchData(EditPatchData& emc)
{
meshSteps = emc.meshSteps;
// 3-18-99 to suport render steps and removal of the mental tesselator
meshStepsRender = emc.meshStepsRender;
showInterior = emc.showInterior;
// meshAdaptive = emc.meshAdaptive; // Future use (Not used now)
viewTess = emc.viewTess;
prodTess = emc.prodTess;
dispTess = emc.dispTess;
tileLevel = emc.tileLevel;
transitionType = emc.transitionType;
tileMode = emc.tileMode;
includeMeshes = emc.includeMeshes;
keepMapping = emc.keepMapping;
mViewTessNormals = emc.mViewTessNormals;
mProdTessNormals = emc.mProdTessNormals;
mViewTessWeld = emc.mViewTessWeld;
mProdTessWeld = emc.mProdTessWeld;
displayLattice = emc.displayLattice;
displaySurface = emc.displaySurface;
flags = emc.flags;
tempData = NULL;
vertMap = emc.vertMap;
finalPatch = emc.finalPatch;
rfinalPatch = emc.rfinalPatch;
}
void EditPatchData::Apply(TimeValue t, RPO *patchOb, int selLevel)
{
TTicks ticks=CTime::getPerformanceTime ();
// Either just copy it from the existing cache or rebuild from previous level!
if (!GetFlag(EPD_UPDATING_CACHE) && tempData
&& tempData->PatchCached(t))
{
RPatchMesh *rpatch;
PatchMesh *patch=tempData->GetPatch(t, rpatch);
patchOb->patch.DeepCopy( patch,
PART_GEOM | SELECT_CHANNEL | PART_SUBSEL_TYPE|
PART_DISPLAY | PART_TOPO | TEXMAP_CHANNEL);
//rpatch->UpdateBinding (*patch, t);
*patchOb->rpatch=*rpatch;
patchOb->PointsWereChanged();
}
else if (GetFlag(EPD_HASDATA))
{
// For old files, which contain exhaustive data to reconstruct the editing process
// of patches, we'll have data in the 'changes' table. If it's there, go ahead and
// replay the edits, then store the alterations in our new delta format and discard
// the change table!
int count = changes.Count();
if (count)
{
// DebugPrint("*** Applying old style (%d) ***\n", count);
// Store the topology for future reference
vertMap.Build(patchOb->patch);
finalPatch = patchOb->patch;
rfinalPatch = *patchOb->rpatch;
for (int i = 0; i < count; ++i)
{
PModRecord *rec = changes[i];
// Record the topo flags
RecordTopologyTags(&patchOb->patch);
BOOL result = rec->Redo(&patchOb->patch, patchOb->rpatch, 0);
UpdateChanges(&patchOb->patch, patchOb->rpatch);
// If we hit one that didn't play back OK, we need to flush the remainder
if (!result)
{
for (int j = i; j < count; ++j)
delete changes[j];
changes.Delete(i, count - i);
break;
}
}
// Nuke the changes table
count = changes.Count();
for (int k = 0; k < count; ++k)
delete changes[k];
changes.Delete(0, count);
changes.Shrink();
count = 0;
}
else
{
// Apply deltas to incoming shape, placing into finalPatch
vertMap.UpdateAndApplyDeltas(patchOb->patch, finalPatch);
patchOb->patch = finalPatch;
*patchOb->rpatch = rfinalPatch;
}
patchOb->PointsWereChanged();
// Kind of a waste when there's no animation...
patchOb->UpdateValidity(GEOM_CHAN_NUM, FOREVER);
patchOb->UpdateValidity(TOPO_CHAN_NUM, FOREVER);
patchOb->UpdateValidity(SELECT_CHAN_NUM, FOREVER);
patchOb->UpdateValidity(SUBSEL_TYPE_CHAN_NUM, FOREVER);
patchOb->UpdateValidity(DISP_ATTRIB_CHAN_NUM, FOREVER);
}
else
{ // No data yet -- Store initial required data
// DebugPrint("<<<Storing Initial Data>>>\n");
vertMap.Build(patchOb->patch);
finalPatch = patchOb->patch;
rfinalPatch = *patchOb->rpatch;
}
// Hand it its mesh interpolation info
patchOb->SetMeshSteps(meshSteps);
// 3-18-99 to suport render steps and removal of the mental tesselator
patchOb->SetMeshStepsRender(meshStepsRender);
patchOb->SetShowInterior(showInterior);
// patchOb->SetAdaptive(meshAdaptive); // Future use (Not used now)
patchOb->SetViewTess(viewTess);
patchOb->SetProdTess(prodTess);
patchOb->SetDispTess(dispTess);
patchOb->rpatch->rTess.ModeTile=tileMode;
patchOb->rpatch->rTess.TileTesselLevel=tileLevel;
patchOb->rpatch->rTess.TransitionType=transitionType;
patchOb->rpatch->rTess.KeepMapping=keepMapping;
patchOb->SetViewTessNormals(mViewTessNormals);
patchOb->SetProdTessNormals(mProdTessNormals);
patchOb->SetViewTessWeld(mViewTessWeld);
patchOb->SetProdTessWeld(mProdTessWeld);
patchOb->showMesh = displaySurface;
patchOb->SetShowLattice(displayLattice);
patchOb->patch.dispFlags = 0; // TH 3/3/99
switch (selLevel)
{
case EP_PATCH:
patchOb->patch.SetDispFlag(DISP_SELPATCHES);
break;
case EP_EDGE:
patchOb->patch.SetDispFlag(DISP_SELEDGES);
break;
case EP_VERTEX:
patchOb->patch.SetDispFlag(DISP_VERTTICKS | DISP_SELVERTS | DISP_VERTS);
break;
case EP_TILE:
//patchOb->patch.SetDispFlag(DISP_VERTTICKS | DISP_SELVERTS | DISP_VERTS);
break;
}
patchOb->patch.selLevel = patchLevel[selLevel];
patchOb->rpatch->SetSelLevel (selLevel);
/*rfinalPatch.UpdateBinding (finalPatch, t);
patchOb->rpatch->UpdateBinding (patchOb->patch, t);*/
if (GetFlag(EPD_UPDATING_CACHE))
{
nlassert(tempData);
tempData->UpdateCache(patchOb);
SetFlag(EPD_UPDATING_CACHE, FALSE);
}
ticks=CTime::getPerformanceTime ()-ticks;
nldebug ("%f", CTime::ticksToSecond(ticks));
}
void EditPatchData::Invalidate(PartID part, BOOL patchValid)
{
if (tempData)
{
tempData->Invalidate(part, patchValid);
}
}
void EditPatchData::BeginEdit(TimeValue t)
{
nlassert(tempData);
if (!GetFlag(EPD_HASDATA))
SetFlag(EPD_HASDATA, TRUE);
}
EPTempData *EditPatchData::TempData(EditPatchMod *mod)
{
if (!tempData)
{
nlassert(mod->ip);
tempData = new EPTempData(mod, this);
}
return tempData;
}
void EditPatchData::RescaleWorldUnits(float f)
{
// Scale the deltas inside the vertex map
vertMap.RescaleWorldUnits(f);
// Now rescale stuff inside our data structures
Matrix3 stm = ScaleMatrix(Point3(f, f, f));
finalPatch.Transform(stm);
}
void EditPatchData::RecordTopologyTags(PatchMesh *patch)
{
// First, stuff all -1's into aux fields
int i;
for (i = 0; i < patch->numVerts; ++i)
patch->verts[i].aux1 = 0xffffffff;
for (i = 0; i < patch->numVecs; ++i)
patch->vecs[i].aux1 = 0xffffffff;
for (i = 0; i < patch->numPatches; ++i)
patch->patches[i].aux1 = 0xffffffff;
// Now put in our tags
vertMap.RecordTopologyTags(*patch);
}
GenericNamedSelSetList &EditPatchData::GetSelSet(EditPatchMod *mod)
{
switch (mod->GetSubobjectLevel())
{
case EP_VERTEX:
return vselSet;
case EP_EDGE:
return eselSet;
case EP_PATCH:
case EP_TILE:
default:
return pselSet;
}
}
GenericNamedSelSetList &EditPatchData::GetSelSet(int level)
{
switch (level + EP_VERTEX)
{
case EP_VERTEX:
return vselSet;
case EP_EDGE:
return eselSet;
case EP_PATCH:
case EP_TILE:
default:
return pselSet;
}
}
void EditPatchData::UpdateChanges(PatchMesh *patch, RPatchMesh *rpatch, BOOL checkTopology)
{
if (theHold.Holding())
{
theHold.Put(new EPVertMapRestore(this));
//theHold.Put(new FinalPatchRestore(&finalPatch, &rfinalPatch));
if (rpatch)
theHold.Put(new FinalPatchRestore(&finalPatch, &rfinalPatch));
else
theHold.Put(new FinalPatchRestore(&finalPatch, NULL));
}
// Update the mapper's indices
if (checkTopology)
vertMap.UpdateMapping(*patch);
// Update mapper's XYZ deltas
vertMap.RecomputeDeltas(*patch);
// Store the final shape
finalPatch = *patch;
if (rpatch)
rfinalPatch = *rpatch;
}
#define EPD_GENERAL_CHUNK 0x1000 // Obsolete as of 11/12/98 (r3)
#define CHANGE_CHUNK 0x1010 // Obsolete as of 11/12/98 (r3)
#define EPD_R3_GENERAL_CHUNK 0x1015
#define MESH_ATTRIB_CHUNK 0x1020
#define DISP_PARTS_CHUNK 0x1030
#define VTESS_ATTRIB_CHUNK 0x1070
#define PTESS_ATTRIB_CHUNK 0x1080
#define DTESS_ATTRIB_CHUNK 0x1090
#define NORMAL_TESS_ATTRIB_CHUNK 0x1110
#define WELD_TESS_ATTRIB_CHUNK 0x1120
#define VERTMAP_CHUNK 0x1130
#define FINALPATCH_CHUNK 0x1140
#define RENDERSTEPS_CHUNK 0x1150
#define SHOWINTERIOR_CHUNK 0x1160
// Named sel set chunks
#define VSELSET_CHUNK 0x1040
#define ESELSET_CHUNK 0x1050
#define PSELSET_CHUNK 0x1060
#define RPO_MODE_TILE 0x4000
#define RFINALPATCH_CHUNK 0x4001
#define RPO_MODE_TILE_TRANSITION 0x4002
#define RPO_INCLUDE_MESHES 0x4003
IOResult EditPatchData::Save(ISave *isave)
{
ULONG nb;
isave->BeginChunk(EPD_R3_GENERAL_CHUNK);
isave->Write(&flags, sizeof(DWORD), &nb);
isave->EndChunk();
isave->BeginChunk(MESH_ATTRIB_CHUNK);
isave->Write(&meshSteps, sizeof(int), &nb);
// Future use (Not used now)
BOOL fakeAdaptive = FALSE;
isave->Write(&fakeAdaptive, sizeof(BOOL), &nb);
// isave->Write(&meshAdaptive,sizeof(BOOL),&nb); // Future use (Not used now)
isave->EndChunk();
// 3-18-99 to suport render steps and removal of the mental tesselator
isave->BeginChunk(RENDERSTEPS_CHUNK);
if ((meshStepsRender < 0) ||(meshStepsRender > 100))
{
meshStepsRender = 5;
nlassert(0);
}
isave->Write(&meshStepsRender, sizeof(int), &nb);
isave->EndChunk();
isave->BeginChunk(SHOWINTERIOR_CHUNK);
isave->Write(&showInterior, sizeof(BOOL), &nb);
isave->EndChunk();
isave->BeginChunk(VTESS_ATTRIB_CHUNK);
viewTess.Save(isave);
isave->EndChunk();
isave->BeginChunk(PTESS_ATTRIB_CHUNK);
prodTess.Save(isave);
isave->EndChunk();
isave->BeginChunk(DTESS_ATTRIB_CHUNK);
dispTess.Save(isave);
isave->EndChunk();
isave->BeginChunk(DISP_PARTS_CHUNK);
isave->Write(&displaySurface, sizeof(BOOL), &nb);
isave->Write(&displayLattice, sizeof(BOOL), &nb);
isave->EndChunk();
isave->BeginChunk(NORMAL_TESS_ATTRIB_CHUNK);
isave->Write(&mViewTessNormals, sizeof(BOOL), &nb);
isave->Write(&mProdTessNormals, sizeof(BOOL), &nb);
isave->EndChunk();
isave->BeginChunk(WELD_TESS_ATTRIB_CHUNK);
isave->Write(&mViewTessWeld, sizeof(BOOL), &nb);
isave->Write(&mProdTessWeld, sizeof(BOOL), &nb);
isave->EndChunk();
isave->BeginChunk(RPO_MODE_TILE);
isave->Write(&tileMode, sizeof(tileMode), &nb);
isave->Write(&tileLevel, sizeof(tileLevel), &nb);
isave->Write(&keepMapping, sizeof(keepMapping), &nb);
isave->EndChunk();
isave->BeginChunk(RPO_INCLUDE_MESHES);
isave->Write(&includeMeshes, sizeof(includeMeshes), &nb);
isave->EndChunk();
isave->BeginChunk(RPO_MODE_TILE_TRANSITION);
isave->Write(&transitionType, sizeof(transitionType), &nb);
isave->EndChunk();
// Save named sel sets
if (vselSet.Count())
{
isave->BeginChunk(VSELSET_CHUNK);
vselSet.Save(isave);
isave->EndChunk();
}
if (eselSet.Count())
{
isave->BeginChunk(ESELSET_CHUNK);
eselSet.Save(isave);
isave->EndChunk();
}
if (pselSet.Count())
{
isave->BeginChunk(PSELSET_CHUNK);
pselSet.Save(isave);
isave->EndChunk();
}
isave->BeginChunk(VERTMAP_CHUNK);
vertMap.Save(isave);
isave->EndChunk();
isave->BeginChunk(FINALPATCH_CHUNK);
finalPatch.Save(isave);
isave->EndChunk();
isave->BeginChunk(RFINALPATCH_CHUNK);
rfinalPatch.Save(isave);
isave->EndChunk();
return IO_OK;
}
IOResult EditPatchData::Load(ILoad *iload)
{
IOResult res;
ULONG nb;
PModRecord *theChange;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
// The following code is here to load pre-release 3 files.
case EPD_GENERAL_CHUNK:
iload->SetObsolete();
iload->Read(&flags, sizeof(DWORD), &nb);
break;
case CLEARVERTSELRECORD_CHUNK:
theChange = new ClearPVertSelRecord;
goto load_change;
case SETVERTSELRECORD_CHUNK:
theChange = new SetPVertSelRecord;
goto load_change;
case INVERTVERTSELRECORD_CHUNK:
theChange = new InvertPVertSelRecord;
goto load_change;
case CLEAREDGESELRECORD_CHUNK:
theChange = new ClearPEdgeSelRecord;
goto load_change;
case SETEDGESELRECORD_CHUNK:
theChange = new SetPEdgeSelRecord;
goto load_change;
case INVERTEDGESELRECORD_CHUNK:
theChange = new InvertPEdgeSelRecord;
goto load_change;
case CLEARPATCHSELRECORD_CHUNK:
theChange = new ClearPatchSelRecord;
goto load_change;
case SETPATCHSELRECORD_CHUNK:
theChange = new SetPatchSelRecord;
goto load_change;
case INVERTPATCHSELRECORD_CHUNK:
theChange = new InvertPatchSelRecord;
goto load_change;
case VERTSELRECORD_CHUNK:
theChange = new PVertSelRecord;
goto load_change;
case EDGESELRECORD_CHUNK:
theChange = new PEdgeSelRecord;
goto load_change;
case PATCHSELRECORD_CHUNK:
theChange = new PatchSelRecord;
goto load_change;
case PATCHDELETERECORD_CHUNK:
theChange = new PatchDeleteRecord;
goto load_change;
case VERTMOVERECORD_CHUNK:
theChange = new PVertMoveRecord;
goto load_change;
case PATCHCHANGERECORD_CHUNK:
theChange = new PatchChangeRecord;
goto load_change;
case VERTCHANGERECORD_CHUNK:
theChange = new PVertChangeRecord;
goto load_change;
case PATCHADDRECORD_CHUNK:
theChange = new PatchAddRecord;
goto load_change;
case EDGESUBDIVIDERECORD_CHUNK:
theChange = new EdgeSubdivideRecord;
goto load_change;
case PATCHSUBDIVIDERECORD_CHUNK:
theChange = new PatchSubdivideRecord;
goto load_change;
case PATTACHRECORD_CHUNK:
theChange = new PAttachRecord;
goto load_change;
case PATCHDETACHRECORD_CHUNK:
theChange = new PatchDetachRecord;
goto load_change;
case PATCHMTLRECORD_CHUNK:
theChange = new PatchMtlRecord;
goto load_change;
case VERTWELDRECORD_CHUNK:
theChange = new PVertWeldRecord;
goto load_change;
case VERTDELETERECORD_CHUNK:
theChange = new PVertDeleteRecord;
// Intentional fall-thru!
load_change:
changes.Append(1, &theChange);
changes[changes.Count() - 1]->Load(iload);
break;
//
// The following code is used for post-release 3 files
//
case EPD_R3_GENERAL_CHUNK:
res = iload->Read(&flags, sizeof(DWORD), &nb);
break;
case VERTMAP_CHUNK:
res = vertMap.Load(iload);
break;
case FINALPATCH_CHUNK:
res = finalPatch.Load(iload);
break;
case RFINALPATCH_CHUNK:
res = rfinalPatch.Load(iload);
break;
//
// The following code is common to all versions' files
//
case MESH_ATTRIB_CHUNK:
iload->Read(&meshSteps, sizeof(int), &nb);
res = iload->Read(&meshAdaptive, sizeof(BOOL), &nb); // Future use (Not used now)
break;
// 3-18-99 to suport render steps and removal of the mental tesselator
case RENDERSTEPS_CHUNK:
iload->Read(&meshStepsRender, sizeof(int), &nb);
if ((meshStepsRender < 0) ||(meshStepsRender > 100))
{
meshStepsRender = 5;
nlassert(0);
}
break;
case SHOWINTERIOR_CHUNK:
iload->Read(&showInterior, sizeof(BOOL), &nb);
break;
case VTESS_ATTRIB_CHUNK:
viewTess.Load(iload);
break;
case PTESS_ATTRIB_CHUNK:
prodTess.Load(iload);
break;
case DTESS_ATTRIB_CHUNK:
dispTess.Load(iload);
break;
case NORMAL_TESS_ATTRIB_CHUNK:
iload->Read(&mViewTessNormals, sizeof(BOOL), &nb);
res = iload->Read(&mProdTessNormals, sizeof(BOOL), &nb);
break;
case WELD_TESS_ATTRIB_CHUNK:
iload->Read(&mViewTessWeld, sizeof(BOOL), &nb);
res = iload->Read(&mProdTessWeld, sizeof(BOOL), &nb);
break;
case DISP_PARTS_CHUNK:
iload->Read(&displaySurface, sizeof(BOOL), &nb);
res = iload->Read(&displayLattice, sizeof(BOOL), &nb);
break;
// Load named selection sets
case VSELSET_CHUNK:
res = vselSet.Load(iload);
break;
case PSELSET_CHUNK:
res = pselSet.Load(iload);
break;
case ESELSET_CHUNK:
res = eselSet.Load(iload);
break;
case RPO_MODE_TILE:
res = iload->Read(&tileMode, sizeof(tileMode), &nb);
res = iload->Read(&tileLevel, sizeof(tileLevel), &nb);
res = iload->Read(&keepMapping, sizeof(keepMapping), &nb);
break;
case RPO_INCLUDE_MESHES:
res = iload->Read(&includeMeshes, sizeof(includeMeshes), &nb);
break;
case RPO_MODE_TILE_TRANSITION:
res = iload->Read(&transitionType, sizeof(transitionType), &nb);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}

View file

@ -1,311 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EPM_BindCMode::EnterMode()
{
if (pobj->hOpsPanel)
{
ICustButton *but = GetICustButton(GetDlgItem(pobj->hOpsPanel, IDC_BIND));
but->SetCheck(TRUE);
ReleaseICustButton(but);
}
}
void EPM_BindCMode::ExitMode()
{
if (pobj->hOpsPanel)
{
ICustButton *but = GetICustButton(GetDlgItem(pobj->hOpsPanel, IDC_BIND));
but->SetCheck(FALSE);
ReleaseICustButton(but);
}
}
/*-------------------------------------------------------------------*/
HCURSOR EPM_BindMouseProc::GetTransformCursor()
{
static HCURSOR hCur = NULL;
if (!hCur)
{
hCur = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_SEGREFINECUR));
}
return hCur;
}
BOOL EPM_BindMouseProc::HitTest(
ViewExp *vpt, IPoint2 *p, int type, int flags, int subType)
{
vpt->ClearSubObjHitList();
SetPatchHitOverride(subType);
ip->SubObHitTest(ip->GetTime(), type, ip->GetCrossing(), flags, p, vpt);
ClearPatchHitOverride();
if (vpt->NumSubObjHits())
{
return TRUE;
} else
{
return FALSE;
}
}
BOOL EPM_BindMouseProc::HitAKnot(ViewExp *vpt, IPoint2 *p, int *vert)
{
int first = 1;
if (HitTest(vpt, p, HITTYPE_POINT, 0, 1))
{
HitLog &hits = vpt->GetSubObjHitList();
HitRecord *rec = hits.First();
DWORD best = 9999;
HitRecord *bestRec;
while (rec)
{
PatchHitData *hit =((PatchHitData *)rec->hitData);
// If there's an exclusion shape, this must be a part of it!
pMesh = hit->patch;
if (1)
{
if (hit->type == PATCH_HIT_VERTEX)
{
// If there's an exclusion shape, the vert & poly can't be the same!
if (first || rec->distance < best)
{
first = 0;
best = rec->distance;
bestRec = rec;
}
}
}
rec = rec->Next();
}
if (!first)
{
PatchHitData *hit =((PatchHitData *)bestRec->hitData);
*vert = hit->index;
return TRUE;
}
}
return FALSE;
}
BOOL EPM_BindMouseProc::HitASegment(ViewExp *vpt, IPoint2 *p, int *seg)
{
int first = 1;
if (HitTest(vpt, p, HITTYPE_POINT, 0, 2))
{
HitLog &hits = vpt->GetSubObjHitList();
HitRecord *rec = hits.First();
DWORD best = 9999;
HitRecord *bestRec;
while (rec)
{
PatchHitData *hit =((PatchHitData *)rec->hitData);
// If there's an exclusion shape, this must be a part of it!
if (pMesh == hit->patch)
{
if (hit->type == PATCH_HIT_EDGE)
{
// If there's an exclusion shape, the vert & poly can't be the same!
if (first || rec->distance < best)
{
first = 0;
best = rec->distance;
bestRec = rec;
}
}
}
rec = rec->Next();
}
if (!first)
{
PatchHitData *hit =((PatchHitData *)bestRec->hitData);
*seg = hit->index;
return TRUE;
}
}
return FALSE;
}
static void PatchXORDottedLine(HWND hwnd, IPoint2 p0, IPoint2 p1)
{
HDC hdc;
hdc = GetDC(hwnd);
SetROP2(hdc, R2_XORPEN);
SetBkMode(hdc, TRANSPARENT);
SelectObject(hdc, CreatePen(PS_DOT, 0, RGB(255, 255, 255)));
MoveToEx(hdc, p0.x, p0.y, NULL);
LineTo(hdc, p1.x, p1.y);
DeleteObject(SelectObject(hdc, GetStockObject(BLACK_PEN)));
ReleaseDC(hwnd, hdc);
}
int EPM_BindMouseProc::proc(
HWND hwnd,
int msg,
int point,
int flags,
IPoint2 m)
{
ViewExp *vpt = ip->GetViewport(hwnd);
int res = TRUE;
static PatchMesh *shape1 = NULL;
static int poly1, vert1, seg1;
static IPoint2 anchor, lastPoint;
switch (msg)
{
case MOUSE_PROPCLICK:
ip->SetStdCommandMode(CID_OBJMOVE);
break;
case MOUSE_POINT:
switch (point)
{
case 0:
{
if (HitAKnot(vpt, &m, &vert1))
{
//if (rpatch->UIVertex[vert1].binded)
{
res = TRUE;
anchor = lastPoint = m;
PatchXORDottedLine(hwnd, anchor, m); // Draw it!
// get valid seg list
/*knotList.SetSize(pMesh->numVerts);
knotList.ClearAll();
for (int i = 0; i < pMesh->numEdges; i++)
{
if (pMesh->edges[i].v1 == vert1)
{
knotList.Set(pMesh->edges[i].v2);
}
if (pMesh->edges[i].v2 == vert1)
{
knotList.Set(pMesh->edges[i].v1);
}
}*/
tab.build (*pMesh);
}
}
else res = FALSE;
break;
}
case 1:
PatchXORDottedLine(hwnd, anchor, lastPoint); // Erase it!
// if(HitAnEndpoint(vpt, &m, shape1, poly1, vert1, NULL, &poly2, &vert2))
// ss->DoVertConnect(vpt, shape1, poly1, vert1, poly2, vert2);
if (HitASegment(vpt, &m, &seg1))
{
// if a valid segemtn change cursor
/*int a = pMesh->edges[seg1].v1;
int b = pMesh->edges[seg1].v2;
if (knotList[a] && knotList[b])
pobj->DoAddHook(pMesh, vert1, seg1);*/
int v0, v1, v2, v3;
switch (CheckBind (vert1, seg1, v0, v1, v2, v3, tab, *pMesh, false, true))
{
case 0:
pobj->DoAddHook(pMesh, v2, vert1, v3, seg1, 0);
break;
case 1:
pobj->DoAddHook(pMesh, v2, vert1, v3, seg1, 1);
break;
case -1:
break;
default:
nlassert (0);
}
}
res = FALSE;
break;
default:
nlassert(0);
}
break;
case MOUSE_MOVE:
// Erase old dotted line
PatchXORDottedLine(hwnd, anchor, lastPoint);
// Draw new dotted line
PatchXORDottedLine(hwnd, anchor, m);
lastPoint = m;
if (HitASegment(vpt, &m, &seg1))
{
// if a valid segemtn change cursor
/*int a = pMesh->edges[seg1].v1;
int b = pMesh->edges[seg1].v2;
if (knotList[a] && knotList[b])
SetCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_TH_SELCURSOR)));
else SetCursor(LoadCursor(NULL, IDC_ARROW));*/
int v0, v1, v2, v3;
if (CheckBind (vert1, seg1, v0, v1, v2, v3, tab, *pMesh, false, true)!=-1)
SetCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_TH_SELCURSOR)));
else
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
else
{
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
break;
case MOUSE_FREEMOVE:
if (HitAKnot(vpt, &m, &vert1))
{
SetCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_TH_SELCURSOR)));
}
else
{
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
/*
if (HitTest(vpt, &m, HITTYPE_POINT, HIT_ABORTONHIT, 1))
{
HitLog &hits = vpt->GetSubObjHitList();
HitRecord *rec = hits.First();
if (rec)
{
SetCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_TH_SELCURSOR)));
}
}
SetCursor(LoadCursor(NULL, IDC_ARROW));
*/
break;
case MOUSE_ABORT:
// Erase old dotted line
PatchXORDottedLine(hwnd, anchor, lastPoint);
break;
}
if (vpt)
ip->ReleaseViewport(vpt);
return res;
}
/*-------------------------------------------------------------------*/

View file

@ -1,341 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
extern void CancelEditPatchModes(IObjParam *ip);
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// This function checks the current command mode and resets it to CID_OBJMOVE if
// it's one of our command modes
void CancelEditPatchModes(IObjParam *ip)
{
switch (ip->GetCommandMode()->ID())
{
case CID_STDPICK:
ip->SetStdCommandMode(CID_OBJMOVE);
break;
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// This gets rid of two-step modes, like booleans. This is necessary because
// the first step, which activates the mode button, validates the selection set.
// If the selection set changes, the mode must be turned off because the new
// selection set may not be valid for the mode.
void Cancel2StepPatchModes(IObjParam *ip)
{
// switch(ip->GetCommandMode()->ID()) {
// case CID_BOOLEAN:
// ip->SetStdCommandMode( CID_OBJMOVE );
// break;
// }
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------
// IPatchSelect and IPatchOps interfaces (JBW 2/2/99)
void* EditPatchMod::GetInterface(ULONG id)
{
switch (id)
{
case I_PATCHSELECT:
return (IPatchSelect*)this;
case I_PATCHSELECTDATA:
return (IPatchSelectData*)this;
case I_PATCHOPS:
return (IPatchOps*)this;
case I_SUBMTLAPI:
return (ISubMtlAPI*)this;
}
return Modifier::GetInterface(id);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::StartCommandMode(patchCommandMode mode)
{
switch (mode)
{
case PcmAttach:
if (hOpsPanel != NULL)
PostMessage(hOpsPanel, WM_COMMAND, IDC_ATTACH, 0);
break;
case PcmExtrude:
if (hOpsPanel != NULL)
PostMessage(hOpsPanel, WM_COMMAND, IDC_EP_EXTRUDE, 0);
break;
case PcmBevel:
if (hOpsPanel != NULL)
PostMessage(hOpsPanel, WM_COMMAND, IDC_EP_BEVEL, 0);
break;
case PcmBind:
if (hOpsPanel != NULL)
PostMessage(hOpsPanel, WM_COMMAND, IDC_BIND, 0);
break;
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::ButtonOp(patchButtonOp opcode)
{
switch (opcode)
{
case PopUnbind:
if (hOpsPanel != NULL)
PostMessage(hOpsPanel, WM_COMMAND, IDC_UNBIND, 0);
break;
case PopHide:
if (hOpsPanel != NULL)
PostMessage(hOpsPanel, WM_COMMAND, IDC_HIDE, 0);
break;
case PopUnhideAll:
if (hOpsPanel != NULL)
PostMessage(hOpsPanel, WM_COMMAND, IDC_UNHIDE, 0);
break;
case PopWeld:
if (hOpsPanel != NULL && GetSubobjectLevel() == PO_VERTEX)
PostMessage(hOpsPanel, WM_COMMAND, IDC_WELD, 0);
break;
case PopDelete:
if (hOpsPanel != NULL && GetSubobjectLevel() >= PO_VERTEX)
PostMessage(hOpsPanel, WM_COMMAND, IDC_PATCH_DELETE, 0);
break;
case PopSubdivide:
if (hOpsPanel != NULL && GetSubobjectLevel() >= PO_EDGE && GetSubobjectLevel() != PO_TILE)
PostMessage(hOpsPanel, WM_COMMAND, IDC_SUBDIVIDE, 0);
break;
case PopAddTri:
if (hOpsPanel != NULL && GetSubobjectLevel() == PO_EDGE)
PostMessage(hOpsPanel, WM_COMMAND, IDC_ADDTRI, 0);
break;
case PopAddQuad:
if (hOpsPanel != NULL && GetSubobjectLevel() == PO_EDGE)
PostMessage(hOpsPanel, WM_COMMAND, IDC_ADDQUAD, 0);
break;
case PopDetach:
if (hOpsPanel != NULL && GetSubobjectLevel() == PO_PATCH)
PostMessage(hOpsPanel, WM_COMMAND, IDC_DETACH, 0);
break;
}
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev)
{
this->ip = ip;
patchUIValid = FALSE;
CreatePatchDataTempData();
hSelectPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_SELECT),
PatchSelectDlgProc, GetString(IDS_TH_SELECTION), (LPARAM)this, rsSel ? 0 : APPENDROLL_CLOSED);
hOpsPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_OPS),
PatchOpsDlgProc, GetString(IDS_TH_GEOMETRY), (LPARAM) this, rsOps ? 0 : APPENDROLL_CLOSED);
/* watje 3 - 18 - 99
if (selLevel == EP_OBJECT)
{
hSurfPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_SURF_OBJ),
PatchObjSurfDlgProc, GetString(IDS_TH_SURFACEPROPERTIES), (LPARAM) this, rsSurf ? 0 : APPENDROLL_CLOSED);
}
else
*/
if (selLevel == EP_PATCH)
{
hSurfPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_SURF),
PatchSurfDlgProc, GetString(IDS_TH_SURFACEPROPERTIES), (LPARAM) this, rsSurf ? 0 : APPENDROLL_CLOSED);
}
else
hSurfPanel = NULL;
if (selLevel == EP_TILE)
{
hTilePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_TILE),
PatchTileDlgProc, "Tile Properties", (LPARAM) this, rsTile ? 0 : APPENDROLL_CLOSED);
}
else
hTilePanel = NULL;
if (selLevel == EP_EDGE)
{
hEdgePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_EDGE),
PatchEdgeDlgProc, "Edge Properties", (LPARAM) this, rsEdge ? 0 : APPENDROLL_CLOSED);
}
else
hEdgePanel = NULL;
// Create sub object editing modes.
moveMode = new MoveModBoxCMode(this, ip);
rotMode = new RotateModBoxCMode(this, ip);
uscaleMode = new UScaleModBoxCMode(this, ip);
nuscaleMode = new NUScaleModBoxCMode(this, ip);
squashMode = new SquashModBoxCMode(this, ip);
selectMode = new SelectModBoxCMode(this, ip);
extrudeMode = new EPM_ExtrudeCMode(this, ip);
bevelMode = new EPM_BevelCMode(this, ip);
bindMode = new EPM_BindCMode(this, ip);
// Add our sub object type
TSTR type1(GetString(IDS_TH_VERTEX));
TSTR type2(GetString(IDS_TH_EDGE));
TSTR type3(GetString(IDS_TH_PATCH));
TSTR type4("Tile");
const TCHAR *ptype[] = { type1, type2, type3 , type4 };
ip->RegisterSubObjectTypes(ptype, 4);
// Restore the selection level.
ip->SetSubObjectLevel(selLevel);
// Disable show end result.
ip->EnableShowEndResult(FALSE);
// Setup named selection sets
SetupNamedSelDropDown();
// Update selection UI display
SelectionChanged();
TimeValue t = ip->GetTime();
NotifyDependents(Interval(t, t), PART_ALL, REFMSG_BEGIN_EDIT);
NotifyDependents(Interval(t, t), PART_ALL, REFMSG_MOD_DISPLAY_ON);
SetAFlag(A_MOD_BEING_EDITED);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::EndEditParams(IObjParam *ip, ULONG flags, Animatable *next)
{
if (hSelectPanel)
{
rsSel = IsRollupPanelOpen(hSelectPanel);
ip->DeleteRollupPage(hSelectPanel);
hSelectPanel = NULL;
}
if (hOpsPanel)
{
rsOps = IsRollupPanelOpen(hOpsPanel);
ip->DeleteRollupPage(hOpsPanel);
hOpsPanel = NULL;
}
if (hSurfPanel)
{
rsSurf = IsRollupPanelOpen(hSurfPanel);
ip->DeleteRollupPage(hSurfPanel);
hSurfPanel = NULL;
}
if (hTilePanel)
{
rsTile = IsRollupPanelOpen(hTilePanel);
ip->DeleteRollupPage(hTilePanel);
hTilePanel = NULL;
}
if (hEdgePanel)
{
rsEdge = IsRollupPanelOpen(hEdgePanel);
ip->DeleteRollupPage(hEdgePanel);
hEdgePanel = NULL;
}
// Enable show end result
ip->EnableShowEndResult(TRUE);
CancelEditPatchModes(ip);
if (ip->GetCommandMode()->ID()==CID_EP_PAINT)
ip->SetStdCommandMode(CID_OBJMOVE);
TimeValue t = ip->GetTime();
NotifyDependents(Interval(t, t), PART_ALL, REFMSG_END_EDIT);
NotifyDependents(Interval(t, t), PART_ALL, REFMSG_MOD_DISPLAY_OFF);
ClearAFlag(A_MOD_BEING_EDITED);
DeletePatchDataTempData();
this->ip = NULL;
// if ( ip->GetCommandMode()->ID() == CID_EP_EXTRUDE ) ip->SetStdCommandMode( CID_OBJMOVE );
// if ( ip->GetCommandMode()->ID() == CID_EP_BEVEL ) ip->SetStdCommandMode( CID_OBJMOVE );
ip->DeleteMode(moveMode);
ip->DeleteMode(rotMode);
ip->DeleteMode(uscaleMode);
ip->DeleteMode(nuscaleMode);
ip->DeleteMode(squashMode);
ip->DeleteMode(selectMode);
ip->DeleteMode(extrudeMode);
ip->DeleteMode(bevelMode);
ip->DeleteMode(bindMode);
if (moveMode)
delete moveMode;
moveMode = NULL;
if (rotMode)
delete rotMode;
rotMode = NULL;
if (uscaleMode)
delete uscaleMode;
uscaleMode = NULL;
if (nuscaleMode)
delete nuscaleMode;
nuscaleMode = NULL;
if (squashMode)
delete squashMode;
squashMode = NULL;
if (selectMode)
delete selectMode;
selectMode = NULL;
if (extrudeMode)
delete extrudeMode;
extrudeMode = NULL;
if (bevelMode)
delete bevelMode;
bevelMode = NULL;
if (bindMode)
delete bindMode;
bindMode = NULL;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
EditPatchMod::EditPatchMod()
{
selLevel = EP_OBJECT;
displayLattice = TRUE;
displaySurface = TRUE;
propagate = TRUE;
meshSteps = 5;
transitionType = 1;
channelModified = EDITPAT_CHANNELS;
// 3-18-99 to suport render steps and removal of the mental tesselator
meshStepsRender = 5;
showInterior = TRUE;
namedSelNeedsFixup = FALSE;
includeMeshes=false;
// meshAdaptive = FALSE; // Future use (Not used now)
}
EditPatchMod::~EditPatchMod()
{
ClearSetNames();
}

View file

@ -1,197 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern Point3 zeroPoint;
// ------------------------------------------------------------------------------------------------------------------------------------------------------
PatchPointTab::PatchPointTab()
{
}
PatchPointTab::~PatchPointTab()
{
}
void PatchPointTab::Empty()
{
ptab.Delete(0, ptab.Count());
vtab.Delete(0, vtab.Count());
pttab.Delete(0, pttab.Count());
}
void PatchPointTab::Zero()
{
// DebugPrint("Zeroing\n");
int points = ptab.Count();
int vectors = vtab.Count();
Point3 zero(0, 0, 0);
int i;
for (i = 0; i < points; ++i)
{
ptab[i] = zero;
pttab[i] = 0;
}
for (i = 0; i < vectors; ++i)
vtab[i] = zero;
}
void PatchPointTab::MakeCompatible(PatchMesh& patch, int clear)
{
int izero = 0;
if (clear)
{
ptab.Delete(0, ptab.Count());
pttab.Delete(0, pttab.Count());
vtab.Delete(0, vtab.Count());
}
// First, the verts
int size = patch.numVerts;
if (ptab.Count() > size)
{
int diff = ptab.Count() - size;
ptab.Delete(ptab.Count() - diff, diff);
pttab.Delete(pttab.Count() - diff, diff);
}
if (ptab.Count() < size)
{
int diff = size - ptab.Count();
ptab.Resize(size);
pttab.Resize(size);
for (int j = 0; j < diff; j++)
{
ptab.Append(1, &zeroPoint);
pttab.Append(1, &izero);
}
}
// Now, the vectors
size = patch.numVecs;
if (vtab.Count() > size)
{
int diff = vtab.Count() - size;
vtab.Delete(vtab.Count() - diff, diff);
}
if (vtab.Count() < size)
{
int diff = size - vtab.Count();
vtab.Resize(size);
for (int j = 0; j < diff; j++)
vtab.Append(1, &zeroPoint);
}
}
PatchPointTab& PatchPointTab::operator=(PatchPointTab& from)
{
ptab = from.ptab;
vtab = from.vtab;
pttab = from.pttab;
return *this;
}
BOOL PatchPointTab::IsCompatible(PatchMesh &patch)
{
if (ptab.Count() != patch.numVerts)
return FALSE;
if (pttab.Count() != patch.numVerts)
return FALSE;
if (vtab.Count() != patch.numVecs)
return FALSE;
return TRUE;
}
void PatchPointTab::RescaleWorldUnits(float f)
{
Matrix3 stm = ScaleMatrix(Point3(f, f, f));
int points = ptab.Count();
int vectors = vtab.Count();
int i;
for (i = 0; i < points; ++i)
ptab[i] = ptab[i] * stm;
for (i = 0; i < vectors; ++i)
vtab[i] = vtab[i] * stm;
}
#define PPT_VERT_CHUNK 0x1000
#define PPT_VEC_CHUNK 0x1010
#define PPT_VERTTYPE_CHUNK 0x1020
IOResult PatchPointTab::Save(ISave *isave)
{
int i;
ULONG nb;
isave->BeginChunk(PPT_VERT_CHUNK);
int count = ptab.Count();
isave->Write(&count, sizeof(int), &nb);
for (i = 0; i < count; ++i)
isave->Write(&ptab[i], sizeof(Point3), &nb);
isave->EndChunk();
isave->BeginChunk(PPT_VERTTYPE_CHUNK);
count = pttab.Count();
isave->Write(&count, sizeof(int), &nb);
for (i = 0; i < count; ++i)
isave->Write(&pttab[i], sizeof(int), &nb);
isave->EndChunk();
isave->BeginChunk(PPT_VEC_CHUNK);
count = vtab.Count();
isave->Write(&count, sizeof(int), &nb);
for (i = 0; i < count; ++i)
isave->Write(&vtab[i], sizeof(Point3), &nb);
isave->EndChunk();
return IO_OK;
}
IOResult PatchPointTab::Load(ILoad *iload)
{
int i, count;
Point3 workpt;
int workint;
IOResult res;
ULONG nb;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case PPT_VERT_CHUNK:
ptab.Delete(0, ptab.Count());
iload->Read(&count, sizeof(int), &nb);
for (i = 0; i < count; ++i)
{
iload->Read(&workpt, sizeof(Point3), &nb);
ptab.Append(1, &workpt);
}
break;
case PPT_VERTTYPE_CHUNK:
pttab.Delete(0, pttab.Count());
iload->Read(&count, sizeof(int), &nb);
for (i = 0; i < count; ++i)
{
iload->Read(&workint, sizeof(int), &nb);
pttab.Append(1, &workint);
}
break;
case PPT_VEC_CHUNK:
vtab.Delete(0, vtab.Count());
iload->Read(&count, sizeof(int), &nb);
for (i = 0; i < count; ++i)
{
iload->Read(&workpt, sizeof(Point3), &nb);
vtab.Append(1, &workpt);
}
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}

View file

@ -1,123 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern void Cancel2StepPatchModes(IObjParam *ip);
// ------------------------------------------------------------------------------------------------------------------------------------------------------
PatchRestore::PatchRestore(EditPatchData* pd, EditPatchMod* mod, PatchMesh *patch, RPatchMesh *rpatch, TCHAR *id)
{
gotRedo = FALSE;
epd = pd;
this->mod = mod;
oldPatch = *patch;
roldPatch=NULL;
rnewPatch=NULL;
// rpatch
if (rpatch)
{
roldPatch=new RPatchMesh();
*roldPatch = *rpatch;
}
t = mod->ip->GetTime();
where = TSTR(id);
}
PatchRestore::~PatchRestore()
{
if (roldPatch)
delete roldPatch;
if (rnewPatch)
delete rnewPatch;
}
void PatchRestore::Restore(int isUndo)
{
if (epd->tempData && epd->TempData(mod)->PatchCached(t))
{
RPatchMesh *rpatch;
PatchMesh *patch = epd->TempData(mod)->GetPatch(t,rpatch);
if (patch)
{
if (isUndo && !gotRedo)
{
newPatch = *patch;
// rpatch
if (!rnewPatch)
rnewPatch = new RPatchMesh();
*rnewPatch = *rpatch;
gotRedo = TRUE;
}
}
DWORD selLevel = patch->selLevel; // Grab this...
DWORD dispFlags = patch->dispFlags; // Grab this...
*patch = oldPatch;
if (roldPatch)
*rpatch = *roldPatch;
patch->selLevel = selLevel; // ...and put it back in
patch->dispFlags = dispFlags; // ...and put it back in
patch->InvalidateGeomCache();
epd->TempData(mod)->Invalidate(PART_GEOM | PART_TOPO | PART_SELECT);
}
else
if (epd->tempData)
{
epd->TempData(mod)->Invalidate(PART_GEOM | PART_TOPO | PART_SELECT, FALSE);
}
if (mod->ip)
Cancel2StepPatchModes(mod->ip);
mod->InvalidateSurfaceUI();
mod->SelectionChanged();
mod->NotifyDependents(FOREVER, PART_GEOM | PART_TOPO | PART_SELECT, REFMSG_CHANGE);
}
void PatchRestore::Redo()
{
if (epd->tempData && epd->TempData(mod)->PatchCached(t))
{
RPatchMesh *rpatch;
PatchMesh *patch = epd->TempData(mod)->GetPatch(t,rpatch);
if (patch)
{
DWORD selLevel = patch->selLevel; // Grab this...
DWORD dispFlags = patch->dispFlags; // Grab this...
*patch = newPatch;
nlassert (rnewPatch); // should not be NULL
*rpatch = *rnewPatch;
patch->selLevel = selLevel; // ...and put it back in
patch->dispFlags = dispFlags; // ...and put it back in
patch->InvalidateGeomCache();
}
epd->TempData(mod)->Invalidate(PART_GEOM | PART_TOPO | PART_SELECT);
}
else
if (epd->tempData)
{
epd->TempData(mod)->Invalidate(PART_GEOM | PART_TOPO | PART_SELECT, FALSE);
}
if (mod->ip)
Cancel2StepPatchModes(mod->ip);
mod->InvalidateSurfaceUI();
mod->SelectionChanged();
mod->NotifyDependents(FOREVER, PART_GEOM | PART_TOPO | PART_SELECT, REFMSG_CHANGE);
}

View file

@ -1,87 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern void Cancel2StepPatchModes(IObjParam *ip);
// ------------------------------------------------------------------------------------------------------------------------------------------------------
PatchSelRestore::PatchSelRestore(EditPatchData* pd, EditPatchMod* mod, PatchMesh *patch)
{
gotRedo = FALSE;
epd = pd;
this->mod = mod;
oldVSel = patch->vertSel;
oldESel = patch->edgeSel;
oldPSel = patch->patchSel;
t = mod->ip->GetTime();
}
void PatchSelRestore::Restore(int isUndo)
{
if (epd->tempData && epd->TempData(mod)->PatchCached(t))
{
RPatchMesh *rpatch;
PatchMesh *patch = epd->TempData(mod)->GetPatch(t, rpatch);
if (patch)
{
if (isUndo && !gotRedo)
{
newVSel = patch->vertSel;
newESel = patch->edgeSel;
newPSel = patch->patchSel;
gotRedo = TRUE;
}
}
patch->vertSel = oldVSel;
patch->edgeSel = oldESel;
patch->patchSel = oldPSel;
epd->TempData(mod)->Invalidate(PART_GEOM | PART_TOPO | PART_SELECT);
}
else
if (epd->tempData)
{
epd->TempData(mod)->Invalidate(PART_GEOM | PART_TOPO | PART_SELECT, FALSE);
}
if (mod->ip)
Cancel2StepPatchModes(mod->ip);
mod->InvalidateSurfaceUI();
// mod->PatchSelChanged();
// mod->UpdateSelectDisplay();
mod->NotifyDependents(FOREVER, PART_GEOM | PART_TOPO | PART_SELECT, REFMSG_CHANGE);
}
void PatchSelRestore::Redo()
{
if (epd->tempData && epd->TempData(mod)->PatchCached(t))
{
RPatchMesh *rpatch;
PatchMesh *patch = epd->TempData(mod)->GetPatch(t,rpatch);
if (patch)
{
patch->vertSel = newVSel;
patch->edgeSel = newESel;
patch->patchSel = newPSel;
}
epd->TempData(mod)->Invalidate(PART_GEOM | PART_TOPO | PART_SELECT);
}
else
if (epd->tempData)
{
epd->TempData(mod)->Invalidate(PART_GEOM | PART_TOPO | PART_SELECT, FALSE);
}
if (mod->ip)
Cancel2StepPatchModes(mod->ip);
mod->InvalidateSurfaceUI();
// mod->PatchSelChanged();
// mod->UpdateSelectDisplay();
mod->NotifyDependents(FOREVER, PART_GEOM | PART_TOPO | PART_SELECT, REFMSG_CHANGE);
}

View file

@ -1,138 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void PatchVertexDelta::SetSize(PatchMesh& patch, BOOL load)
{
dtab.MakeCompatible(patch, FALSE);
// Load it if necessary
if (load)
{
int verts = patch.numVerts;
int vecs = patch.numVecs;
int i;
for (i = 0; i < verts; ++i)
{
dtab.ptab[i] = patch.verts[i].p;
dtab.pttab[i] = patch.verts[i].flags & PVERT_COPLANAR;
}
for (i = 0; i < vecs; ++i)
dtab.vtab[i] = patch.vecs[i].p;
}
}
void PatchVertexDelta::Apply(PatchMesh &patch)
{
// DebugPrint(_T("PVD:Applying\n"));
// This does nothing if the number of verts hasn't changed in the mesh.
SetSize(patch, FALSE);
// Apply the deltas
int verts = patch.numVerts;
int vecs = patch.numVecs;
int i;
for (i = 0; i < verts; ++i)
{
patch.verts[i].p += dtab.ptab[i];
patch.verts[i].flags ^= dtab.pttab[i];
}
for (i = 0; i < vecs; ++i)
{
patch.vecs[i].p += dtab.vtab[i];
}
patch.computeInteriors();
}
void PatchVertexDelta::UnApply(PatchMesh &patch)
{
// DebugPrint(_T("PVD:UnApplying\n"));
// This does nothing if the number of verts hasn't changed in the mesh.
SetSize(patch, FALSE);
// Apply the deltas
int verts = patch.numVerts;
int vecs = patch.numVecs;
int i;
for (i = 0; i < verts; ++i)
{
patch.verts[i].p -= dtab.ptab[i];
patch.verts[i].flags ^= dtab.pttab[i];
}
for (i = 0; i < vecs; ++i)
{
patch.vecs[i].p -= dtab.vtab[i];
}
patch.computeInteriors();
}
// This function applies the current changes to slave handles and their knots, and zeroes everything else
void PatchVertexDelta::ApplyHandlesAndZero(PatchMesh &patch, int handleVert)
{
// DebugPrint(_T("PVD:ApplyAndZero\n"));
// This does nothing if the number of verts hasn't changed in the mesh.
SetSize(patch, FALSE);
Point3 zeroPt(0.0f, 0.0f, 0.0f);
// Apply the deltas to just the slave handles
int verts = patch.numVerts;
int vecs = patch.numVecs;
Point3Tab& delta = dtab.vtab;
IntTab& kdelta = dtab.pttab;
int i;
for (i = 0; i < vecs; ++i)
{
if (!(delta[i] == zeroPt))
{
if (i != handleVert)
patch.vecs[i].p += delta[i];
else
delta[i] = zeroPt;
}
}
for (i = 0; i < verts; ++i)
{
if (kdelta[i])
patch.verts[i].flags ^= kdelta[i];
}
}
#define PVD_POINTTAB_CHUNK 0x1000
IOResult PatchVertexDelta::Save(ISave *isave)
{
isave->BeginChunk(PVD_POINTTAB_CHUNK);
dtab.Save(isave);
isave-> EndChunk();
return IO_OK;
}
IOResult PatchVertexDelta::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case PVD_POINTTAB_CHUNK:
res = dtab.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}

View file

@ -1,138 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PickPatchAttach::Filter(INode *node)
{
ModContextList mcList;
INodeTab nodes;
if (node)
{
// Make sure the node does not depend on us
node->BeginDependencyTest();
ep->NotifyDependents(FOREVER, 0, REFMSG_TEST_DEPENDENCY);
if (node->EndDependencyTest())
return FALSE;
ObjectState os = node->GetObjectRef()->Eval(ep->ip->GetTime());
GeomObject *object =(GeomObject *)os.obj;
// Make sure it isn't one of the nodes we're editing, for heaven's sake!
ep->ip->GetModContexts(mcList, nodes);
int numNodes = nodes.Count();
for (int i = 0; i < numNodes; ++i)
{
if (nodes[i] == node)
{
nodes.DisposeTemporary();
return FALSE;
}
}
if (object->CanConvertToType(RYKOLPATCHOBJ_CLASS_ID))
{
nodes.DisposeTemporary();
return TRUE;
}
}
nodes.DisposeTemporary();
return FALSE;
}
BOOL PickPatchAttach::HitTest(
IObjParam *ip, HWND hWnd, ViewExp *vpt, IPoint2 m, int flags)
{
INode *node = ip->PickNode(hWnd, m, this);
ModContextList mcList;
INodeTab nodes;
if (node)
{
ObjectState os = node->GetObjectRef()->Eval(ip->GetTime());
GeomObject *object =(GeomObject *)os.obj;
// Make sure it isn't one of the nodes we're editing, for heaven's sake!
ep->ip->GetModContexts(mcList, nodes);
int numNodes = nodes.Count();
for (int i = 0; i < numNodes; ++i)
{
if (nodes[i] == node)
{
nodes.DisposeTemporary();
return FALSE;
}
}
if (object->CanConvertToType(RYKOLPATCHOBJ_CLASS_ID))
{
nodes.DisposeTemporary();
return TRUE;
}
}
nodes.DisposeTemporary();
return FALSE;
}
BOOL PickPatchAttach::Pick(IObjParam *ip, ViewExp *vpt)
{
INode *node = vpt->GetClosestHit();
nlassert(node);
GeomObject *object =(GeomObject *)node->GetObjectRef()->Eval(ip->GetTime()).obj;
if (object->CanConvertToType(RYKOLPATCHOBJ_CLASS_ID))
{
RPO *attPatch =(RPO *)object->ConvertToType(ip->GetTime(), RYKOLPATCHOBJ_CLASS_ID);
if (attPatch)
{
PatchMesh patch = attPatch->patch;
RPatchMesh rpatch = *attPatch->rpatch;
ModContextList mcList;
INodeTab nodes;
ip->GetModContexts(mcList, nodes);
BOOL res = TRUE;
if (nodes[0]->GetMtl() && node->GetMtl() &&(nodes[0]->GetMtl() != node->GetMtl()))
res = DoAttachMatOptionDialog(ep->ip, ep);
if (res)
{
bool canUndo = TRUE;
ep->DoAttach(node, &patch, &rpatch, canUndo);
if (!canUndo)
GetSystemSetting(SYSSET_CLEAR_UNDO);
}
nodes.DisposeTemporary();
// Discard the copy it made, if it isn't the same as the object itself
if (attPatch !=(PatchObject *)object)
delete attPatch;
}
}
return FALSE;
}
void PickPatchAttach::EnterMode(IObjParam *ip)
{
if (ep->hOpsPanel)
{
ICustButton *but = GetICustButton(GetDlgItem(ep->hOpsPanel, IDC_ATTACH));
but->SetCheck(TRUE);
ReleaseICustButton(but);
}
}
void PickPatchAttach::ExitMode(IObjParam *ip)
{
if (ep->hOpsPanel)
{
ICustButton *but = GetICustButton(GetDlgItem(ep->hOpsPanel, IDC_ATTACH));
but->SetCheck(FALSE);
ReleaseICustButton(but);
}
}
HCURSOR PickPatchAttach::GetHitCursor(IObjParam *ip)
{
return LoadCursor(hInstance, MAKEINTRESOURCE(IDC_ATTACHCUR));
}

View file

@ -1,895 +0,0 @@
#include "stdafx.h"
#include "editpat.h"
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx
#define DBGWELD_ACTIONx
#define DBG_NAMEDSELSx
#define PROMPT_TIME 2000
extern void DeletePatchParts(PatchMesh *patch, RPatchMesh *rpatch, BitArray &delVerts, BitArray &delPatches);
// ------------------------------------------------------------------------------------------------------------------------------------------------------
static BOOL IsCompatible(BitArray &a, BitArray &b)
{
return (a.GetSize() == b.GetSize()) ? TRUE : FALSE;
}
BOOL ClearPVertSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
sel = patch->vertSel;
patch->vertSel.ClearAll();
return TRUE;
}
#define CVSR_SEL_CHUNK 0x1000
IOResult ClearPVertSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case CVSR_SEL_CHUNK:
res = sel.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL SetPVertSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
sel = patch->vertSel;
patch->vertSel.SetAll();
return TRUE;
}
#define SVSR_SEL_CHUNK 0x1000
IOResult SetPVertSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case SVSR_SEL_CHUNK:
res = sel.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL InvertPVertSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
patch->vertSel = ~patch->vertSel;
return TRUE;
}
IOResult InvertPVertSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
// switch(iload->CurChunkID()) {
// default:
// break;
// }
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL ClearPEdgeSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
sel = patch->edgeSel;
patch->edgeSel.ClearAll();
return TRUE;
}
#define CESR_SEL_CHUNK 0x1000
IOResult ClearPEdgeSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case CESR_SEL_CHUNK:
res = sel.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL SetPEdgeSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
sel = patch->edgeSel;
patch->edgeSel.SetAll();
return TRUE;
}
#define SESR_SEL_CHUNK 0x1000
IOResult SetPEdgeSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case SESR_SEL_CHUNK:
res = sel.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL InvertPEdgeSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
patch->edgeSel = ~patch->edgeSel;
return TRUE;
}
IOResult InvertPEdgeSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
// switch(iload->CurChunkID()) {
// default:
// break;
// }
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL ClearPatchSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
sel = patch->patchSel;
patch->patchSel.ClearAll();
return TRUE;
}
#define CPSR_SEL_CHUNK 0x1000
IOResult ClearPatchSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case CPSR_SEL_CHUNK:
res = sel.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL SetPatchSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
sel = patch->patchSel;
patch->patchSel.SetAll();
return TRUE;
}
#define SPSR_SEL_CHUNK 0x1000
IOResult SetPatchSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case SPSR_SEL_CHUNK:
res = sel.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL InvertPatchSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
patch->patchSel = ~patch->patchSel;
return TRUE;
}
IOResult InvertPatchSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
// switch(iload->CurChunkID()) {
// default:
// break;
// }
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PVertSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (!IsCompatible(patch->vertSel, newSel))
return FALSE;
patch->vertSel = newSel;
return TRUE;
}
#define VSR_OLDSEL_CHUNK 0x1000
#define VSR_NEWSEL_CHUNK 0x1010
IOResult PVertSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case VSR_OLDSEL_CHUNK:
res = oldSel.Load(iload);
break;
case VSR_NEWSEL_CHUNK:
res = newSel.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PEdgeSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (!IsCompatible(patch->edgeSel, newSel))
return FALSE;
patch->edgeSel = newSel;
return TRUE;
}
#define ESR_OLDSEL_CHUNK 0x1000
#define ESR_NEWSEL_CHUNK 0x1010
IOResult PEdgeSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case ESR_OLDSEL_CHUNK:
res = oldSel.Load(iload);
break;
case ESR_NEWSEL_CHUNK:
res = newSel.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PatchSelRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (!IsCompatible(patch->patchSel, newSel))
return FALSE;
patch->patchSel = newSel;
return TRUE;
}
#define PSR_OLDSEL_CHUNK 0x1000
#define PSR_NEWSEL_CHUNK 0x1010
IOResult PatchSelRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case PSR_OLDSEL_CHUNK:
res = oldSel.Load(iload);
break;
case PSR_NEWSEL_CHUNK:
res = newSel.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define PDELR_PATCH_CHUNK 0x1060
IOResult PatchDeleteRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
// switch(iload->CurChunkID()) {
// case PDELR_PATCH_CHUNK:
// res = oldPatch.Load(iload);
// break;
// }
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PVertMoveRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (!delta.IsCompatible(*patch))
return FALSE;
delta.Apply(*patch);
return TRUE;
}
#define VMR_DELTA_CHUNK 0x1000
IOResult PVertMoveRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case VMR_DELTA_CHUNK:
res = delta.Load(iload);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
extern void DeleteSelVerts(PatchMesh *patch, RPatchMesh *rpatch);
BOOL PVertDeleteRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
{
oldPatch = *patch;
roldPatch = *rpatch;
}
DeleteSelVerts(patch, rpatch);
return TRUE;
}
#define VDELR_PATCH_CHUNK 0x1060
IOResult PVertDeleteRecord::Load(ILoad *iload)
{
IOResult res;
while (IO_OK == (res = iload->OpenChunk()))
{
// switch(iload->CurChunkID()) {
// case VDELR_PATCH_CHUNK:
// res = oldPatch.Load(iload);
// break;
// }
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PVertChangeRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
{
oldPatch = *patch;
roldPatch = *rpatch;
}
patch->ChangeVertType(index, type);
return TRUE;
}
#define VCHG_GENERAL_CHUNK 0x1001
#define VCHG_PATCH_CHUNK 0x1010
IOResult PVertChangeRecord::Load(ILoad *iload)
{
IOResult res;
ULONG nb;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case VCHG_GENERAL_CHUNK:
res = iload->Read(&index, sizeof(int), &nb);
res = iload->Read(&type, sizeof(int), &nb);
break;
// case VCHG_PATCH_CHUNK:
// res = oldPatch.Load(iload);
// break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PAttachRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
oldPatchCount = patch->numPatches;
patch->Attach(&attPatch, mtlOffset);
return TRUE;
}
#define ATTR_GENERAL_CHUNK 0x1001
#define ATTR_ATTPATCH_CHUNK 0x1010
#define ATTR_MTLOFFSET_CHUNK 0x1020
IOResult PAttachRecord::Load(ILoad *iload)
{
IOResult res;
ULONG nb;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case ATTR_GENERAL_CHUNK:
res = iload->Read(&oldPatchCount, sizeof(int), &nb);
break;
case ATTR_ATTPATCH_CHUNK:
res = attPatch.Load(iload);
break;
case ATTR_MTLOFFSET_CHUNK:
res = iload->Read(&mtlOffset, sizeof(int), &nb);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PatchDetachRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord && !copy)
{
oldPatch = *patch;
roldPatch = *rpatch;
}
if (!copy)
{
BitArray vdel(patch->numVerts);
vdel.ClearAll();
BitArray pdel = patch->patchSel;
DeletePatchParts(patch, rpatch, vdel, pdel);
}
return TRUE;
}
#define PDETR_GENERAL_CHUNK 0x1000
#define PDETR_PATCH_CHUNK 0x1030
IOResult PatchDetachRecord::Load(ILoad *iload)
{
IOResult res;
ULONG nb;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case PDETR_GENERAL_CHUNK:
res = iload->Read(&copy, sizeof(int), &nb);
break;
// case PDETR_PATCH_CHUNK:
// res = oldPatch.Load(iload);
// break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PatchMtlRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
for (int i = 0; i < patch->numPatches; ++i)
{
if (patch->patchSel[i])
patch->patches[i].setMatID(index);
}
return TRUE;
}
#define PMTLR_GENERAL_CHUNK 0x1000
#define PMTLR_INDEX_CHUNK 0x1020
IOResult PatchMtlRecord::Load(ILoad *iload)
{
IOResult res;
ULONG nb;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case PMTLR_INDEX_CHUNK:
res = iload->Read(&index, sizeof(MtlID), &nb);
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void ChangePatchType(PatchMesh *patch, int index, int type)
{
// If positive vertex number, do it to just one vertex
if (index >= 0)
{
patch->patches[index].flags = type;
patch->computeInteriors();
return;
}
// Otherwise, do it to all selected vertices!
int patches = patch->numPatches;
BitArray &psel = patch->patchSel;
for (int i = 0; i < patches; ++i)
{
if (psel[i])
patch->patches[i].flags = type;
}
patch->computeInteriors();
}
BOOL PatchChangeRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (index >= 0 && index >= patch->numPatches)
return FALSE;
if (reRecord)
{
oldPatch = *patch;
roldPatch = *rpatch;
}
ChangePatchType(patch, index, type);
return TRUE;
}
#define PCHG_GENERAL_CHUNK 0x1001
#define PCHG_PATCH_CHUNK 0x1010
IOResult PatchChangeRecord::Load(ILoad *iload)
{
IOResult res;
ULONG nb;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case PCHG_GENERAL_CHUNK:
res = iload->Read(&index, sizeof(int), &nb);
res = iload->Read(&type, sizeof(int), &nb);
break;
// case PCHG_PATCH_CHUNK:
// res = oldPatch.Load(iload);
// break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define PADDR_TYPE_CHUNK 0x1000
#define PADDR_PATCH_CHUNK 0x1010
#define PADDR_POSTWELD_CHUNK 0x1020
IOResult PatchAddRecord::Load(ILoad *iload)
{
IOResult res;
ULONG nb;
postWeld = FALSE;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case PADDR_TYPE_CHUNK:
res = iload->Read(&type, sizeof(int), &nb);
break;
// case PADDR_PATCH_CHUNK:
// res = oldPatch.Load(iload);
// break;
// If the following chunk is present, it's a MAX 2.0 file and a post-addition
// weld is to be performed
case PADDR_POSTWELD_CHUNK:
postWeld = TRUE;
break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// Compute midpoint division for patch vectors -- Provide patchmesh, patch number, 4 bez points
// returns 2 new vectors
/*
static Point3 InterpPoint(PatchMesh *patch, int index, float pct, int e1, int i1, int i2, int e2, Point3 *v1 = NULL, Point3 *v2 = NULL, Point3 *v3 = NULL, Point3 *v4 = NULL)
{
PatchVec *v = patch->vecs;
Patch &p = patch->patches[index];
Point3 pe1 = v[p.vec[e1]].p;
Point3 pe2 = v[p.vec[e2]].p;
Point3 pi1 = v[p.interior[i1]].p;
Point3 pi2 = v[p.interior[i2]].p;
Point3 e1i1 = pe1 +(pi1 - pe1) * pct;
Point3 i1i2 = pi1 +(pi2 - pi1) * pct;
Point3 i2e2 = pi2 +(pe2 - pi2) * pct;
Point3 a = e1i1 +(i1i2 - e1i1) * pct;
Point3 b = i1i2 +(i2e2 - i1i2) * pct;
if (v1)
*v1 = e1i1;
if (v2)
*v2 = a;
if (v3)
*v3 = b;
if (v4)
*v4 = i2e2;
return a +(b - a) * pct;
}
static Point3 InterpPoint(float pct, Point3 e1, Point3 i1, Point3 i2, Point3 e2, Point3 *v1 = NULL, Point3 *v2 = NULL, Point3 *v3 = NULL, Point3 *v4 = NULL)
{
Point3 e1i1 = e1 +(i1 - e1) * pct;
Point3 i1i2 = i1 +(i2 - i1) * pct;
Point3 i2e2 = i2 +(e2 - i2) * pct;
Point3 a = e1i1 +(i1i2 - e1i1) * pct;
Point3 b = i1i2 +(i2e2 - i1i2) * pct;
if (v1)
*v1 = e1i1;
if (v2)
*v2 = a;
if (v3)
*v3 = b;
if (v4)
*v4 = i2e2;
return a +(b - a) * pct;
}
static Point3 InterpLinear(Point3 a, Point3 b, float interp)
{
return a +(a - b) * interp;
}
static Point3 InterpDegree2(Point3 a, Point3 b, Point3 c, float interp)
{
Point3 ab = a +(b - a) * interp;
Point3 bc = b +(c - b) * interp;
return ab +(bc - ab) * interp;
}
static Point3 InterpDegree3(Point3 a, Point3 b, Point3 c, Point3 d, float interp)
{
Point3 ab = a +(b - a) * interp;
Point3 bc = b +(c - b) * interp;
Point3 cd = c +(d - c) * interp;
Point3 abbc = ab +(bc - ab) * interp;
Point3 bccd = bc +(cd - bc) * interp;
return abbc +(bccd - abbc) * interp;
}
*/
extern void SubdividePatch(int type, BOOL propagate, PatchMesh *patch, RPatchMesh *rpatch);
BOOL EdgeSubdivideRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
{
oldPatch = *patch;
roldPatch = *rpatch;
}
SubdividePatch(SUBDIV_EDGES, propagate, patch, rpatch);
return TRUE;
}
#define ESUBR_PROPAGATE_CHUNK 0x1000
#define ESUBR_PATCH_CHUNK 0x1010
IOResult EdgeSubdivideRecord::Load(ILoad *iload)
{
IOResult res;
propagate = FALSE;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case ESUBR_PROPAGATE_CHUNK:
propagate = TRUE;
break;
// case ESUBR_PATCH_CHUNK:
// res = oldPatch.Load(iload);
// break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
BOOL PatchSubdivideRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
{
oldPatch = *patch;
roldPatch = *rpatch;
}
SubdividePatch(SUBDIV_PATCHES, propagate, patch, rpatch);
return TRUE;
}
#define PSUBR_PROPAGATE_CHUNK 0x1000
#define PSUBR_PATCH_CHUNK 0x1010
IOResult PatchSubdivideRecord::Load(ILoad *iload)
{
IOResult res;
propagate = FALSE;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case PSUBR_PROPAGATE_CHUNK:
propagate = TRUE;
break;
// case PSUBR_PATCH_CHUNK:
// res = oldPatch.Load(iload);
// break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}
BOOL PVertWeldRecord::Redo(PatchMesh *patch, RPatchMesh *rpatch, int reRecord)
{
if (reRecord)
{
oldPatch = *patch;
roldPatch = *rpatch;
}
patch->Weld(thresh);
return TRUE;
}
#define WELDR_THRESH_CHUNK 0x1010
#define WELDR_PATCH_CHUNK 0x1000
IOResult PVertWeldRecord::Load(ILoad *iload)
{
IOResult res;
ULONG nb;
propagate = FALSE;
while (IO_OK == (res = iload->OpenChunk()))
{
switch (iload->CurChunkID())
{
case WELDR_THRESH_CHUNK:
res = iload->Read(&thresh, sizeof(float), &nb);
break;
// case WELDR_PATCH_CHUNK:
// res = oldPatch.Load(iload);
// break;
}
iload->CloseChunk();
if (res != IO_OK)
return res;
}
return IO_OK;
}

Some files were not shown because too many files have changed in this diff Show more