[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58632] branches/soc-2013-cycles_volume/ intern/cycles/kernel: - Added textures folder under cycles/kernel, and moved the vdb volume class to this directory.
Rafael Campos
rafaelcdn at gmail.com
Fri Jul 26 21:29:13 CEST 2013
Revision: 58632
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58632
Author: jehuty
Date: 2013-07-26 19:29:13 +0000 (Fri, 26 Jul 2013)
Log Message:
-----------
- Added textures folder under cycles/kernel, and moved the vdb volume class to this directory.
Added Paths:
-----------
branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/
branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/CMakeLists.txt
branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/openvdb_volume.cpp
branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/openvdb_volume.h
Added: branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/CMakeLists.txt
===================================================================
--- branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/CMakeLists.txt (rev 0)
+++ branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/CMakeLists.txt 2013-07-26 19:29:13 UTC (rev 58632)
@@ -0,0 +1,27 @@
+
+set(INC
+ .
+ ..
+ ../svm
+ ../../render
+ ../../util
+ ../../device
+)
+
+set(INC_SYS
+
+)
+
+set(SRC
+ openvdb_volume.cpp
+)
+
+set(HEADER_SRC
+ openvdb_volume.h
+)
+
+include_directories(${INC})
+include_directories(SYSTEM ${INC_SYS})
+
+add_library(cycles_kernel_textures ${SRC} ${HEADER_SRC})
+
Added: branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/openvdb_volume.cpp
===================================================================
--- branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/openvdb_volume.cpp (rev 0)
+++ branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/openvdb_volume.cpp 2013-07-26 19:29:13 UTC (rev 58632)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2013, Blender Foundation.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "openvdb_volume.h"
+
+CCL_NAMESPACE_BEGIN
+
+/* static ustrings */
+ustring OpenVDBUtil::u_openvdb_file_extension(".vdb");
+
+void OpenVDBUtil::initialize_library()
+{ //any additional configuration needed?
+ openvdb::initialize();
+}
+
+bool OpenVDBUtil::open_file(OIIO::ustring filename, OpenVDBVolume &vdb_volume)
+{
+ openvdb::io::File file(filename.string());
+
+ file.open();
+ openvdb::GridPtrVecPtr grids = file.getGrids();
+
+ file.close();
+
+ // Build OpenVDBVolume
+ //OpenVDBVolume vdb_volume(file, grids);
+
+ //return vdb_volume;
+ return true;
+}
+
+bool OpenVDBUtil::is_openvdb_volume_file(OIIO::ustring filename)
+{
+
+
+ if (filename.substr(filename.length() - u_openvdb_file_extension.length(),
+ u_openvdb_file_extension.length()) == u_openvdb_file_extension)
+ return true;
+ else
+ return false;
+}
+
+bool OpenVDBUtil::is_openvdb_volume_file(OIIO::ustring filename, ustring &openvdb_version)
+{
+ if (is_openvdb_volume_file(filename))
+ {
+ openvdb::io::File file(filename.string());
+ file.open();
+
+ openvdb_version.empty();
+ openvdb_version = file.version();
+
+ if(openvdb_version.length() > 0)
+ return true;
+ }
+
+ return false;
+}
+
+
+CCL_NAMESPACE_END
\ No newline at end of file
Added: branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/openvdb_volume.h
===================================================================
--- branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/openvdb_volume.h (rev 0)
+++ branches/soc-2013-cycles_volume/intern/cycles/kernel/textures/openvdb_volume.h 2013-07-26 19:29:13 UTC (rev 58632)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013, Blender Foundation.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __OPENVDB_VOLUME_H__
+#define __OPENVDB_VOLUME_H__
+
+#include <openvdb/openvdb.h>
+#include <OSL/oslexec.h>
+
+CCL_NAMESPACE_BEGIN
+
+using namespace OIIO;
+
+typedef enum eOpenVDBGridType
+{
+ OPENVDB_GRID_TYPE_NOT_SET,
+ OPENVDB_GRID_TYPE_FLOAT,
+ OPENVDB_GRID_TYPE_INT32,
+ OPENVDB_GRID_TYPE_INT64,
+ OPENVDB_GRID_TYPE_VEC3F
+} eOpenVDBGridType;
+
+typedef struct OpenVDBVolume { //increasingly, it seems OpenVDBVolume should actually be OpenVDBVolumeCollection; checking with Brecht.
+ //TODO: wip: handles for file, sampling mechanism and pointer to grid(s): each file might contain more than 1 grid;
+ openvdb::io::File file;
+ openvdb::GridPtrVecPtr grids;
+
+
+} OpenVDBVolume;
+
+class OpenVDBVolumeAccessor {
+public:
+private:
+ openvdb::GridBase::Ptr grid;
+ eOpenVDBGridType grid_type; // Is this really necessary? Check OpenVDB's generic programming guidelines.
+
+};
+
+class OpenVDBUtil
+{
+public:
+ static void initialize_library();
+ static bool open_file(OIIO::ustring filename, OpenVDBVolume &vdb_volume);
+ static bool is_openvdb_volume_file(OIIO::ustring filename);
+ static bool is_openvdb_volume_file(OIIO::ustring filename, ustring &openvdb_version);
+
+ static ustring u_openvdb_file_extension;
+private:
+ int i;
+};
+
+
+
+CCL_NAMESPACE_END
+
+#endif /* __OPENVDB_VOLUME_H__ */
\ No newline at end of file
More information about the Bf-blender-cvs
mailing list