Merge branch 'master' into blender2.8

This commit is contained in:
2016-10-02 18:53:01 +02:00
42 changed files with 451 additions and 194 deletions

View File

@@ -414,7 +414,7 @@ if(WITH_OPENCOLORIO)
endif()
if(WITH_OPENVDB)
set(BLOSC_LIBRARIES ${LIBDIR}/blosc/lib/libblosc.lib )
set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib)
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
set(OPENVDB ${LIBDIR}/openvdb)

View File

@@ -6,10 +6,10 @@
BASE_DIR="$PWD"
blender_srcdir=$(dirname -- $0)/../..
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
if [ "$blender_version_cycle" = "release" ] ; then
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char

2
extern/cuew/README vendored
View File

@@ -4,7 +4,7 @@ for determining which CUDA functions and extensions extensions are supported
on the target platform.
CUDA core and extension functionality is exposed in a single header file.
GUEW has been tested on a variety of operating systems, including Windows,
CUEW has been tested on a variety of operating systems, including Windows,
Linux, Mac OS X.
LICENSE

View File

@@ -1,5 +1,5 @@
Project: Cuda Wrangler
URL: https://github.com/CudaWrangler/cuew
License: Apache 2.0
Upstream version: e2e0315
Upstream version: 63d2a0f
Local modifications: None

View File

@@ -993,7 +993,7 @@ public:
cuda_assert(cuCtxSynchronize());
if(task.get_cancel()) {
canceled = false;
canceled = true;
break;
}
}

View File

@@ -2346,7 +2346,9 @@ public:
}
}
void path_trace(SplitRenderTile& rtile, int2 max_render_feasible_tile_size)
void path_trace(DeviceTask *task,
SplitRenderTile& rtile,
int2 max_render_feasible_tile_size)
{
/* cast arguments to cl types */
cl_mem d_data = CL_MEM_PTR(const_mem_map["__data"]->device_pointer);
@@ -2739,6 +2741,7 @@ public:
/* Record number of time host intervention has been made */
unsigned int numHostIntervention = 0;
unsigned int numNextPathIterTimes = PathIteration_times;
bool canceled = false;
while(activeRaysAvailable) {
/* Twice the global work size of other kernels for
* ckPathTraceKernel_shadow_blocked_direct_lighting. */
@@ -2757,6 +2760,10 @@ public:
ENQUEUE_SPLIT_KERNEL(direct_lighting, global_size, local_size);
ENQUEUE_SPLIT_KERNEL(shadow_blocked, global_size_shadow_blocked, local_size);
ENQUEUE_SPLIT_KERNEL(next_iteration_setup, global_size, local_size);
if(task->get_cancel()) {
canceled = true;
break;
}
}
/* Read ray-state into Host memory to decide if we should exit
@@ -2794,22 +2801,28 @@ public:
*/
numNextPathIterTimes += PATH_ITER_INC_FACTOR;
}
if(task->get_cancel()) {
canceled = true;
break;
}
}
/* Execute SumALLRadiance kernel to accumulate radiance calculated in
* per_sample_output_buffers into RenderTile's output buffer.
*/
size_t sum_all_radiance_local_size[2] = {16, 16};
size_t sum_all_radiance_global_size[2];
sum_all_radiance_global_size[0] =
(((d_w - 1) / sum_all_radiance_local_size[0]) + 1) *
sum_all_radiance_local_size[0];
sum_all_radiance_global_size[1] =
(((d_h - 1) / sum_all_radiance_local_size[1]) + 1) *
sum_all_radiance_local_size[1];
ENQUEUE_SPLIT_KERNEL(sum_all_radiance,
sum_all_radiance_global_size,
sum_all_radiance_local_size);
if (!canceled) {
size_t sum_all_radiance_local_size[2] = {16, 16};
size_t sum_all_radiance_global_size[2];
sum_all_radiance_global_size[0] =
(((d_w - 1) / sum_all_radiance_local_size[0]) + 1) *
sum_all_radiance_local_size[0];
sum_all_radiance_global_size[1] =
(((d_h - 1) / sum_all_radiance_local_size[1]) + 1) *
sum_all_radiance_local_size[1];
ENQUEUE_SPLIT_KERNEL(sum_all_radiance,
sum_all_radiance_global_size,
sum_all_radiance_local_size);
}
#undef ENQUEUE_SPLIT_KERNEL
#undef GLUE
@@ -3182,7 +3195,8 @@ public:
tile_iter < to_path_trace_render_tiles.size();
++tile_iter)
{
path_trace(to_path_trace_render_tiles[tile_iter],
path_trace(task,
to_path_trace_render_tiles[tile_iter],
max_render_feasible_tile_size);
}
}
@@ -3198,7 +3212,7 @@ public:
/* buffer_rng_state_stride is stride itself. */
SplitRenderTile split_tile(tile);
split_tile.buffer_rng_state_stride = tile.stride;
path_trace(split_tile, max_render_feasible_tile_size);
path_trace(task, split_tile, max_render_feasible_tile_size);
}
tile.sample = tile.start_sample + tile.num_samples;

View File

