Revert "Object Info node support for GLSL mode and the internal render"
This reverts commit 76425feed8.
** Note **
This was supposed to be a merge, but it was rebased.
This commit is contained in:
@@ -97,7 +97,6 @@ typedef enum GPUBuiltin {
|
||||
GPU_PARTICLE_ANG_VELOCITY = (1 << 12),
|
||||
GPU_LOC_TO_VIEW_MATRIX = (1 << 13),
|
||||
GPU_INVERSE_LOC_TO_VIEW_MATRIX = (1 << 14),
|
||||
GPU_OBJECT_INFO = (1 << 15)
|
||||
} GPUBuiltin;
|
||||
|
||||
typedef enum GPUOpenGLBuiltin {
|
||||
@@ -213,7 +212,6 @@ bool GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNod
|
||||
|
||||
void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link);
|
||||
void GPU_material_enable_alpha(GPUMaterial *material);
|
||||
GPUBuiltin GPU_get_material_builtins(GPUMaterial *material);
|
||||
GPUBlendMode GPU_material_alpha_blend(GPUMaterial *material, float obcol[4]);
|
||||
|
||||
/* High level functions to create and use GPU materials */
|
||||
@@ -230,7 +228,7 @@ void GPU_material_bind(
|
||||
float viewmat[4][4], float viewinv[4][4], float cameraborder[4], bool scenelock);
|
||||
void GPU_material_bind_uniforms(
|
||||
GPUMaterial *material, float obmat[4][4], float viewmat[4][4], float obcol[4],
|
||||
float autobumpscale, GPUParticleInfo *pi, float object_info[3]);
|
||||
float autobumpscale, GPUParticleInfo *pi);
|
||||
void GPU_material_unbind(GPUMaterial *material);
|
||||
bool GPU_material_bound(GPUMaterial *material);
|
||||
struct Scene *GPU_material_scene(GPUMaterial *material);
|
||||
@@ -327,7 +325,6 @@ struct GPUParticleInfo
|
||||
float location[3];
|
||||
float velocity[3];
|
||||
float angular_velocity[3];
|
||||
int random_id;
|
||||
};
|
||||
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
|
||||
@@ -410,8 +410,6 @@ const char *GPU_builtin_name(GPUBuiltin builtin)
|
||||
return "unfparticlevel";
|
||||
else if (builtin == GPU_PARTICLE_ANG_VELOCITY)
|
||||
return "unfparticleangvel";
|
||||
else if (builtin == GPU_OBJECT_INFO)
|
||||
return "unfobjectinfo";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_threads.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_hash.h"
|
||||
|
||||
#include "DNA_lamp_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
@@ -1881,21 +1880,6 @@ static int gpu_get_particle_info(GPUParticleInfo *pi)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void GPU_get_object_info(float oi[3], Material *mat)
|
||||
{
|
||||
Object *ob = GMS.gob;
|
||||
oi[0] = ob->index;
|
||||
oi[1] = mat->index;
|
||||
unsigned int random;
|
||||
if (GMS.dob) {
|
||||
random = GMS.dob->random_id;
|
||||
}
|
||||
else {
|
||||
random = BLI_hash_int_2d(BLI_hash_string(GMS.gob->id.name + 2), 0);
|
||||
}
|
||||
oi[2] = random * (1.0f/(float)0xFFFFFFFF);
|
||||
}
|
||||
|
||||
int GPU_object_material_bind(int nr, void *attribs)
|
||||
{
|
||||
GPUVertexAttribs *gattribs = attribs;
|
||||
@@ -1955,27 +1939,21 @@ int GPU_object_material_bind(int nr, void *attribs)
|
||||
/* bind glsl material and get attributes */
|
||||
Material *mat = GMS.gmatbuf[nr];
|
||||
GPUParticleInfo partile_info;
|
||||
float object_info[3] = {0};
|
||||
|
||||
float auto_bump_scale;
|
||||
|
||||
GPUMaterial *gpumat = GPU_material_from_blender(GMS.gscene, mat, GMS.is_opensubdiv);
|
||||
GPU_material_vertex_attributes(gpumat, gattribs);
|
||||
|
||||
if (GMS.dob) {
|
||||
if (GMS.dob)
|
||||
gpu_get_particle_info(&partile_info);
|
||||
}
|
||||
|
||||
if (GPU_get_material_builtins(gpumat) & GPU_OBJECT_INFO) {
|
||||
GPU_get_object_info(object_info, mat);
|
||||
}
|
||||
|
||||
GPU_material_bind(
|
||||
gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT),
|
||||
GMS.gviewmat, GMS.gviewinv, GMS.gviewcamtexcofac, GMS.gscenelock);
|
||||
|
||||
auto_bump_scale = GMS.gob->derivedFinal != NULL ? GMS.gob->derivedFinal->auto_bump_scale : 1.0f;
|
||||
GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gob->col, auto_bump_scale, &partile_info, object_info);
|
||||
GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gob->col, auto_bump_scale, &partile_info);
|
||||
GMS.gboundmat = mat;
|
||||
|
||||
/* for glsl use alpha blend mode, unless it's set to solid and
|
||||
|
||||
@@ -124,8 +124,6 @@ struct GPUMaterial {
|
||||
int partvel;
|
||||
int partangvel;
|
||||
|
||||
int objectinfoloc;
|
||||
|
||||
ListBase lamps;
|
||||
bool bound;
|
||||
|
||||
@@ -228,8 +226,6 @@ static int gpu_material_construct_end(GPUMaterial *material, const char *passnam
|
||||
material->partvel = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_VELOCITY));
|
||||
if (material->builtins & GPU_PARTICLE_ANG_VELOCITY)
|
||||
material->partangvel = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_ANG_VELOCITY));
|
||||
if (material->builtins & GPU_OBJECT_INFO)
|
||||
material->objectinfoloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_OBJECT_INFO));
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
@@ -350,14 +346,9 @@ void GPU_material_bind(
|
||||
}
|
||||
}
|
||||
|
||||
GPUBuiltin GPU_get_material_builtins(GPUMaterial *material)
|
||||
{
|
||||
return material->builtins;
|
||||
}
|
||||
|
||||
void GPU_material_bind_uniforms(
|
||||
GPUMaterial *material, float obmat[4][4], float viewmat[4][4], float obcol[4],
|
||||
float autobumpscale, GPUParticleInfo *pi, float object_info[3])
|
||||
float autobumpscale, GPUParticleInfo *pi)
|
||||
{
|
||||
if (material->pass) {
|
||||
GPUShader *shader = GPU_pass_shader(material->pass);
|
||||
@@ -406,9 +397,6 @@ void GPU_material_bind_uniforms(
|
||||
if (material->builtins & GPU_PARTICLE_ANG_VELOCITY) {
|
||||
GPU_shader_uniform_vector(shader, material->partangvel, 3, 1, pi->angular_velocity);
|
||||
}
|
||||
if (material->builtins & GPU_OBJECT_INFO) {
|
||||
GPU_shader_uniform_vector(shader, material->objectinfoloc, 3, 1, object_info);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "GPU_uniformbuffer.h"
|
||||
#include "GPU_texture.h"
|
||||
#include "GPU_matrix.h"
|
||||
#include "GPU_material.h"
|
||||
|
||||
#include "gpu_shader_private.h"
|
||||
|
||||
|
||||
@@ -3578,12 +3578,12 @@ void node_light_falloff(float strength, float tsmooth, out float quadratic, out
|
||||
constant = strength;
|
||||
}
|
||||
|
||||
void node_object_info(mat4 obmat, vec3 info, out vec3 location, out float object_index, out float material_index, out float random)
|
||||
void node_object_info(out vec3 location, out float object_index, out float material_index, out float random)
|
||||
{
|
||||
location = obmat[3].xyz;
|
||||
object_index = info.x;
|
||||
material_index = info.y;
|
||||
random = info.z;
|
||||
location = vec3(0.0);
|
||||
object_index = 0.0;
|
||||
material_index = 0.0;
|
||||
random = 0.0;
|
||||
}
|
||||
|
||||
void node_normal_map(vec4 tangent, vec3 normal, vec3 texnormal, out vec3 outnormal)
|
||||
|
||||
Reference in New Issue
Block a user