[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39329] branches/soc-2011-onion: Revision: 31053

Jason Wilkins Jason.A.Wilkins at gmail.com
Fri Aug 12 13:10:17 CEST 2011


Revision: 39329
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39329
Author:   jwilkins
Date:     2011-08-12 11:10:15 +0000 (Fri, 12 Aug 2011)
Log Message:
-----------
Revision: 31053
Author: nicholasbishop
Date: 7:53:02 PM, Wednesday, August 04, 2010
Message:
== Ptex ==

initial ptex integration

* added the ptex C++ library to extern

* wrote a small C api for the library; just the functions I've used so
  far are in the C api, but easy to add more

* added a new CustomData type (face data), stored as struct MPtex

* added RNA for CD_MPTEX

* each MPtex stores:
** the U- and V-resolution (always a power of two)
** the number of color channels (e.g. RGB or RGBA)
** the data type (can be bytes, shorts, or floats)
** the number of subfaces (for triangles now, will work also for ngons)

* for drawing ptex, one power of two texture is assigned to each face
** for quads, the texture is mapped normally across the full face
** for triangles, the face is split into four quads for drawing, and each
   subface gets an equal-sized portion of the texture
** the texture is created with the same internal format as the ptex layer

* added an operator for loading ptex files

* added an operator for creating ptex layers; takes data type, number of
  channels, and texel density as inputs. has some hackish code to allocate
  texels based on a faces catmull-clark limit surface area

* added a simple ptex UI, shows ptex layers in the mesh data panel

* modified vpaint to paint on ptex instead of mcols


partial todo list:
* VBO drawing (make sure to turn VBO off before testing ptex for now)
* ptex saving
* better texel allocation
* upsampling/downsampling faces
* UI for setting individual faces' resolutions
----
Modified : /branches/soc-2010-nicolasbishop/extern/CMakeLists.txt
Modified : /branches/soc-2010-nicolasbishop/release/scripts/ui/properties_data_mesh.py
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/cdderivedmesh.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/customdata.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/subsurf_ccg.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenloader/intern/readfile.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenloader/intern/writefile.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/makesdna/DNA_customdata_types.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/makesrna/RNA_access.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/makesrna/intern/rna_mesh.c
Modified : /branches/soc-2010-nicolasbishop/source/creator/CMakeLists.txt
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenloader/CMakeLists.txt
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/CMakeLists.txt
Modified : /branches/soc-2010-nicolasbishop/source/blender/gpu/CMakeLists.txt
Modified : /branches/soc-2010-nicolasbishop/source/blender/gpu/GPU_buffers.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/makesdna/DNA_meshdata_types.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex
Added : /branches/soc-2010-nicolasbishop/extern/ptex/ptex.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/ptex_C_api.cpp
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/pbvh_undo.c
Added : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/ptex.c
Added : /branches/soc-2010-nicolasbishop/extern/ptex/CMakeLists.txt
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/Makefile
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc/Doxyfile
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc/Doxyfile_API_only
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc/FilterFootprint.html
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc/License.txt
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc/Makefile
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc/README
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc/apiintro.txt
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc/main.txt
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/doc/uvellipse.png
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/Makefile
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/Makefile.deps
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexCache.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexCache.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexDict.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexFilters.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexHalf.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexHalf.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexHashMap.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexIO.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexInt.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexMutex.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexPlatform.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexReader.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexReader.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexSeparableFilter.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexSeparableFilter.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexSeparableKernel.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexSeparableKernel.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexTriangleFilter.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexTriangleFilter.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexTriangleKernel.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexTriangleKernel.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexUtils.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexUtils.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexWriter.cpp
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/PtexWriter.h
Added : /branches/soc-2010-nicolasbishop/extern/ptex/src/ptex/Ptexture.h

Revision: 31054
Author: nicholasbishop
Date: 8:42:34 PM, Wednesday, August 04, 2010
Message:
== Ptex ==

Hopefully fixes building with scons

----
Modified : /branches/soc-2010-nicolasbishop/extern/SConscript
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/SConscript
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenloader/SConscript
Modified : /branches/soc-2010-nicolasbishop/source/blender/gpu/SConscript

