diff libinterp/corefcn/gl-render.cc @ 18901:df972b9d080a

Translate patch property listeners to C++ (bug #42159) * graphics.in.h (patch::properties::bad_data_msg): new private attribute to store the updaters warnings * graphics.in.h (patch::properties::has_bad_data(std::string &msg)): new public method * graphics.in.h (patch::properties::x/ydata): change default values to be consistent with default faces/vertices * graphics.in.h (patch::properties::faces/vertives/facevertexcdata): add updaters * graphics.in.h (patch::properties::update_fvc/update_data): declare new methods * graphics.in.h (patch::properties::update_x/y/z/cdata): use new update_fvc method * graphics.in.h (patch::properties::update_faces/vertices/facevertexcdata): use new update_data method * gl-render.cc (opengl_renderer::draw_patch): do not render if the patch has incorrect data * graphics.cc (default_patch_x/ydata (void)): new functions * graphics.cc (patch::properties::update_data/fvc): new methods, translated from former setvertexdata and setdata (__patch__.m) except "facecolor" is not updated (matlab compatibility). When incoherent data are found, a warning message is stored in bad_data_msg. * graphics.cc: new static variable updating_patch_data to prevent recurrent calls to update_data and update_fvc * __patch__.m: remove listeners * patch.m: small correction in a demo to take into account the fact "facecolor" is no more updated
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sat, 21 Jun 2014 13:07:57 +0200
parents 096b1a159d1f
children c0fb31c46e87
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Sat Jul 05 10:09:56 2014 +0200
+++ b/libinterp/corefcn/gl-render.cc	Sat Jun 21 13:07:57 2014 +0200
@@ -2208,6 +2208,14 @@
 void
 opengl_renderer::draw_patch (const patch::properties &props)
 {
+  // Do not render if the patch has incoherent data
+  std::string msg;
+  if (props.has_bad_data (msg))
+    {
+      warning ("opengl_renderer: %s. Not rendering.", msg.c_str ());
+      return;
+    }
+
   const Matrix f = props.get_faces ().matrix_value ();
   const Matrix v = xform.scale (props.get_vertices ().matrix_value ());
   Matrix c;