Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_node.h1
-rw-r--r--source/blender/blenkernel/intern/node.c1
-rw-r--r--source/blender/blenkernel/intern/smoke.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c14
-rw-r--r--source/blender/gpu/GPU_extensions.h3
-rw-r--r--source/blender/gpu/intern/gpu_draw.c14
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c90
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h2
-rw-r--r--source/blender/nodes/CMakeLists.txt1
-rw-r--r--source/blender/nodes/NOD_shader.h1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mybsdf_diffuse.c63
13 files changed, 20 insertions, 176 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 6a5f93b987d..acd6f120f93 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -551,7 +551,6 @@ struct ShadeResult;
#define SH_NODE_OBJECT_INFO 167
#define SH_NODE_PARTICLE_INFO 168
#define SH_NODE_TEX_BRICK 169
-#define SH_NODE_MYBSDF_DIFFUSE 170 //Diffuse copy node added for test purposes
/* custom defines options for Material node */
#define SH_NODE_MAT_DIFF 1
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 38655f7e7a1..8965488a9b3 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2249,7 +2249,6 @@ static void registerShaderNodes(bNodeTreeType *ttype)
register_node_type_sh_background(ttype);
register_node_type_sh_bsdf_diffuse(ttype);
- register_node_type_sh_mybsdf_diffuse(ttype);//Test node
register_node_type_sh_bsdf_glossy(ttype);
register_node_type_sh_bsdf_glass(ttype);
register_node_type_sh_bsdf_translucent(ttype);
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 25a389f2c52..a07c58746df 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -295,7 +295,7 @@ static int smokeModifier_init(SmokeModifierData *smd, Object *ob, Scene *scene,
/* set domain dimensions from derivedmesh */
smoke_set_domain_from_derivedmesh(sds, ob, dm);
/* reset domain values */
- zero_v3(sds->shift);
+ zero_v3_int(sds->shift);
zero_v3(sds->shift_f);
add_v3_fl(sds->shift_f, 0.5f);
zero_v3(sds->prev_loc);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 9285a0340af..9171e78e7ad 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8056,40 +8056,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (md->type == eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData *)md;
if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
- /* hack to keep branch changes without version number */
+ /* keep branch saves if possible */
if (!smd->domain->flame_max_temp) {
smd->domain->burning_rate = 0.75f;
smd->domain->flame_smoke = 1.0f;
smd->domain->flame_vorticity = 0.5f;
smd->domain->flame_ignition = 1.25f;
smd->domain->flame_max_temp = 1.75f;
- }
- if (!smd->domain->adapt_threshold) {
smd->domain->adapt_threshold = 0.02f;
smd->domain->adapt_margin = 4;
- }
- if (smd->branch_v < 1) {
smd->domain->flame_smoke_color[0] = 0.7f;
smd->domain->flame_smoke_color[1] = 0.7f;
smd->domain->flame_smoke_color[2] = 0.7f;
}
}
else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
- if (!smd->flow->fuel_amount) {
+ if (!smd->flow->texture_size) {
smd->flow->fuel_amount = 1.0;
smd->flow->surface_distance = 1.5;
- }
-
- if (smd->branch_v < 1) {
smd->flow->color[0] = 0.7f;
smd->flow->color[1] = 0.7f;
smd->flow->color[2] = 0.7f;
- }
- if (smd->branch_v < 2) {
smd->flow->texture_size = 1.0f;
}
}
- smd->branch_v = 2; /* hack to keep branch changes without version number */
}
}
}
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index 515c0d6bfd2..f4bb5da0495 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -107,8 +107,7 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver);
GPUTexture *GPU_texture_create_1D(int w, float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_2D(int w, int h, float *pixels, char err_out[256]);
-GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels);
-GPUTexture *GPU_texture_create_3D_rgba(int w, int h, int depth, float *fpixels);
+GPUTexture *GPU_texture_create_3D(int w, int h, int depth, int channels, float *fpixels);
GPUTexture *GPU_texture_create_depth(int w, int h, char err_out[256]);
GPUTexture *GPU_texture_create_vsm_shadow_map(int size, char err_out[256]);
GPUTexture *GPU_texture_from_blender(struct Image *ima,
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index f2176e6a0f4..ac05f1e8309 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1036,31 +1036,31 @@ void GPU_create_smoke(SmokeModifierData *smd, int highres)
if (smoke_has_colors(sds->fluid)) {
float *data = MEM_callocN(sizeof(float)*sds->total_cells*4, "smokeColorTexture");
smoke_get_rgba(sds->fluid, data, 0);
- sds->tex = GPU_texture_create_3D_rgba(sds->res[0], sds->res[1], sds->res[2], data);
+ sds->tex = GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], 4, data);
MEM_freeN(data);
}
/* density only */
else {
- sds->tex = GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], smoke_get_density(sds->fluid));
+ sds->tex = GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], 1, smoke_get_density(sds->fluid));
}
- sds->tex_flame = (smoke_has_fuel(sds->fluid)) ? GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], smoke_get_flame(sds->fluid)) : NULL;
+ sds->tex_flame = (smoke_has_fuel(sds->fluid)) ? GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], 1, smoke_get_flame(sds->fluid)) : NULL;
}
else if (!sds->tex && highres) {
/* rgba texture for color + density */
if (smoke_turbulence_has_colors(sds->wt)) {
float *data = MEM_callocN(sizeof(float)*smoke_turbulence_get_cells(sds->wt)*4, "smokeColorTexture");
smoke_turbulence_get_rgba(sds->wt, data, 0);
- sds->tex = GPU_texture_create_3D_rgba(sds->res_wt[0], sds->res_wt[1], sds->res_wt[2], data);
+ sds->tex = GPU_texture_create_3D(sds->res_wt[0], sds->res_wt[1], sds->res_wt[2], 4, data);
MEM_freeN(data);
}
/* density only */
else {
- sds->tex = GPU_texture_create_3D(sds->res_wt[0], sds->res_wt[1], sds->res_wt[2], smoke_turbulence_get_density(sds->wt));
+ sds->tex = GPU_texture_create_3D(sds->res_wt[0], sds->res_wt[1], sds->res_wt[2], 1, smoke_turbulence_get_density(sds->wt));
}
- sds->tex_flame = (smoke_turbulence_has_fuel(sds->wt)) ? GPU_texture_create_3D(sds->res_wt[0], sds->res_wt[1], sds->res_wt[2], smoke_turbulence_get_flame(sds->wt)) : NULL;
+ sds->tex_flame = (smoke_turbulence_has_fuel(sds->wt)) ? GPU_texture_create_3D(sds->res_wt[0], sds->res_wt[1], sds->res_wt[2], 1, smoke_turbulence_get_flame(sds->wt)) : NULL;
}
- sds->tex_shadow = GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], sds->shadow);
+ sds->tex_shadow = GPU_texture_create_3D(sds->res[0], sds->res[1], sds->res[2], 1, sds->shadow);
}
#else // WITH_SMOKE
(void)highres;
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 114db9a851f..798868a5efe 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -442,7 +442,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
}
-GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
+GPUTexture *GPU_texture_create_3D(int w, int h, int depth, int channels, float *fpixels)
{
GPUTexture *tex;
GLenum type, format, internalformat;
@@ -480,90 +480,16 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
GPU_print_error("3D glBindTexture");
- type = GL_FLOAT; // GL_UNSIGNED_BYTE
- format = GL_RED;
- internalformat = GL_INTENSITY;
-
- //if (fpixels)
- // pixels = GPU_texture_convert_pixels(w*h*depth, fpixels);
-
- glTexImage3D(tex->target, 0, internalformat, tex->w, tex->h, tex->depth, 0, format, type, NULL);
-
- GPU_print_error("3D glTexImage3D");
-
- if (fpixels) {
- if (!GPU_non_power_of_two_support() && (w != tex->w || h != tex->h || depth != tex->depth)) {
- /* clear first to avoid unitialized pixels */
- float *zero= MEM_callocN(sizeof(float)*tex->w*tex->h*tex->depth, "zero");
- glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->depth, format, type, zero);
- MEM_freeN(zero);
- }
-
- glTexSubImage3D(tex->target, 0, 0, 0, 0, w, h, depth, format, type, fpixels);
- GPU_print_error("3D glTexSubImage3D");
- }
-
-
- glTexParameterfv(GL_TEXTURE_3D, GL_TEXTURE_BORDER_COLOR, vfBorderColor);
- GPU_print_error("3D GL_TEXTURE_BORDER_COLOR");
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- GPU_print_error("3D GL_LINEAR");
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
- GPU_print_error("3D GL_CLAMP_TO_BORDER");
-
- if (pixels)
- MEM_freeN(pixels);
-
- GPU_texture_unbind(tex);
-
- return tex;
-}
-
-GPUTexture *GPU_texture_create_3D_rgba(int w, int h, int depth, float *fpixels)
-{
- GPUTexture *tex;
- GLenum type, format, internalformat;
- void *pixels = NULL;
- float vfBorderColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
-
- if (!GLEW_VERSION_1_2)
- return NULL;
-
- tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
- tex->w = w;
- tex->h = h;
- tex->depth = depth;
- tex->number = -1;
- tex->refcount = 1;
- tex->target = GL_TEXTURE_3D;
-
- glGenTextures(1, &tex->bindcode);
-
- if (!tex->bindcode) {
- fprintf(stderr, "GPUTexture: texture create failed: %d\n",
- (int)glGetError());
- GPU_texture_free(tex);
- return NULL;
+ type = GL_FLOAT;
+ if (channels == 4) {
+ format = GL_RGBA;
+ internalformat = GL_RGBA;
}
-
- if (!GPU_non_power_of_two_support()) {
- tex->w = power_of_2_max_i(tex->w);
- tex->h = power_of_2_max_i(tex->h);
- tex->depth = power_of_2_max_i(tex->depth);
+ else {
+ format = GL_RED;
+ internalformat = GL_INTENSITY;
}
- tex->number = 0;
- glBindTexture(tex->target, tex->bindcode);
-
- GPU_print_error("3D glBindTexture");
-
- type = GL_FLOAT; // GL_UNSIGNED_BYTE
- format = GL_RGBA;
- internalformat = GL_RGBA;
-
//if (fpixels)
// pixels = GPU_texture_convert_pixels(w*h*depth, fpixels);
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 64eb0146bba..99df51e9ec4 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -302,8 +302,6 @@ typedef struct SmokeModifierData {
struct SmokeCollSettings *coll; /* collision objects */
float time;
int type; /* domain, inflow, outflow, ... */
- int pad;
- int branch_v; /* temp hack to keep track of changes at readfile.c */
} SmokeModifierData;
typedef struct DisplaceModifierData {
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index 766b8fb6d4e..db1e1e16adf 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -68,8 +68,6 @@ DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "AT
DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "" )
DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" )
DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse Bsdf", "" )
-//Custom node for learning purposes
-DefNode( ShaderNode, SH_NODE_MYBSDF_DIFFUSE, 0, "MYBSDF_DIFFUSE", MYBSDFDiffuse, "CustomNode", "" )
DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy Bsdf", "" )
DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glossy, "BSDF_GLASS", BsdfGlass, "Glass Bsdf", "" )
DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent Bsdf", "" )
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 71bb6b4b459..08e0e7b0f93 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -148,7 +148,6 @@ set(SRC
shader/nodes/node_shader_background.c
# shader/nodes/node_shader_bsdf_anisotropic.c # XXX, why not included?
shader/nodes/node_shader_bsdf_diffuse.c
- shader/nodes/node_shader_mybsdf_diffuse.c
shader/nodes/node_shader_bsdf_glossy.c
shader/nodes/node_shader_bsdf_glass.c
shader/nodes/node_shader_bsdf_translucent.c
diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h
index aa68f1add98..49428c06e5f 100644
--- a/source/blender/nodes/NOD_shader.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -83,7 +83,6 @@ void register_node_type_sh_particle_info(struct bNodeTreeType *ttype);
void register_node_type_sh_background(struct bNodeTreeType *ttype);
void register_node_type_sh_bsdf_diffuse(struct bNodeTreeType *ttype);
-void register_node_type_sh_mybsdf_diffuse(struct bNodeTreeType *ttype);//Copy of diffuse node added for testing
void register_node_type_sh_bsdf_glossy(struct bNodeTreeType *ttype);
void register_node_type_sh_bsdf_glass(struct bNodeTreeType *ttype);
void register_node_type_sh_bsdf_translucent(struct bNodeTreeType *ttype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
index 2e62809ed82..d2e2db3e78a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
@@ -42,7 +42,7 @@ static bNodeSocketTemplate sh_node_bsdf_diffuse_out[]= {
static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{
- return GPU_stack_link(mat, "node_bsdf_diffuse", in, out, GPU_builtin(GPU_VIEW_NORMAL));
+ return GPU_stack_link(mat, "node_bsdf_diffuse", in, out, GPU_builtin(GPU_VIEW_NORMAL));
}
/* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_mybsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_mybsdf_diffuse.c
deleted file mode 100644
index 6bf4c45a436..00000000000
--- a/source/blender/nodes/shader/nodes/node_shader_mybsdf_diffuse.c
+++ /dev/null
@@ -1,63 +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) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "../node_shader_util.h"
-
-/* **************** OUTPUT ******************** */
-
-static bNodeSocketTemplate sh_node_mybsdf_diffuse_in[]= {
- { SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_FLOAT, 1, "Roughness", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { -1, 0, "" }
-};
-
-static bNodeSocketTemplate sh_node_mybsdf_diffuse_out[]= {
- { SOCK_SHADER, 0, "BSDF"},
- { -1, 0, "" }
-};
-
-static int node_shader_gpu_mybsdf_diffuse(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
-{
- return GPU_stack_link(mat, "node_mybsdf_diffuse", in, out, GPU_builtin(GPU_VIEW_NORMAL));
-}
-
-/* node type definition */
-void register_node_type_sh_mybsdf_diffuse(bNodeTreeType *ttype)
-{
- static bNodeType ntype;
-
- node_type_base(ttype, &ntype, SH_NODE_MYBSDF_DIFFUSE, "Diffuse Test Shader", NODE_CLASS_SHADER, 0);
- node_type_compatibility(&ntype, NODE_NEW_SHADING);
- node_type_socket_templates(&ntype, sh_node_mybsdf_diffuse_in, sh_node_mybsdf_diffuse_out);
- node_type_size(&ntype, 150, 60, 200);
- node_type_init(&ntype, NULL);
- node_type_storage(&ntype, "", NULL, NULL);
- node_type_exec(&ntype, NULL);
- node_type_gpu(&ntype, node_shader_gpu_mybsdf_diffuse);
-
- nodeRegisterType(ttype, &ntype);
-}