Revision: 31067
Author: nicholasbishop
Date: 9:03:30 AM, Thursday, August 05, 2010
Message:
== Ptex ==

Missed a file in my last commit

----
Added : /branches/soc-2010-nicolasbishop/extern/ptex/SConscript

Revision: 31080
Author: nicholasbishop
Date: 2:20:00 PM, Thursday, August 05, 2010
Message:
== Ptex ==

Cmake fix from mariusz.

----
Modified : /branches/soc-2010-nicolasbishop/extern/ptex/CMakeLists.txt

Revision: 31082
Author: nicholasbishop
Date: 3:16:38 PM, Thursday, August 05, 2010
Message:
== Ptex ==

Another scons fix provided by mariusz

----
Modified : /branches/soc-2010-nicolasbishop/extern/ptex/SConscript


Revision: 31108
Author: nicholasbishop
Date: 10:58:15 AM, Friday, August 06, 2010
Message:
== Ptex ==

Fixed unitialized variable reported by mariusz

----
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/ptex.c

Modified Paths:
--------------
    branches/soc-2011-onion/CMakeLists.txt
    branches/soc-2011-onion/build_files/scons/tools/btools.py
    branches/soc-2011-onion/extern/CMakeLists.txt
    branches/soc-2011-onion/extern/SConscript
    branches/soc-2011-onion/release/scripts/startup/bl_ui/properties_data_mesh.py
    branches/soc-2011-onion/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/soc-2011-onion/source/blender/blenkernel/intern/customdata.c
    branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c
    branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h
    branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c
    branches/soc-2011-onion/source/blender/blenloader/CMakeLists.txt
    branches/soc-2011-onion/source/blender/blenloader/SConscript
    branches/soc-2011-onion/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-onion/source/blender/blenloader/intern/writefile.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/SConscript
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/pbvh_undo.c
    branches/soc-2011-onion/source/blender/gpu/CMakeLists.txt
    branches/soc-2011-onion/source/blender/gpu/GPU_buffers.h
    branches/soc-2011-onion/source/blender/gpu/SConscript
    branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c
    branches/soc-2011-onion/source/blender/makesdna/DNA_customdata_types.h
    branches/soc-2011-onion/source/blender/makesdna/DNA_meshdata_types.h
    branches/soc-2011-onion/source/blender/makesrna/RNA_access.h
    branches/soc-2011-onion/source/blender/makesrna/intern/rna_mesh.c
    branches/soc-2011-onion/source/creator/CMakeLists.txt

Added Paths:
-----------
    branches/soc-2011-onion/extern/ptex/
    branches/soc-2011-onion/extern/ptex/CMakeLists.txt
    branches/soc-2011-onion/extern/ptex/SConscript
    branches/soc-2011-onion/extern/ptex/ptex.h
    branches/soc-2011-onion/extern/ptex/ptex_C_api.cpp
    branches/soc-2011-onion/extern/ptex/src/
    branches/soc-2011-onion/extern/ptex/src/Makefile
    branches/soc-2011-onion/extern/ptex/src/doc/
    branches/soc-2011-onion/extern/ptex/src/doc/Doxyfile
    branches/soc-2011-onion/extern/ptex/src/doc/Doxyfile_API_only
    branches/soc-2011-onion/extern/ptex/src/doc/FilterFootprint.html
    branches/soc-2011-onion/extern/ptex/src/doc/License.txt
    branches/soc-2011-onion/extern/ptex/src/doc/Makefile
    branches/soc-2011-onion/extern/ptex/src/doc/README
    branches/soc-2011-onion/extern/ptex/src/doc/apiintro.txt
    branches/soc-2011-onion/extern/ptex/src/doc/main.txt
    branches/soc-2011-onion/extern/ptex/src/doc/uvellipse.png
    branches/soc-2011-onion/extern/ptex/src/ptex/
    branches/soc-2011-onion/extern/ptex/src/ptex/Makefile
    branches/soc-2011-onion/extern/ptex/src/ptex/Makefile.deps
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexCache.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexCache.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexDict.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexFilters.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexHalf.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexHalf.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexHashMap.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexIO.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexInt.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexMutex.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexPlatform.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexReader.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexReader.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexSeparableFilter.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexSeparableFilter.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexSeparableKernel.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexSeparableKernel.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexTriangleFilter.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexTriangleFilter.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexTriangleKernel.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexTriangleKernel.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexUtils.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexUtils.h
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexWriter.cpp
    branches/soc-2011-onion/extern/ptex/src/ptex/PtexWriter.h
    branches/soc-2011-onion/extern/ptex/src/ptex/Ptexture.h
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/ptex.c