@@ -1,6 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation
* Modifications Copyright 2011, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,6 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation
* Modifications Copyright 2011, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -12,6 +12,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Aligned nodes intersection SSE code is adopted from Embree,
*/
struct QBVHStackItem {

View File

@@ -1,8 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation,
* and code copyright 2009-2012 Intel Corporation
*
* Modifications Copyright 2011-2014, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,8 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation,
* and code copyright 2009-2012 Intel Corporation
*
* Modifications Copyright 2011-2014, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,8 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation,
* and code copyright 2009-2012 Intel Corporation
*
* Modifications Copyright 2011-2014, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,8 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation,
* and code copyright 2009-2012 Intel Corporation
*
* Modifications Copyright 2011-2014, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,8 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation,
* and code copyright 2009-2012 Intel Corporation
*
* Modifications Copyright 2011-2014, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,6 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation
* Modifications Copyright 2011, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,6 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation
* Modifications Copyright 2011, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,6 +1,5 @@
/*
* Adapted from code Copyright 2009-2010 NVIDIA Corporation
* Modifications Copyright 2011, Blender Foundation.
* Copyright 2011-2013 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -164,6 +164,9 @@ ccl_device float3 svm_math_blackbody_color(float t) {
ccl_device_inline float3 svm_math_gamma_color(float3 color, float gamma)
{
if(gamma == 0.0f)
return make_float3(1.0f, 1.0f, 1.0f);
if(color.x > 0.0f)
color.x = powf(color.x, gamma);
if(color.y > 0.0f)

View File

@@ -89,6 +89,19 @@ void ConstantFolder::make_zero() const
}
}
void ConstantFolder::make_one() const
{
if(output->type() == SocketType::FLOAT) {
make_constant(1.0f);
}
else if(SocketType::is_float3(output->type())) {
make_constant(make_float3(1.0f, 1.0f, 1.0f));
}
else {
assert(0);
}
}
void ConstantFolder::bypass(ShaderOutput *new_output) const
{
assert(new_output);
@@ -321,6 +334,15 @@ void ConstantFolder::fold_math(NodeMath type, bool clamp) const
make_zero();
}
break;
case NODE_MATH_POWER:
/* 1 ^ X == X ^ 0 == 1 */
if(is_one(value1_in) || is_zero(value2_in)) {
make_one();
}
/* X ^ 1 == X */
else if(is_one(value2_in)) {
try_bypass_or_make_constant(value1_in, clamp);
}
default:
break;
}

View File

@@ -43,6 +43,7 @@ public:
void make_constant_clamp(float value, bool clamp) const;
void make_constant_clamp(float3 value, bool clamp) const;
void make_zero() const;
void make_one() const;
/* Bypass node, relinking to another output socket. */
void bypass(ShaderOutput *output) const;

View File

@@ -109,7 +109,7 @@ namespace Far {
template<>
void TopologyRefinerFactory<ccl::Mesh>::reportInvalidTopology(TopologyError /*err_code*/,
char const */*msg*/, ccl::Mesh const& /*mesh*/)
char const * /*msg*/, ccl::Mesh const& /*mesh*/)
{
}
} /* namespace Far */

View File

@@ -3896,6 +3896,19 @@ void GammaNode::constant_fold(const ConstantFolder& folder)
if(folder.all_inputs_constant()) {
folder.make_constant(svm_math_gamma_color(color, gamma));
}
else {
ShaderInput *color_in = input("Color");
ShaderInput *gamma_in = input("Gamma");
/* 1 ^ X == X ^ 0 == 1 */
if(folder.is_one(color_in) || folder.is_zero(gamma_in)) {
folder.make_one();
}
/* X ^ 1 == X */
else if(folder.is_one(gamma_in)) {
folder.try_bypass_or_make_constant(color_in, false);
}
}
}
void GammaNode::compile(SVMCompiler& compiler)

View File

@@ -930,6 +930,72 @@ TEST(render_graph, constant_fold_gamma)
graph.finalize(&scene);
}
/*
* Tests: Gamma with one constant 0 input.
*/
TEST(render_graph, constant_fold_gamma_part_0)
{
DEFINE_COMMON_VARIABLES(builder, log);
EXPECT_ANY_MESSAGE(log);
INVALID_INFO_MESSAGE(log, "Folding Gamma_Cx::");
CORRECT_INFO_MESSAGE(log, "Folding Gamma_xC::Color to constant (1, 1, 1).");
builder
.add_attribute("Attribute")
/* constant on the left */
.add_node(ShaderNodeBuilder<GammaNode>("Gamma_Cx")
.set("Color", make_float3(0.0f, 0.0f, 0.0f)))
.add_connection("Attribute::Fac", "Gamma_Cx::Gamma")
/* constant on the right */
.add_node(ShaderNodeBuilder<GammaNode>("Gamma_xC")
.set("Gamma", 0.0f))
.add_connection("Attribute::Color", "Gamma_xC::Color")
/* output sum */
.add_node(ShaderNodeBuilder<MixNode>("Out")
.set(&MixNode::type, NODE_MIX_ADD)
.set(&MixNode::use_clamp, true)
.set("Fac", 1.0f))
.add_connection("Gamma_Cx::Color", "Out::Color1")
.add_connection("Gamma_xC::Color", "Out::Color2")
.output_color("Out::Color");
graph.finalize(&scene);
}
/*
* Tests: Gamma with one constant 1 input.
*/
TEST(render_graph, constant_fold_gamma_part_1)
{
DEFINE_COMMON_VARIABLES(builder, log);
EXPECT_ANY_MESSAGE(log);
CORRECT_INFO_MESSAGE(log, "Folding Gamma_Cx::Color to constant (1, 1, 1).");
CORRECT_INFO_MESSAGE(log, "Folding Gamma_xC::Color to socket Attribute::Color.");
builder
.add_attribute("Attribute")
/* constant on the left */
.add_node(ShaderNodeBuilder<GammaNode>("Gamma_Cx")
.set("Color", make_float3(1.0f, 1.0f, 1.0f)))
.add_connection("Attribute::Fac", "Gamma_Cx::Gamma")
/* constant on the right */
.add_node(ShaderNodeBuilder<GammaNode>("Gamma_xC")
.set("Gamma", 1.0f))
.add_connection("Attribute::Color", "Gamma_xC::Color")
/* output sum */
.add_node(ShaderNodeBuilder<MixNode>("Out")
.set(&MixNode::type, NODE_MIX_ADD)
.set(&MixNode::use_clamp, true)
.set("Fac", 1.0f))
.add_connection("Gamma_Cx::Color", "Out::Color1")
.add_connection("Gamma_xC::Color", "Out::Color2")
.output_color("Out::Color");
graph.finalize(&scene);
}
/*
* Tests: BrightnessContrast with all constant inputs.
*/
@@ -1142,6 +1208,40 @@ TEST(render_graph, constant_fold_part_math_div_0)
graph.finalize(&scene);
}
/*
* Tests: partial folding for Math Power with known 0.
*/
TEST(render_graph, constant_fold_part_math_pow_0)
{
DEFINE_COMMON_VARIABLES(builder, log);
EXPECT_ANY_MESSAGE(log);
/* X ^ 0 == 1 */
INVALID_INFO_MESSAGE(log, "Folding Math_Cx::");
CORRECT_INFO_MESSAGE(log, "Folding Math_xC::Value to constant (1).");
INVALID_INFO_MESSAGE(log, "Folding Out::");
build_math_partial_test_graph(builder, NODE_MATH_POWER, 0.0f);
graph.finalize(&scene);
}
/*
* Tests: partial folding for Math Power with known 1.
*/
TEST(render_graph, constant_fold_part_math_pow_1)
{
DEFINE_COMMON_VARIABLES(builder, log);
EXPECT_ANY_MESSAGE(log);
/* 1 ^ X == 1; X ^ 1 == X */
CORRECT_INFO_MESSAGE(log, "Folding Math_Cx::Value to constant (1)");
CORRECT_INFO_MESSAGE(log, "Folding Math_xC::Value to socket Attribute::Fac.");
INVALID_INFO_MESSAGE(log, "Folding Out::");
build_math_partial_test_graph(builder, NODE_MATH_POWER, 1.0f);
graph.finalize(&scene);
}
/*
* Tests: Vector Math with all constant inputs.
*/

