Vector Transform node support for GLSL mode and the internal renderer
The Vector Transform node is a useful node which is present in the Cycles renderer.
{F144283}
This patch implements the Vector Transform node for GLSL mode and the internal renderer.
Example: {F273060}
Alexander (Blend4Web Team)
Reviewers: brecht, campbellbarton, sergey
Reviewed By: campbellbarton, sergey
Subscribers: psy-fi, duarteframos, RobM, lightbwk, sergey, AlexKowel, valentin_b4w, Evgeny_Rodygin, yurikovelenov
Projects: #bf_blender:_next
Differential Revision: https://developer.blender.org/D909
This commit is contained in:
@@ -1363,6 +1363,26 @@ void project_renderdata(Render *re,
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
void RE_updateRenderInstance(Render *re, ObjectInstanceRen *obi, int flag)
|
||||
{
|
||||
/* flag specifies what things have changed. */
|
||||
if (flag & RE_OBJECT_INSTANCES_UPDATE_OBMAT) {
|
||||
copy_m4_m4(obi->obmat, obi->ob->obmat);
|
||||
invert_m4_m4(obi->obinvmat, obi->obmat);
|
||||
}
|
||||
if (flag & RE_OBJECT_INSTANCES_UPDATE_VIEW) {
|
||||
mul_m4_m4m4(obi->localtoviewmat, re->viewmat, obi->obmat);
|
||||
mul_m4_m4m4(obi->localtoviewinvmat, obi->obinvmat, re->viewinv);
|
||||
}
|
||||
}
|
||||
|
||||
void RE_updateRenderInstances(Render *re, int flag)
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < re->totinstance; i++)
|
||||
RE_updateRenderInstance(re, &re->objectinstance[i], flag);
|
||||
}
|
||||
|
||||
ObjectInstanceRen *RE_addRenderInstance(
|
||||
Render *re, ObjectRen *obr, Object *ob, Object *par,
|
||||
int index, int psysindex, float mat[4][4], int lay, const DupliObject *dob)
|
||||
@@ -1407,6 +1427,8 @@ ObjectInstanceRen *RE_addRenderInstance(
|
||||
}
|
||||
}
|
||||
|
||||
RE_updateRenderInstance(re, obi, RE_OBJECT_INSTANCES_UPDATE_OBMAT | RE_OBJECT_INSTANCES_UPDATE_VIEW);
|
||||
|
||||
if (mat) {
|
||||
copy_m4_m4(obi->mat, mat);
|
||||
copy_m3_m4(mat3, mat);
|
||||
|
||||
@@ -2112,3 +2112,31 @@ float RE_lamp_get_data(ShadeInput *shi, Object *lamp_obj, float col[4], float lv
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
const float (*RE_object_instance_get_matrix(struct ObjectInstanceRen *obi, int matrix_id))[4]
|
||||
{
|
||||
if (obi) {
|
||||
switch (matrix_id) {
|
||||
case RE_OBJECT_INSTANCE_MATRIX_OB:
|
||||
return (const float(*)[4])obi->obmat;
|
||||
case RE_OBJECT_INSTANCE_MATRIX_OBINV:
|
||||
return (const float(*)[4])obi->obinvmat;
|
||||
case RE_OBJECT_INSTANCE_MATRIX_LOCALTOVIEW:
|
||||
return (const float(*)[4])obi->localtoviewmat;
|
||||
case RE_OBJECT_INSTANCE_MATRIX_LOCALTOVIEWINV:
|
||||
return (const float(*)[4])obi->localtoviewinvmat;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const float (*RE_render_current_get_matrix(int matrix_id))[4]
|
||||
{
|
||||
switch(matrix_id) {
|
||||
case RE_VIEW_MATRIX:
|
||||
return (const float(*)[4])R.viewmat;
|
||||
case RE_VIEWINV_MATRIX:
|
||||
return (const float(*)[4])R.viewinv;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user