Modified: branches/soc-2011-onion/CMakeLists.txt
===================================================================
--- branches/soc-2011-onion/CMakeLists.txt	2011-08-12 07:22:29 UTC (rev 39328)
+++ branches/soc-2011-onion/CMakeLists.txt	2011-08-12 11:10:15 UTC (rev 39329)
@@ -186,6 +186,7 @@
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
 
 option(WITH_BRUSHLIB       "Enable MyPaint brushlib for paint/sculpt" ON)
+option(WITH_PTEX           "Enable Ptex library for paint/sculpt" ON)
 option(WITH_ONSURFACEBRUSH "Enable use of the 'on-surface brush' for paint/sculpt.  Requires a stencil buffer, GL_depth_texture, and GLSL" ON)
 
 # disable for now, but plan to support on all platforms eventually
@@ -1073,14 +1074,18 @@
 	endif()
 endif()
 
+if(WITH_BRUSHLIB)
+	add_definitions(-DWITH_BRUSHLIB)
+endif(WITH_BRUSHLIB)
+
+if(WITH_PTEX)
+	add_definitions(-DWITH_PTEX)
+endif(WITH_PTEX)
+
 if(WITH_ONSURFACEBRUSH)
 	add_definitions(-DWITH_ONSURFACEBRUSH)
 endif(WITH_ONSURFACEBRUSH)
 
-if(WITH_BRUSHLIB)
-	add_definitions(-DWITH_BRUSHLIB)
-endif(WITH_BRUSHLIB)
-
 if(WITH_IMAGE_OPENJPEG)
 	if(UNIX AND NOT APPLE)
 		# dealt with above

Modified: branches/soc-2011-onion/build_files/scons/tools/btools.py
===================================================================
--- branches/soc-2011-onion/build_files/scons/tools/btools.py	2011-08-12 07:22:29 UTC (rev 39328)
+++ branches/soc-2011-onion/build_files/scons/tools/btools.py	2011-08-12 11:10:15 UTC (rev 39329)
@@ -133,8 +133,9 @@
             'BF_GHOST_DEBUG',
             'WITH_BF_RAYOPTIMIZATION',
             'BF_RAYOPTIMIZATION_SSE_FLAGS',
+            'WITH_BF_BRUSHLIB',
+            'WITH_BF_PTEX',
             'WITH_BF_ONSURFACEBRUSH',
-            'WITH_BF_BRUSHLIB',
             'BF_NO_ELBEEM',
             'WITH_BF_CXX_GUARDEDALLOC',
             'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
@@ -507,10 +508,12 @@
         (BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)),
         ('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''),
  
+        (BoolVariable('WITH_BF_BRUSHLIB', 'Enable MyPaint brushlib for paint/sculpt', True)),
+
+        (BoolVariable('WITH_BF_PTEX', 'Enable Ptex library for paint/sculpt', True)),
+
         (BoolVariable('WITH_BF_ONSURFACEBRUSH', 'Enable use of the "on-surface brush" for paint/sculpt.  Requires a stencil buffer, GL_depth_texture, and GLSL', True)),
 
-        (BoolVariable('WITH_BF_BRUSHLIB', 'Enable MyPaint brushlib for paint/sculpt', True)),
-
         (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)),
 
         ('BUILDBOT_BRANCH', 'Buildbot branch name', ''),

Modified: branches/soc-2011-onion/extern/CMakeLists.txt
===================================================================
--- branches/soc-2011-onion/extern/CMakeLists.txt	2011-08-12 07:22:29 UTC (rev 39328)
+++ branches/soc-2011-onion/extern/CMakeLists.txt	2011-08-12 11:10:15 UTC (rev 39329)
@@ -62,3 +62,7 @@
 if(WITH_BRUSHLIB)
 	add_subdirectory(brushlib)
 endif()