View File

@@ -778,7 +778,9 @@ static string line_directive(const string& path, int line)
}
string path_source_replace_includes(const string& source, const string& path)
string path_source_replace_includes(const string& source,
const string& path,
const string& source_filename)
{
/* Our own little c preprocessor that replaces #includes with the file
* contents, to work around issue of opencl drivers not supporting
@@ -807,12 +809,12 @@ string path_source_replace_includes(const string& source, const string& path)
* and avoids having list of include directories.x
*/
text = path_source_replace_includes(
text, path_dirname(filepath));
text = path_source_replace_includes(text, path);
text, path_dirname(filepath), filename);
text = path_source_replace_includes(text, path, filename);
/* Use line directives for better error messages. */
line = line_directive(filepath, 1)
+ token.replace(0, n_end + 1, "\n" + text + "\n")
+ line_directive(path, i);
+ line_directive(path_join(path, source_filename), i);
}
}
}

View File

@@ -66,7 +66,9 @@ bool path_read_text(const string& path, string& text);
bool path_remove(const string& path);
/* source code utility */
string path_source_replace_includes(const string& source, const string& path);
string path_source_replace_includes(const string& source,
const string& path,
const string& source_filename="");
/* cache utility */
void path_cache_clear_except(const string& name, const set<string>& except);

View File

@@ -332,7 +332,7 @@ class LbmFsgrSolver :
void debugMarkCellCall(int level, int vi,int vj,int vk);
// loop over grid, stream&collide update
void mainLoop(int lev);
void mainLoop(const int lev);
// change time step size
void adaptTimestep();
//! init mObjectSpeeds for current parametrization

View File

