Object Info node support for GLSL mode and the internal render
Object Info node can be useful to give some variation to a single material assigned to multiple instances. This patch adds support for Viewport and BI.
{F499530}
Example: {F499528}
Reviewers: merwin, brecht, dfelinto
Reviewed By: brecht
Subscribers: duarteframos, fclem, homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov
Differential Revision: https://developer.blender.org/D2425
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_hash.h"
|
||||
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
@@ -1458,6 +1459,14 @@ ObjectInstanceRen *RE_addRenderInstance(
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill object info */
|
||||
if (dob) {
|
||||
obi->random_id = dob->random_id;
|
||||
}
|
||||
else {
|
||||
obi->random_id = BLI_hash_int_2d(BLI_hash_string(obi->ob->id.name + 2), 0);
|
||||
}
|
||||
|
||||
RE_updateRenderInstance(re, obi, RE_OBJECT_INSTANCES_UPDATE_OBMAT | RE_OBJECT_INSTANCES_UPDATE_VIEW);
|
||||
|
||||
if (mat) {
|
||||
|
||||
@@ -2141,6 +2141,16 @@ const float (*RE_object_instance_get_matrix(struct ObjectInstanceRen *obi, int m
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float RE_object_instance_get_object_pass_index(struct ObjectInstanceRen *obi)
|
||||
{
|
||||
return obi->ob->index;
|
||||
}
|
||||
|
||||
float RE_object_instance_get_random_id(struct ObjectInstanceRen *obi)
|
||||
{
|
||||
return obi->random_id;
|
||||
}
|
||||
|
||||
const float (*RE_render_current_get_matrix(int matrix_id))[4]
|
||||
{
|
||||
switch (matrix_id) {
|
||||
|
||||
Reference in New Issue
Block a user