+
+if(WITH_PTEX)
+	add_subdirectory(ptex)
+endif()

Modified: branches/soc-2011-onion/extern/SConscript
===================================================================
--- branches/soc-2011-onion/extern/SConscript	2011-08-12 07:22:29 UTC (rev 39328)
+++ branches/soc-2011-onion/extern/SConscript	2011-08-12 11:10:15 UTC (rev 39329)
@@ -27,3 +27,6 @@
 
 if env['WITH_BF_BRUSHLIB']:
     SConscript(['brushlib/SConscript'])
+
+if env['WITH_BF_PTEX']:
+    SConscript(['ptex/SConscript'])


Property changes on: branches/soc-2011-onion/extern/ptex
___________________________________________________________________
Added: bugtraq:number
   + true

Added: branches/soc-2011-onion/extern/ptex/CMakeLists.txt
===================================================================
--- branches/soc-2011-onion/extern/ptex/CMakeLists.txt	                        (rev 0)
+++ branches/soc-2011-onion/extern/ptex/CMakeLists.txt	2011-08-12 11:10:15 UTC (rev 39329)
@@ -0,0 +1,51 @@
+# $Id$
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2011, Jason Wilkins
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): None
+#
+# ***** END GPL LICENSE BLOCK *****
+
+SET(INC src .)
+
+SET(INC_SYS ${ZLIB_INCLUDE_DIRS})
+
+SET(SRC
+	src/ptex/PtexCache.cpp
+	src/ptex/PtexFilters.cpp
+	src/ptex/PtexHalf.cpp
+	src/ptex/PtexReader.cpp
+	src/ptex/PtexSeparableFilter.cpp
+	src/ptex/PtexSeparableKernel.cpp
+	src/ptex/PtexTriangleFilter.cpp
+	src/ptex/PtexTriangleKernel.cpp
+	src/ptex/PtexUtils.cpp
+	src/ptex/PtexWriter.cpp
+	ptex_C_api.cpp
+
+	ptex.h
+)
+
+add_definitions(-DPTEX_STATIC)
+
+blender_add_lib(extern_ptex "${SRC}" "${INC}" "${INC_SYS}")
+
+SET_TARGET_PROPERTIES(extern_ptex PROPERTIES LINKER_LANGUAGE CXX)

Added: branches/soc-2011-onion/extern/ptex/SConscript
===================================================================
--- branches/soc-2011-onion/extern/ptex/SConscript	                        (rev 0)
+++ branches/soc-2011-onion/extern/ptex/SConscript	2011-08-12 11:10:15 UTC (rev 39329)
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+import sys
+import os
+
+Import('env')
+
+sources = ['src/glew.c']
+sources = env.Glob('src/ptex/*.cpp')
+sources += env.Glob('*.cpp')
+
+defs = 'PTEX_STATIC'
+incs = 'src/ptex'
+incs += ' ' + env['BF_ZLIB_INC'] 
+
+env.BlenderLib ( 'extern_ptex', sources, Split(incs), Split(defs), libtype=['extern','player'], priority=[50,230])