@@ -355,7 +355,7 @@ void LbmFsgrSolver::fineAdvance()
//! fine step function
/*****************************************************************************/
void
LbmFsgrSolver::mainLoop(int lev)
LbmFsgrSolver::mainLoop(const int lev)
{
// loops over _only inner_ cells -----------------------------------------------------------------------------------
@@ -376,13 +376,16 @@ LbmFsgrSolver::mainLoop(int lev)
// main loop region
const bool doReduce = true;
const int gridLoopBound=1;
const int gDebugLevel = ::gDebugLevel;
int calcNumInvIfCells = 0;
LbmFloat calcInitialMass = 0;
GRID_REGION_INIT();
#if PARALLEL==1
#pragma omp parallel default(shared) num_threads(mNumOMPThreads) \
#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
reduction(+: \
calcCurrentMass,calcCurrentVolume, \
calcCellsFilled,calcCellsEmptied, \
calcNumUsedCells )
calcNumUsedCells,calcNumInvIfCells,calcInitialMass)
GRID_REGION_START();
#else // PARALLEL==1
GRID_REGION_START();
@@ -468,7 +471,7 @@ LbmFsgrSolver::mainLoop(int lev)
calcCurrentMass += iniRho;
calcCurrentVolume += 1.0;
calcNumUsedCells++;
mInitialMass += iniRho;
calcInitialMass += iniRho;
// dont treat cell until next step
continue;
}
@@ -479,7 +482,7 @@ LbmFsgrSolver::mainLoop(int lev)
if(isnotValid) {
// remove fluid cells, shouldnt be here anyway
LbmFloat fluidRho = m[0]; FORDF1 { fluidRho += m[l]; }
mInitialMass -= fluidRho;
calcInitialMass -= fluidRho;
const LbmFloat iniRho = 0.0;
RAC(tcel, dMass) = RAC(tcel, dFfrac) = iniRho;
RAC(tcel, dFlux) = FLUX_INIT;
@@ -608,8 +611,8 @@ LbmFsgrSolver::mainLoop(int lev)
// read distribution funtions of adjacent cells = stream step
DEFAULT_STREAM;
if((nbored & CFFluid)==0) { newFlag |= CFNoNbFluid; mNumInvIfCells++; }
if((nbored & CFEmpty)==0) { newFlag |= CFNoNbEmpty; mNumInvIfCells++; }
if((nbored & CFFluid)==0) { newFlag |= CFNoNbFluid; calcNumInvIfCells++; }
if((nbored & CFEmpty)==0) { newFlag |= CFNoNbEmpty; calcNumInvIfCells++; }
// calculate mass exchange for interface cells
LbmFloat myfrac = RAC(ccel,dFfrac);
@@ -809,7 +812,7 @@ LbmFsgrSolver::mainLoop(int lev)
// fill if cells in inflow region
if(myfrac<0.5) {
mass += 0.25;
mInitialMass += 0.25;
calcInitialMass += 0.25;
}
const int OId = oldFlag>>24;
const LbmVec vel(mObjectSpeeds[OId]);
@@ -1013,7 +1016,7 @@ LbmFsgrSolver::mainLoop(int lev)
if( (mass) <= (rho * ( -FSGR_MAGICNR)) ) { ifemptied = 1; }
if(oldFlag & (CFMbndOutflow)) {
mInitialMass -= mass;
calcInitialMass -= mass;
mass = myfrac = 0.0;
iffilled = 0; ifemptied = 1;
}
@@ -1105,6 +1108,8 @@ LbmFsgrSolver::mainLoop(int lev)
mNumFilledCells = calcCellsFilled;
mNumEmptiedCells = calcCellsEmptied;
mNumUsedCells = calcNumUsedCells;
mNumInvIfCells += calcNumInvIfCells;
mInitialMass += calcInitialMass;
}
@@ -1115,13 +1120,14 @@ LbmFsgrSolver::preinitGrids()
const int lev = mMaxRefine;
const bool doReduce = false;
const int gridLoopBound=0;
const int gDebugLevel = ::gDebugLevel;
// preinit both grids
for(int s=0; s<2; s++) {
GRID_REGION_INIT();
#if PARALLEL==1
#pragma omp parallel default(shared) num_threads(mNumOMPThreads) \
#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
reduction(+: \
calcCurrentMass,calcCurrentVolume, \
calcCellsFilled,calcCellsEmptied, \
@@ -1155,10 +1161,11 @@ LbmFsgrSolver::standingFluidPreinit()
const int lev = mMaxRefine;
const bool doReduce = false;
const int gridLoopBound=1;
const int gDebugLevel = ::gDebugLevel;
GRID_REGION_INIT();
#if PARALLEL==1
#pragma omp parallel default(shared) num_threads(mNumOMPThreads) \
#pragma omp parallel default(none) num_threads(mNumOMPThreads) \
reduction(+: \
calcCurrentMass,calcCurrentVolume, \
calcCellsFilled,calcCellsEmptied, \

View File

@@ -712,18 +712,26 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type,
}
GHOST_EventWheel *GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam)
void GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam)
{
// short fwKeys = LOWORD(wParam); // key flags
int zDelta = (short) HIWORD(wParam); // wheel rotation
// zDelta /= WHEEL_DELTA;
// temporary fix below: microsoft now has added more precision, making the above division not work
zDelta = (zDelta <= 0) ? -1 : 1;
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
// short xPos = (short) LOWORD(lParam); // horizontal position of pointer
// short yPos = (short) HIWORD(lParam); // vertical position of pointer
return new GHOST_EventWheel(getSystem()->getMilliSeconds(), window, zDelta);
int acc = system->m_wheelDeltaAccum;
int delta = GET_WHEEL_DELTA_WPARAM(wParam);
if (acc * delta < 0) {
// scroll direction reversed.
acc = 0;
}
acc += delta;
int direction = (acc >= 0) ? 1 : -1;
acc = abs(acc);
while (acc >= WHEEL_DELTA) {
system->pushEvent(new GHOST_EventWheel(system->getMilliSeconds(), window, direction));
acc -= WHEEL_DELTA;
}
system->m_wheelDeltaAccum = acc * direction;
}
@@ -1137,14 +1145,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
POINT mouse_pos = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
HWND mouse_hwnd = ChildWindowFromPoint(HWND_DESKTOP, mouse_pos);
GHOST_WindowWin32 *mouse_window = (GHOST_WindowWin32 *)::GetWindowLongPtr(mouse_hwnd, GWLP_USERDATA);
if (mouse_window != NULL) {
event = processWheelEvent(mouse_window, wParam, lParam);
}
else {
/* Happens when mouse is not over any of blender's windows. */
event = processWheelEvent(window, wParam, lParam);
}
processWheelEvent(mouse_window ? mouse_window : window , wParam, lParam);
eventHandled = true;
#ifdef BROKEN_PEEK_TOUCHPAD
PostMessage(hwnd, WM_USER, 0, 0);
#endif
@@ -1203,6 +1206,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
GHOST_ModifierKeys modifiers;
modifiers.clear();
system->storeModifierKeys(modifiers);
system->m_wheelDeltaAccum = 0;
event = processWindowEvent(LOWORD(wParam) ? GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate, window);
/* WARNING: Let DefWindowProc handle WM_ACTIVATE, otherwise WM_MOUSEWHEEL
* will not be dispatched to OUR active window if we minimize one of OUR windows. */

View File

@@ -264,12 +264,12 @@ protected:
static GHOST_EventCursor *processCursorEvent(GHOST_TEventType type, GHOST_WindowWin32 *window);
/**
* Creates a mouse wheel event.
* Handles a mouse wheel event.
* \param window The window receiving the event (the active window).
* \param wParam The wParam from the wndproc
* \param lParam The lParam from the wndproc
*/
static GHOST_EventWheel *processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam);
static void processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam);
/**
* Creates a key event and updates the key data stored locally (m_modifierKeys).
@@ -376,6 +376,9 @@ protected:
/** Console status */
int m_consoleStatus;
/** Wheel delta accumulator **/
int m_wheelDeltaAccum;
};
inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys& keys) const

114
make.bat
View File

