Added new render pass: "Mist".
[blender.git] / source / blender / nodes / intern / CMP_nodes / CMP_image.c
index 29845d8835cafe83e64b2cfa1ec1597a25fb0b67..0984aa4bfe1de71bb2ddc6705ce8115962f1fe97 100644 (file)
@@ -48,6 +48,7 @@ static bNodeSocketType cmp_node_rlayers_out[]= {
        {       SOCK_RGBA, 0, "Refract",        0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
        {       SOCK_RGBA, 0, "Radio",          0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
        {       SOCK_VALUE, 0, "IndexOB",       0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+       {       SOCK_VALUE, 0, "Mist",          0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
        {       -1, 0, ""       }
 };
 
@@ -149,6 +150,8 @@ void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, I
                out[RRES_OUT_RADIO]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_RADIO);
        if(out[RRES_OUT_INDEXOB]->hasoutput)
                out[RRES_OUT_INDEXOB]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXOB);
+       if(out[RRES_OUT_MIST]->hasoutput)
+               out[RRES_OUT_MIST]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_MIST);
        
 };
 
@@ -212,16 +215,19 @@ static void node_composit_init_image(bNode* node)
 
 bNodeType cmp_node_image= {
        /* *next,*prev */       NULL, NULL,
-   /* type code   */   CMP_NODE_IMAGE,
-   /* name        */   "Image",
-   /* width+range */   120, 80, 300,
-   /* class+opts  */   NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
-   /* input sock  */   NULL,
-   /* output sock */   cmp_node_rlayers_out,
-   /* storage     */   "ImageUser",
-   /* execfunc    */   node_composit_exec_image,
-   /* butfunc     */    NULL,
-       /* initfunc   */    node_composit_init_image
+       /* type code   */       CMP_NODE_IMAGE,
+       /* name        */       "Image",
+       /* width+range */       120, 80, 300,
+       /* class+opts  */       NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
+       /* input sock  */       NULL,
+       /* output sock */       cmp_node_rlayers_out,
+       /* storage     */       "ImageUser",
+       /* execfunc    */       node_composit_exec_image,
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_image,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
 /* **************** RENDER RESULT ******************** */
@@ -233,7 +239,7 @@ static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, in
       CompBuf *buf;
       int buftype= CB_VEC3;
 
-      if(ELEM(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB))
+      if(ELEM3(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST))
          buftype= CB_VAL;
       else if(passcode==SCE_PASS_VECTOR)
          buftype= CB_VEC4;
@@ -279,7 +285,9 @@ void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out
    if(out[RRES_OUT_RADIO]->hasoutput)
       out[RRES_OUT_RADIO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RADIO);
    if(out[RRES_OUT_INDEXOB]->hasoutput)
-      out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB);
+          out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB);
+   if(out[RRES_OUT_MIST]->hasoutput)
+          out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST);
 
 };
 
@@ -330,16 +338,19 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in,
 
 bNodeType cmp_node_rlayers= {
        /* *next,*prev */       NULL, NULL,
-   /* type code   */   CMP_NODE_R_LAYERS,
-   /* name        */   "Render Layers",
-   /* width+range */   150, 100, 300,
-   /* class+opts  */   NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
-   /* input sock  */   NULL,
-   /* output sock */   cmp_node_rlayers_out,
-   /* storage     */   "",
-   /* execfunc    */   node_composit_exec_rlayers,
-   /* butfunc     */    NULL,
-       /* initfunc   */        NULL
+       /* type code   */       CMP_NODE_R_LAYERS,
+       /* name        */       "Render Layers",
+       /* width+range */       150, 100, 300,
+       /* class+opts  */       NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
+       /* input sock  */       NULL,
+       /* output sock */       cmp_node_rlayers_out,
+       /* storage     */       "",
+       /* execfunc    */       node_composit_exec_rlayers,
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 
 };