Added: branches/soc-2011-onion/extern/ptex/ptex.h
===================================================================
--- branches/soc-2011-onion/extern/ptex/ptex.h	                        (rev 0)
+++ branches/soc-2011-onion/extern/ptex/ptex.h	2011-08-12 11:10:15 UTC (rev 39329)
@@ -0,0 +1,52 @@
+#ifndef PTEX_H
+#define PTEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct PtexTextureHandle PtexTextureHandle;
+typedef struct PtexFaceInfoHandle PtexFaceInfoHandle;
+typedef struct PtexResHandle PtexResHandle;
+typedef struct PtexWriterHandle PtexWriterHandle;
+
+typedef enum {
+	PTEX_DT_UINT8,
+	PTEX_DT_UINT16,
+	PTEX_DT_FLOAT,
+	PTEX_DT_UNSUPPORTED
+} PtexDataType;
+
+/* PtexTexture class */
+extern PtexTextureHandle *ptex_open(const char *path, int print_error, int premultiply);
+extern void ptex_texture_release(PtexTextureHandle *ptex_texture_handle);
+extern PtexDataType ptex_texture_data_type(PtexTextureHandle *ptex_texture_handle);
+extern int ptex_texture_num_channels(PtexTextureHandle *ptex_texture_handle);
+extern PtexFaceInfoHandle *ptex_texture_get_face_info(PtexTextureHandle* ptex_texture_handle, int faceid);
+extern void ptex_texture_get_data(PtexTextureHandle *ptex_texture_handle, int faceid, void *buffer, int stride, PtexResHandle *res_handle);
+extern void ptex_texture_get_pixel(PtexTextureHandle *ptex_texture_handle, int faceid, int u, int v, float *result, int firstchan, int nchannels, PtexResHandle res_handle);
+
+/* FaceInfo struct */
+PtexFaceInfoHandle *ptex_face_info_new(int u, int v, int adjfaces[4], int adjedges[4], int isSubface);
+extern PtexResHandle *ptex_face_info_get_res(PtexFaceInfoHandle *face_info_handle);
+extern int ptex_face_info_is_subface(PtexFaceInfoHandle *face_info_handle);
+
+/* Res struct */
+extern int ptex_res_u(PtexResHandle *ptex_res_handle);
+extern int ptex_res_v(PtexResHandle *ptex_res_handle);
+
+/* PtexWriter class */
+extern PtexWriterHandle *ptex_writer_open(const char *path, PtexDataType dt, int nchannels, int alphachan, int nfaces, int genmipmaps);
+extern void ptex_writer_write_face(PtexWriterHandle *ptex_writer_handle, int faceid, PtexFaceInfoHandle *info, const void *data, int stride);
+extern void ptex_writer_release(PtexWriterHandle *ptex_writer_handle);
+
+/* Utils */
+int ptex_data_size(PtexDataType type);
+int ptex_res_to_log2(int res);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Added: branches/soc-2011-onion/extern/ptex/ptex_C_api.cpp
===================================================================
--- branches/soc-2011-onion/extern/ptex/ptex_C_api.cpp	                        (rev 0)
+++ branches/soc-2011-onion/extern/ptex/ptex_C_api.cpp	2011-08-12 11:10:15 UTC (rev 39329)
@@ -0,0 +1,184 @@
+#include "ptex.h"
+#include "src/ptex/Ptexture.h"
+#include <iostream>
+
+/**** PtexTexture class ****/
+PtexTextureHandle *ptex_open(const char *path, int print_error, int premultiply)
+{
+	PtexTextureHandle *ptex_texture_handle;
+
+	Ptex::String error_string;
+
+	ptex_texture_handle = (PtexTextureHandle*)PtexTexture::open(path, error_string, premultiply);
+
+	if(!ptex_texture_handle && print_error)
+		std::cout << "Ptex error: " << error_string << std::endl;
+
+	return ptex_texture_handle;
+}
+
+void ptex_texture_release(PtexTextureHandle *ptex_texture_handle)
+{
+	((PtexTexture*)ptex_texture_handle)->release();
+}
+
+PtexDataType ptex_texture_data_type(PtexTextureHandle *ptex_texture_handle)
+{
+	Ptex::DataType type = ((PtexTexture*)ptex_texture_handle)->dataType();
+
+	switch(type) {
+	case Ptex::dt_uint8:
+		return PTEX_DT_UINT8;
+	case Ptex::dt_uint16:
+		return PTEX_DT_UINT16;
+	case Ptex::dt_float:
+		return PTEX_DT_FLOAT;
+	default:
+		return PTEX_DT_UNSUPPORTED;
+	}
+}
+
+int ptex_texture_num_channels(PtexTextureHandle *ptex_texture_handle)
+{
+	return ((PtexTexture*)ptex_texture_handle)->numChannels();
+}
+
+PtexFaceInfoHandle *ptex_texture_get_face_info(PtexTextureHandle *ptex_texture_handle, int faceid)
+{
+	return (PtexFaceInfoHandle*)(&((PtexTexture*)ptex_texture_handle)->getFaceInfo(faceid));
+}
+

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list