forked from bartvdbraak/blender
Merged changes in the trunk up to revision 47381.
Conflicts resolved: source/blender/blenloader/intern/readfile.c
This commit is contained in:
commit
329b05dcd7
@ -1,4 +1,3 @@
|
||||
# -*- mode: cmake; indent-tabs-mode: t; -*-
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
@ -229,19 +228,16 @@ option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install fol
|
||||
set(PYTHON_NUMPY_PATH "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module")
|
||||
mark_as_advanced(PYTHON_NUMPY_PATH)
|
||||
|
||||
option(WITH_MINGW64 "Use the 64-bit version of MinGW" OFF)
|
||||
mark_as_advanced(WITH_MINGW64)
|
||||
if(MINGW)
|
||||
option(WITH_MINGW64 "Use the 64-bit version of MinGW" OFF)
|
||||
mark_as_advanced(WITH_MINGW64)
|
||||
endif()
|
||||
|
||||
# Cycles
|
||||
option(WITH_CYCLES "Enable cycles Render Engine" ON)
|
||||
option(WITH_CYCLES_TEST "Build cycles test application" OFF)
|
||||
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
|
||||
if(WIN32 AND NOT CMAKE_CL_64 AND NOT WITH_MINGW64)
|
||||
set(PLATFORM_DEFAULT sm_20 sm_21)
|
||||
else()
|
||||
set(PLATFORM_DEFAULT sm_13 sm_20 sm_21)
|
||||
endif()
|
||||
set(CYCLES_CUDA_BINARIES_ARCH ${PLATFORM_DEFAULT} CACHE STRING "CUDA architectures to build binaries for")
|
||||
set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build binaries for")
|
||||
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
|
||||
unset(PLATFORM_DEFAULT)
|
||||
|
||||
@ -557,7 +553,7 @@ if(UNIX AND NOT APPLE)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FFMPEG)
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include ${FFMPEG}/include/ffmpeg)
|
||||
mark_as_advanced(FFMPEG_LIBRARIES)
|
||||
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
|
||||
@ -1105,7 +1101,7 @@ elseif(WIN32)
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
set(FFMPEG ${LIBDIR}/ffmpeg)
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include ${FFMPEG}/include)
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
|
||||
if(WITH_MINGW64)
|
||||
set(FFMPEG_LIBRARIES avcodec.dll avformat.dll avdevice.dll avutil.dll swscale.dll swresample.dll)
|
||||
else()
|
||||
|
@ -109,9 +109,12 @@ all:
|
||||
@echo
|
||||
@echo Configuring Blender ...
|
||||
|
||||
if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
|
||||
$(CMAKE_CONFIG); \
|
||||
fi
|
||||
# if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
|
||||
# $(CMAKE_CONFIG); \
|
||||
# fi
|
||||
|
||||
# do this always incase of failed initial build, could be smarter here...
|
||||
$(CMAKE_CONFIG)
|
||||
|
||||
@echo
|
||||
@echo Building Blender ...
|
||||
|
42
SConstruct
42
SConstruct
@ -667,42 +667,6 @@ if env['OURPLATFORM']=='linuxcross':
|
||||
|
||||
scriptinstall.append(env.Install(dir=dir, source=source))
|
||||
|
||||
#-- plugins
|
||||
pluglist = []
|
||||
plugtargetlist = []
|
||||
for tp, tn, tf in os.walk('release/plugins'):
|
||||
if '.svn' in tn:
|
||||
tn.remove('.svn')
|
||||
if '_svn' in tn:
|
||||
tn.remove('_svn')
|
||||
df = tp[8:] # remove 'release/'
|
||||
for f in tf:
|
||||
pluglist.append(os.path.join(tp, f))
|
||||
plugtargetlist.append( os.path.join(env['BF_INSTALLDIR'], VERSION, df, f) )
|
||||
|
||||
|
||||
# header files for plugins
|
||||
pluglist.append('source/blender/blenpluginapi/documentation.h')
|
||||
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'documentation.h'))
|
||||
pluglist.append('source/blender/blenpluginapi/externdef.h')
|
||||
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'externdef.h'))
|
||||
pluglist.append('source/blender/blenpluginapi/floatpatch.h')
|
||||
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'floatpatch.h'))
|
||||
pluglist.append('source/blender/blenpluginapi/iff.h')
|
||||
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'iff.h'))
|
||||
pluglist.append('source/blender/blenpluginapi/plugin.h')
|
||||
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'plugin.h'))
|
||||
pluglist.append('source/blender/blenpluginapi/util.h')
|
||||
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'util.h'))
|
||||
pluglist.append('source/blender/blenpluginapi/plugin.DEF')
|
||||
plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], VERSION, 'plugins', 'include', 'plugin.def'))
|
||||
|
||||
plugininstall = []
|
||||
# plugins in blender 2.5 don't work at the moment.
|
||||
#for targetdir,srcfile in zip(plugtargetlist, pluglist):
|
||||
# td, tf = os.path.split(targetdir)
|
||||
# plugininstall.append(env.Install(dir=td, source=srcfile))
|
||||
|
||||
textlist = []
|
||||
texttargetlist = []
|
||||
for tp, tn, tf in os.walk('release/text'):
|
||||
@ -716,11 +680,11 @@ for tp, tn, tf in os.walk('release/text'):
|
||||
textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
|
||||
|
||||
if env['OURPLATFORM']=='darwin':
|
||||
allinstall = [blenderinstall, plugininstall, textinstall]
|
||||
allinstall = [blenderinstall, textinstall]
|
||||
elif env['OURPLATFORM']=='linux':
|
||||
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
|
||||
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall, iconinstall]
|
||||
else:
|
||||
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
|
||||
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall]
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
|
||||
dllsources = []
|
||||
|
@ -17,6 +17,7 @@ set(WITH_FFTW3 OFF CACHE FORCE BOOL)
|
||||
set(WITH_LIBMV OFF CACHE FORCE BOOL)
|
||||
set(WITH_CARVE OFF CACHE FORCE BOOL)
|
||||
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
|
||||
set(WITH_GHOST_XDND OFF CACHE FORCE BOOL)
|
||||
set(WITH_IK_ITASC OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_CINEON OFF CACHE FORCE BOOL)
|
||||
set(WITH_IMAGE_DDS OFF CACHE FORCE BOOL)
|
||||
|
@ -1,5 +1,27 @@
|
||||
# -*- mode: cmake; indent-tabs-mode: t; -*-
|
||||
|
||||
# ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2006, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Jacques Beaurain.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# foo_bar.spam --> foo_barMySuffix.spam
|
||||
macro(file_suffix
|
||||
|
@ -165,7 +165,7 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
||||
#CUDA
|
||||
WITH_BF_CYCLES_CUDA_BINARIES = False
|
||||
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
|
||||
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21'] # don't build sm_13 until the compile can fit in 32bit process again :)
|
||||
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = True
|
||||
|
@ -162,11 +162,12 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
||||
#CUDA
|
||||
WITH_BF_CYCLES_CUDA_BINARIES = False
|
||||
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
|
||||
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21']
|
||||
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
|
||||
|
||||
#Ray trace optimization
|
||||
WITH_BF_RAYOPTIMIZATION = True
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2']
|
||||
# No need to manually specify SSE/SSE2 on x64 systems.
|
||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['']
|
||||
|
||||
WITH_BF_STATICOPENGL = False
|
||||
BF_OPENGL_INC = '${BF_OPENGL}/include'
|
||||
|
4
extern/bullet2/CMakeLists.txt
vendored
4
extern/bullet2/CMakeLists.txt
vendored
@ -118,6 +118,7 @@ set(SRC
|
||||
src/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp
|
||||
src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp
|
||||
src/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
|
||||
src/BulletDynamics/Character/btKinematicCharacterController.cpp
|
||||
src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp
|
||||
src/BulletDynamics/ConstraintSolver/btContactConstraint.cpp
|
||||
src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp
|
||||
@ -154,7 +155,6 @@ set(SRC
|
||||
# src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp
|
||||
# src/BulletCollision/CollisionShapes/btBox2dShape.cpp
|
||||
# src/BulletCollision/CollisionShapes/btConvex2dShape.cpp
|
||||
# src/BulletDynamics/Character/btKinematicCharacterController.cpp
|
||||
# src/BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp
|
||||
# src/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp
|
||||
|
||||
@ -274,6 +274,7 @@ set(SRC
|
||||
src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h
|
||||
src/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h
|
||||
src/BulletDynamics/Character/btCharacterControllerInterface.h
|
||||
src/BulletDynamics/Character/btKinematicCharacterController.h
|
||||
src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
|
||||
src/BulletDynamics/ConstraintSolver/btConstraintSolver.h
|
||||
src/BulletDynamics/ConstraintSolver/btContactConstraint.h
|
||||
@ -343,7 +344,6 @@ set(SRC
|
||||
# src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h
|
||||
# src/BulletCollision/CollisionShapes/btBox2dShape.h
|
||||
# src/BulletCollision/CollisionShapes/btConvex2dShape.h
|
||||
# src/BulletDynamics/Character/btKinematicCharacterController.h
|
||||
# src/BulletDynamics/ConstraintSolver/btHinge2Constraint.h
|
||||
# src/BulletDynamics/ConstraintSolver/btUniversalConstraint.h
|
||||
)
|
||||
|
@ -339,7 +339,7 @@ public:
|
||||
|
||||
|
||||
///***************************************** expert/internal use only *************************
|
||||
void setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.0));
|
||||
void setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.5));
|
||||
QuantizedNodeArray& getLeafNodeArray() { return m_quantizedLeafNodes; }
|
||||
///buildInternal is expert use only: assumes that setQuantizationValues and LeafNodeArray are initialized
|
||||
void buildInternal();
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
} else
|
||||
{
|
||||
///need to transform normal into worldspace
|
||||
hitNormalWorld = m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;
|
||||
hitNormalWorld = convexResult.m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;
|
||||
}
|
||||
|
||||
btScalar dotUp = m_up.dot(hitNormalWorld);
|
||||
|
2
extern/bullet2/src/SConscript
vendored
2
extern/bullet2/src/SConscript
vendored
@ -23,7 +23,7 @@ elif sys.platform=='darwin':
|
||||
|
||||
linearmath_src = env.Glob("LinearMath/*.cpp")
|
||||
|
||||
bulletdyn_src = env.Glob("BulletDynamics/Vehicle/*.cpp") + env.Glob("BulletDynamics/ConstraintSolver/*.cpp") + env.Glob("BulletDynamics/Dynamics/*.cpp")
|
||||
bulletdyn_src = env.Glob("BulletDynamics/Vehicle/*.cpp") + env.Glob("BulletDynamics/ConstraintSolver/*.cpp") + env.Glob("BulletDynamics/Dynamics/*.cpp") + env.Glob("BulletDynamics/Character/*.cpp")
|
||||
|
||||
collision_broadphase_src = env.Glob("BulletCollision/BroadphaseCollision/*.cpp")
|
||||
collision_dispatch_src = env.Glob("BulletCollision/CollisionDispatch/*.cpp")
|
||||
|
9
extern/libredcode/codec.c
vendored
9
extern/libredcode/codec.c
vendored
@ -7,17 +7,20 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static void error_callback(const char *msg, void *client_data) {
|
||||
static void error_callback(const char *msg, void *client_data)
|
||||
{
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[R3D ERR] %s", msg);
|
||||
}
|
||||
|
||||
static void warning_callback(const char *msg, void *client_data) {
|
||||
static void warning_callback(const char *msg, void *client_data)
|
||||
{
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[R3D WARN] %s", msg);
|
||||
}
|
||||
|
||||
static void info_callback(const char *msg, void *client_data) {
|
||||
static void info_callback(const char *msg, void *client_data)
|
||||
{
|
||||
(void)client_data;
|
||||
fprintf(stdout, "[R3D INFO] %s", msg);
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
|
||||
invertB = false;
|
||||
if (face[1] == 1) {
|
||||
|
||||
// invertAø?
|
||||
// invertA?
|
||||
for(i=0;i<size;i++) {
|
||||
if (position[i] == 1) {
|
||||
invertA = true;
|
||||
@ -543,7 +543,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
|
||||
else if (position[i] == 0) break;
|
||||
}
|
||||
|
||||
// invertBø?
|
||||
// invertB?
|
||||
if (size == 4) {
|
||||
for(i=0;i<size;i++) {
|
||||
if (position[i] == 3) {
|
||||
@ -555,7 +555,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
|
||||
}
|
||||
}
|
||||
else if (face[1] == 2) {
|
||||
// invertBø?
|
||||
// invertB?
|
||||
for(i=0;i<size;i++) {
|
||||
if (position[i] == 2) {
|
||||
invertB = true;
|
||||
|
@ -65,7 +65,7 @@ include_directories(
|
||||
if(WITH_CYCLES_BLENDER)
|
||||
add_definitions(-DBLENDER_PLUGIN)
|
||||
add_subdirectory(blender)
|
||||
endif(WITH_CYCLES_BLENDER)
|
||||
endif()
|
||||
|
||||
add_subdirectory(app)
|
||||
add_subdirectory(bvh)
|
||||
|
@ -46,8 +46,10 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
|
||||
if env['WITH_BF_RAYOPTIMIZATION']:
|
||||
optim_cxxflags = []
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
||||
if env['OURPLATFORM'] == 'win32-vc':
|
||||
optim_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
|
||||
elif env['OURPLATFORM'] == 'win64-vc':
|
||||
optim_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
|
||||
else:
|
||||
optim_cxxflags.append('-ffast-math -msse -msse2 -msse3 -mfpmath=sse'.split())
|
||||
|
||||
|
@ -673,7 +673,7 @@ static void xml_read_mesh(const XMLReadState& state, pugi::xml_node node)
|
||||
for(int j = 0; j < nverts[i]-2; j++) {
|
||||
int v0 = verts[index_offset];
|
||||
int v1 = verts[index_offset + j + 1];
|
||||
int v2 = verts[index_offset + j + 2];;
|
||||
int v2 = verts[index_offset + j + 2];
|
||||
|
||||
sdmesh.add_face(v0, v1, v2);
|
||||
}
|
||||
|
@ -304,7 +304,6 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
|
||||
void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion)
|
||||
{
|
||||
/* todo: displacement, subdivision */
|
||||
BL::ID b_ob_data = b_ob.data();
|
||||
size_t size = mesh->verts.size();
|
||||
|
||||
/* skip objects without deforming modifiers. this is not a totally reliable,
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "blender_util.h"
|
||||
|
||||
#include "util_foreach.h"
|
||||
#include "util_hash.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
@ -245,17 +246,20 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
|
||||
/* object sync */
|
||||
if(object_updated || (object->mesh && object->mesh->need_update)) {
|
||||
object->name = b_ob.name().c_str();
|
||||
object->instance_id = b_index;
|
||||
object->pass_id = b_ob.pass_index();
|
||||
object->tfm = tfm;
|
||||
object->motion.pre = tfm;
|
||||
object->motion.post = tfm;
|
||||
object->use_motion = false;
|
||||
|
||||
object->random_id = hash_int_2d(hash_string(object->name.c_str()), b_index);
|
||||
|
||||
/* visibility flags for both parent */
|
||||
object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL;
|
||||
if(b_parent.ptr.data != b_ob.ptr.data)
|
||||
if(b_parent.ptr.data != b_ob.ptr.data) {
|
||||
object->visibility &= object_ray_visibility(b_parent);
|
||||
object->random_id ^= hash_int(hash_string(b_parent.name().c_str()));
|
||||
}
|
||||
|
||||
/* camera flag is not actually used, instead is tested
|
||||
against render layer flags */
|
||||
|
@ -117,7 +117,6 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
|
||||
case BL::ShaderNode::type_MATERIAL: break;
|
||||
case BL::ShaderNode::type_MATERIAL_EXT: break;
|
||||
case BL::ShaderNode::type_OUTPUT: break;
|
||||
case BL::ShaderNode::type_SCRIPT: break;
|
||||
case BL::ShaderNode::type_SQUEEZE: break;
|
||||
case BL::ShaderNode::type_TEXTURE: break;
|
||||
/* handled outside this function */
|
||||
@ -417,7 +416,7 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
|
||||
break;
|
||||
}
|
||||
case BL::ShaderNode::type_TEX_COORD: {
|
||||
node = new TextureCoordinateNode();;
|
||||
node = new TextureCoordinateNode();
|
||||
break;
|
||||
}
|
||||
case BL::ShaderNode::type_TEX_SKY: {
|
||||
|
@ -135,7 +135,6 @@ void BlenderSync::sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, const
|
||||
|
||||
void BlenderSync::sync_integrator()
|
||||
{
|
||||
BL::RenderSettings r = b_scene.render();
|
||||
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
||||
|
||||
experimental = (RNA_enum_get(&cscene, "feature_set") != 0);
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
string kernel_path = path_get("kernel");
|
||||
string md5 = path_files_md5_hash(kernel_path);
|
||||
|
||||
cubin = string_printf("cycles_kernel_sm%d%d_%s.cubin", major, minor, md5.c_str());;
|
||||
cubin = string_printf("cycles_kernel_sm%d%d_%s.cubin", major, minor, md5.c_str());
|
||||
cubin = path_user_get(path_join("cache", cubin));
|
||||
|
||||
/* if exists already, use it */
|
||||
@ -259,7 +259,7 @@ public:
|
||||
|
||||
path_create_directories(cubin);
|
||||
|
||||
string command = string_printf("\"%s\" -arch=sm_%d%d -m%d --cubin \"%s\" --use_fast_math "
|
||||
string command = string_printf("\"%s\" -arch=sm_%d%d -m%d --cubin \"%s\" "
|
||||
"-o \"%s\" --ptxas-options=\"-v\" --maxrregcount=%d --opencc-options -OPT:Olimit=0 -I\"%s\" -DNVCC",
|
||||
nvcc.c_str(), major, minor, machine, kernel.c_str(), cubin.c_str(), maxreg, include.c_str());
|
||||
|
||||
|
@ -407,7 +407,7 @@ public:
|
||||
string device_md5 = device_md5_hash();
|
||||
|
||||
/* try to use cache binary */
|
||||
string clbin = string_printf("cycles_kernel_%s_%s.clbin", device_md5.c_str(), kernel_md5.c_str());;
|
||||
string clbin = string_printf("cycles_kernel_%s_%s.clbin", device_md5.c_str(), kernel_md5.c_str());
|
||||
clbin = path_user_get(path_join("cache", clbin));
|
||||
|
||||
if(path_exists(clbin)) {
|
||||
|
@ -114,7 +114,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${cuda_cubin}
|
||||
COMMAND ${CUDA_NVCC_EXECUTABLE} -arch=${arch} -m${CUDA_BITS} --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu --use_fast_math -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} --ptxas-options="-v" --maxrregcount=24 --opencc-options -OPT:Olimit=0 -I${CMAKE_CURRENT_SOURCE_DIR}/../util -I${CMAKE_CURRENT_SOURCE_DIR}/svm -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC
|
||||
COMMAND ${CUDA_NVCC_EXECUTABLE} -arch=${arch} -m${CUDA_BITS} --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} --ptxas-options="-v" --maxrregcount=24 --opencc-options -OPT:Olimit=0 -I${CMAKE_CURRENT_SOURCE_DIR}/../util -I${CMAKE_CURRENT_SOURCE_DIR}/svm -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC
|
||||
DEPENDS ${cuda_sources})
|
||||
|
||||
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_cubin}" ${CYCLES_INSTALL_PATH}/lib)
|
||||
|
@ -35,7 +35,7 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
|
||||
|
||||
# nvcc flags
|
||||
nvcc_flags = "-m%s" % (bits)
|
||||
nvcc_flags += " --cubin -use_fast_math --ptxas-options=\"-v\" --maxrregcount=24"
|
||||
nvcc_flags += " --cubin --ptxas-options=\"-v\" --maxrregcount=24"
|
||||
nvcc_flags += " --opencc-options -OPT:Olimit=0"
|
||||
nvcc_flags += " -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC"
|
||||
nvcc_flags += " -I \"%s\" -I \"%s\"" % (util_dir, svm_dir)
|
||||
|
@ -74,10 +74,10 @@ __device_inline void bvh_instance_push(KernelGlobals *kg, int object, const Ray
|
||||
|
||||
__device_inline void bvh_instance_pop(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, const float tmax)
|
||||
{
|
||||
Transform tfm = object_fetch_transform(kg, object, ray->time, OBJECT_TRANSFORM);
|
||||
|
||||
if(*t != FLT_MAX)
|
||||
if(*t != FLT_MAX) {
|
||||
Transform tfm = object_fetch_transform(kg, object, ray->time, OBJECT_TRANSFORM);
|
||||
*t *= len(transform_direction(&tfm, 1.0f/(*idir)));
|
||||
}
|
||||
|
||||
*P = ray->P;
|
||||
*idir = bvh_inverse_direction(ray->D);
|
||||
|
@ -62,5 +62,14 @@ typedef texture<uchar4, 2, cudaReadModeNormalizedFloat> texture_image_uchar4;
|
||||
|
||||
#define kernel_data __data
|
||||
|
||||
/* Use fast math functions */
|
||||
|
||||
#define cosf(x) __cosf(((float)x))
|
||||
#define sinf(x) __sinf(((float)x))
|
||||
#define powf(x, y) __powf(((float)x), ((float)y))
|
||||
#define tanf(x) __tanf(((float)x))
|
||||
#define logf(x) __logf(((float)x))
|
||||
#define expf(x) __expf(((float)x))
|
||||
|
||||
#endif /* __KERNEL_COMPAT_CUDA_H__ */
|
||||
|
||||
|
@ -69,20 +69,20 @@ __device float3 equirectangular_to_direction(float u, float v)
|
||||
float theta = M_PI_F*(1.0f - v);
|
||||
|
||||
return make_float3(
|
||||
sin(theta)*cos(phi),
|
||||
sin(theta)*sin(phi),
|
||||
cos(theta));
|
||||
sinf(theta)*cosf(phi),
|
||||
sinf(theta)*sinf(phi),
|
||||
cosf(theta));
|
||||
}
|
||||
|
||||
/* Fisheye <-> Cartesian direction */
|
||||
|
||||
__device float2 direction_to_fisheye(float3 dir, float fov)
|
||||
{
|
||||
float r = atan2f(sqrt(dir.y*dir.y + dir.z*dir.z), dir.x) / fov;
|
||||
float phi = atan2(dir.z, dir.y);
|
||||
float r = atan2f(sqrtf(dir.y*dir.y + dir.z*dir.z), dir.x) / fov;
|
||||
float phi = atan2f(dir.z, dir.y);
|
||||
|
||||
float u = r * cos(phi) + 0.5f;
|
||||
float v = r * sin(phi) + 0.5f;
|
||||
float u = r * cosf(phi) + 0.5f;
|
||||
float v = r * sinf(phi) + 0.5f;
|
||||
|
||||
return make_float2(u, v);
|
||||
}
|
||||
@ -92,7 +92,7 @@ __device float3 fisheye_to_direction(float u, float v, float fov)
|
||||
u = (u - 0.5f) * 2.0f;
|
||||
v = (v - 0.5f) * 2.0f;
|
||||
|
||||
float r = sqrt(u*u + v*v);
|
||||
float r = sqrtf(u*u + v*v);
|
||||
|
||||
if(r > 1.0f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
@ -127,7 +127,7 @@ __device float3 fisheye_equisolid_to_direction(float u, float v, float lens, flo
|
||||
v = (v - 0.5f) * height;
|
||||
|
||||
float rmax = 2.0f * lens * sinf(fov * 0.25f);
|
||||
float r = sqrt(u*u + v*v);
|
||||
float r = sqrtf(u*u + v*v);
|
||||
|
||||
if(r > rmax)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
@ -153,7 +153,7 @@ __device float3 mirrorball_to_direction(float u, float v)
|
||||
|
||||
dir.x = 2.0f*u - 1.0f;
|
||||
dir.z = 2.0f*v - 1.0f;
|
||||
dir.y = -sqrt(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f));
|
||||
dir.y = -sqrtf(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f));
|
||||
|
||||
/* reflection */
|
||||
float3 I = make_float3(0.0f, -1.0f, 0.0f);
|
||||
@ -166,7 +166,7 @@ __device float2 direction_to_mirrorball(float3 dir)
|
||||
/* inverse of mirrorball_to_direction */
|
||||
dir.y -= 1.0f;
|
||||
|
||||
float div = 2.0f*sqrt(max(-0.5f*dir.y, 0.0f));
|
||||
float div = 2.0f*sqrtf(max(-0.5f*dir.y, 0.0f));
|
||||
if(div > 0.0f)
|
||||
dir /= div;
|
||||
|
||||
|
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2011, 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 KERNEL_TEX
|
||||
#define KERNEL_TEX(type, ttype, name)
|
||||
|
@ -16,31 +16,6 @@
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* An implementation of Oren-Nayar reflectance model, public domain
|
||||
* http://www1.cs.columbia.edu/CAVE/publications/pdfs/Oren_SIGGRAPH94.pdf
|
||||
*
|
||||
* NOTE:
|
||||
* BSDF = A + B * cos() * sin() * tan()
|
||||
*
|
||||
* The parameter sigma means different from original.
|
||||
* A and B are calculated by the following formula:
|
||||
* 0 <= sigma <= 1
|
||||
* A = 1 / ((1 + sigma / 2) * pi);
|
||||
* B = sigma / ((1 + sigma / 2) * pi);
|
||||
*
|
||||
* This formula is derived as following:
|
||||
*
|
||||
* 0. Normalize A-term and B-term of BSDF *individually*.
|
||||
* B-term is normalized at maximum point: dot(L, N) = 0.
|
||||
* A = (1/pi) * A'
|
||||
* B = (2/pi) * B'
|
||||
*
|
||||
* 1. Solve the following equation:
|
||||
* A' + B' = 1
|
||||
* B / A = sigma
|
||||
*/
|
||||
|
||||
#include <OpenImageIO/fmath.h>
|
||||
#include <OSL/genclosure.h>
|
||||
#include "osl_closures.h"
|
||||
@ -60,8 +35,11 @@ public:
|
||||
|
||||
void setup() {
|
||||
m_sigma = clamp(m_sigma, 0.0f, 1.0f);
|
||||
m_a = 1.0f / ((1.0f + 0.5f * m_sigma) * M_PI);
|
||||
m_b = m_sigma / ((1.0f + 0.5f * m_sigma) * M_PI);
|
||||
|
||||
float div = 1.0f / (M_PI + ((3.0f * M_PI - 4.0f) / 6.0f) * m_sigma);
|
||||
|
||||
m_a = 1.0f * div;
|
||||
m_b = m_sigma * div;
|
||||
}
|
||||
|
||||
bool mergeable(const ClosurePrimitive* other) const {
|
||||
@ -137,27 +115,12 @@ private:
|
||||
float get_intensity(Vec3 const& n, Vec3 const& v, Vec3 const& l) const {
|
||||
float nl = max(n.dot(l), 0.0f);
|
||||
float nv = max(n.dot(v), 0.0f);
|
||||
|
||||
Vec3 al = l - nl * n;
|
||||
al.normalize();
|
||||
Vec3 av = v - nv * n;
|
||||
av.normalize();
|
||||
float t = max(al.dot(av), 0.0f);
|
||||
|
||||
float cos_a, cos_b;
|
||||
if (nl < nv) {
|
||||
cos_a = nl;
|
||||
cos_b = nv;
|
||||
float t = l.dot(v) - nl * nv;
|
||||
|
||||
if(t > 0.0f) {
|
||||
t /= max(nl, vl) + 1e-8f;
|
||||
}
|
||||
else {
|
||||
cos_a = nv;
|
||||
cos_b = nl;
|
||||
}
|
||||
|
||||
float sin_a = sqrtf(1.0f - cos_a * cos_a);
|
||||
float tan_b = sqrtf(1.0f - cos_b * cos_b) / (cos_b + FLT_MIN);
|
||||
|
||||
return nl * (m_a + m_b * t * sin_a * tan_b);
|
||||
return nl * (m_a + m_b * t);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -5,21 +5,20 @@ set(SRC_OSL
|
||||
node_add_closure.osl
|
||||
node_attribute.osl
|
||||
node_background.osl
|
||||
node_blend_texture.osl
|
||||
node_bump.osl
|
||||
node_camera.osl
|
||||
node_clouds_texture.osl
|
||||
node_checker_texture.osl
|
||||
node_convert_from_color.osl
|
||||
node_convert_from_float.osl
|
||||
node_convert_from_normal.osl
|
||||
node_convert_from_point.osl
|
||||
node_convert_from_vector.osl
|
||||
node_diffuse_bsdf.osl
|
||||
node_distorted_noise_texture.osl
|
||||
node_emission.osl
|
||||
node_environment_texture.osl
|
||||
node_fresnel.osl
|
||||
node_gamma.osl
|
||||
node_gradient_texture.osl
|
||||
node_brightness.osl
|
||||
node_geometry.osl
|
||||
node_glass_bsdf.osl
|
||||
@ -30,7 +29,6 @@ set(SRC_OSL
|
||||
node_light_path.osl
|
||||
node_magic_texture.osl
|
||||
node_mapping.osl
|
||||
node_marble_texture.osl
|
||||
node_math.osl
|
||||
node_mix.osl
|
||||
node_mix_closure.osl
|
||||
@ -43,7 +41,6 @@ set(SRC_OSL
|
||||
node_output_volume.osl
|
||||
node_sepcomb_rgb.osl
|
||||
node_sky_texture.osl
|
||||
node_stucci_texture.osl
|
||||
node_texture_coordinate.osl
|
||||
node_translucent_bsdf.osl
|
||||
node_transparent_bsdf.osl
|
||||
@ -52,7 +49,7 @@ set(SRC_OSL
|
||||
node_velvet_bsdf.osl
|
||||
node_voronoi_texture.osl
|
||||
node_ward_bsdf.osl
|
||||
node_wood_texture.osl
|
||||
node_wave_texture.osl
|
||||
)
|
||||
|
||||
set(SRC_OSL_HEADERS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
* Copyright 2012, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,24 +19,40 @@
|
||||
#include "stdosl.h"
|
||||
#include "node_texture.h"
|
||||
|
||||
/* Turbulence */
|
||||
/* Checker */
|
||||
|
||||
shader node_clouds_texture(
|
||||
string Basis = "Perlin",
|
||||
int Hard = 0,
|
||||
int Depth = 2,
|
||||
float Size = 0.25,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0,
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
float checker(point p)
|
||||
{
|
||||
float size = nonzero(Size, 1e-5);
|
||||
point p = Vector/size;
|
||||
p[0] = (p[0] + 0.00001)*0.9999);
|
||||
p[1] = (p[1] + 0.00001)*0.9999);
|
||||
p[2] = (p[2] + 0.00001)*0.9999);
|
||||
|
||||
int xi = fabs(floor(p[0]));
|
||||
int yi = fabs(floor(p[1]));
|
||||
int zi = fabs(floor(p[2]));
|
||||
|
||||
Fac = noise_turbulence(p, Basis, Depth, Hard);
|
||||
|
||||
Color[0] = Fac;
|
||||
Color[1] = noise_turbulence(point(p[1], p[0], p[2]), Basis, Depth, Hard);
|
||||
Color[2] = noise_turbulence(point(p[1], p[2], p[0]), Basis, Depth, Hard);
|
||||
if((xi % 2 == yi % 2) == (zi % 2)) {
|
||||
return 1.0;
|
||||
}
|
||||
else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
shader node_checker_texture(
|
||||
float Scale = 5.0,
|
||||
point Vector = P,
|
||||
color Color1 = color(0.8, 0.8, 0.8);
|
||||
color Color2 = color(0.2, 0.2, 0.2);
|
||||
output float Fac = 0.0)
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
{
|
||||
Fac = checker(Vector*Scale);
|
||||
if(Fac == 1.0) {
|
||||
Color = color(Color1, Color1, Color1);
|
||||
}
|
||||
else {
|
||||
Color = color(Color2, Color2, Color2);
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include "stdosl.h"
|
||||
#include "node_texture.h"
|
||||
|
||||
/* Blend */
|
||||
/* Gradient */
|
||||
|
||||
float blend(point p, string progression, string axis)
|
||||
float gradient(point p, string progression, string axis)
|
||||
{
|
||||
float x, y;
|
||||
|
||||
@ -67,12 +67,12 @@ float blend(point p, string progression, string axis)
|
||||
return result;
|
||||
}
|
||||
|
||||
shader node_blend_texture(
|
||||
shader node_gradient_texture(
|
||||
string Progression = "Linear",
|
||||
string Axis = "Horizontal",
|
||||
point Vector = P,
|
||||
output float Fac = 0.0)
|
||||
{
|
||||
Fac = blend(Vector, Progression, Axis);
|
||||
Fac = gradient(Vector, Progression, Axis);
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, 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 "stdosl.h"
|
||||
#include "node_texture.h"
|
||||
|
||||
/* Marble */
|
||||
|
||||
float marble(point p, float size, string type, string wave, string basis, int hard, float turb, int depth)
|
||||
{
|
||||
float x = p[0];
|
||||
float y = p[1];
|
||||
float z = p[2];
|
||||
|
||||
float n = 5.0 * (x + y + z);
|
||||
|
||||
float mi = n + turb * noise_turbulence(p/size, basis, depth, hard);
|
||||
|
||||
mi = noise_wave(wave, mi);
|
||||
|
||||
if(type == "Sharp")
|
||||
mi = sqrt(mi);
|
||||
else if(type == "Sharper")
|
||||
mi = sqrt(sqrt(mi));
|
||||
|
||||
return mi;
|
||||
}
|
||||
|
||||
shader node_marble_texture(
|
||||
string Type = "Soft",
|
||||
string Wave = "Sine",
|
||||
string Basis = "Perlin",
|
||||
int Hard = 0,
|
||||
float Size = 0.25,
|
||||
float Turbulence = 5.0,
|
||||
int Depth = 2,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0)
|
||||
{
|
||||
float size = nonzero(Size, 1e-5);
|
||||
Fac = marble(Vector, size, Type, Wave, Basis, Hard, Turbulence, Depth);
|
||||
}
|
||||
|
@ -193,16 +193,15 @@ shader node_musgrave_texture(
|
||||
float Offset = 0.0,
|
||||
float Intensity = 1.0,
|
||||
float Gain = 1.0,
|
||||
float Size = 0.25,
|
||||
float Scale = 5.0,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0)
|
||||
{
|
||||
float dimension = max(Dimension, 0.0);
|
||||
float octaves = max(Octaves, 0.0);
|
||||
float lacunarity = max(Lacunarity, 1e-5);
|
||||
float size = nonzero(Size, 1e-5);
|
||||
|
||||
point p = Vector/size;
|
||||
point p = Vector*Scale;
|
||||
|
||||
if(Type == "Multifractal")
|
||||
Fac = Intensity*noise_musgrave_multi_fractal(p, Basis, dimension, lacunarity, octaves);
|
||||
|
@ -19,18 +19,41 @@
|
||||
#include "stdosl.h"
|
||||
#include "node_texture.h"
|
||||
|
||||
shader node_noise_texture(
|
||||
point Vector = P,
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output float Fac = 0.0)
|
||||
/* Noise */
|
||||
|
||||
float noise(point p, string basis, float distortion, float detail)
|
||||
{
|
||||
point p = Vector*1e8;
|
||||
point r;
|
||||
int hard = 0;
|
||||
float fac = 0.0;
|
||||
|
||||
if(distortion != 0.0( {
|
||||
r[0] = noise_basis(p + point(13.5), basis) * distortion;
|
||||
r[1] = noise_basis(p, basis) * distortion;
|
||||
r[2] = noise_basis(p - point(13.5), basis) * distortion;
|
||||
|
||||
p += r;
|
||||
}
|
||||
|
||||
float r = cellnoise(p);
|
||||
float g = cellnoise(point(p[1], p[0], p[2]));
|
||||
float b = cellnoise(point(p[1], p[2], p[0]));
|
||||
|
||||
Fac = r;
|
||||
Color = color(r, g, b);
|
||||
fac = noise_turbulence(p, basis, detail, hard);
|
||||
|
||||
return fac;
|
||||
|
||||
/*
|
||||
Color[0] = Fac;
|
||||
Color[1] = noise_turbulence(point(p[1], p[0], p[2]), basis, detail, hard);
|
||||
Color[2] = noise_turbulence(point(p[1], p[2], p[0]), basis, detail, hard);
|
||||
*/
|
||||
}
|
||||
|
||||
shader node_noise_texture(
|
||||
string Basis = "Perlin",
|
||||
float Distortion = 0.0,
|
||||
float Scale = 5.0,
|
||||
float Detail = 2.0,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0)
|
||||
{
|
||||
Fac = noise(Vector*Scale, Basis, Distortion, Detail);
|
||||
}
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, 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 "stdosl.h"
|
||||
#include "node_texture.h"
|
||||
|
||||
/* Stucci */
|
||||
|
||||
shader node_stucci_texture(
|
||||
string Type = "Plastic",
|
||||
string Basis = "Perlin",
|
||||
int Hard = 0,
|
||||
float Turbulence = 1.0,
|
||||
float Size = 0.25,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0)
|
||||
{
|
||||
float size = nonzero(Size, 1e-5);
|
||||
point p = Vector/size;
|
||||
|
||||
float b2 = noise_basis_hard(p, Basis, Hard);
|
||||
float ofs = Turbulence/200.0;
|
||||
|
||||
if(Type != "Plastic")
|
||||
ofs *= b2*b2;
|
||||
|
||||
Fac = noise_basis_hard(point(p[0], p[1], p[2]+ofs), Basis, Hard);
|
||||
|
||||
if(Type == "Wall Out")
|
||||
Fac = 1.0 - Fac;
|
||||
|
||||
Fac = max(Fac, 0.0);
|
||||
}
|
||||
|
@ -30,13 +30,12 @@ shader node_voronoi_texture(
|
||||
float Weight4 = 0.0,
|
||||
float Exponent = 2.5,
|
||||
float Intensity = 1.0,
|
||||
float Size = 0.25,
|
||||
float Scale = 5.0,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0,
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
{
|
||||
float exponent = max(Exponent, 1e-5);
|
||||
float size = nonzero(Size, 1e-5);
|
||||
|
||||
float aw1 = fabs(Weight1);
|
||||
float aw2 = fabs(Weight2);
|
||||
@ -51,7 +50,7 @@ shader node_voronoi_texture(
|
||||
float da[4];
|
||||
point pa[4];
|
||||
|
||||
voronoi(Vector/size, DistanceMetric, exponent, da, pa);
|
||||
voronoi(Vector*Scale, DistanceMetric, exponent, da, pa);
|
||||
|
||||
/* Scalar output */
|
||||
Fac = sc * fabs(Weight1*da[0] + Weight2*da[1] + Weight3*da[2] + Weight4*da[3]);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
* Copyright 2012, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,28 +19,41 @@
|
||||
#include "stdosl.h"
|
||||
#include "node_texture.h"
|
||||
|
||||
/* Distorted Noise (variable lacunarity noise) */
|
||||
/* Wave */
|
||||
|
||||
float noise_distorted(point p, string basis, string distortion_basis, float distortion)
|
||||
float wave(point p, float scale, string type, float detail, float distortion, float dscale)
|
||||
{
|
||||
point r;
|
||||
float x = p[0] * scale;
|
||||
float y = p[1] * scale;
|
||||
float z = p[2] * scale;
|
||||
|
||||
r[0] = noise_basis(p + point(13.5), basis) * distortion;
|
||||
r[1] = noise_basis(p, basis) * distortion;
|
||||
r[2] = noise_basis(p - point(13.5), basis) * distortion;
|
||||
float result = 0.0;
|
||||
float n = 0.0;
|
||||
|
||||
return noise_basis(p + r, distortion_basis); /* distorted-domain noise */
|
||||
if(type == "Bands") {
|
||||
n = (x + y + z)*10.0);
|
||||
}
|
||||
else if(type == "Rings") {
|
||||
n = (sqrt(x*x + y*y + z*z)*20.0);
|
||||
}
|
||||
|
||||
if(distortion != 0.0) {
|
||||
n = n +(distortion * noise_turbulence(p*dscale, "Perlin", detail, 0);
|
||||
}
|
||||
result = noise_wave("Sine", n);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
shader node_distorted_noise_texture(
|
||||
string Basis = "Perlin",
|
||||
string DistortionBasis = "Perlin",
|
||||
float Distortion = 1.0,
|
||||
float Size = 0.25,
|
||||
shader node_wave_texture(
|
||||
string Type = "Bands",
|
||||
float Scale = 5.0,
|
||||
float distortion = 0.0,
|
||||
float detail = 2.0,
|
||||
float dscale = 1.0,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0)
|
||||
{
|
||||
float size = nonzero(Size, 1e-5);
|
||||
Fac = noise_distorted(Vector/size, Basis, DistortionBasis, Distortion);
|
||||
Fac = wave(Vector, Scale, Type, detail, distortion, dscale);
|
||||
}
|
||||
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, 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 "stdosl.h"
|
||||
#include "node_texture.h"
|
||||
|
||||
/* Wood */
|
||||
|
||||
float wood(point p, float size, string type, string wave, string basis, int hard, float turb)
|
||||
{
|
||||
float x = p[0];
|
||||
float y = p[1];
|
||||
float z = p[2];
|
||||
|
||||
float result = 0.0;
|
||||
|
||||
if(type == "Bands") {
|
||||
result = noise_wave(wave, (x + y + z)*10.0);
|
||||
}
|
||||
else if(type == "Rings") {
|
||||
result = noise_wave(wave, sqrt(x*x + y*y + z*z)*20.0);
|
||||
}
|
||||
else if (type == "Band Noise") {
|
||||
float wi = turb*noise_basis_hard(p/size, basis, hard);
|
||||
result = noise_wave(wave, (x + y + z)*10.0 + wi);
|
||||
}
|
||||
else if (type == "Ring Noise") {
|
||||
float wi = turb*noise_basis_hard(p/size, basis, hard);
|
||||
result = noise_wave(wave, sqrt(x*x + y*y + z*z)*20.0 + wi);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
shader node_wood_texture(
|
||||
string Type = "Bands",
|
||||
string Wave = "Sine",
|
||||
string Basis = "Perlin",
|
||||
int Hard = 0,
|
||||
float Size = 0.25,
|
||||
float Turbulence = 5.0,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0)
|
||||
{
|
||||
float size = nonzero(Size, 1e-5);
|
||||
Fac = wood(Vector, size, Type, Wave, Basis, Hard, Turbulence);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Clouds */
|
||||
/* Noise */
|
||||
|
||||
__device_inline void svm_noise(float3 p, float scale, float detail, float distortion, float *fac, float3 *color)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ __device_inline float3 svm_world_to_ndc(KernelGlobals *kg, ShaderData *sd, float
|
||||
else
|
||||
P = normalize(transform_direction(&tfm, P));
|
||||
|
||||
float2 uv = direction_to_panorama(kg, P);;
|
||||
float2 uv = direction_to_panorama(kg, P);
|
||||
|
||||
return make_float3(uv.x, uv.y, 0.0f);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ __device_noinline float svm_wave(NodeWoodType type, float3 p, float scale, float
|
||||
p *= scale;
|
||||
|
||||
if(type == NODE_WAVE_BANDS)
|
||||
n= (p.x + p.x + p.z)*10.0f;
|
||||
n= (p.x + p.y + p.z)*10.0f;
|
||||
else /* if(type == NODE_WAVE_RINGS) */
|
||||
n= len(p)*20.0f;
|
||||
|
||||
|
@ -340,7 +340,8 @@ void ShaderGraph::remove_proxy_nodes(vector<bool>& removed)
|
||||
|
||||
foreach(ShaderInput *input, inputs) {
|
||||
disconnect(input);
|
||||
connect(output, input);
|
||||
if (output)
|
||||
connect(output, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -755,7 +755,7 @@ void WaveTextureNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
compiler.parameter("Type", type);
|
||||
|
||||
compiler.add(this, "node_marble_texture");
|
||||
compiler.add(this, "node_wave_texture");
|
||||
}
|
||||
|
||||
/* Magic Texture */
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "scene.h"
|
||||
|
||||
#include "util_foreach.h"
|
||||
#include "util_hash.h"
|
||||
#include "util_map.h"
|
||||
#include "util_progress.h"
|
||||
|
||||
@ -37,7 +36,7 @@ Object::Object()
|
||||
mesh = NULL;
|
||||
tfm = transform_identity();
|
||||
visibility = ~0;
|
||||
instance_id = 0;
|
||||
random_id = 0;
|
||||
pass_id = 0;
|
||||
bounds = BoundBox::empty;
|
||||
motion.pre = transform_identity();
|
||||
@ -165,9 +164,7 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
|
||||
float uniform_scale;
|
||||
float surface_area = 0.0f;
|
||||
float pass_id = ob->pass_id;
|
||||
|
||||
uint ob_hash = hash_int_2d(hash_string(ob->name.c_str()), ob->instance_id);
|
||||
float random_number = (float)ob_hash * (1.0f/(float)0xFFFFFFFF);
|
||||
float random_number = (float)ob->random_id * (1.0f/(float)0xFFFFFFFF);
|
||||
|
||||
if(transform_uniform_scale(tfm, uniform_scale)) {
|
||||
map<Mesh*, float>::iterator it = surface_area_map.find(mesh);
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
Transform tfm;
|
||||
BoundBox bounds;
|
||||
ustring name;
|
||||
int instance_id;
|
||||
uint random_id;
|
||||
int pass_id;
|
||||
vector<ParamValue> attributes;
|
||||
uint visibility;
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
static void *run(void *arg)
|
||||
{
|
||||
((thread*)arg)->run_cb();;
|
||||
((thread*)arg)->run_cb();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -61,16 +61,20 @@ __device_inline float3 transform_perspective(const Transform *t, const float3 a)
|
||||
|
||||
__device_inline float3 transform_point(const Transform *t, const float3 a)
|
||||
{
|
||||
float4 b = make_float4(a.x, a.y, a.z, 1.0f);
|
||||
float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b));
|
||||
float3 c = make_float3(
|
||||
a.x*t->x.x + a.y*t->x.y + a.z*t->x.z + t->x.w,
|
||||
a.x*t->y.x + a.y*t->y.y + a.z*t->y.z + t->y.w,
|
||||
a.x*t->z.x + a.y*t->z.y + a.z*t->z.z + t->z.w);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
__device_inline float3 transform_direction(const Transform *t, const float3 a)
|
||||
{
|
||||
float4 b = make_float4(a.x, a.y, a.z, 0.0f);
|
||||
float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b));
|
||||
float3 c = make_float3(
|
||||
a.x*t->x.x + a.y*t->x.y + a.z*t->x.z,
|
||||
a.x*t->y.x + a.y*t->y.y + a.z*t->y.z,
|
||||
a.x*t->z.x + a.y*t->z.y + a.z*t->z.z);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -51,8 +51,8 @@
|
||||
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
# define GHOST_PRINT(x) { std::cout << x; }
|
||||
# define GHOST_PRINTF(x, ...) { printf(x, __VA_ARGS__); }
|
||||
# define GHOST_PRINT(x) { std::cout << x; } (void)0
|
||||
# define GHOST_PRINTF(x, ...) { printf(x, __VA_ARGS__); } (void)0
|
||||
#else // GHOST_DEBUG
|
||||
# define GHOST_PRINT(x)
|
||||
# define GHOST_PRINTF(x, ...)
|
||||
@ -67,7 +67,7 @@
|
||||
GHOST_PRINT(info); \
|
||||
GHOST_PRINT("\n"); \
|
||||
} \
|
||||
}
|
||||
} (void)0
|
||||
#else // GHOST_DEBUG
|
||||
# define GHOST_ASSERT(x, info)
|
||||
#endif // GHOST_DEBUG
|
||||
|
@ -142,7 +142,7 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting
|
||||
const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
|
||||
{
|
||||
GHOST_TSuccess success = GHOST_kFailure;
|
||||
GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager")
|
||||
GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager");
|
||||
if (m_displayManager) {
|
||||
if (!m_windowManager->getFullScreen()) {
|
||||
m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, m_preFullScreenSetting);
|
||||
@ -184,12 +184,12 @@ GHOST_TSuccess GHOST_System::updateFullScreen(const GHOST_DisplaySetting& settin
|
||||
GHOST_TSuccess GHOST_System::endFullScreen(void)
|
||||
{
|
||||
GHOST_TSuccess success = GHOST_kFailure;
|
||||
GHOST_ASSERT(m_windowManager, "GHOST_System::endFullScreen(): invalid window manager")
|
||||
GHOST_ASSERT(m_windowManager, "GHOST_System::endFullScreen(): invalid window manager");
|
||||
if (m_windowManager->getFullScreen()) {
|
||||
//GHOST_IWindow* window = m_windowManager->getFullScreenWindow();
|
||||
//GHOST_PRINT("GHOST_System::endFullScreen(): leaving window manager full-screen mode\n");
|
||||
success = m_windowManager->endFullScreen();
|
||||
GHOST_ASSERT(m_displayManager, "GHOST_System::endFullScreen(): invalid display manager")
|
||||
GHOST_ASSERT(m_displayManager, "GHOST_System::endFullScreen(): invalid display manager");
|
||||
//GHOST_PRINT("GHOST_System::endFullScreen(): leaving full-screen mode\n");
|
||||
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, m_preFullScreenSetting);
|
||||
}
|
||||
@ -350,7 +350,7 @@ GHOST_TSuccess GHOST_System::exit()
|
||||
GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window, const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
|
||||
{
|
||||
GHOST_TSuccess success;
|
||||
GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager")
|
||||
GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager");
|
||||
GHOST_DisplaySetting settings;
|
||||
|
||||
success = m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, settings);
|
||||
|
@ -57,8 +57,6 @@
|
||||
#include "GHOST_NDOFManager.h"
|
||||
#include "AssertMacros.h"
|
||||
|
||||
#define GHOST_KEY_SWITCH(mac, ghost) { case (mac): ghostKey = (ghost); break; }
|
||||
|
||||
/* blender class and types events */
|
||||
enum {
|
||||
kEventClassBlender = 'blnd'
|
||||
@ -1027,7 +1025,7 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
|
||||
GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0");
|
||||
if (::TrackGoAway(window, mousePos))
|
||||
{
|
||||
// todo: add option-close, because itÿs in the HIG
|
||||
// todo: add option-close, because it's in the HIG
|
||||
// if (event.modifiers & optionKey) {
|
||||
// Close the clean documents, others will be confirmed one by one.
|
||||
//}
|
||||
|
@ -915,7 +915,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
|
||||
case NSFlagsChanged:
|
||||
handleKeyEvent(event);
|
||||
|
||||
/* Support system-wide keyboard shortcuts, like Exposé, ...) =>included in always NSApp sendEvent */
|
||||
/* Support system-wide keyboard shortcuts, like Exposé, ...) =>included in always NSApp sendEvent */
|
||||
/* if (([event modifierFlags] & NSCommandKeyMask) || [event type] == NSFlagsChanged) {
|
||||
[NSApp sendEvent:event];
|
||||
}*/
|
||||
|
@ -27,18 +27,12 @@
|
||||
|
||||
/** \file ghost/intern/GHOST_SystemWin32.cpp
|
||||
* \ingroup GHOST
|
||||
*
|
||||
* \author Maarten Gribnau
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* Copyright (C) 2001 NaN Technologies B.V.
|
||||
* @author Maarten Gribnau
|
||||
* @date May 7, 2001
|
||||
*/
|
||||
|
||||
#ifdef BF_GHOST_DEBUG
|
||||
#include <iostream>
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
# include <iostream>
|
||||
#endif
|
||||
|
||||
#include <stdio.h> // [mce] temporary debug, remove soon!
|
||||
@ -47,17 +41,18 @@
|
||||
#include "GHOST_EventDragnDrop.h"
|
||||
|
||||
#ifndef _WIN32_IE
|
||||
#define _WIN32_IE 0x0501 /* shipped before XP, so doesn't impose additional requirements */
|
||||
# define _WIN32_IE 0x0501 /* shipped before XP, so doesn't impose additional requirements */
|
||||
#endif
|
||||
|
||||
#include <shlobj.h>
|
||||
#include <tlhelp32.h>
|
||||
|
||||
// win64 doesn't define GWL_USERDATA
|
||||
#ifdef WIN32
|
||||
#ifndef GWL_USERDATA
|
||||
#define GWL_USERDATA GWLP_USERDATA
|
||||
#define GWL_WNDPROC GWLP_WNDPROC
|
||||
#endif
|
||||
# ifndef GWL_USERDATA
|
||||
# define GWL_USERDATA GWLP_USERDATA
|
||||
# define GWL_WNDPROC GWLP_WNDPROC
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "utfconv.h"
|
||||
@ -389,11 +384,11 @@ GHOST_TSuccess GHOST_SystemWin32::init()
|
||||
// Determine whether this system has a high frequency performance counter. */
|
||||
m_hasPerformanceCounter = ::QueryPerformanceFrequency((LARGE_INTEGER *)&m_freq) == TRUE;
|
||||
if (m_hasPerformanceCounter) {
|
||||
GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer available\n")
|
||||
GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer available\n");
|
||||
::QueryPerformanceCounter((LARGE_INTEGER *)&m_start);
|
||||
}
|
||||
else {
|
||||
GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer not available\n")
|
||||
GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer not available\n");
|
||||
}
|
||||
|
||||
if (success) {
|
||||
@ -885,7 +880,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
|
||||
LRESULT lResult = 0;
|
||||
GHOST_SystemWin32 *system = ((GHOST_SystemWin32 *)getSystem());
|
||||
GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized")
|
||||
GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized");
|
||||
|
||||
if (hwnd) {
|
||||
GHOST_WindowWin32 *window = (GHOST_WindowWin32 *)::GetWindowLong(hwnd, GWL_USERDATA);
|
||||
@ -917,9 +912,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
case RIM_TYPEKEYBOARD:
|
||||
event = processKeyEvent(window, raw);
|
||||
if (!event) {
|
||||
GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ")
|
||||
GHOST_PRINT(msg)
|
||||
GHOST_PRINT(" key ignored\n")
|
||||
GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ");
|
||||
GHOST_PRINT(msg);
|
||||
GHOST_PRINT(" key ignored\n");
|
||||
}
|
||||
break;
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
@ -1233,7 +1228,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
}
|
||||
else {
|
||||
// Event found for a window before the pointer to the class has been set.
|
||||
GHOST_PRINT("GHOST_SystemWin32::wndProc: GHOST window event before creation\n")
|
||||
GHOST_PRINT("GHOST_SystemWin32::wndProc: GHOST window event before creation\n");
|
||||
/* These are events we typically miss at this point:
|
||||
WM_GETMINMAXINFO 0x24
|
||||
WM_NCCREATE 0x81
|
||||
@ -1245,7 +1240,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
}
|
||||
else {
|
||||
// Events without valid hwnd
|
||||
GHOST_PRINT("GHOST_SystemWin32::wndProc: event without window\n")
|
||||
GHOST_PRINT("GHOST_SystemWin32::wndProc: event without window\n");
|
||||
}
|
||||
|
||||
if (event) {
|
||||
|
@ -221,7 +221,7 @@ bool GHOST_WindowCarbon::getValid() const
|
||||
|
||||
void GHOST_WindowCarbon::setTitle(const STR_String& title)
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid");
|
||||
Str255 title255;
|
||||
gen2mac(title, title255);
|
||||
::SetWTitle(m_windowRef, title255);
|
||||
@ -230,7 +230,7 @@ void GHOST_WindowCarbon::setTitle(const STR_String& title)
|
||||
|
||||
void GHOST_WindowCarbon::getTitle(STR_String& title) const
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getTitle(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getTitle(): window invalid");
|
||||
Str255 title255;
|
||||
::GetWTitle(m_windowRef, title255);
|
||||
mac2gen(title255, title);
|
||||
@ -241,7 +241,7 @@ void GHOST_WindowCarbon::getWindowBounds(GHOST_Rect& bounds) const
|
||||
{
|
||||
OSStatus success;
|
||||
Rect rect;
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getWindowBounds(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getWindowBounds(): window invalid");
|
||||
success = ::GetWindowBounds(m_windowRef, kWindowStructureRgn, &rect);
|
||||
bounds.m_b = rect.bottom;
|
||||
bounds.m_l = rect.left;
|
||||
@ -253,7 +253,7 @@ void GHOST_WindowCarbon::getWindowBounds(GHOST_Rect& bounds) const
|
||||
void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const
|
||||
{
|
||||
Rect rect;
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getClientBounds(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getClientBounds(): window invalid");
|
||||
//::GetPortBounds(m_grafPtr, &rect);
|
||||
::GetWindowBounds(m_windowRef, kWindowContentRgn, &rect);
|
||||
|
||||
@ -277,7 +277,7 @@ void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const
|
||||
|
||||
GHOST_TSuccess GHOST_WindowCarbon::setClientWidth(GHOST_TUns32 width)
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientWidth(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientWidth(): window invalid");
|
||||
GHOST_Rect cBnds, wBnds;
|
||||
getClientBounds(cBnds);
|
||||
if (((GHOST_TUns32)cBnds.getWidth()) != width) {
|
||||
@ -289,7 +289,7 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientWidth(GHOST_TUns32 width)
|
||||
|
||||
GHOST_TSuccess GHOST_WindowCarbon::setClientHeight(GHOST_TUns32 height)
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientHeight(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientHeight(): window invalid");
|
||||
GHOST_Rect cBnds, wBnds;
|
||||
getClientBounds(cBnds);
|
||||
#ifdef GHOST_DRAW_CARBON_GUTTER
|
||||
@ -307,7 +307,7 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientHeight(GHOST_TUns32 height)
|
||||
|
||||
GHOST_TSuccess GHOST_WindowCarbon::setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientSize(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientSize(): window invalid");
|
||||
GHOST_Rect cBnds, wBnds;
|
||||
getClientBounds(cBnds);
|
||||
#ifdef GHOST_DRAW_CARBON_GUTTER
|
||||
@ -328,7 +328,7 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientSize(GHOST_TUns32 width, GHOST_TUns3
|
||||
|
||||
GHOST_TWindowState GHOST_WindowCarbon::getState() const
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getState(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getState(): window invalid");
|
||||
GHOST_TWindowState state;
|
||||
if (::IsWindowVisible(m_windowRef) == false) {
|
||||
state = GHOST_kWindowStateMinimized;
|
||||
@ -345,7 +345,7 @@ GHOST_TWindowState GHOST_WindowCarbon::getState() const
|
||||
|
||||
void GHOST_WindowCarbon::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::screenToClient(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::screenToClient(): window invalid");
|
||||
Point point;
|
||||
point.h = inX;
|
||||
point.v = inY;
|
||||
@ -361,7 +361,7 @@ void GHOST_WindowCarbon::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOS
|
||||
|
||||
void GHOST_WindowCarbon::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::clientToScreen(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::clientToScreen(): window invalid");
|
||||
Point point;
|
||||
point.h = inX;
|
||||
point.v = inY;
|
||||
@ -377,7 +377,7 @@ void GHOST_WindowCarbon::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOS
|
||||
|
||||
GHOST_TSuccess GHOST_WindowCarbon::setState(GHOST_TWindowState state)
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setState(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setState(): window invalid");
|
||||
switch (state) {
|
||||
case GHOST_kWindowStateMinimized:
|
||||
::HideWindow(m_windowRef);
|
||||
@ -400,7 +400,7 @@ GHOST_TSuccess GHOST_WindowCarbon::setState(GHOST_TWindowState state)
|
||||
|
||||
GHOST_TSuccess GHOST_WindowCarbon::setOrder(GHOST_TWindowOrder order)
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setOrder(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setOrder(): window invalid");
|
||||
if (order == GHOST_kWindowOrderTop) {
|
||||
//::BringToFront(m_windowRef); is wrong, front window should be active for input too
|
||||
::SelectWindow(m_windowRef);
|
||||
@ -555,7 +555,7 @@ GHOST_TSuccess GHOST_WindowCarbon::removeDrawingContext()
|
||||
|
||||
GHOST_TSuccess GHOST_WindowCarbon::invalidate()
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::invalidate(): window invalid")
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::invalidate(): window invalid");
|
||||
if (!m_fullScreen) {
|
||||
Rect rect;
|
||||
::GetPortBounds(m_grafPtr, &rect);
|
||||
|
@ -482,7 +482,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
|
||||
i=0;
|
||||
pixelFormatAttrsWindow[i++] = NSOpenGLPFADoubleBuffer;
|
||||
|
||||
// Guarantees the back buffer contents to be valid after a call to NSOpenGLContext object’s flushBuffer
|
||||
// Guarantees the back buffer contents to be valid after a call to NSOpenGLContext object's flushBuffer
|
||||
// needed for 'Draw Overlap' drawing method
|
||||
pixelFormatAttrsWindow[i++] = NSOpenGLPFABackingStore;
|
||||
|
||||
@ -525,7 +525,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
|
||||
i=0;
|
||||
pixelFormatAttrsWindow[i++] = NSOpenGLPFADoubleBuffer;
|
||||
|
||||
// Guarantees the back buffer contents to be valid after a call to NSOpenGLContext object’s flushBuffer
|
||||
// Guarantees the back buffer contents to be valid after a call to NSOpenGLContext object's flushBuffer
|
||||
// needed for 'Draw Overlap' drawing method
|
||||
pixelFormatAttrsWindow[i++] = NSOpenGLPFABackingStore;
|
||||
|
||||
|
@ -34,7 +34,8 @@
|
||||
#include "GHOST_C-api.h"
|
||||
#include "EventToBuf.h"
|
||||
|
||||
char *eventtype_to_string(GHOST_TEventType type) {
|
||||
char *eventtype_to_string(GHOST_TEventType type)
|
||||
{
|
||||
switch(type) {
|
||||
case GHOST_kEventCursorMove: return "CursorMove";
|
||||
case GHOST_kEventButtonDown: return "ButtonDown";
|
||||
@ -55,7 +56,8 @@ char *eventtype_to_string(GHOST_TEventType type) {
|
||||
}
|
||||
}
|
||||
|
||||
static char *keytype_to_string(GHOST_TKey key) {
|
||||
static char *keytype_to_string(GHOST_TKey key)
|
||||
{
|
||||
#define K(key) case GHOST_k##key: return #key;
|
||||
switch (key) {
|
||||
K(KeyBackSpace);
|
||||
@ -193,7 +195,8 @@ static char *keytype_to_string(GHOST_TKey key) {
|
||||
#undef K
|
||||
}
|
||||
|
||||
void event_to_buf(GHOST_EventHandle evt, char buf[128]) {
|
||||
void event_to_buf(GHOST_EventHandle evt, char buf[128])
|
||||
{
|
||||
GHOST_TEventType type= GHOST_GetEventType(evt);
|
||||
double time= (double) ((GHOST_TInt64) GHOST_GetEventTime(evt))/1000;
|
||||
GHOST_WindowHandle win= GHOST_GetEventWindow(evt);
|
||||
|
@ -75,7 +75,8 @@ void multitestapp_exit(MultiTestApp *app);
|
||||
|
||||
/**/
|
||||
|
||||
void rect_bevel_side(int rect[2][2], int side, float *lt, float *dk, float *col, int width) {
|
||||
void rect_bevel_side(int rect[2][2], int side, float *lt, float *dk, float *col, int width)
|
||||
{
|
||||
int ltidx = (side / 2) % 4;
|
||||
int dkidx = (ltidx + 1 + (side & 1)) % 4;
|
||||
int i, corner;
|
||||
@ -107,7 +108,8 @@ void rect_bevel_side(int rect[2][2], int side, float *lt, float *dk, float *col,
|
||||
glRecti(rect[0][0] + width, rect[0][1] + width, rect[1][0] - width, rect[1][1] - width);
|
||||
}
|
||||
|
||||
void rect_bevel_smooth(int rect[2][2], int width) {
|
||||
void rect_bevel_smooth(int rect[2][2], int width)
|
||||
{
|
||||
float *lt = malloc(sizeof(*lt) * width);
|
||||
float *dk = malloc(sizeof(*dk) * width);
|
||||
float col[4];
|
||||
@ -143,11 +145,13 @@ typedef struct {
|
||||
int tmouse[2];
|
||||
} MainWindow;
|
||||
|
||||
static void mainwindow_log(MainWindow *mw, char *str) {
|
||||
static void mainwindow_log(MainWindow *mw, char *str)
|
||||
{
|
||||
loggerwindow_log(multitestapp_get_logger(mw->app), str);
|
||||
}
|
||||
|
||||
static void mainwindow_do_draw(MainWindow *mw) {
|
||||
static void mainwindow_do_draw(MainWindow *mw)
|
||||
{
|
||||
GHOST_ActivateWindowDrawingContext(mw->win);
|
||||
|
||||
if (mw->lmbut[0]) {
|
||||
@ -164,7 +168,8 @@ static void mainwindow_do_draw(MainWindow *mw) {
|
||||
GHOST_SwapWindowBuffers(mw->win);
|
||||
}
|
||||
|
||||
static void mainwindow_do_reshape(MainWindow *mw) {
|
||||
static void mainwindow_do_reshape(MainWindow *mw)
|
||||
{
|
||||
GHOST_RectangleHandle bounds = GHOST_GetClientBounds(mw->win);
|
||||
|
||||
GHOST_ActivateWindowDrawingContext(mw->win);
|
||||
@ -183,7 +188,8 @@ static void mainwindow_do_reshape(MainWindow *mw) {
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
static void mainwindow_do_key(MainWindow *mw, GHOST_TKey key, int press) {
|
||||
static void mainwindow_do_key(MainWindow *mw, GHOST_TKey key, int press)
|
||||
{
|
||||
switch (key) {
|
||||
case GHOST_kKeyC:
|
||||
if (press)
|
||||
@ -226,7 +232,8 @@ static void mainwindow_do_key(MainWindow *mw, GHOST_TKey key, int press) {
|
||||
}
|
||||
}
|
||||
|
||||
static void mainwindow_do_move(MainWindow *mw, int x, int y) {
|
||||
static void mainwindow_do_move(MainWindow *mw, int x, int y)
|
||||
{
|
||||
mw->lmouse[0] = x, mw->lmouse[1] = y;
|
||||
|
||||
if (mw->lmbut[0]) {
|
||||
@ -235,7 +242,8 @@ static void mainwindow_do_move(MainWindow *mw, int x, int y) {
|
||||
}
|
||||
}
|
||||
|
||||
static void mainwindow_do_button(MainWindow *mw, int which, int press) {
|
||||
static void mainwindow_do_button(MainWindow *mw, int which, int press)
|
||||
{
|
||||
if (which == GHOST_kButtonMaskLeft) {
|
||||
mw->lmbut[0] = press;
|
||||
mw->tmouse[0] = mw->lmouse[0], mw->tmouse[1] = mw->lmouse[1];
|
||||
@ -249,7 +257,8 @@ static void mainwindow_do_button(MainWindow *mw, int which, int press) {
|
||||
}
|
||||
}
|
||||
|
||||
static void mainwindow_handle(void *priv, GHOST_EventHandle evt) {
|
||||
static void mainwindow_handle(void *priv, GHOST_EventHandle evt)
|
||||
{
|
||||
MainWindow *mw = priv;
|
||||
GHOST_TEventType type = GHOST_GetEventType(evt);
|
||||
char buf[256];
|
||||
@ -289,7 +298,8 @@ static void mainwindow_handle(void *priv, GHOST_EventHandle evt) {
|
||||
|
||||
/**/
|
||||
|
||||
static void mainwindow_timer_proc(GHOST_TimerTaskHandle task, GHOST_TUns64 time) {
|
||||
static void mainwindow_timer_proc(GHOST_TimerTaskHandle task, GHOST_TUns64 time)
|
||||
{
|
||||
MainWindow *mw = GHOST_GetTimerTaskUserData(task);
|
||||
char buf[64];
|
||||
|
||||
@ -321,7 +331,8 @@ MainWindow *mainwindow_new(MultiTestApp *app) {
|
||||
}
|
||||
}
|
||||
|
||||
void mainwindow_free(MainWindow *mw) {
|
||||
void mainwindow_free(MainWindow *mw)
|
||||
{
|
||||
GHOST_SystemHandle sys = multitestapp_get_system(mw->app);
|
||||
|
||||
windowdata_free(GHOST_GetWindowUserData(mw->win));
|
||||
@ -362,7 +373,8 @@ struct _LoggerWindow {
|
||||
#define SCROLLBAR_PAD 2
|
||||
#define SCROLLBAR_WIDTH 14
|
||||
#define TEXTAREA_PAD 2
|
||||
static void loggerwindow_recalc_regions(LoggerWindow *lw) {
|
||||
static void loggerwindow_recalc_regions(LoggerWindow *lw)
|
||||
{
|
||||
int nscroll[2][2];
|
||||
|
||||
nscroll[0][0] = SCROLLBAR_PAD;
|
||||
@ -381,7 +393,8 @@ static void loggerwindow_recalc_regions(LoggerWindow *lw) {
|
||||
scrollbar_set_rect(lw->scroll, nscroll);
|
||||
}
|
||||
|
||||
static void loggerwindow_setup_window_gl(LoggerWindow *lw) {
|
||||
static void loggerwindow_setup_window_gl(LoggerWindow *lw)
|
||||
{
|
||||
glViewport(0, 0, lw->size[0], lw->size[1]);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@ -393,7 +406,8 @@ static void loggerwindow_setup_window_gl(LoggerWindow *lw) {
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
static void loggerwindow_do_reshape(LoggerWindow *lw) {
|
||||
static void loggerwindow_do_reshape(LoggerWindow *lw)
|
||||
{
|
||||
GHOST_RectangleHandle bounds = GHOST_GetClientBounds(lw->win);
|
||||
|
||||
GHOST_ActivateWindowDrawingContext(lw->win);
|
||||
@ -405,7 +419,8 @@ static void loggerwindow_do_reshape(LoggerWindow *lw) {
|
||||
loggerwindow_setup_window_gl(lw);
|
||||
}
|
||||
|
||||
static void loggerwindow_do_draw(LoggerWindow *lw) {
|
||||
static void loggerwindow_do_draw(LoggerWindow *lw)
|
||||
{
|
||||
int i, ndisplines, startline;
|
||||
int sb_rect[2][2], sb_thumb[2][2];
|
||||
|
||||
@ -472,7 +487,8 @@ static void loggerwindow_do_draw(LoggerWindow *lw) {
|
||||
GHOST_SwapWindowBuffers(lw->win);
|
||||
}
|
||||
|
||||
static void loggerwindow_do_move(LoggerWindow *lw, int x, int y) {
|
||||
static void loggerwindow_do_move(LoggerWindow *lw, int x, int y)
|
||||
{
|
||||
lw->lmouse[0] = x, lw->lmouse[1] = y;
|
||||
|
||||
if (scrollbar_is_scrolling(lw->scroll)) {
|
||||
@ -481,7 +497,8 @@ static void loggerwindow_do_move(LoggerWindow *lw, int x, int y) {
|
||||
}
|
||||
}
|
||||
|
||||
static void loggerwindow_do_button(LoggerWindow *lw, int which, int press) {
|
||||
static void loggerwindow_do_button(LoggerWindow *lw, int which, int press)
|
||||
{
|
||||
if (which == GHOST_kButtonMaskLeft) {
|
||||
lw->lmbut[0] = press;
|
||||
|
||||
@ -508,7 +525,8 @@ static void loggerwindow_do_button(LoggerWindow *lw, int which, int press) {
|
||||
}
|
||||
}
|
||||
|
||||
static void loggerwindow_do_key(LoggerWindow *lw, GHOST_TKey key, int press) {
|
||||
static void loggerwindow_do_key(LoggerWindow *lw, GHOST_TKey key, int press)
|
||||
{
|
||||
switch (key) {
|
||||
case GHOST_kKeyQ:
|
||||
if (press)
|
||||
@ -517,7 +535,8 @@ static void loggerwindow_do_key(LoggerWindow *lw, GHOST_TKey key, int press) {
|
||||
}
|
||||
}
|
||||
|
||||
static void loggerwindow_handle(void *priv, GHOST_EventHandle evt) {
|
||||
static void loggerwindow_handle(void *priv, GHOST_EventHandle evt)
|
||||
{
|
||||
LoggerWindow *lw = priv;
|
||||
GHOST_TEventType type = GHOST_GetEventType(evt);
|
||||
|
||||
@ -597,7 +616,8 @@ LoggerWindow *loggerwindow_new(MultiTestApp *app) {
|
||||
}
|
||||
}
|
||||
|
||||
void loggerwindow_log(LoggerWindow *lw, char *line) {
|
||||
void loggerwindow_log(LoggerWindow *lw, char *line)
|
||||
{
|
||||
if (lw->nloglines == lw->logsize) {
|
||||
lw->loglines = memdbl(lw->loglines, &lw->logsize, sizeof(*lw->loglines));
|
||||
}
|
||||
@ -608,7 +628,8 @@ void loggerwindow_log(LoggerWindow *lw, char *line) {
|
||||
GHOST_InvalidateWindow(lw->win);
|
||||
}
|
||||
|
||||
void loggerwindow_free(LoggerWindow *lw) {
|
||||
void loggerwindow_free(LoggerWindow *lw)
|
||||
{
|
||||
GHOST_SystemHandle sys = multitestapp_get_system(lw->app);
|
||||
int i;
|
||||
|
||||
@ -635,7 +656,8 @@ typedef struct {
|
||||
int size[2];
|
||||
} ExtraWindow;
|
||||
|
||||
static void extrawindow_do_draw(ExtraWindow *ew) {
|
||||
static void extrawindow_do_draw(ExtraWindow *ew)
|
||||
{
|
||||
GHOST_ActivateWindowDrawingContext(ew->win);
|
||||
|
||||
glClearColor(1, 1, 1, 1);
|
||||
@ -647,7 +669,8 @@ static void extrawindow_do_draw(ExtraWindow *ew) {
|
||||
GHOST_SwapWindowBuffers(ew->win);
|
||||
}
|
||||
|
||||
static void extrawindow_do_reshape(ExtraWindow *ew) {
|
||||
static void extrawindow_do_reshape(ExtraWindow *ew)
|
||||
{
|
||||
GHOST_RectangleHandle bounds = GHOST_GetClientBounds(ew->win);
|
||||
|
||||
GHOST_ActivateWindowDrawingContext(ew->win);
|
||||
@ -666,7 +689,8 @@ static void extrawindow_do_reshape(ExtraWindow *ew) {
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
static void extrawindow_do_key(ExtraWindow *ew, GHOST_TKey key, int press) {
|
||||
static void extrawindow_do_key(ExtraWindow *ew, GHOST_TKey key, int press)
|
||||
{
|
||||
switch (key) {
|
||||
case GHOST_kKeyE:
|
||||
if (press)
|
||||
@ -675,7 +699,8 @@ static void extrawindow_do_key(ExtraWindow *ew, GHOST_TKey key, int press) {
|
||||
}
|
||||
}
|
||||
|
||||
static void extrawindow_spin_cursor(ExtraWindow *ew, GHOST_TUns64 time) {
|
||||
static void extrawindow_spin_cursor(ExtraWindow *ew, GHOST_TUns64 time)
|
||||
{
|
||||
GHOST_TUns8 bitmap[16][2];
|
||||
GHOST_TUns8 mask[16][2];
|
||||
double ftime = (double) ((GHOST_TInt64) time) / 1000;
|
||||
@ -707,7 +732,8 @@ static void extrawindow_spin_cursor(ExtraWindow *ew, GHOST_TUns64 time) {
|
||||
GHOST_SetCustomCursorShape(ew->win, bitmap, mask, 0, 0);
|
||||
}
|
||||
|
||||
static void extrawindow_handle(void *priv, GHOST_EventHandle evt) {
|
||||
static void extrawindow_handle(void *priv, GHOST_EventHandle evt)
|
||||
{
|
||||
ExtraWindow *ew = priv;
|
||||
GHOST_TEventType type = GHOST_GetEventType(evt);
|
||||
char buf[256];
|
||||
@ -764,7 +790,8 @@ ExtraWindow *extrawindow_new(MultiTestApp *app) {
|
||||
}
|
||||
}
|
||||
|
||||
void extrawindow_free(ExtraWindow *ew) {
|
||||
void extrawindow_free(ExtraWindow *ew)
|
||||
{
|
||||
GHOST_SystemHandle sys = multitestapp_get_system(ew->app);
|
||||
|
||||
windowdata_free(GHOST_GetWindowUserData(ew->win));
|
||||
@ -785,7 +812,8 @@ struct _MultiTestApp {
|
||||
int exit;
|
||||
};
|
||||
|
||||
static int multitest_event_handler(GHOST_EventHandle evt, GHOST_TUserDataPtr data) {
|
||||
static int multitest_event_handler(GHOST_EventHandle evt, GHOST_TUserDataPtr data)
|
||||
{
|
||||
MultiTestApp *app = data;
|
||||
GHOST_WindowHandle win;
|
||||
|
||||
@ -855,12 +883,14 @@ GHOST_SystemHandle multitestapp_get_system(MultiTestApp *app) {
|
||||
return app->sys;
|
||||
}
|
||||
|
||||
void multitestapp_free_extrawindow(MultiTestApp *app) {
|
||||
void multitestapp_free_extrawindow(MultiTestApp *app)
|
||||
{
|
||||
extrawindow_free(app->extra);
|
||||
app->extra = NULL;
|
||||
}
|
||||
|
||||
void multitestapp_toggle_extra_window(MultiTestApp *app) {
|
||||
void multitestapp_toggle_extra_window(MultiTestApp *app)
|
||||
{
|
||||
if (app->extra) {
|
||||
multitestapp_free_extrawindow(app);
|
||||
}
|
||||
@ -869,18 +899,21 @@ void multitestapp_toggle_extra_window(MultiTestApp *app) {
|
||||
}
|
||||
}
|
||||
|
||||
void multitestapp_exit(MultiTestApp *app) {
|
||||
void multitestapp_exit(MultiTestApp *app)
|
||||
{
|
||||
app->exit = 1;
|
||||
}
|
||||
|
||||
void multitestapp_run(MultiTestApp *app) {
|
||||
void multitestapp_run(MultiTestApp *app)
|
||||
{
|
||||
while (!app->exit) {
|
||||
GHOST_ProcessEvents(app->sys, 1);
|
||||
GHOST_DispatchEvents(app->sys);
|
||||
}
|
||||
}
|
||||
|
||||
void multitestapp_free(MultiTestApp *app) {
|
||||
void multitestapp_free(MultiTestApp *app)
|
||||
{
|
||||
mainwindow_free(app->main);
|
||||
loggerwindow_free(app->logger);
|
||||
GHOST_DisposeSystem(app->sys);
|
||||
@ -889,7 +922,8 @@ void multitestapp_free(MultiTestApp *app) {
|
||||
|
||||
/***/
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifndef USE_BMF
|
||||
BLF_init(11, 72);
|
||||
#endif
|
||||
|
@ -96,7 +96,8 @@ int scrollbar_is_scrolling(ScrollBar *sb)
|
||||
{
|
||||
return sb->scrolling;
|
||||
}
|
||||
int scrollbar_contains_pt(ScrollBar *sb, int pt[2]) {
|
||||
int scrollbar_contains_pt(ScrollBar *sb, int pt[2])
|
||||
{
|
||||
return rect_contains_pt(sb->rect, pt);
|
||||
}
|
||||
|
||||
|
@ -545,7 +545,8 @@ static void MEM_printmemlist_internal(int pydict)
|
||||
mem_unlock_thread();
|
||||
}
|
||||
|
||||
void MEM_callbackmemlist(void (*func)(void *)) {
|
||||
void MEM_callbackmemlist(void (*func)(void *))
|
||||
{
|
||||
MemHead *membl;
|
||||
|
||||
mem_lock_thread();
|
||||
@ -563,7 +564,8 @@ void MEM_callbackmemlist(void (*func)(void *)) {
|
||||
mem_unlock_thread();
|
||||
}
|
||||
|
||||
short MEM_testN(void *vmemh) {
|
||||
short MEM_testN(void *vmemh)
|
||||
{
|
||||
MemHead *membl;
|
||||
|
||||
mem_lock_thread();
|
||||
@ -588,10 +590,12 @@ short MEM_testN(void *vmemh) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MEM_printmemlist(void) {
|
||||
void MEM_printmemlist(void)
|
||||
{
|
||||
MEM_printmemlist_internal(0);
|
||||
}
|
||||
void MEM_printmemlist_pydict(void) {
|
||||
void MEM_printmemlist_pydict(void)
|
||||
{
|
||||
MEM_printmemlist_internal(1);
|
||||
}
|
||||
|
||||
|
@ -201,6 +201,9 @@ public:
|
||||
//! Adds a vector from the Vector object itself
|
||||
inline Vector& operator +=(const Vector& arg);
|
||||
|
||||
//! Multiply by a scalar
|
||||
inline Vector& operator *=(double arg);
|
||||
|
||||
//! Scalar multiplication is defined
|
||||
inline friend Vector operator*(const Vector& lhs,double rhs);
|
||||
//! Scalar multiplication is defined
|
||||
|
@ -143,6 +143,14 @@ Vector& Vector::operator -=(const Vector & arg)
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector& Vector::operator *=(double arg)
|
||||
{
|
||||
data[0] *= arg;
|
||||
data[1] *= arg;
|
||||
data[2] *= arg;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector Vector::Zero()
|
||||
{
|
||||
return Vector(0,0,0);
|
||||
|
@ -46,8 +46,8 @@ namespace KDL {
|
||||
class Segment {
|
||||
friend class Chain;
|
||||
private:
|
||||
Joint joint;
|
||||
Inertia M;
|
||||
Joint joint;
|
||||
Frame f_tip;
|
||||
|
||||
public:
|
||||
|
@ -29,15 +29,18 @@ using namespace std;
|
||||
|
||||
Tree::Tree() :
|
||||
nrOfJoints(0), nrOfSegments(0) {
|
||||
segments.insert(make_pair("root", TreeElement::Root()));
|
||||
TreeElement root;
|
||||
std::pair<std::string, TreeElement> val("root", root);
|
||||
segments.insert(val);
|
||||
}
|
||||
|
||||
Tree::Tree(const Tree& in) {
|
||||
segments.clear();
|
||||
nrOfSegments = 0;
|
||||
nrOfJoints = 0;
|
||||
|
||||
segments.insert(make_pair("root", TreeElement::Root()));
|
||||
TreeElement root;
|
||||
std::pair<std::string, TreeElement> val("root", root);
|
||||
segments.insert(val);
|
||||
this->addTree(in, "", "root");
|
||||
|
||||
}
|
||||
@ -46,8 +49,9 @@ Tree& Tree::operator=(const Tree& in) {
|
||||
segments.clear();
|
||||
nrOfSegments = 0;
|
||||
nrOfJoints = 0;
|
||||
|
||||
segments.insert(make_pair("root", TreeElement::Root()));
|
||||
TreeElement root;
|
||||
std::pair<std::string, TreeElement> val("root", root);
|
||||
segments.insert(val);
|
||||
this->addTree(in, "", "root");
|
||||
return *this;
|
||||
}
|
||||
@ -60,8 +64,10 @@ bool Tree::addSegment(const Segment& segment, const std::string& segment_name,
|
||||
return false;
|
||||
pair<SegmentMap::iterator, bool> retval;
|
||||
//insert new element
|
||||
retval = segments.insert(make_pair(segment_name, TreeElement(segment,
|
||||
parent, nrOfJoints)));
|
||||
TreeElement elem(segment, parent, nrOfJoints);
|
||||
std::pair<std::string, TreeElement> val(segment_name, elem);
|
||||
|
||||
retval = segments.insert(val);
|
||||
//check if insertion succeeded
|
||||
if (!retval.second)
|
||||
return false;
|
||||
|
@ -43,7 +43,7 @@ namespace KDL
|
||||
#endif
|
||||
class TreeElement
|
||||
{
|
||||
private:
|
||||
public:
|
||||
TreeElement():q_nr(0)
|
||||
{};
|
||||
public:
|
||||
|
@ -153,9 +153,13 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res, int zBegin, int zEnd)
|
||||
index = x + y * res[0];
|
||||
field[index] = field[index + 2 * slabSize];
|
||||
/* only allow outwards flux */
|
||||
if(field[index]>0.) field[index] = 0.;
|
||||
index += slabSize;
|
||||
if(field[index]>0.) field[index] = 0.;
|
||||
|
||||
// DG: Disable this for z-axis.
|
||||
// The problem is that smoke somehow gets sucked in again
|
||||
// from the TOP slab when this is enabled
|
||||
// if(field[index]>0.) field[index] = 0.;
|
||||
// index += slabSize;
|
||||
// if(field[index]>0.) field[index] = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ int conv_utf_16_to_8(const wchar_t *in16, char *out8, size_t size8)
|
||||
else if (u < 0xD800 || u >= 0xE000) {
|
||||
if (out8 + 2 >= out8end) break;
|
||||
*out8++ = (0x7 << 5) | (0xF & (u >> 12));
|
||||
*out8++ = (0x1 << 7) | (0x3F & (u >> 6));;
|
||||
*out8++ = (0x1 << 7) | (0x3F & (u >> 6));
|
||||
*out8 = (0x1 << 7) | (0x3F & (u));
|
||||
}
|
||||
else if (u < 0xDC00) {
|
||||
|
@ -1,36 +0,0 @@
|
||||
# ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
all: textures sequences
|
||||
|
||||
textures:
|
||||
$(MAKE) -C texture
|
||||
|
||||
sequences:
|
||||
$(MAKE) -C sequence
|
||||
|
||||
clean:
|
||||
$(MAKE) -C texture clean
|
||||
$(MAKE) -C sequence clean
|
@ -1,141 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# detect the system
|
||||
|
||||
UNAME=`uname`
|
||||
EXT="so";
|
||||
if ( test "WIN32" = "$TARGET" ) then
|
||||
CC="gcc";
|
||||
CFLAGS="-funsigned-char -O2";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-Bshareable -lm";
|
||||
elif ( test $UNAME = "IRIX64" -o $UNAME = "IRIX" ) then
|
||||
CC="cc";
|
||||
CFLAGS="-KPIC -O2 -mips3";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-shared -U";
|
||||
elif ( test $UNAME = "FreeBSD" ) then
|
||||
CC="gcc";
|
||||
CFLAGS="-fPIC -funsigned-char -O2";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-Bshareable";
|
||||
elif ( test $UNAME = "OpenBSD" ) then
|
||||
CC="gcc";
|
||||
CFLAGS="-fPIC -funsigned-char -O2";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-Bshareable";
|
||||
elif ( test $UNAME = "Linux" ) then
|
||||
CC="gcc";
|
||||
CFLAGS="-fPIC -funsigned-char -O2";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-Bshareable";
|
||||
elif ( test $UNAME = "SunOS" ) then
|
||||
CC="cc";
|
||||
CFLAGS="-O";
|
||||
|
||||
LD="ld";
|
||||
LDFLAGS="-r";
|
||||
elif ( test $UNAME = "Darwin" ) then
|
||||
CC="cc";
|
||||
CFLAGS="-fPIC -funsigned-char -O2 -fno-common";
|
||||
LD="cc";
|
||||
LDFLAGS="-flat_namespace -bundle -bundle_loader ../../blender.app/Contents/MacOS/blender -lm";
|
||||
EXT="so";
|
||||
fi
|
||||
|
||||
if ( test "$#" = "1" ) then
|
||||
if ( test -f $1 ) then
|
||||
BASE_FILE=`echo $1 | sed -e "1 s/\.c//g"`;
|
||||
else
|
||||
BASE_FILE=$1;
|
||||
fi
|
||||
|
||||
CFILE="$BASE_FILE.c"
|
||||
OFILE="$BASE_FILE.o"
|
||||
SOFILE="$BASE_FILE.$EXT"
|
||||
else
|
||||
if ( test -f $1$2 ) then
|
||||
BASE_FILE=`echo $2 | sed -e "1 s/\.c//g"`;
|
||||
else
|
||||
BASE_FILE=$2;
|
||||
fi
|
||||
|
||||
CFILE="$1$BASE_FILE.c"
|
||||
if (test "$TARGET" = "WIN32" ) then
|
||||
DLLFILE="$BASE_FILE.dll";
|
||||
fi
|
||||
OFILE="$BASE_FILE.o"
|
||||
SOFILE="$BASE_FILE.$EXT"
|
||||
fi
|
||||
|
||||
INCLUDES=
|
||||
if ( test -f plugin.h ) then
|
||||
INCLUDES=-I.;
|
||||
elif ( test -f "include/plugin.h" ) then
|
||||
INCLUDES=-Iinclude/
|
||||
elif ( test -f "../plugin.h" ) then
|
||||
INCLUDES=-I..;
|
||||
elif ( test -f "../include/plugin.h" ) then
|
||||
INCLUDES=-I../include
|
||||
else
|
||||
echo "Couldn't find plugin.h";
|
||||
exit;
|
||||
fi
|
||||
|
||||
LIBM=`fgrep "#include <math.h>" $CFILE`
|
||||
LIBC=`fgrep "#include <std" $CFILE`
|
||||
|
||||
LIBS=
|
||||
|
||||
if ( test -n "$LIBM" ) then
|
||||
LIBS="$LIBS -lm";
|
||||
fi
|
||||
if ( test -n "$LIBC" ) then
|
||||
LIBS="$LIBS -lc";
|
||||
fi
|
||||
|
||||
echo "$CC $CFLAGS -c $CFILE $INCLUDES"
|
||||
$CC $CFLAGS -c $CFILE $INCLUDES
|
||||
|
||||
if ( test "$?" != "0") then
|
||||
echo "Compile error";
|
||||
exit;
|
||||
fi
|
||||
|
||||
echo "$LD $LDFLAGS $OFILE -o $SOFILE $LIBS"
|
||||
$LD $LDFLAGS $OFILE -o $SOFILE $LIBS
|
||||
|
||||
if ( test "$?" != "0") then
|
||||
echo "Link error";
|
||||
exit;
|
||||
fi
|
@ -1,32 +0,0 @@
|
||||
# ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
all: plugins
|
||||
|
||||
plugins:
|
||||
@/bin/sh -c 'for i in *.c; do ../bmake $$i; done;'
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.so
|
@ -1,284 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "plugin.h"
|
||||
|
||||
/* ******************** GLOBAL VARIABLES ***************** */
|
||||
|
||||
|
||||
char name[24] = "Blur";
|
||||
|
||||
/* structure for buttons,
|
||||
* butcode name default min max 0
|
||||
*/
|
||||
|
||||
VarStruct varstr[] = {
|
||||
LABEL, "Input: 1 strip", 0.0, 0.0, 0.0, "",
|
||||
NUMSLI | FLO, "Blur", 0.5, 0.0, 10.0, "Maximum filtersize",
|
||||
NUMSLI | FLO, "Gamma", 1.0, 0.4, 2.0, "Gamma correction",
|
||||
TOG | INT, "Animated", 0.0, 0.0, 1.0, "For (Ipo) animated blur",
|
||||
NUM | INT, "debug", 0.0, 0.0, 2.0,
|
||||
"0:off 1: show primary blur buffer 2: show 2nd blur buffer",
|
||||
|
||||
};
|
||||
|
||||
/* The cast struct is for input in the main doit function
|
||||
Varstr and Cast must have the same variables in the same order */
|
||||
|
||||
typedef struct Cast {
|
||||
int dummy; /* because of the 'label' button */
|
||||
float blur;
|
||||
float gamma;
|
||||
float use_ipo;
|
||||
int show;
|
||||
} Cast;
|
||||
|
||||
|
||||
/* cfra: the current frame */
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
/* ******************** Fixed functions ***************** */
|
||||
|
||||
int plugin_seq_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name = name;
|
||||
info->nvars = sizeof(varstr) / sizeof(VarStruct);
|
||||
info->cfra = &cfra;
|
||||
|
||||
info->varstr = varstr;
|
||||
|
||||
info->init = plugin_init;
|
||||
info->seq_doit = (SeqDoit) plugin_seq_doit;
|
||||
info->callback = plugin_but_changed;
|
||||
}
|
||||
|
||||
|
||||
void blurbuf(struct ImBuf *ibuf, int nr, Cast *cast)
|
||||
{
|
||||
/* nr = number of blurs */
|
||||
/* the ibuf->rect is replaced */
|
||||
struct ImBuf *tbuf, *ttbuf;
|
||||
int i, x4;
|
||||
|
||||
tbuf = dupImBuf(ibuf);
|
||||
x4 = ibuf->x / 4;
|
||||
|
||||
/* This doesn't seem to work... paprmh */
|
||||
if (cast->gamma != 1.0) gamwarp(tbuf, cast->gamma);
|
||||
|
||||
/* reduce */
|
||||
for (i = 0; i < nr; i++) {
|
||||
ttbuf = onehalf(tbuf);
|
||||
if (ttbuf) {
|
||||
freeImBuf(tbuf);
|
||||
tbuf = ttbuf;
|
||||
}
|
||||
if (tbuf->x < 4 || tbuf->y < 4) break;
|
||||
}
|
||||
|
||||
/* enlarge */
|
||||
for (i = 0; i < nr; i++) {
|
||||
ttbuf = double_x(tbuf);
|
||||
if (ttbuf) {
|
||||
freeImBuf(tbuf);
|
||||
tbuf = ttbuf;
|
||||
}
|
||||
ttbuf = double_y(tbuf);
|
||||
if (ttbuf) {
|
||||
freeImBuf(tbuf);
|
||||
tbuf = ttbuf;
|
||||
}
|
||||
if (tbuf->x > x4) {
|
||||
scaleImBuf(tbuf, ibuf->x, ibuf->y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* this doesn't seem to work...paprmh*/
|
||||
if (cast->gamma != 1.0) gamwarp(tbuf, 1.0 / cast->gamma);
|
||||
|
||||
if (ibuf->rect) memcpy(ibuf->rect, tbuf->rect, 4 * ibuf->x * ibuf->y);
|
||||
|
||||
if (ibuf->rect_float)
|
||||
memcpy(ibuf->rect_float, tbuf->rect_float, 4 * ibuf->x * ibuf->y * sizeof(float));
|
||||
|
||||
freeImBuf(tbuf);
|
||||
|
||||
}
|
||||
|
||||
void doblur(struct ImBuf *mbuf, float fac, Cast *cast)
|
||||
{
|
||||
/* make two filtered images, like a mipmap structure
|
||||
* fac is filtersize in pixels
|
||||
*/
|
||||
struct ImBuf *ibuf, *pbuf;
|
||||
float ifac, pfac, infac;
|
||||
int n, b1, b2;
|
||||
char *irect, *prect, *mrect;
|
||||
float *irectf, *prectf, *mrectf;
|
||||
|
||||
/* which buffers ? */
|
||||
|
||||
if (fac > 7.0) fac = 7.0;
|
||||
if (fac <= 1.0) return;
|
||||
|
||||
pfac = 2.0;
|
||||
pbuf = dupImBuf(mbuf);
|
||||
n = 1;
|
||||
while (pfac < fac) {
|
||||
blurbuf(pbuf, n, cast);
|
||||
blurbuf(pbuf, n, cast);
|
||||
|
||||
n++;
|
||||
pfac += 1.0;
|
||||
}
|
||||
|
||||
ifac = pfac;
|
||||
pfac -= 1.0;
|
||||
|
||||
ibuf = dupImBuf(pbuf);
|
||||
blurbuf(ibuf, n, cast);
|
||||
blurbuf(ibuf, n, cast);
|
||||
|
||||
fac = (fac - pfac) / (ifac - pfac);
|
||||
n = mbuf->x * mbuf->y;
|
||||
|
||||
if (cast->show) fac = cast->show - 1;
|
||||
|
||||
if (mbuf->rect_float) {
|
||||
if (fac >= 1) {
|
||||
memcpy(mbuf->rect_float, ibuf->rect_float, 4 * n * sizeof(float));
|
||||
}
|
||||
else if (fac <= 0) {
|
||||
memcpy(mbuf->rect_float, pbuf->rect_float, 4 * n * sizeof(float));
|
||||
}
|
||||
else { /* interpolate */
|
||||
infac = 1 - fac;
|
||||
|
||||
irectf = (float *)ibuf->rect_float;
|
||||
prectf = (float *)pbuf->rect_float;
|
||||
mrectf = (float *)mbuf->rect_float;
|
||||
while (n--) {
|
||||
mrectf[0] = irectf[0] * fac + prectf[0] * infac;
|
||||
mrectf[1] = irectf[1] * fac + prectf[1] * infac;
|
||||
mrectf[2] = irectf[2] * fac + prectf[2] * infac;
|
||||
mrectf[3] = irectf[3] * fac + prectf[3] * infac;
|
||||
mrectf += 4;
|
||||
irectf += 4;
|
||||
prectf += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mbuf->rect) {
|
||||
b1 = (int)fac * 255.0;
|
||||
if (b1 > 255) b1 = 255;
|
||||
b2 = 255 - b1;
|
||||
|
||||
if (b1 == 255) {
|
||||
memcpy(mbuf->rect, ibuf->rect, 4 * n);
|
||||
}
|
||||
else if (b1 == 0) {
|
||||
memcpy(mbuf->rect, pbuf->rect, 4 * n);
|
||||
}
|
||||
else { /* interpolate */
|
||||
irect = (char *)ibuf->rect;
|
||||
prect = (char *)pbuf->rect;
|
||||
mrect = (char *)mbuf->rect;
|
||||
while (n--) {
|
||||
mrect[0] = (irect[0] * b1 + prect[0] * b2) >> 8;
|
||||
mrect[1] = (irect[1] * b1 + prect[1] * b2) >> 8;
|
||||
mrect[2] = (irect[2] * b1 + prect[2] * b2) >> 8;
|
||||
mrect[3] = (irect[3] * b1 + prect[3] * b2) >> 8;
|
||||
mrect += 4;
|
||||
irect += 4;
|
||||
prect += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
freeImBuf(ibuf);
|
||||
freeImBuf(pbuf);
|
||||
}
|
||||
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int x, int y, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use)
|
||||
{
|
||||
float bfacf0, bfacf1;
|
||||
|
||||
if (cast->use_ipo == 0) {
|
||||
bfacf0 = bfacf1 = cast->blur + 1.0;
|
||||
}
|
||||
else {
|
||||
bfacf0 = (facf0 * 6.0) + 1.0;
|
||||
bfacf1 = (facf1 * 6.0) + 1.0;
|
||||
}
|
||||
|
||||
if (out->rect) memcpy(out->rect, ibuf1->rect, 4 * out->x * out->y);
|
||||
if (out->rect_float) memcpy(out->rect_float, ibuf1->rect_float, 4 * out->x * out->y * sizeof(float));
|
||||
|
||||
/****************I can't get this field code to work... works ok without...paprmh****************/
|
||||
|
||||
|
||||
/* it blurs interlaced, only tested with even fields */
|
||||
|
||||
/* de_interlace(out);*/
|
||||
/* otherwise scaling goes wrong */
|
||||
/* out->flags &= ~IB_fields;*/
|
||||
|
||||
doblur(out, bfacf0, cast); /*fieldA*/
|
||||
|
||||
/* if (out->rect)out->rect += out->x * out->y;
|
||||
if (out->rect_float)out->rect_float += out->x * out->y;
|
||||
|
||||
doblur(out, bfacf1, cast);*/ /*fieldB*/
|
||||
|
||||
/* if (out->rect)out->rect -= out->x * out->y;
|
||||
if (out->rect_float)out->rect_float -= out->x * out->y;
|
||||
out->flags |= IB_fields;
|
||||
|
||||
interlace(out);*/
|
||||
|
||||
}
|
||||
|
@ -1,299 +0,0 @@
|
||||
/*
|
||||
* Color Correction Plugin (YUV Version) 0.01
|
||||
*
|
||||
* Copyright (c) 2005 Peter Schlaile
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
#include <stdio.h>
|
||||
|
||||
char name[] = "Color Correction";
|
||||
|
||||
VarStruct varstr[] = {
|
||||
{ NUMSLI | FLO, "St Y:", 0.0, -1.0, 1.0, "Setup Y"},
|
||||
{ NUMSLI | FLO, "Gn Y:", 1.0, 0.0, 10.0, "Gain Y"},
|
||||
{ NUMSLI | FLO, "Ga Y:", 1.0, 0.0, 10.0, "Gamma Y"},
|
||||
|
||||
{ NUMSLI | FLO, "Lo S:", 1.0, 0.0, 10.0, "Saturation Shadows"},
|
||||
{ NUMSLI | FLO, "Md S:", 1.0, 0.0, 10.0, "Saturation Midtones"},
|
||||
{ NUMSLI | FLO, "Hi S:", 1.0, 0.0, 10.0, "Saturation Highlights"},
|
||||
|
||||
{ NUMSLI | FLO, "MA S:", 1.0, 0.0, 10.0, "Master Saturation"},
|
||||
|
||||
{ NUMSLI | FLO, "Lo T:", 0.25, 0.0, 1.0,
|
||||
"Saturation Shadow Thres"},
|
||||
{ NUMSLI | FLO, "Hi T:", 0.75, 0.0, 1.0,
|
||||
"Saturation Highlights Thres"},
|
||||
{ TOG | INT, "Debug", 0.0, 0.0, 1.0,
|
||||
"Show curves as overlay"},
|
||||
};
|
||||
|
||||
typedef struct Cast {
|
||||
float setup_y;
|
||||
float gain_y;
|
||||
float gamma_y;
|
||||
float sat_shadows;
|
||||
float sat_midtones;
|
||||
float sat_highlights;
|
||||
|
||||
float master_sat;
|
||||
float lo_thres;
|
||||
float hi_thres;
|
||||
int debug;
|
||||
} Cast;
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
int plugin_seq_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
void plugin_but_changed(int but) {}
|
||||
void plugin_init() {}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name = name;
|
||||
info->nvars = sizeof(varstr) / sizeof(VarStruct);
|
||||
info->cfra = &cfra;
|
||||
|
||||
info->varstr = varstr;
|
||||
|
||||
info->init = plugin_init;
|
||||
info->seq_doit = (SeqDoit) plugin_seq_doit;
|
||||
info->callback = plugin_but_changed;
|
||||
}
|
||||
|
||||
static void hsv_to_rgb(double h, double s, double v,
|
||||
double *r, double *g, double *b)
|
||||
{
|
||||
int i;
|
||||
double f, w, q, t;
|
||||
|
||||
if (s == 0.0)
|
||||
s = 0.000001;
|
||||
|
||||
if (h == -1.0)
|
||||
{
|
||||
*r = v;
|
||||
*g = v;
|
||||
*b = v;
|
||||
}
|
||||
else {
|
||||
if (h == 360.0)
|
||||
h = 0.0;
|
||||
h = h / 60.0;
|
||||
i = (int) h;
|
||||
f = h - i;
|
||||
w = v * (1.0 - s);
|
||||
q = v * (1.0 - (s * f));
|
||||
t = v * (1.0 - (s * (1.0 - f)));
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
*r = v;
|
||||
*g = t;
|
||||
*b = w;
|
||||
break;
|
||||
case 1:
|
||||
*r = q;
|
||||
*g = v;
|
||||
*b = w;
|
||||
break;
|
||||
case 2:
|
||||
*r = w;
|
||||
*g = v;
|
||||
*b = t;
|
||||
break;
|
||||
case 3:
|
||||
*r = w;
|
||||
*g = q;
|
||||
*b = v;
|
||||
break;
|
||||
case 4:
|
||||
*r = t;
|
||||
*g = w;
|
||||
*b = v;
|
||||
break;
|
||||
case 5:
|
||||
*r = v;
|
||||
*g = w;
|
||||
*b = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rgb_to_hsv(double r, double g, double b,
|
||||
double *h, double *s, double *v)
|
||||
{
|
||||
double max, min, delta;
|
||||
|
||||
max = r;
|
||||
if (g > max)
|
||||
max = g;
|
||||
if (b > max)
|
||||
max = b;
|
||||
|
||||
min = r;
|
||||
if (g < min)
|
||||
min = g;
|
||||
if (b < min)
|
||||
min = b;
|
||||
|
||||
*v = max;
|
||||
|
||||
if (max != 0.0)
|
||||
*s = (max - min) / max;
|
||||
else
|
||||
*s = 0.0;
|
||||
|
||||
if (*s == 0.0)
|
||||
*h = -1.0;
|
||||
else {
|
||||
delta = max - min;
|
||||
|
||||
if (r == max)
|
||||
*h = (g - b) / delta;
|
||||
else if (g == max)
|
||||
*h = 2.0 + (b - r) / delta;
|
||||
else if (b == max)
|
||||
*h = 4.0 + (r - g) / delta;
|
||||
|
||||
*h = *h * 60.0;
|
||||
|
||||
if (*h < 0.0)
|
||||
*h = *h + 360;
|
||||
}
|
||||
}
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
||||
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use)
|
||||
{
|
||||
char *dest, *src1;
|
||||
int x, y, c;
|
||||
double gamma_table[256];
|
||||
double uv_table[256];
|
||||
float *destf = out->rect_float;
|
||||
float *src1f;
|
||||
|
||||
if (!ibuf1) return;
|
||||
|
||||
dest = (char *) out->rect;
|
||||
src1 = (char *) ibuf1->rect;
|
||||
src1f = ibuf1->rect_float;
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0 * y / 255;
|
||||
v += cast->setup_y;
|
||||
v *= cast->gain_y;
|
||||
v = pow(v, cast->gamma_y);
|
||||
if (v > 1.0) {
|
||||
v = 1.0;
|
||||
}
|
||||
else if (v < 0.0) {
|
||||
v = 0.0;
|
||||
}
|
||||
gamma_table[y] = v * 255;
|
||||
}
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0;
|
||||
v *= cast->master_sat;
|
||||
if (y < cast->lo_thres * 255) {
|
||||
v *= cast->sat_shadows;
|
||||
}
|
||||
else if (y > cast->hi_thres * 255) {
|
||||
v *= cast->sat_highlights;
|
||||
}
|
||||
else {
|
||||
v *= cast->sat_midtones;
|
||||
}
|
||||
uv_table[y] = v;
|
||||
}
|
||||
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
double h, s, v, r, g, b;
|
||||
double fac;
|
||||
|
||||
if (ibuf1->rect_float) rgb_to_hsv(src1f[0], src1f[1],
|
||||
src1f[2], &h, &s, &v);
|
||||
else rgb_to_hsv((double) src1[0] / 255.0,
|
||||
(double) src1[1] / 255.0,
|
||||
(double) src1[2] / 255.0,
|
||||
&h, &s, &v);
|
||||
v = gamma_table[(int) (v * 255.0)] / 255.0;
|
||||
|
||||
fac = uv_table[(int) (255.0 * v)];
|
||||
|
||||
s *= fac;
|
||||
if (s >= 1.0) {
|
||||
s = 1.0;
|
||||
}
|
||||
hsv_to_rgb(h, s, v, &r, &g, &b);
|
||||
|
||||
if (out->rect_float) {
|
||||
destf[0] = r;
|
||||
destf[1] = g;
|
||||
destf[2] = b;
|
||||
destf = destf + 4;
|
||||
src1f += 4;
|
||||
}
|
||||
else {
|
||||
dest[0] = r * 255.0;
|
||||
dest[1] = g * 255.0;
|
||||
dest[2] = b * 255.0;
|
||||
dest += 4;
|
||||
}
|
||||
|
||||
src1 += 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (cast->debug) {
|
||||
dest = (char *) out->rect;
|
||||
for (c = 0; c < 10; c++) {
|
||||
x = 0;
|
||||
for (y = 0; y < 256; y++) {
|
||||
char val = gamma_table[y];
|
||||
while (x < y * width / 255) {
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
dest++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (c = 0; c < 10; c++) {
|
||||
x = 0;
|
||||
for (y = 0; y < 256; y++) {
|
||||
char val = uv_table[y] * 255.0 / 10.0;
|
||||
while (x < y * width / 255) {
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
dest++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,239 +0,0 @@
|
||||
/*
|
||||
* Color Correction Plugin (YUV Version) 0.01
|
||||
*
|
||||
* Copyright (c) 2005 Peter Schlaile
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
#include <stdio.h>
|
||||
|
||||
char name[]= "Color Correction";
|
||||
|
||||
VarStruct varstr[]= {
|
||||
{ NUMSLI|FLO, "St Y:", 0.0, -1.0, 1.0, "Setup Y"},
|
||||
{ NUMSLI|FLO, "Gn Y:", 1.0, 0.0, 10.0,"Gain Y"},
|
||||
{ NUMSLI|FLO, "Ga Y:", 1.0, 0.0, 10.0, "Gamma Y"},
|
||||
|
||||
{ NUMSLI|FLO, "Lo S:", 1.0, 0.0, 10.0,"Saturation Shadows"},
|
||||
{ NUMSLI|FLO, "Md S:", 1.0, 0.0, 10.0,"Saturation Midtones"},
|
||||
{ NUMSLI|FLO, "Hi S:", 1.0, 0.0, 10.0,"Saturation Highlights"},
|
||||
|
||||
{ NUMSLI|FLO, "MA S:", 1.0, 0.0, 10.0,"Master Saturation"},
|
||||
{ NUMSLI|FLO, "Lo T:", 0.25, 0.0, 1.0,
|
||||
"Saturation Shadow Thres"},
|
||||
{ NUMSLI|FLO, "Hi T:", 0.75, 0.0, 1.0,
|
||||
"Saturation Highlights Thres"},
|
||||
{ TOG|INT, "Debug", 0.0, 0.0, 1.0,
|
||||
"Show curves as overlay"},
|
||||
};
|
||||
|
||||
typedef struct Cast {
|
||||
float setup_y;
|
||||
float gain_y;
|
||||
float gamma_y;
|
||||
|
||||
float sat_shadows;
|
||||
float sat_midtones;
|
||||
float sat_highlights;
|
||||
|
||||
float master_sat;
|
||||
float lo_thres;
|
||||
float hi_thres;
|
||||
int debug;
|
||||
} Cast;
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
int plugin_seq_getversion(void) { return B_PLUGIN_VERSION;}
|
||||
void plugin_but_changed(int but) {}
|
||||
void plugin_init() {}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
info->cfra= &cfra;
|
||||
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->seq_doit= (SeqDoit) plugin_seq_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
}
|
||||
|
||||
static void rgb_to_yuv(float rgb[3], float yuv[3])
|
||||
{
|
||||
yuv[0]= 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
|
||||
yuv[1]= 0.492*(rgb[2] - yuv[0]);
|
||||
yuv[2]= 0.877*(rgb[0] - yuv[0]);
|
||||
|
||||
/* Normalize */
|
||||
yuv[1] /= 0.436;
|
||||
yuv[2] /= 0.615;
|
||||
}
|
||||
|
||||
static void yuv_to_rgb(float yuv[3], float rgb[3])
|
||||
{
|
||||
yuv[1] *= 0.436;
|
||||
yuv[2] *= 0.615;
|
||||
|
||||
rgb[0] = yuv[2]/0.877 + yuv[0];
|
||||
rgb[2] = yuv[1]/0.492 + yuv[0];
|
||||
rgb[1] = (yuv[0] - 0.299*rgb[0] - 0.114*rgb[2]) / 0.587;
|
||||
if (rgb[0] > 1.0) {
|
||||
rgb[0] = 1.0;
|
||||
}
|
||||
if (rgb[0] < 0.0) {
|
||||
rgb[0] = 0.0;
|
||||
}
|
||||
if (rgb[1] > 1.0) {
|
||||
rgb[1] = 1.0;
|
||||
}
|
||||
if (rgb[1] < 0.0) {
|
||||
rgb[1] = 0.0;
|
||||
}
|
||||
if (rgb[2] > 1.0) {
|
||||
rgb[2] = 1.0;
|
||||
}
|
||||
if (rgb[2] < 0.0) {
|
||||
rgb[2] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
||||
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use) {
|
||||
char *dest, *src1, *src2;
|
||||
int x, y, c;
|
||||
float rgb[3];
|
||||
float yuv[3];
|
||||
float gamma_table[256];
|
||||
float uv_table[256];
|
||||
float *destf = out->rect_float;
|
||||
float *src1f;
|
||||
|
||||
if (!ibuf1) return;
|
||||
|
||||
dest= (char *) out->rect;
|
||||
src1= (char *) ibuf1->rect;
|
||||
src1f= ibuf1->rect_float;
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0 * y / 255;
|
||||
v += cast->setup_y;
|
||||
v *= cast->gain_y;
|
||||
v = pow(v, cast->gamma_y);
|
||||
if ( v > 1.0) {
|
||||
v = 1.0;
|
||||
} else if (v < 0.0) {
|
||||
v = 0.0;
|
||||
}
|
||||
gamma_table[y] = v * 255;
|
||||
}
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0;
|
||||
v *= cast->master_sat;
|
||||
if (y < cast->lo_thres * 255) {
|
||||
v *= cast->sat_shadows;
|
||||
} else if (y > cast->hi_thres * 255) {
|
||||
v *= cast->sat_highlights;
|
||||
} else {
|
||||
v *= cast->sat_midtones;
|
||||
}
|
||||
uv_table[y] = v;
|
||||
}
|
||||
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
float fac;
|
||||
if (out->rect_float) {
|
||||
rgb[0]= (float)src1f[0]/255.0;
|
||||
rgb[1]= (float)src1f[1]/255.0;
|
||||
rgb[2]= (float)src1f[2]/255.0;
|
||||
} else {
|
||||
rgb[0]= (float)src1[0]/255.0;
|
||||
rgb[1]= (float)src1[1]/255.0;
|
||||
rgb[2]= (float)src1[2]/255.0;
|
||||
}
|
||||
rgb_to_yuv(rgb, yuv);
|
||||
|
||||
yuv[0] = gamma_table[(int) (yuv[0] * 255.0)] / 255.0;
|
||||
fac = uv_table[(int) (255.0 * yuv[0])];
|
||||
|
||||
yuv[1] = yuv[1] * fac;
|
||||
yuv[2] = yuv[2] * fac;
|
||||
if (yuv[1] > 1.0) {
|
||||
yuv[1] = 1.0;
|
||||
}
|
||||
if (yuv[1] < -1.0) {
|
||||
yuv[1] = -1.0;
|
||||
}
|
||||
if (yuv[2] > 1.0) {
|
||||
yuv[2] = 1.0;
|
||||
}
|
||||
if (yuv[2] < -1.0) {
|
||||
yuv[2] = -1.0;
|
||||
}
|
||||
yuv_to_rgb(yuv, rgb);
|
||||
|
||||
if (out->rect_float) {
|
||||
*destf++ = rgb[0];
|
||||
*destf++ = rgb[1];
|
||||
*destf++ = rgb[2];
|
||||
destf++;
|
||||
src1f += 4;
|
||||
} else {
|
||||
*dest++ = rgb[0]*255.0;
|
||||
*dest++ = rgb[1]*255.0;
|
||||
*dest++ = rgb[2]*255.0;
|
||||
dest++;
|
||||
src1 += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cast->debug) {
|
||||
dest= (char *) out->rect;
|
||||
for (c = 0; c < 10; c++) {
|
||||
x = 0;
|
||||
for (y = 0; y < 256; y++) {
|
||||
char val = gamma_table[y];
|
||||
while (x < y * width / 255) {
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
dest++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (c = 0; c < 10; c++) {
|
||||
x = 0;
|
||||
for (y = 0; y < 256; y++) {
|
||||
char val = uv_table[y] * 255.0/10.0;
|
||||
while (x < y * width / 255) {
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
*dest++ = val;
|
||||
dest++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
/*
|
||||
* Dynamic Noise Reduction (based on the VirtualDub filter by Steven Don)
|
||||
*
|
||||
* Copyright (c) 2005 Peter Schlaile
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
#include <stdio.h>
|
||||
|
||||
char name[]= "Dynamic Noise Reduction";
|
||||
|
||||
VarStruct varstr[]= {
|
||||
{ NUMSLI|INT, "Level:", 10.0, 0.0, 15.0, "Level"},
|
||||
};
|
||||
|
||||
typedef struct Cast {
|
||||
int level;
|
||||
} Cast;
|
||||
|
||||
float cfra;
|
||||
void * plugin_private_data;
|
||||
|
||||
struct my_data {
|
||||
unsigned char lookup_table[65536];
|
||||
int last_level;
|
||||
float last_cfra;
|
||||
int last_width;
|
||||
int last_height;
|
||||
unsigned char * last_frame;
|
||||
};
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int,
|
||||
ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
int plugin_seq_getversion(void) { return B_PLUGIN_VERSION;}
|
||||
|
||||
static void precalculate(unsigned char * table, int level)
|
||||
{
|
||||
int ap_, bp;
|
||||
|
||||
for (ap_ = 0; ap_ < 256; ap_++) {
|
||||
for (bp = 0; bp < 256; bp++) {
|
||||
int ap = ap_;
|
||||
int diff = ap - bp;
|
||||
if (diff < 0) {
|
||||
diff = -diff;
|
||||
}
|
||||
if (diff < level) {
|
||||
if (diff > (level >> 1)) {
|
||||
ap = (ap + ap + bp)/3;
|
||||
} else {
|
||||
ap = bp;
|
||||
}
|
||||
}
|
||||
|
||||
*table++ = ap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but) { }
|
||||
void plugin_init() { }
|
||||
|
||||
void * plugin_seq_alloc_private_data()
|
||||
{
|
||||
struct my_data * result = (struct my_data*) calloc(
|
||||
sizeof(struct my_data), 1);
|
||||
result->last_cfra = -1;
|
||||
return result;
|
||||
}
|
||||
|
||||
void plugin_seq_free_private_data(void * data)
|
||||
{
|
||||
struct my_data * d = (struct my_data*) data;
|
||||
if (d->last_frame) {
|
||||
free(d->last_frame);
|
||||
}
|
||||
free(d);
|
||||
}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
info->cfra= &cfra;
|
||||
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->seq_doit= (SeqDoit) plugin_seq_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
}
|
||||
|
||||
static void doit(unsigned char * src_, unsigned char * dst_,
|
||||
unsigned char * table, int width, int height)
|
||||
{
|
||||
int count = width * height;
|
||||
unsigned char * src = src_;
|
||||
unsigned char * dst = dst_;
|
||||
|
||||
while (count--) {
|
||||
*dst = table[(*src++ << 8) | *dst]; dst++;
|
||||
*dst = table[(*src++ << 8) | *dst]; dst++;
|
||||
*dst = table[(*src++ << 8) | *dst]; dst++;
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
||||
memcpy(src_, dst_, width * height * 4);
|
||||
}
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
||||
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use) {
|
||||
|
||||
struct my_data * d = (struct my_data*) plugin_private_data;
|
||||
|
||||
if (!ibuf1) return;
|
||||
|
||||
if (cast->level != d->last_level) {
|
||||
precalculate(d->lookup_table, cast->level);
|
||||
d->last_level = cast->level;
|
||||
}
|
||||
|
||||
if (width != d->last_width || height != d->last_height ||
|
||||
cfra != d->last_cfra + 1)
|
||||
{
|
||||
free(d->last_frame);
|
||||
d->last_frame = (unsigned char*) calloc(width * height, 4);
|
||||
|
||||
d->last_width = width;
|
||||
d->last_height = height;
|
||||
}
|
||||
|
||||
memcpy(out->rect, ibuf1->rect, width * height * 4);
|
||||
|
||||
doit((unsigned char*) out->rect,
|
||||
d->last_frame, d->lookup_table, width, height);
|
||||
|
||||
d->last_cfra = cfra;
|
||||
}
|
@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Gamma Correction Plugin (RGB Version) 0.01
|
||||
*
|
||||
* Copyright (c) 2005 Peter Schlaile
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
#include "util.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define alpha_epsilon 0.0001f
|
||||
char name[]= "Gamma Correction";
|
||||
|
||||
VarStruct varstr[]= {
|
||||
{ NUMSLI|FLO, "St M:", 0.0, -1.0, 1.0, "Setup Main"},
|
||||
{ NUMSLI|FLO, "Gn M:", 1.0, 0.0, 10.0,"Gain Main"},
|
||||
{ NUMSLI|FLO, "Ga M:", 1.0, 0.0, 10.0, "Gamma Main"},
|
||||
|
||||
{ NUMSLI|FLO, "St R:", 0.0, -1.0, 1.0, "Setup Red"},
|
||||
{ NUMSLI|FLO, "Gn R:", 1.0, 0.0, 10.0,"Gain Red"},
|
||||
{ NUMSLI|FLO, "Ga R:", 1.0, 0.0, 10.0, "Gamma Red"},
|
||||
|
||||
{ NUMSLI|FLO, "St G:", 0.0, -1.0, 1.0, "Setup Green"},
|
||||
{ NUMSLI|FLO, "Gn G:", 1.0, 0.0, 10.0,"Gain Green"},
|
||||
{ NUMSLI|FLO, "Ga G:", 1.0, 0.0, 10.0, "Gamma Green"},
|
||||
|
||||
{ NUMSLI|FLO, "St B:", 0.0, -1.0, 1.0, "Setup Blue"},
|
||||
{ NUMSLI|FLO, "Gn B:", 1.0, 0.0, 10.0,"Gain Blue"},
|
||||
{ NUMSLI|FLO, "Ga B:", 1.0, 0.0, 10.0, "Gamma Blue"},
|
||||
};
|
||||
|
||||
typedef struct Cast {
|
||||
float setup_m;
|
||||
float gain_m;
|
||||
float gamma_m;
|
||||
|
||||
float setup_r;
|
||||
float gain_r;
|
||||
float gamma_r;
|
||||
|
||||
float setup_g;
|
||||
float gain_g;
|
||||
float gamma_g;
|
||||
|
||||
float setup_b;
|
||||
float gain_b;
|
||||
float gamma_b;
|
||||
} Cast;
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
int plugin_seq_getversion(void) { return B_PLUGIN_VERSION; }
|
||||
void plugin_but_changed(int but) {}
|
||||
void plugin_init() {}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
info->cfra= &cfra;
|
||||
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->seq_doit= (SeqDoit) plugin_seq_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
}
|
||||
|
||||
static void make_gamma_table(float setup, float gain, float gamma,
|
||||
unsigned char * table)
|
||||
{
|
||||
int y;
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
float v = 1.0 * y / 255;
|
||||
v += setup;
|
||||
v *= gain;
|
||||
v = pow(v, gamma);
|
||||
if ( v > 1.0) {
|
||||
v = 1.0;
|
||||
} else if (v < 0.0) {
|
||||
v = 0.0;
|
||||
}
|
||||
table[y] = v * 255;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int width,
|
||||
int height, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use) {
|
||||
if (!out->rect_float)
|
||||
{
|
||||
unsigned char *dest, *src1, *src2;
|
||||
int x, y, c;
|
||||
unsigned char gamma_table_m[256];
|
||||
unsigned char gamma_table_r[256];
|
||||
unsigned char gamma_table_g[256];
|
||||
unsigned char gamma_table_b[256];
|
||||
|
||||
if (!ibuf1) return;
|
||||
|
||||
dest= (unsigned char *) out->rect;
|
||||
src1= (unsigned char *) ibuf1->rect;
|
||||
|
||||
make_gamma_table(cast->setup_m, cast->gain_m, cast->gamma_m,
|
||||
gamma_table_m);
|
||||
make_gamma_table(cast->setup_r, cast->gain_r, cast->gamma_r,
|
||||
gamma_table_r);
|
||||
make_gamma_table(cast->setup_g, cast->gain_g, cast->gamma_g,
|
||||
gamma_table_g);
|
||||
make_gamma_table(cast->setup_b, cast->gain_b, cast->gamma_b,
|
||||
gamma_table_b);
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
*dest++ = gamma_table_r[gamma_table_m[*src1++]];
|
||||
*dest++ = gamma_table_g[gamma_table_m[*src1++]];
|
||||
*dest++ = gamma_table_b[gamma_table_m[*src1++]];
|
||||
dest++; src1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float *i=ibuf1->rect_float;
|
||||
float *o=out->rect_float;
|
||||
unsigned int size=width*height;
|
||||
unsigned int k;
|
||||
float val_r[3]={cast->setup_r,cast->gain_r,cast->gamma_r};
|
||||
float val_g[3]={cast->setup_g,cast->gain_g,cast->gamma_g};
|
||||
float val_b[3]={cast->setup_b,cast->gain_b,cast->gamma_b};
|
||||
float *vals[3]={val_r,val_g,val_b};
|
||||
for (k=0;k<size;++k)
|
||||
{
|
||||
if (cast->gamma_m!=1.f || cast->setup_m!=0.f || cast->gain_m!=1.f)
|
||||
{
|
||||
float alpha=CLAMP(i[3],0.f,1.f);
|
||||
if (alpha>alpha_epsilon) {
|
||||
int l;
|
||||
for (l=0;l<3;++l)
|
||||
{
|
||||
float *val=vals[l];
|
||||
o[l]=i[l]/alpha;
|
||||
o[l]=pow((o[l]+cast->setup_m)*cast->gain_m,cast->gamma_m);
|
||||
if (val[2]!=1.f || val[0]!=0.f || val[1]!=1.f)
|
||||
{
|
||||
o[l]=pow((o[l]+val[0])*val[1],val[2]);
|
||||
}
|
||||
o[l]*=alpha;
|
||||
o[l]=CLAMP(o[l],0.f,1.f);
|
||||
}
|
||||
} else {
|
||||
o[0]=o[1]=o[2]=0.0;
|
||||
}
|
||||
o[3]=1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int l;
|
||||
for (l=0;l<3;++l)
|
||||
o[l]=CLAMP(i[l],0.f,1.f);
|
||||
o[3]=1.0;
|
||||
}
|
||||
i+=4;
|
||||
o+=4;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,263 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
/* ******************** GLOBAL VARIABLES ***************** */
|
||||
|
||||
|
||||
char name[24] = "scatter";
|
||||
|
||||
/* structure for buttons,
|
||||
* butcode name default min max 0
|
||||
*/
|
||||
|
||||
VarStruct varstr[] = {
|
||||
LABEL, "Input: 1 strip", 0.0, 0.0, 0.0, "",
|
||||
NUM | INT, "seed: ", 1.0, 0.0, 10.0, "Offset in random table",
|
||||
NUMSLI | FLO, "swing: ", 1.0, 0.0, 3.0, "The amplitude, width of the effect",
|
||||
TOG | INT, "wrap", 0.0, 0.0, 1.0, "Cyclic wrap around the left/right edges",
|
||||
NUM | INT, "type: ", 1.0, 0.0, 1.0, "Type 1 is random for each frame",
|
||||
};
|
||||
|
||||
/* The cast struct is for input in the main doit function
|
||||
Varstr and Cast must have the same variables in the same order */
|
||||
|
||||
typedef struct Cast {
|
||||
int dummy; /* because of the 'label' button */
|
||||
int seed;
|
||||
float swing;
|
||||
int wrap;
|
||||
int type;
|
||||
} Cast;
|
||||
|
||||
/* cfra: the current frame */
|
||||
|
||||
float cfra;
|
||||
|
||||
void plugin_seq_doit(Cast *, float, float, int, int, ImBuf *, ImBuf *, ImBuf *, ImBuf *);
|
||||
|
||||
|
||||
/* ******************** Fixed functions ***************** */
|
||||
|
||||
int plugin_seq_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_init()
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name = name;
|
||||
info->nvars = sizeof(varstr) / sizeof(VarStruct);
|
||||
info->cfra = &cfra;
|
||||
|
||||
info->varstr = varstr;
|
||||
|
||||
info->init = plugin_init;
|
||||
info->seq_doit = (SeqDoit) plugin_seq_doit;
|
||||
info->callback = plugin_but_changed;
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************
|
||||
Scatter
|
||||
|
||||
************************************************************ */
|
||||
|
||||
static void rectcpy(ImBuf *dbuf, ImBuf *sbuf,
|
||||
int destx, int desty,
|
||||
int srcx, int srcy, int width, int height)
|
||||
{
|
||||
uint *drect, *srect;
|
||||
float *dfrect, *sfrect;
|
||||
int tmp;
|
||||
|
||||
if (dbuf == 0) return;
|
||||
|
||||
if (destx < 0) {
|
||||
srcx -= destx;
|
||||
width += destx;
|
||||
destx = 0;
|
||||
}
|
||||
if (srcx < 0) {
|
||||
destx -= srcx;
|
||||
width += destx;
|
||||
srcx = 0;
|
||||
}
|
||||
if (desty < 0) {
|
||||
srcy -= desty;
|
||||
height += desty;
|
||||
desty = 0;
|
||||
}
|
||||
if (srcy < 0) {
|
||||
desty -= srcy;
|
||||
height += desty;
|
||||
srcy = 0;
|
||||
}
|
||||
|
||||
if (width > dbuf->x - destx) width = dbuf->x - destx;
|
||||
if (height > dbuf->y - desty) height = dbuf->y - desty;
|
||||
if (sbuf) {
|
||||
if (width > sbuf->x - srcx) width = sbuf->x - srcx;
|
||||
if (height > sbuf->y - srcy) height = sbuf->y - srcy;
|
||||
srect = sbuf->rect;
|
||||
sfrect = sbuf->rect_float;
|
||||
}
|
||||
|
||||
if (width <= 0) return;
|
||||
if (height <= 0) return;
|
||||
|
||||
drect = dbuf->rect;
|
||||
dfrect = dbuf->rect_float;
|
||||
|
||||
tmp = (desty * dbuf->x + destx);
|
||||
|
||||
if (dbuf->rect_float) dfrect += 4 * tmp;
|
||||
else drect += tmp;
|
||||
|
||||
destx = dbuf->x;
|
||||
|
||||
if (sbuf) {
|
||||
tmp = (srcy * sbuf->x + srcx);
|
||||
if (dbuf->rect_float) sfrect += 4 * tmp;
|
||||
else srect += tmp;
|
||||
srcx = sbuf->x;
|
||||
}
|
||||
else {
|
||||
if (dbuf->rect_float) sfrect = dfrect;
|
||||
else srect = drect;
|
||||
srcx = destx;
|
||||
}
|
||||
|
||||
for (; height > 0; height--) {
|
||||
if (dbuf->rect_float) {
|
||||
memcpy(dfrect, sfrect, 4 * width * sizeof(float));
|
||||
dfrect += destx;
|
||||
sfrect += srcx;
|
||||
}
|
||||
else {
|
||||
memcpy(drect, srect, width * sizeof(int));
|
||||
drect += destx;
|
||||
srect += srcx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_out(ImBuf *out, float r, float g, float b, float a)
|
||||
{
|
||||
int tot, x;
|
||||
float *rectf = out->rect_float;
|
||||
unsigned char *rect = (unsigned char *)out->rect;
|
||||
|
||||
tot = out->x * out->y;
|
||||
if (out->rect_float) {
|
||||
for (x = 0; x < tot; x++) {
|
||||
rectf[0] = r;
|
||||
rectf[1] = g;
|
||||
rectf[2] = b;
|
||||
rectf[3] = a;
|
||||
rectf += 4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (x = 0; x < tot; x++) {
|
||||
rect[0] = (int)(r * 255);
|
||||
rect[1] = (int)(g * 255);
|
||||
rect[2] = (int)(b * 255);
|
||||
rect[3] = (int)(a * 255);
|
||||
rect += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void plugin_seq_doit(Cast *cast, float facf0, float facf1, int sx, int sy, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *out, ImBuf *use)
|
||||
{
|
||||
float f1, f2, t1, t2, t3;
|
||||
int x, y, lr;
|
||||
|
||||
/* fill imbuf 'out' with black */
|
||||
fill_out(out, 0, 0, 0, 0);
|
||||
|
||||
|
||||
switch (cast->type) {
|
||||
case 0:
|
||||
srand48(cast->seed);
|
||||
break;
|
||||
case 1:
|
||||
srand48(cast->seed + facf0 * 1000);
|
||||
break;
|
||||
}
|
||||
|
||||
for (y = 0; y < sy; y++) {
|
||||
switch (cast->type) {
|
||||
case 0:
|
||||
if ((y & 1) == 0) {
|
||||
f1 = drand48() - 0.5;
|
||||
f2 = drand48() - 0.5;
|
||||
f1 = cast->swing * f1;
|
||||
f2 = cast->swing * f2;
|
||||
if (cast->wrap) f2 += 1.0;
|
||||
lr = drand48() > 0.5;
|
||||
t1 = facf0;
|
||||
}
|
||||
else t1 = facf1;
|
||||
|
||||
t2 = 1.0 - t1;
|
||||
t3 = 3.0 * (f1 * t1 * t1 * t2 + f2 * t1 * t2 * t2);
|
||||
if (cast->wrap) t3 += t2 * t2 * t2;
|
||||
x = sx * t3;
|
||||
if (lr) x = -x;
|
||||
break;
|
||||
case 1:
|
||||
f1 = drand48() - 0.5;
|
||||
f1 = f1 * cast->swing;
|
||||
if ((y & 1) == 0) f1 *= facf0;
|
||||
else f1 *= facf1;
|
||||
x = f1 * sx;
|
||||
break;
|
||||
}
|
||||
|
||||
rectcpy(out, ibuf1, 0, y, x, y, 32767, 1);
|
||||
if (cast->wrap) {
|
||||
rectcpy(out, ibuf1, 0, y, x + sx, y, 32767, 1);
|
||||
rectcpy(out, ibuf1, 0, y, x + sx + sx, y, 32767, 1);
|
||||
rectcpy(out, ibuf1, 0, y, x - sx, y, 32767, 1);
|
||||
rectcpy(out, ibuf1, 0, y, x - sx - sx, y, 32767, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
# ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
all: plugins
|
||||
|
||||
plugins:
|
||||
@/bin/sh -c 'for i in *.c; do ../bmake $$i; done;'
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.so
|
@ -1,178 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
|
||||
/* ******************** GLOBAL VARIABLES ***************** */
|
||||
|
||||
/* Texture name */
|
||||
|
||||
char name[24]= "Clouds2";
|
||||
|
||||
/* Subtype names must be less than 15 characters */
|
||||
|
||||
#define NR_TYPES 3
|
||||
char stnames[NR_TYPES][16]= {"Intens", "Col", "Bump" };
|
||||
|
||||
/* Structure for buttons,
|
||||
* butcode name default min max 0
|
||||
*/
|
||||
|
||||
VarStruct varstr[]= {
|
||||
{ NUM|FLO, "Offset", -0.5, -20.0, 20.0, ""},
|
||||
{ NUM|INT, "Depth", 8.0, 1.0, 12.0, ""},
|
||||
{ NUM|FLO, "Scale", 2.2, -20.0, 20.0, ""},
|
||||
{ NUM|FLO, "Falloff", 1.0, -20.0, 20.0, ""}
|
||||
};
|
||||
|
||||
/* The cast struct is for input in the main doit function
|
||||
Varstr and Cast must have the same variables in the same order,
|
||||
INCLUDING dummy variables for label fields. */
|
||||
|
||||
typedef struct Cast {
|
||||
float offset;
|
||||
int depth;
|
||||
float txtscale;
|
||||
float falloff;
|
||||
} Cast;
|
||||
|
||||
/* result:
|
||||
Intensity, R, G, B, Alpha, nor.x, nor.y, nor.z
|
||||
*/
|
||||
|
||||
float result[8];
|
||||
|
||||
/* cfra: the current frame */
|
||||
|
||||
float cfra;
|
||||
|
||||
int plugin_tex_doit(int, Cast*, float*, float*, float*, float*);
|
||||
void plugin_instance_init(Cast*);
|
||||
|
||||
/* ******************** Fixed functions ***************** */
|
||||
|
||||
int plugin_tex_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize any data for a particular instance of
|
||||
* the plugin here
|
||||
*/
|
||||
void plugin_instance_init(Cast *cast)
|
||||
{
|
||||
}
|
||||
|
||||
/* this function should not be changed: */
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->stypes= NR_TYPES;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
|
||||
info->snames= stnames[0];
|
||||
info->result= result;
|
||||
info->cfra= &cfra;
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->tex_doit= (TexDoit) plugin_tex_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
info->instance_init= (void (*)(void *)) plugin_instance_init;
|
||||
}
|
||||
|
||||
/* ********************* the texture ******************** */
|
||||
|
||||
|
||||
int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt, float *result)
|
||||
{
|
||||
float val = 0.0;
|
||||
float a = 1.0;
|
||||
float p[3];
|
||||
float tv[3];
|
||||
int i;
|
||||
int res = TEX_INT;
|
||||
|
||||
tv[0]=(texvec[0]+1.0)/2.0;
|
||||
tv[1]=(texvec[1]+1.0)/2.0;
|
||||
tv[2]=(texvec[2]+1.0)/2.0;
|
||||
|
||||
p[0] = cast->txtscale * tv[0];
|
||||
p[1] = cast->txtscale * tv[1];
|
||||
p[2] = cast->txtscale * tv[2];
|
||||
|
||||
for (i=0; i<cast->depth; i++) {
|
||||
val += a * hnoise(1.0, p[0], p[1], p[2]);
|
||||
|
||||
p[0] *= 2.0;
|
||||
p[1] *= 2.0;
|
||||
p[2] *= 2.0;
|
||||
a *= 0.5;
|
||||
}
|
||||
|
||||
/* always return this value */
|
||||
result[0] = CLAMP (val+cast->offset, 0.0, 1.0) * pow (fabs(sqrt(tv[0]*tv[0]+tv[1]*tv[1]+tv[2]*tv[2])), cast->falloff);
|
||||
|
||||
if (stype==1) {
|
||||
/*
|
||||
* this is r, g, b, a:
|
||||
*/
|
||||
result[1]= 0.5*result[0];
|
||||
result[2]= 1.0-val;
|
||||
result[3]= fsqrt(fabs(result[0]));
|
||||
result[4]= 1.0;
|
||||
|
||||
res |= TEX_RGB;
|
||||
}
|
||||
if (stype==2) {
|
||||
/*
|
||||
* This value is the displacement of the actual normal in
|
||||
* the Material calculation.
|
||||
*/
|
||||
result[5]+= val;
|
||||
result[6]+= 1.0-val;
|
||||
result[7]= 0.0;
|
||||
|
||||
res |= TEX_NOR;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -1,177 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "plugin.h"
|
||||
|
||||
/* ******************** GLOBAL VARIABLES ***************** */
|
||||
|
||||
char name[]= "tiles";
|
||||
|
||||
/* Subtype names must be less than 15 characters */
|
||||
|
||||
#define NR_TYPES 2
|
||||
char stnames[NR_TYPES][16]= {"Square", "Deformed"};
|
||||
|
||||
VarStruct varstr[]= {
|
||||
NUM|FLO, "size", 1.0, 0.0, 1.0, "The size of each tile",
|
||||
NUM|FLO, "Noise", 1.0, 0.01, 10.0, ""
|
||||
};
|
||||
|
||||
/* The cast struct is for input in the main doit function
|
||||
Varstr and Cast must have the same variables in the same order */
|
||||
|
||||
typedef struct Cast {
|
||||
float size;
|
||||
float noise;
|
||||
} Cast;
|
||||
|
||||
/* result:
|
||||
Intensity, R, G, B, Alpha, nor.x, nor.y, nor.z
|
||||
*/
|
||||
|
||||
float result[8];
|
||||
|
||||
/* cfra: the current frame */
|
||||
|
||||
float cfra;
|
||||
|
||||
int plugin_tex_doit(int, Cast *, float *, float *, float *, float *);
|
||||
void plugin_instance_init(Cast*);
|
||||
|
||||
/* ******************** Fixed functions ***************** */
|
||||
|
||||
int plugin_tex_getversion(void)
|
||||
{
|
||||
return B_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
void plugin_but_changed(int but)
|
||||
{
|
||||
}
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize any data for a particular instance of
|
||||
* the plugin here
|
||||
*/
|
||||
void plugin_instance_init(Cast *cast)
|
||||
{
|
||||
}
|
||||
|
||||
/* this function should not be changed: */
|
||||
|
||||
void plugin_getinfo(PluginInfo *info)
|
||||
{
|
||||
info->name= name;
|
||||
info->stypes= NR_TYPES;
|
||||
info->nvars= sizeof(varstr)/sizeof(VarStruct);
|
||||
|
||||
info->snames= stnames[0];
|
||||
info->result= result;
|
||||
info->cfra= &cfra;
|
||||
info->varstr= varstr;
|
||||
|
||||
info->init= plugin_init;
|
||||
info->tex_doit= (TexDoit) plugin_tex_doit;
|
||||
info->callback= plugin_but_changed;
|
||||
info->instance_init= (void (*)(void *)) plugin_instance_init;
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************
|
||||
Tiles
|
||||
|
||||
Demonstration of a simple square wave function sampled
|
||||
with anti-aliasing.
|
||||
It is not mipmapped yet...
|
||||
|
||||
************************************************************ */
|
||||
|
||||
|
||||
/* square wave, antialiased, no mipmap! */
|
||||
|
||||
float sample_wave(float freq, float coord, float pixsize)
|
||||
{
|
||||
float fac, frac, retval;
|
||||
int part1, part2;
|
||||
|
||||
if (pixsize > freq) return 0.5;
|
||||
|
||||
pixsize/= freq;
|
||||
|
||||
fac= coord/freq;
|
||||
part1= ffloor(fac);
|
||||
frac= fac - part1;
|
||||
|
||||
if (part1 & 1) retval= 0.0;
|
||||
else retval = 1.0;
|
||||
|
||||
if (pixsize != 0.0) {
|
||||
|
||||
/* is coord+pixsize another value? */
|
||||
|
||||
part2= ffloor(fac + pixsize);
|
||||
if (part1==part2) return retval;
|
||||
|
||||
/* antialias */
|
||||
if (retval == 1.0) retval= (1.0 - frac) / pixsize;
|
||||
else retval= 1.0 - (1.0 - frac) / pixsize;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt, float *result)
|
||||
{
|
||||
float xwave, ywave;
|
||||
|
||||
if (stype==1) {
|
||||
texvec[0]+= hnoise(cast->noise, texvec[0], texvec[1], texvec[2]);
|
||||
texvec[1]+= hnoise(cast->noise, texvec[1], texvec[2], texvec[0]);
|
||||
}
|
||||
|
||||
if (dxt && dyt) {
|
||||
xwave= sample_wave(cast->size, texvec[0], fabs(dxt[0]) + fabs(dyt[0]) );
|
||||
ywave= sample_wave(cast->size, texvec[1], fabs(dxt[1]) + fabs(dyt[1]) );
|
||||
|
||||
if (xwave > ywave) result[0]= xwave-ywave;
|
||||
else result[0]= ywave-xwave;
|
||||
}
|
||||
else {
|
||||
xwave= sample_wave(cast->size, texvec[0], 0.0 );
|
||||
ywave= sample_wave(cast->size, texvec[1], 0.0 );
|
||||
|
||||
if (xwave > ywave) result[0]= xwave-ywave;
|
||||
else result[0]= ywave-xwave;
|
||||
}
|
||||
|
||||
return TEX_INT;
|
||||
}
|
@ -391,6 +391,11 @@ def smpte_from_frame(frame, fps=None, fps_base=None):
|
||||
Returns an SMPTE formatted string from the frame: "HH:MM:SS:FF".
|
||||
|
||||
If *fps* and *fps_base* are not given the current scene is used.
|
||||
|
||||
:arg time: time in seconds.
|
||||
:type time: number or timedelta object
|
||||
:return: the frame.
|
||||
:rtype: float
|
||||
"""
|
||||
|
||||
if fps is None:
|
||||
@ -402,6 +407,56 @@ def smpte_from_frame(frame, fps=None, fps_base=None):
|
||||
return smpte_from_seconds((frame * fps_base) / fps, fps)
|
||||
|
||||
|
||||
def time_from_frame(frame, fps=None, fps_base=None):
|
||||
"""
|
||||
Returns the time from a frame number .
|
||||
|
||||
If *fps* and *fps_base* are not given the current scene is used.
|
||||
|
||||
:arg frame: number.
|
||||
:type frame: the frame number
|
||||
:return: the time in seconds.
|
||||
:rtype: timedate.timedelta
|
||||
"""
|
||||
|
||||
if fps is None:
|
||||
fps = _bpy.context.scene.render.fps
|
||||
|
||||
if fps_base is None:
|
||||
fps_base = _bpy.context.scene.render.fps_base
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
return timedelta((frame * fps_base) / fps)
|
||||
|
||||
|
||||
def time_to_frame(time, fps=None, fps_base=None):
|
||||
"""
|
||||
Returns a float frame number from a time given in seconds or
|
||||
as a timedate.timedelta object.
|
||||
|
||||
If *fps* and *fps_base* are not given the current scene is used.
|
||||
|
||||
:arg time: time in seconds.
|
||||
:type time: number or a timedate.timedelta object
|
||||
:return: the frame.
|
||||
:rtype: float
|
||||
"""
|
||||
|
||||
if fps is None:
|
||||
fps = _bpy.context.scene.render.fps
|
||||
|
||||
if fps_base is None:
|
||||
fps_base = _bpy.context.scene.render.fps_base
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
if isinstance(time, timedelta):
|
||||
time = time.total_seconds()
|
||||
|
||||
return (time / fps_base) * fps
|
||||
|
||||
|
||||
def preset_find(name, preset_path, display_name=False, ext=".py"):
|
||||
if not name:
|
||||
return None
|
||||
|
@ -145,7 +145,7 @@ def _export_properties(prefix, properties, lines=None):
|
||||
return result
|
||||
|
||||
for pname in properties.bl_rna.properties.keys():
|
||||
if pname != "rna_type" and not properties.is_property_hidden(pname):
|
||||
if pname != "rna_type":
|
||||
value = getattr(properties, pname)
|
||||
if isinstance(value, OperatorProperties):
|
||||
_export_properties(prefix + "." + pname, value, lines)
|
||||
|
@ -4,4 +4,5 @@ op = bpy.context.active_operator
|
||||
op.selected = True
|
||||
op.apply_modifiers = True
|
||||
op.include_bone_children = False
|
||||
op.use_object_instantiation = False
|
||||
op.second_life = True
|
||||
|
@ -34,7 +34,7 @@ class SelectPattern(Operator):
|
||||
|
||||
pattern = StringProperty(
|
||||
name="Pattern",
|
||||
description="Name filter using '*' and '?' wildcard chars",
|
||||
description="Name filter using '*', '?' and '[abc]' unix style wildcards",
|
||||
maxlen=64,
|
||||
default="*",
|
||||
)
|
||||
|
@ -799,6 +799,88 @@ class WM_OT_path_open(Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
||||
def _wm_doc_get_id(doc_id, do_url=True, url_prefix=""):
|
||||
id_split = doc_id.split(".")
|
||||
url = rna = None
|
||||
|
||||
if len(id_split) == 1: # rna, class
|
||||
if do_url:
|
||||
url = "%s/bpy.types.%s.html" % (url_prefix, id_split[0])
|
||||
else:
|
||||
rna = "bpy.types.%s" % id_split[0]
|
||||
|
||||
elif len(id_split) == 2: # rna, class.prop
|
||||
class_name, class_prop = id_split
|
||||
|
||||
if hasattr(bpy.types, class_name.upper() + "_OT_" + class_prop):
|
||||
if do_url:
|
||||
url = ("%s/bpy.ops.%s.html#bpy.ops.%s.%s" % (url_prefix, class_name, class_name, class_prop))
|
||||
else:
|
||||
rna = "bpy.ops.%s.%s" % (class_name, class_prop)
|
||||
else:
|
||||
|
||||
# detect if this is a inherited member and use that name instead
|
||||
rna_parent = getattr(bpy.types, class_name).bl_rna
|
||||
rna_prop = rna_parent.properties[class_prop]
|
||||
rna_parent = rna_parent.base
|
||||
while rna_parent and rna_prop == rna_parent.properties.get(class_prop):
|
||||
class_name = rna_parent.identifier
|
||||
rna_parent = rna_parent.base
|
||||
|
||||
if do_url:
|
||||
url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" % (url_prefix, class_name, class_name, class_prop))
|
||||
else:
|
||||
rna = ("bpy.types.%s.%s" % (class_name, class_prop))
|
||||
|
||||
return url if do_url else rna
|
||||
|
||||
|
||||
class WM_OT_doc_view_manual(Operator):
|
||||
'''Load online manual'''
|
||||
bl_idname = "wm.doc_view_manual"
|
||||
bl_label = "View Manual"
|
||||
|
||||
doc_id = doc_id
|
||||
|
||||
@staticmethod
|
||||
def _find_reference(rna_id, url_mapping):
|
||||
print("online manual check for: '%s'... " % rna_id)
|
||||
from fnmatch import fnmatch
|
||||
for pattern, url_suffix in url_mapping:
|
||||
if fnmatch(rna_id, pattern):
|
||||
print(" match found: '%s' --> '%s'" % (pattern, url_suffix))
|
||||
return url_suffix
|
||||
print("match not found")
|
||||
return None
|
||||
|
||||
def execute(self, context):
|
||||
rna_id = _wm_doc_get_id(self.doc_id, do_url=False)
|
||||
if rna_id is None:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
import rna_wiki_reference
|
||||
rna_ref = self._find_reference(rna_id, rna_wiki_reference.url_manual_mapping)
|
||||
|
||||
if rna_ref is None:
|
||||
self.report({'WARNING'}, "No reference available '%s', "
|
||||
"Update info in %r" %
|
||||
(self.doc_id, rna_wiki_reference.__file__))
|
||||
|
||||
import sys
|
||||
del sys.modules["rna_wiki_reference"]
|
||||
|
||||
if rna_ref is None:
|
||||
return {'CANCELLED'}
|
||||
else:
|
||||
url = rna_wiki_reference.url_manual_prefix + rna_ref
|
||||
|
||||
import webbrowser
|
||||
webbrowser.open(url)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_doc_view(Operator):
|
||||
'''Load online reference docs'''
|
||||
bl_idname = "wm.doc_view"
|
||||
@ -812,39 +894,9 @@ class WM_OT_doc_view(Operator):
|
||||
_prefix = ("http://www.blender.org/documentation/blender_python_api_%s" %
|
||||
"_".join(str(v) for v in bpy.app.version))
|
||||
|
||||
def _nested_class_string(self, class_string):
|
||||
ls = []
|
||||
class_obj = getattr(bpy.types, class_string, None).bl_rna
|
||||
while class_obj:
|
||||
ls.insert(0, class_obj)
|
||||
class_obj = class_obj.nested
|
||||
return '.'.join(class_obj.identifier for class_obj in ls)
|
||||
|
||||
def execute(self, context):
|
||||
id_split = self.doc_id.split('.')
|
||||
if len(id_split) == 1: # rna, class
|
||||
url = '%s/bpy.types.%s.html' % (self._prefix, id_split[0])
|
||||
elif len(id_split) == 2: # rna, class.prop
|
||||
class_name, class_prop = id_split
|
||||
|
||||
if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
|
||||
url = ("%s/bpy.ops.%s.html#bpy.ops.%s.%s" %
|
||||
(self._prefix, class_name, class_name, class_prop))
|
||||
else:
|
||||
|
||||
# detect if this is a inherited member and use that name instead
|
||||
rna_parent = getattr(bpy.types, class_name).bl_rna
|
||||
rna_prop = rna_parent.properties[class_prop]
|
||||
rna_parent = rna_parent.base
|
||||
while rna_parent and rna_prop == rna_parent.properties.get(class_prop):
|
||||
class_name = rna_parent.identifier
|
||||
rna_parent = rna_parent.base
|
||||
|
||||
#~ class_name_full = self._nested_class_string(class_name)
|
||||
url = ("%s/bpy.types.%s.html#bpy.types.%s.%s" %
|
||||
(self._prefix, class_name, class_name, class_prop))
|
||||
|
||||
else:
|
||||
url = _wm_doc_get_id(self.doc_id, do_url=True, url_prefix=self._prefix)
|
||||
if url is None:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
import webbrowser
|
||||
|
@ -49,7 +49,12 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
|
||||
|
||||
physics_type = game.physics_type
|
||||
|
||||
if physics_type in {'DYNAMIC', 'RIGID_BODY'}:
|
||||
if physics_type == 'CHARACTER':
|
||||
layout.prop(game, "step_height", slider=True)
|
||||
layout.prop(game, "jump_speed")
|
||||
layout.prop(game, "fall_speed")
|
||||
|
||||
elif physics_type in {'DYNAMIC', 'RIGID_BODY'}:
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
@ -192,7 +197,7 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel):
|
||||
def poll(cls, context):
|
||||
game = context.object.game
|
||||
rd = context.scene.render
|
||||
return (game.physics_type in {'DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC'}) and (rd.engine in cls.COMPAT_ENGINES)
|
||||
return (game.physics_type in {'DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC', 'CHARACTER'}) and (rd.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
game = context.active_object.game
|
||||
@ -616,6 +621,14 @@ class WORLD_PT_game_physics(WorldButtonsPanel, Panel):
|
||||
col.label(text="Logic Steps:")
|
||||
col.prop(gs, "logic_step_max", text="Max")
|
||||
|
||||
col = layout.column()
|
||||
col.label(text="Physics Deactivation:")
|
||||
sub = col.row(align=True)
|
||||
sub.prop(gs, "deactivation_linear_threshold", text="Linear Threshold")
|
||||
sub.prop(gs, "deactivation_angular_threshold", text="Angular Threshold")
|
||||
sub = col.row()
|
||||
sub.prop(gs, "deactivation_time", text="Time")
|
||||
|
||||
col = layout.column()
|
||||
col.prop(gs, "use_occlusion_culling", text="Occlusion Culling")
|
||||
sub = col.column()
|
||||
|
@ -222,7 +222,7 @@ class NODE_PT_quality(bpy.types.Panel):
|
||||
|
||||
layout.prop(tree, "render_quality", text="Render")
|
||||
layout.prop(tree, "edit_quality", text="Edit")
|
||||
layout.prop(tree, "chunksize")
|
||||
layout.prop(tree, "chunk_size")
|
||||
layout.prop(tree, "use_opencl")
|
||||
|
||||
|
||||
|
@ -98,7 +98,6 @@ add_subdirectory(render)
|
||||
add_subdirectory(compositor)
|
||||
add_subdirectory(blenfont)
|
||||
add_subdirectory(blenloader)
|
||||
add_subdirectory(blenpluginapi)
|
||||
add_subdirectory(ikplugin)
|
||||
add_subdirectory(gpu)
|
||||
add_subdirectory(opencl)
|
||||
|
@ -7,7 +7,6 @@ SConscript(['avi/SConscript',
|
||||
'blenkernel/SConscript',
|
||||
'blenlib/SConscript',
|
||||
'blenloader/SConscript',
|
||||
'blenpluginapi/SConscript',
|
||||
'gpu/SConscript',
|
||||
'opencl/SConscript',
|
||||
'editors/SConscript',
|
||||
|
@ -154,7 +154,7 @@ int BLF_load(const char *name)
|
||||
/* check if we already load this font. */
|
||||
i = blf_search(name);
|
||||
if (i >= 0) {
|
||||
/*font= global_font[i];*/ /*UNUSED*/
|
||||
/*font = global_font[i];*/ /*UNUSED*/
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ int BLF_load_mem(const char *name, unsigned char *mem, int mem_size)
|
||||
|
||||
i = blf_search(name);
|
||||
if (i >= 0) {
|
||||
/*font= global_font[i];*/ /*UNUSED*/
|
||||
/*font = global_font[i];*/ /*UNUSED*/
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
|
||||
_g = blf_glyph_add(_font, \
|
||||
FT_Get_Char_Index((_font)->face, _c), _c); \
|
||||
} \
|
||||
} \
|
||||
} (void)0
|
||||
|
||||
|
||||
#define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) \
|
||||
@ -155,7 +155,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
|
||||
_pen_x += delta.x >> 6; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} (void)0
|
||||
|
||||
void blf_font_draw(FontBLF *font, const char *str, unsigned int len)
|
||||
{
|
||||
|
@ -112,6 +112,9 @@ struct bActionGroup *get_active_actiongroup(struct bAction *act);
|
||||
/* Make the given Action Group the active one */
|
||||
void set_active_action_group(struct bAction *act, struct bActionGroup *agrp, short select);
|
||||
|
||||
/* Sync colors used for action/bone group with theme settings */
|
||||
void action_group_colors_sync(struct bActionGroup *grp);
|
||||
|
||||
/* Add a new action group with the given name to the action */
|
||||
struct bActionGroup *action_groups_add_new(struct bAction *act, const char name[]);
|
||||
|
||||
|
@ -42,7 +42,7 @@ extern "C" {
|
||||
* and keep comment above the defines.
|
||||
* Use STRINGIFY() rather than defining with quotes */
|
||||
#define BLENDER_VERSION 263
|
||||
#define BLENDER_SUBVERSION 7
|
||||
#define BLENDER_SUBVERSION 8
|
||||
|
||||
#define BLENDER_MINVERSION 250
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
@ -156,6 +156,10 @@ typedef struct bNodeType {
|
||||
const char *(*labelfunc)(struct bNode *);
|
||||
/// Optional custom resize handle polling.
|
||||
int (*resize_area_func)(struct bNode *node, int x, int y);
|
||||
/// Optional selection area polling.
|
||||
int (*select_area_func)(struct bNode *node, int x, int y);
|
||||
/// Optional tweak area polling (for grabbing).
|
||||
int (*tweak_area_func)(struct bNode *node, int x, int y);
|
||||
|
||||
/// Called when the node is updated in the editor.
|
||||
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node);
|
||||
@ -229,7 +233,7 @@ typedef struct bNodeType {
|
||||
#define NODE_CLASS_CONVERTOR 8
|
||||
#define NODE_CLASS_MATTE 9
|
||||
#define NODE_CLASS_DISTORT 10
|
||||
#define NODE_CLASS_OP_DYNAMIC 11
|
||||
#define NODE_CLASS_OP_DYNAMIC 11 /* deprecated */
|
||||
#define NODE_CLASS_PATTERN 12
|
||||
#define NODE_CLASS_TEXTURE 13
|
||||
#define NODE_CLASS_EXECUTION 14
|
||||
@ -434,8 +438,7 @@ void node_type_compatibility(struct bNodeType *ntype, short compatibility);
|
||||
#define NODE_FORLOOP 3
|
||||
#define NODE_WHILELOOP 4
|
||||
#define NODE_FRAME 5
|
||||
#define NODE_GROUP_MENU 10000
|
||||
#define NODE_DYNAMIC_MENU 20000
|
||||
#define NODE_REROUTE 6
|
||||
|
||||
/* look up a socket on a group node by the internal group socket */
|
||||
struct bNodeSocket *node_group_find_input(struct bNode *gnode, struct bNodeSocket *gsock);
|
||||
@ -451,6 +454,7 @@ int node_group_ungroup(struct bNodeTree *ntree, struct bNode *gnode);
|
||||
|
||||
/* in node_common.c */
|
||||
void register_node_type_frame(struct bNodeTreeType *ttype);
|
||||
void register_node_type_reroute(struct bNodeTreeType *ttype);
|
||||
|
||||
/* ************** SHADER NODES *************** */
|
||||
|
||||
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#ifndef __BKE_PLUGIN_TYPES_H__
|
||||
#define __BKE_PLUGIN_TYPES_H__
|
||||
|
||||
/** \file BKE_plugin_types.h
|
||||
* \ingroup bke
|
||||
* \author nzc
|
||||
*/
|
||||
|
||||
struct ImBuf;
|
||||
|
||||
typedef int (*TexDoitold)(int stype, void *cast, float *texvec, float *dxt, float *dyt);
|
||||
typedef int (*TexDoit)(int stype, void *cast, float *texvec, float *dxt, float *dyt, float *result);
|
||||
typedef void (*SeqDoit)(void *, float, float, int, int,
|
||||
struct ImBuf *, struct ImBuf *,
|
||||
struct ImBuf *, struct ImBuf *);
|
||||
|
||||
typedef struct VarStruct {
|
||||
int type;
|
||||
char name[16];
|
||||
float def, min, max;
|
||||
char tip[80];
|
||||
} VarStruct;
|
||||
|
||||
typedef struct _PluginInfo {
|
||||
char *name;
|
||||
char *snames;
|
||||
|
||||
int stypes;
|
||||
int nvars;
|
||||
VarStruct *varstr;
|
||||
float *result;
|
||||
float *cfra;
|
||||
|
||||
void (*init)(void);
|
||||
void (*callback)(int);
|
||||
void (*tex_doit)(void *);
|
||||
SeqDoit seq_doit;
|
||||
void (*instance_init)(void *);
|
||||
} PluginInfo;
|
||||
|
||||
#endif
|
||||
|
@ -113,9 +113,8 @@ enum {
|
||||
|
||||
struct SeqEffectHandle {
|
||||
/* constructors & destructor */
|
||||
/* init & init_plugin are _only_ called on first creation */
|
||||
/* init is _only_ called on first creation */
|
||||
void (*init)(struct Sequence *seq);
|
||||
void (*init_plugin)(struct Sequence *seq, const char *fname);
|
||||
|
||||
/* number of input strips needed
|
||||
* (called directly after construction) */
|
||||
|
@ -48,7 +48,6 @@ struct Material;
|
||||
struct MTex;
|
||||
struct OceanTex;
|
||||
struct ParticleSettings;
|
||||
struct PluginTex;
|
||||
struct PointDensity;
|
||||
struct Tex;
|
||||
struct TexMapping;
|
||||
@ -60,10 +59,6 @@ struct World;
|
||||
|
||||
|
||||
void BKE_texture_free(struct Tex *t);
|
||||
int test_dlerr(const char *name, const char *symbol);
|
||||
void open_plugin_tex(struct PluginTex *pit);
|
||||
struct PluginTex *add_plugin_tex(char *str);
|
||||
void free_plugin_tex(struct PluginTex *pit);
|
||||
|
||||
void init_colorband(struct ColorBand *coba, int rangetype);
|
||||
struct ColorBand *add_colorband(int rangetype);
|
||||
|
@ -204,7 +204,6 @@ set(SRC
|
||||
BKE_packedFile.h
|
||||
BKE_paint.h
|
||||
BKE_particle.h
|
||||
BKE_plugin_types.h
|
||||
BKE_pointcache.h
|
||||
BKE_property.h
|
||||
BKE_report.h
|
||||
|
@ -275,9 +275,9 @@ static int ccg_edgebase(int level)
|
||||
|
||||
/***/
|
||||
|
||||
#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; }
|
||||
#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; }
|
||||
#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; }
|
||||
#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } (void)0
|
||||
#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; } (void)0
|
||||
#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } (void)0
|
||||
|
||||
/***/
|
||||
|
||||
|
@ -426,7 +426,7 @@ void DM_update_tessface_data(DerivedMesh *dm)
|
||||
|
||||
/* Find out loop indices. */
|
||||
/* XXX Is there a better way to do this? */
|
||||
/* NOTE: This assumes tessface are valid and in sync with loop/poly… Else, most likely, segfault! */
|
||||
/* NOTE: This assumes tessface are valid and in sync with loop/poly... Else, most likely, segfault! */
|
||||
for (i = mp[polyindex[mf_idx]].loopstart, not_done = mf_len; not_done; i++) {
|
||||
MLoop *tml = &ml[i];
|
||||
if (tml->v == mf->v1) {
|
||||
@ -1054,10 +1054,10 @@ static void calc_weightpaint_vert_color(
|
||||
}
|
||||
|
||||
if (make_black) { /* TODO, theme color */
|
||||
r_col[3] = 0;
|
||||
r_col[3] = 255;
|
||||
r_col[2] = 0;
|
||||
r_col[1] = 0;
|
||||
r_col[0] = 255;
|
||||
r_col[0] = 0;
|
||||
}
|
||||
else {
|
||||
CLAMP(input, 0.0f, 1.0f);
|
||||
@ -1651,7 +1651,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
||||
orcodm = create_orco_dm(ob, me, NULL, CD_ORCO);
|
||||
|
||||
nextmask &= ~CD_MASK_ORCO;
|
||||
DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX);
|
||||
DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX |
|
||||
(mti->requiredDataMask ?
|
||||
mti->requiredDataMask(ob, md) : 0));
|
||||
ndm = mti->applyModifier(md, ob, orcodm, app_flags & ~MOD_APPLY_USECACHE);
|
||||
|
||||
if (ndm) {
|
||||
|
@ -252,6 +252,31 @@ void set_active_action_group(bAction *act, bActionGroup *agrp, short select)
|
||||
}
|
||||
}
|
||||
|
||||
/* Sync colors used for action/bone group with theme settings */
|
||||
void action_group_colors_sync(bActionGroup *grp)
|
||||
{
|
||||
/* only do color copying if using a custom color (i.e. not default color) */
|
||||
if (grp->customCol) {
|
||||
if (grp->customCol > 0) {
|
||||
/* copy theme colors on-to group's custom color in case user tries to edit color */
|
||||
bTheme *btheme = U.themes.first;
|
||||
ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)];
|
||||
|
||||
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
|
||||
}
|
||||
else {
|
||||
/* init custom colors with a generic multi-color rgb set, if not initialized already
|
||||
* (for custom color set) */
|
||||
if (grp->cs.solid[0] == 0) {
|
||||
/* define for setting colors in theme below */
|
||||
rgba_char_args_set(grp->cs.solid, 0xff, 0x00, 0x00, 255);
|
||||
rgba_char_args_set(grp->cs.select, 0x81, 0xe6, 0x14, 255);
|
||||
rgba_char_args_set(grp->cs.active, 0x18, 0xb6, 0xe0, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Add a new action group with the given name to the action */
|
||||
bActionGroup *action_groups_add_new(bAction *act, const char name[])
|
||||
{
|
||||
@ -409,10 +434,9 @@ void action_groups_clear_tempflags(bAction *act)
|
||||
|
||||
/* *************** Pose channels *************** */
|
||||
|
||||
/* usually used within a loop, so we got a N^2 slowdown */
|
||||
bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name)
|
||||
{
|
||||
if (ELEM(NULL, pose, name) || (name[0] == 0))
|
||||
if (ELEM(NULL, pose, name) || (name[0] == '\0'))
|
||||
return NULL;
|
||||
|
||||
if (pose->chanhash)
|
||||
|
@ -745,7 +745,7 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u
|
||||
for (id = first; id; id = id->next) { \
|
||||
AnimData *adt = BKE_animdata_from_id(id); \
|
||||
if (adt) func(id, adt, user_data); \
|
||||
}
|
||||
} (void)0
|
||||
|
||||
/* "embedded" nodetree cases (i.e. scene/material/texture->nodetree) */
|
||||
#define ANIMDATA_NODETREE_IDS_CB(first, NtId_Type) \
|
||||
@ -757,7 +757,7 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u
|
||||
if (adt2) func(id, adt2, user_data); \
|
||||
} \
|
||||
if (adt) func(id, adt, user_data); \
|
||||
}
|
||||
} (void)0
|
||||
|
||||
/* nodes */
|
||||
ANIMDATA_IDS_CB(mainptr->nodetree.first);
|
||||
@ -832,7 +832,7 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha
|
||||
for (id = first; id; id = id->next) { \
|
||||
AnimData *adt = BKE_animdata_from_id(id); \
|
||||
BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \
|
||||
}
|
||||
} (void)0
|
||||
|
||||
/* another version of this macro for nodetrees */
|
||||
#define RENAMEFIX_ANIM_NODETREE_IDS(first, NtId_Type) \
|
||||
@ -844,7 +844,7 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha
|
||||
BKE_animdata_fix_paths_rename((ID *)ntp, adt2, ref_id, prefix, oldName, newName, 0, 0, 1); \
|
||||
} \
|
||||
BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \
|
||||
}
|
||||
} (void)0
|
||||
|
||||
/* nodes */
|
||||
RENAMEFIX_ANIM_IDS(mainptr->nodetree.first);
|
||||
@ -1584,7 +1584,7 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N
|
||||
PropertyRNA *prop;
|
||||
PointerRNA new_ptr;
|
||||
char *path = NULL;
|
||||
/* short free_path=0; */
|
||||
/* short free_path = 0; */
|
||||
|
||||
/* sanity checks */
|
||||
if (channels == NULL)
|
||||
@ -1592,7 +1592,7 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N
|
||||
|
||||
/* get RNA pointer+property info from F-Curve for more convenient handling */
|
||||
/* get path, remapped as appropriate to work in its new environment */
|
||||
/* free_path= */ /* UNUSED */ animsys_remap_path(strip->remap, fcu->rna_path, &path);
|
||||
/* free_path = */ /* UNUSED */ animsys_remap_path(strip->remap, fcu->rna_path, &path);
|
||||
|
||||
/* a valid property must be available, and it must be animatable */
|
||||
if (RNA_path_resolve(ptr, path, &new_ptr, &prop) == 0) {
|
||||
@ -2273,7 +2273,8 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
|
||||
AnimData *adt = BKE_animdata_from_id(id); \
|
||||
BKE_animsys_evaluate_animdata(scene, id, adt, ctime, aflag); \
|
||||
} \
|
||||
}
|
||||
} (void)0
|
||||
|
||||
/* another macro for the "embedded" nodetree cases
|
||||
* - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees"
|
||||
* (i.e. scene/material/texture->nodetree) which we need a special exception
|
||||
@ -2291,7 +2292,7 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
|
||||
} \
|
||||
BKE_animsys_evaluate_animdata(scene, id, adt, ctime, aflag); \
|
||||
} \
|
||||
}
|
||||
} (void)0
|
||||
|
||||
/* optimization:
|
||||
* when there are no actions, don't go over database and loop over heaps of datablocks,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user