@@ -6,7 +6,17 @@ setlocal ENABLEEXTENSIONS
set BLENDER_DIR=%~dp0
set BUILD_DIR=%BLENDER_DIR%..\build_windows
set BUILD_TYPE=Release
rem reset all variables so they do not get accidentally get carried over from previous builds
set BUILD_CMAKE_ARGS=
set BUILD_ARCH=
set BUILD_VS_VER=
set BUILD_VS_YEAR=
set KEY_NAME=
set MSBUILD_PLATFORM=
set MUST_CLEAN=
set NOBUILD=
set TARGET=
set WINDOWS_ARCH=
:argv_loop
if NOT "%1" == "" (
@@ -18,54 +28,34 @@ if NOT "%1" == "" (
REM Build Types
if "%1" == "debug" (
set BUILD_DIR=%BUILD_DIR%_debug
set BUILD_TYPE=Debug
REM Build Configurations
) else if "%1" == "full" (
set TARGET_SET=1
set BUILD_DIR=%BUILD_DIR%_full
set TARGET=Full
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\blender_full.cmake"
) else if "%1" == "lite" (
set TARGET_SET=1
set BUILD_DIR=%BUILD_DIR%_lite
set TARGET=Lite
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\blender_lite.cmake"
) else if "%1" == "cycles" (
set TARGET_SET=1
set BUILD_DIR=%BUILD_DIR%_cycles
set TARGET=Cycles
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\cycles_standalone.cmake"
) else if "%1" == "headless" (
set TARGET_SET=1
set BUILD_DIR=%BUILD_DIR%_headless
set TARGET=Headless
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\blender_headless.cmake"
) else if "%1" == "bpy" (
set TARGET_SET=1
set BUILD_DIR=%BUILD_DIR%_bpy
set TARGET=Bpy
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\bpy_module.cmake"
) else if "%1" == "release" (
set TARGET_SET=1
if "%CUDA_PATH_V7_5%"=="" (
echo Cuda 7.5 Not found, aborting!
goto EOF
)
if "%CUDA_PATH_V8_0%"=="" (
echo Cuda 8.0 Not found, aborting!
goto EOF
)
set BUILD_DIR=%BUILD_DIR%_Release
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake" -DCUDA_NVCC_EXECUTABLE:FILEPATH=%CUDA_PATH_V7_5%/bin/nvcc.exe -DCUDA_NVCC8_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe
set TARGET=Release
) else if "%1" == "x86" (
set BUILD_ARCH=x86
set BUILD_DIR=%BUILD_DIR%_x86
) else if "%1" == "x64" (
set BUILD_ARCH=x64
set BUILD_DIR=%BUILD_DIR%_x64
) else if "%1" == "2015" (
set BUILD_VS_VER=14
set BUILD_VS_YEAR=2015
@@ -105,10 +95,13 @@ if NOT "%1" == "" (
if "%BUILD_ARCH%"=="" (
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
set WINDOWS_ARCH= Win64
set BUILD_ARCH=x64
) else if "%PROCESSOR_ARCHITEW6432%" == "AMD64" (
set WINDOWS_ARCH= Win64
set BUILD_ARCH=x64
) else (
set WINDOWS_ARCH=
set BUILD_ARCH=x86
)
) else if "%BUILD_ARCH%"=="x64" (
set WINDOWS_ARCH= Win64
@@ -121,8 +114,39 @@ if "%BUILD_VS_VER%"=="" (
set BUILD_VS_YEAR=2013
)
set BUILD_DIR=%BUILD_DIR%_vc%BUILD_VS_VER%
if "%BUILD_ARCH%"=="x64" (
set MSBUILD_PLATFORM=x64
) else if "%BUILD_ARCH%"=="x86" (
set MSBUILD_PLATFORM=win32
)
set BUILD_DIR=%BUILD_DIR%_%TARGET%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE%
if "%target%"=="Release" (
rem for vc12 check for both cuda 7.5 and 8
if "%BUILD_VS_VER%"=="12" (
if "%CUDA_PATH_V7_5%"=="" (
echo Cuda 7.5 Not found, aborting!
goto EOF
)
)
if "%CUDA_PATH_V8_0%"=="" (
echo Cuda 8.0 Not found, aborting!
goto EOF
)
if "%BUILD_VS_VER%"=="12" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake" -DCUDA_NVCC_EXECUTABLE:FILEPATH=%CUDA_PATH_V7_5%/bin/nvcc.exe -DCUDA_NVCC8_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe
)
if "%BUILD_VS_VER%"=="14" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
-C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake" -DCUDA_NVCC_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe -DCUDA_NVCC8_EXECUTABLE:FILEPATH=%CUDA_PATH_V8_0%/bin/nvcc.exe
)
)
:DetectMSVC
REM Detect MSVC Installation
if DEFINED VisualStudioVersion goto msvc_detect_finally
set VALUE_NAME=ProductDir
@@ -140,10 +164,18 @@ if DEFINED MSVC_VC_DIR call "%MSVC_VC_DIR%\vcvarsall.bat"
REM Sanity Checks
where /Q msbuild
if %ERRORLEVEL% NEQ 0 (
echo Error: "MSBuild" command not in the PATH.
echo You must have MSVC installed and run this from the "Developer Command Prompt"
echo ^(available from Visual Studio's Start menu entry^), aborting!
goto EOF
if "%BUILD_VS_VER%"=="12" (
rem vs12 not found, try vs14
echo Visual Studio 2012 not found, trying Visual Studio 2015.
set BUILD_VS_VER=14
set BUILD_VS_YEAR=2015
goto DetectMSVC
) else (
echo Error: "MSBuild" command not in the PATH.
echo You must have MSVC installed and run this from the "Developer Command Prompt"
echo ^(available from Visual Studio's Start menu entry^), aborting!
goto EOF
)
)
where /Q cmake
if %ERRORLEVEL% NEQ 0 (
@@ -156,7 +188,7 @@ if NOT EXIST %BLENDER_DIR%..\lib\nul (
echo This is needed for building, aborting!
goto EOF
)
if NOT "%TARGET_SET%"=="1" (
if "%TARGET%"=="" (
echo Error: Convenience target not set
echo This is required for building, aborting!
echo .
@@ -173,7 +205,9 @@ if "%MUST_CLEAN%"=="1" (
%BUILD_DIR%\Blender.sln ^
/target:clean ^
/property:Configuration=%BUILD_TYPE% ^
/verbosity:minimal
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM%
if %ERRORLEVEL% NEQ 0 (
echo Cleaned "%BUILD_DIR%"
)
@@ -202,7 +236,8 @@ msbuild ^
/target:build ^
/property:Configuration=%BUILD_TYPE% ^
/maxcpucount ^
/verbosity:minimal
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM%
if %ERRORLEVEL% NEQ 0 (
echo "Build Failed"
@@ -212,7 +247,8 @@ if %ERRORLEVEL% NEQ 0 (
msbuild ^
%BUILD_DIR%\INSTALL.vcxproj ^
/property:Configuration=%BUILD_TYPE% ^
/verbosity:minimal
/verbosity:minimal ^
/p:platform=%MSBUILD_PLATFORM%
echo.
echo At any point you can optionally modify your build configuration by editing:
@@ -224,10 +260,9 @@ goto EOF
:HELP
echo.
echo Convenience targets
echo - release
echo - debug
echo - full
echo - lite
echo - release ^(identical to the offical blender.org builds^)
echo - full ^(same as release minus the cuda kernels^)
echo - lite
echo - headless
echo - cycles
echo - bpy
@@ -239,6 +274,7 @@ goto EOF
echo - showhash ^(Show git hashes of source tree^)
echo.
echo Configuration options
echo - debug ^(Build an unoptimized debuggable build^)
echo - packagename [newname] ^(override default cpack package name^)
echo - x86 ^(override host autodetect and build 32 bit code^)
echo - x64 ^(override host autodetect and build 64 bit code^)

View File

@@ -23,6 +23,7 @@ from bpy.types import Operator
from bpy.props import (
FloatProperty,
IntProperty,
BoolProperty,
)
from bpy.app.translations import pgettext_data as data_
@@ -81,6 +82,33 @@ def add_torus(major_rad, minor_rad, major_seg, minor_seg):
return verts, faces
def add_uvs(mesh, minor_seg, major_seg):
mesh.uv_textures.new()
uv_layer = mesh.uv_layers.active
u_step = 1.0/major_seg
v_step = 1.0/minor_seg
vertex_index = 0
u = 0.5
for major_index in range(major_seg):
v = 0.5
for minor_index in range(minor_seg):
loops = mesh.polygons[vertex_index].loop_indices
if minor_index == minor_seg-1 and major_index == 0:
uv_layer.data[loops[1]].uv = (u, v)
uv_layer.data[loops[2]].uv = (u + u_step, v)
uv_layer.data[loops[0]].uv = (u, v + v_step)
uv_layer.data[loops[3]].uv = (u + u_step, v + v_step)
else:
uv_layer.data[loops[0]].uv = (u, v)
uv_layer.data[loops[1]].uv = (u + u_step, v)
uv_layer.data[loops[3]].uv = (u, v + v_step)
uv_layer.data[loops[2]].uv = (u + u_step, v + v_step)
v = (v + v_step) % 1.0
vertex_index += 1
u = (u + u_step) % 1.0
class AddTorus(Operator, object_utils.AddObjectHelper):
"""Add a torus mesh"""
bl_idname = "mesh.primitive_torus_add"
@@ -145,10 +173,18 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
subtype='DISTANCE',
unit='LENGTH',
)
generate_uvs = BoolProperty(
name="Generate UVs",
description="Generate a default UV map",
default=False,
)
def draw(self, context):
layout = self.layout
col = layout.column(align=True)
col.prop(self, 'generate_uvs')
col.separator()
col.prop(self, 'view_align')
col = layout.column(align=True)
@@ -217,6 +253,10 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
mesh.polygons.foreach_set("loop_start", range(0, nbr_loops, 4))
mesh.polygons.foreach_set("loop_total", (4,) * nbr_polys)
mesh.loops.foreach_set("vertex_index", faces)
if self.generate_uvs:
add_uvs(mesh, self.minor_segments, self.major_segments)
mesh.update()
object_utils.object_data_add(context, mesh, operator=self)

View File

@@ -368,6 +368,10 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
CALLBACK_INVOKE(base->object, IDWALK_USER);
}
for (TimeMarker *marker = scene->markers.first; marker; marker = marker->next) {
CALLBACK_INVOKE(marker->camera, IDWALK_NOP);
}
if (toolsett) {
CALLBACK_INVOKE(toolsett->skgen_template, IDWALK_NOP);
@@ -776,6 +780,15 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
}
break;
}
case ID_AC:
{
bAction *act = (bAction *) id;
for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
CALLBACK_INVOKE(marker->camera, IDWALK_NOP);
}
break;
}
/* Nothing needed for those... */
case ID_IM:
@@ -783,7 +796,6 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
case ID_TXT:
case ID_SO:
case ID_AR:
case ID_AC:
case ID_GD:
case ID_WM:
case ID_PAL:

View File

@@ -3447,7 +3447,13 @@ static ImBuf *do_render_strip_uncached(
state->scene_parents = &scene_parent;
/* end check */
ibuf = do_render_strip_seqbase(context, state, seq, nr, use_preprocess);
/* Use the Scene Seq's scene for the context when rendering the scene's sequences
* (necessary for Multicam Selector among others).
*/
SeqRenderData local_context = *context;
local_context.scene = seq->scene;
ibuf = do_render_strip_seqbase(&local_context, state, seq, nr, use_preprocess);
/* step back in the list */
state->scene_parents = state->scene_parents->next;

View File

@@ -2509,6 +2509,12 @@ static void lib_link_action(FileData *fd, Main *main)
// >>> XXX deprecated - old animation system
lib_link_fcurves(fd, &act->id, &act->curves);
for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
if (marker->camera) {
marker->camera = newlibadr(fd, act->id.lib, marker->camera);
}
}
}
}
}
@@ -5226,7 +5232,6 @@ static void lib_link_scene(FileData *fd, Main *main)
Base *base, *next;
Sequence *seq;
SceneRenderLayer *srl;
TimeMarker *marker;
FreestyleModuleConfig *fmc;
FreestyleLineSet *fls;
@@ -5325,15 +5330,11 @@ static void lib_link_scene(FileData *fd, Main *main)
}
SEQ_END
#ifdef DURIAN_CAMERA_SWITCH
for (marker = sce->markers.first; marker; marker = marker->next) {
for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
if (marker->camera) {
marker->camera = newlibadr(fd, sce->id.lib, marker->camera);
}
}
#else
(void)marker;
#endif
BKE_sequencer_update_muting(sce->ed);
BKE_sequencer_update_sound_bounds_all(sce);
@@ -8461,6 +8462,12 @@ static void expand_action(FileData *fd, Main *mainvar, bAction *act)
/* F-Curves in Action */
expand_fcurves(fd, mainvar, &act->curves);
for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) {
if (marker->camera) {
expand_doit(fd, mainvar, marker->camera);
}
}
}
static void expand_keyingsets(FileData *fd, Main *mainvar, ListBase *list)
@@ -9035,17 +9042,11 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
expand_doit(fd, mainvar, sce->rigidbody_world->constraints);
}
#ifdef DURIAN_CAMERA_SWITCH
{
TimeMarker *marker;
for (marker = sce->markers.first; marker; marker = marker->next) {
if (marker->camera) {
expand_doit(fd, mainvar, marker->camera);
}
for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
if (marker->camera) {
expand_doit(fd, mainvar, marker->camera);
}
}
#endif
expand_doit(fd, mainvar, sce->clip);
}

View File

@@ -370,10 +370,12 @@ void DepsgraphRelationBuilder::add_node_handle_relation(
}
else {
if (!op_from) {
/* XXX TODO handle as error or report if needed */
fprintf(stderr, "add_node_handle_relation(%d, %s) - Could not find op_from (%s)\n",
type, description, key_from.identifier().c_str());
}
if (!op_to) {
/* XXX TODO handle as error or report if needed */
fprintf(stderr, "add_node_handle_relation(%d, %s) - Could not find op_to (%s)\n",
type, description, key_from.identifier().c_str());
}
}
}

View File

@@ -559,6 +559,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
if (pathString == NULL || !CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingUTF8))
continue;
/* Add end slash for consistency with other platforms */
BLI_add_slash(line);
/* Exclude "all my files" as it makes no sense in blender fileselector */
/* Exclude "airdrop" if wlan not active as it would show "" ) */
if (!strstr(line, "myDocuments.cannedSearch") && (*line != '\0')) {

View File

@@ -294,7 +294,7 @@ static void copy_vert_no(const BVHTreeFromMeshType *meshdata, const int index, f
case SNAP_MESH:
{
BVHTreeFromMesh *data = meshdata->userdata;
const MVert *vert = data->vert;
const MVert *vert = data->vert + index;
normal_short_to_float_v3(r_no, vert->no);
break;
}
@@ -1302,6 +1302,7 @@ static bool snapDerivedMesh(
}
}
}
/* SCE_SNAP_MODE_VERTEX or SCE_SNAP_MODE_EDGE */
else {
const ARegion *ar = sctx->v3d_data.ar;

View File

@@ -779,7 +779,7 @@ static void shade_light_textures(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **
for (int i = 0; i < MAX_MTEX; ++i) {
MTex *mtex = lamp->la->mtex[i];
if (mtex && mtex->tex->type & TEX_IMAGE && mtex->tex->ima) {
if (mtex && mtex->tex && (mtex->tex->type & TEX_IMAGE) && mtex->tex->ima) {
mat->dynproperty |= DYN_LAMP_PERSMAT;
float one = 1.0f;

View File

@@ -2705,7 +2705,7 @@ void node_geometry(
parametric = vec3(0.0);
backfacing = (gl_FrontFacing) ? 0.0 : 1.0;
pointiness = 0.0;
pointiness = 0.5;
}
void node_tex_coord(

View File

@@ -188,7 +188,7 @@ static bool polygons_check_flip(
}
static void normalEditModifier_do_radial(
NormalEditModifierData *smd, Object *ob, DerivedMesh *dm,
NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm,
short (*clnors)[2], float (*loopnors)[3], float (*polynors)[3],
const short mix_mode, const float mix_factor, const float mix_limit,
MDeformVert *dvert, const int defgrp_index, const bool use_invert_vgroup,
@@ -203,7 +203,7 @@ static void normalEditModifier_do_radial(
BLI_bitmap *done_verts = BLI_BITMAP_NEW((size_t)num_verts, __func__);
generate_vert_coordinates(dm, ob, smd->target, smd->offset, num_verts, cos, size);
generate_vert_coordinates(dm, ob, enmd->target, enmd->offset, num_verts, cos, size);
/**
* size gives us our spheroid coefficients ``(A, B, C)``.
@@ -287,14 +287,14 @@ static void normalEditModifier_do_radial(
}
static void normalEditModifier_do_directional(
NormalEditModifierData *smd, Object *ob, DerivedMesh *dm,
NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm,
short (*clnors)[2], float (*loopnors)[3], float (*polynors)[3],
const short mix_mode, const float mix_factor, const float mix_limit,
MDeformVert *dvert, const int defgrp_index, const bool use_invert_vgroup,
MVert *mvert, const int num_verts, MEdge *medge, const int num_edges,
MLoop *mloop, const int num_loops, MPoly *mpoly, const int num_polys)
{
const bool use_parallel_normals = (smd->flag & MOD_NORMALEDIT_USE_DIRECTION_PARALLEL) != 0;
const bool use_parallel_normals = (enmd->flag & MOD_NORMALEDIT_USE_DIRECTION_PARALLEL) != 0;
float (*cos)[3] = MEM_mallocN(sizeof(*cos) * num_verts, __func__);
float (*nos)[3] = MEM_mallocN(sizeof(*nos) * num_loops, __func__);
@@ -309,14 +309,14 @@ static void normalEditModifier_do_directional(
float mat[4][4];
invert_m4_m4(mat, ob->obmat);
mul_m4_m4m4(mat, mat, smd->target->obmat);
mul_m4_m4m4(mat, mat, enmd->target->obmat);
copy_v3_v3(target_co, mat[3]);
}
if (use_parallel_normals) {
float no[3];
sub_v3_v3v3(no, target_co, smd->offset);
sub_v3_v3v3(no, target_co, enmd->offset);
normalize_v3(no);
for (i = num_loops; i--; ) {
@@ -362,19 +362,19 @@ static void normalEditModifier_do_directional(
MEM_freeN(nos);
}
static bool is_valid_target(NormalEditModifierData *smd)
static bool is_valid_target(NormalEditModifierData *enmd)
{
if (smd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
if (enmd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
return true;
}
else if ((smd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) && smd->target) {
else if ((enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) && enmd->target) {
return true;
}
modifier_setError((ModifierData *)smd, "Invalid target settings");
modifier_setError((ModifierData *)enmd, "Invalid target settings");
return false;
}
static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *ob, DerivedMesh *dm)
static DerivedMesh *normalEditModifier_do(NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm)
{
Mesh *me = ob->data;
@@ -387,11 +387,11 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o
MLoop *mloop;
MPoly *mpoly;
const bool use_invert_vgroup = ((smd->flag & MOD_NORMALEDIT_INVERT_VGROUP) != 0);
const bool use_current_clnors = !((smd->mix_mode == MOD_NORMALEDIT_MIX_COPY) &&
(smd->mix_factor == 1.0f) &&
(smd->defgrp_name[0] == '\0') &&
(smd->mix_limit == (float)M_PI));
const bool use_invert_vgroup = ((enmd->flag & MOD_NORMALEDIT_INVERT_VGROUP) != 0);
const bool use_current_clnors = !((enmd->mix_mode == MOD_NORMALEDIT_MIX_COPY) &&
(enmd->mix_factor == 1.0f) &&
(enmd->defgrp_name[0] == '\0') &&
(enmd->mix_limit == (float)M_PI));
int defgrp_index;
MDeformVert *dvert;
@@ -403,12 +403,12 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o
bool free_polynors = false;
/* Do not run that modifier at all if autosmooth is disabled! */
if (!is_valid_target(smd) || !num_loops) {
if (!is_valid_target(enmd) || !num_loops) {
return dm;
}
if (!(me->flag & ME_AUTOSMOOTH)) {
modifier_setError((ModifierData *)smd, "Enable 'Auto Smooth' option in mesh settings");
modifier_setError((ModifierData *)enmd, "Enable 'Auto Smooth' option in mesh settings");
return dm;
}
@@ -441,18 +441,18 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o
free_polynors = true;
}
modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
modifier_get_vgroup(ob, dm, enmd->defgrp_name, &dvert, &defgrp_index);
if (smd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
if (enmd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
normalEditModifier_do_radial(
smd, ob, dm, clnors, loopnors, polynors,
smd->mix_mode, smd->mix_factor, smd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
enmd, ob, dm, clnors, loopnors, polynors,
enmd->mix_mode, enmd->mix_factor, enmd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
mvert, num_verts, medge, num_edges, mloop, num_loops, mpoly, num_polys);
}
else if (smd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) {
else if (enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) {
normalEditModifier_do_directional(
smd, ob, dm, clnors, loopnors, polynors,
smd->mix_mode, smd->mix_factor, smd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
enmd, ob, dm, clnors, loopnors, polynors,
enmd->mix_mode, enmd->mix_factor, enmd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
mvert, num_verts, medge, num_edges, mloop, num_loops, mpoly, num_polys);
}
@@ -465,13 +465,13 @@ static DerivedMesh *normalEditModifier_do(NormalEditModifierData *smd, Object *o
static void initData(ModifierData *md)
{
NormalEditModifierData *smd = (NormalEditModifierData *)md;
NormalEditModifierData *enmd = (NormalEditModifierData *)md;
smd->mode = MOD_NORMALEDIT_MODE_RADIAL;
enmd->mode = MOD_NORMALEDIT_MODE_RADIAL;
smd->mix_mode = MOD_NORMALEDIT_MIX_COPY;
smd->mix_factor = 1.0f;
smd->mix_limit = M_PI;
enmd->mix_mode = MOD_NORMALEDIT_MIX_COPY;
enmd->mix_factor = 1.0f;
enmd->mix_limit = M_PI;
}
static void copyData(ModifierData *md, ModifierData *target)
@@ -481,11 +481,11 @@ static void copyData(ModifierData *md, ModifierData *target)
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
NormalEditModifierData *smd = (NormalEditModifierData *)md;
NormalEditModifierData *enmd = (NormalEditModifierData *)md;
CustomDataMask dataMask = CD_CUSTOMLOOPNORMAL;
/* Ask for vertexgroups if we need them. */
if (smd->defgrp_name[0]) {
if (enmd->defgrp_name[0]) {
dataMask |= (CD_MASK_MDEFORMVERT);
}
@@ -499,16 +499,16 @@ static bool dependsOnNormals(ModifierData *UNUSED(md))
static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData)
{
NormalEditModifierData *smd = (NormalEditModifierData *) md;
NormalEditModifierData *enmd = (NormalEditModifierData *) md;
walk(userData, ob, &smd->target, IDWALK_NOP);
walk(userData, ob, &enmd->target, IDWALK_NOP);
}
static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
{
NormalEditModifierData *smd = (NormalEditModifierData *)md;
NormalEditModifierData *enmd = (NormalEditModifierData *)md;
return !is_valid_target(smd);
return !is_valid_target(enmd);
}
static void updateDepgraph(ModifierData *md, DagForest *forest,
@@ -516,10 +516,10 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
struct Scene *UNUSED(scene),
Object *UNUSED(ob), DagNode *obNode)
{
NormalEditModifierData *smd = (NormalEditModifierData *) md;
NormalEditModifierData *enmd = (NormalEditModifierData *) md;
if (smd->target) {
DagNode *Node = dag_get_node(forest, smd->target);
if (enmd->target) {
DagNode *Node = dag_get_node(forest, enmd->target);
dag_add_relation(forest, Node, obNode, DAG_RL_OB_DATA, "NormalEdit Modifier");
}
@@ -531,9 +531,9 @@ static void updateDepsgraph(ModifierData *md,
Object *UNUSED(ob),
struct DepsNodeHandle *node)
{
NormalEditModifierData *smd = (NormalEditModifierData *) md;
if (smd->target) {
DEG_add_object_relation(node, smd->target, DEG_OB_COMP_GEOMETRY, "NormalEdit Modifier");
NormalEditModifierData *enmd = (NormalEditModifierData *) md;
if (enmd->target) {
DEG_add_object_relation(node, enmd->target, DEG_OB_COMP_TRANSFORM, "NormalEdit Modifier");
}
}

View File

@@ -171,7 +171,7 @@ void RAS_StorageVA::TexCoordPtr(const RAS_TexVert *tv)
glVertexAttribPointerARB(unit, 4, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getTangent());
break;
case RAS_IRasterizer::RAS_TEXCO_VCOL:
glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(RAS_TexVert), tv->getRGBA());
glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(RAS_TexVert), tv->getRGBA());
break;
default:
break;

View File

@@ -149,6 +149,9 @@ void VBO::Draw(int texco_num, RAS_IRasterizer::TexCoGen* texco, int attrib_num,
glVertexAttribPointerARB(unit, 4, GL_FLOAT, GL_FALSE, this->stride, this->tangent_offset);
glEnableVertexAttribArrayARB(unit);
break;
case RAS_IRasterizer::RAS_TEXCO_VCOL:
glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_TRUE, this->stride, this->color_offset);
glEnableVertexAttribArrayARB(unit);
default:
break;
}