[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [analitza/aucahuasi/analitzaplot] analitzaplot: The mesh of the surface needs some delemiters,
From:       Percy_Camilo_Triveño_Aucahuasi <percy.camilo.ta () gmail ! com>
Date:       2012-09-27 4:48:18
Message-ID: 20120927044818.BF73BA6042 () git ! kde ! org
[Download RAW message or body]

Git commit 66a85d889f6dd29c22fd0ff33d9765b7f5278ce4 by Percy Camilo Triveño \
Aucahuasi. Committed on 27/09/2012 at 06:48.
Pushed by aucahuasi into branch 'aucahuasi/analitzaplot'.

The mesh of the surface needs some delemiters, that is why the surface show little \
black point that show the contour.

M  +1    -1    analitzaplot/examples/plots3ddemo.cpp
M  +9    -3    analitzaplot/plotter3d.cpp
M  +1    -0    analitzaplot/plotter3d.h
M  +0    -3    analitzaplot/private/abstractsurface.cpp

http://commits.kde.org/analitza/66a85d889f6dd29c22fd0ff33d9765b7f5278ce4

diff --git a/analitzaplot/examples/plots3ddemo.cpp \
b/analitzaplot/examples/plots3ddemo.cpp index ca6e717..44b9349 100644
--- a/analitzaplot/examples/plots3ddemo.cpp
+++ b/analitzaplot/examples/plots3ddemo.cpp
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
     model->addPlot(s->requestPlot(Analitza::Expression("x*x+y*y-z*z= 1/2"), \
                Dim3D).create(Qt::darkBlue, "implicit 2"));
     model->addPlot(s->requestPlot(Analitza::Expression("t->vector{cos(t), sin(t), \
                t}"), Dim3D).create(Qt::green, "curve"));
     model->addPlot(s->requestPlot(Analitza::Expression("(x,y)->x*x"), \
                Dim3D).create(Qt::yellow, "z-map"));
-    model->addPlot(s->requestPlot(Analitza::Expression("(t,p)->1.9"), \
Dim3D).create(Qt::white, "sphere-sphcoords")); +    \
model->addPlot(s->requestPlot(Analitza::Expression("(t,p)->1.9"), \
Dim3D).create(Qt::darkGreen, "sphere-sphcoords"));  //END test calls
 
     if(args->isSet("all-disabled"))
diff --git a/analitzaplot/plotter3d.cpp b/analitzaplot/plotter3d.cpp
index 55ba976..7a65a3a 100644
--- a/analitzaplot/plotter3d.cpp
+++ b/analitzaplot/plotter3d.cpp
@@ -104,11 +104,12 @@ void Plotter3D::initGL()
     GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
     GLfloat lmodel_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
     GLfloat local_view[] = { 1.0 };
-    static GLfloat position[4] = {0.0, 0.0,1000.0, 1.0};
+    static GLfloat position[4] = {0.0, 0.0, 1000.0, 0.0};
 
     glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
     glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
     glLightfv(GL_LIGHT0, GL_POSITION, position);
+    
     glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
     glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view);
 }
@@ -142,12 +143,12 @@ void Plotter3D::setViewport(const QRectF& vp)
 
 void Plotter3D::drawPlots()
 {
-    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     gluPerspective(m_scale, m_viewport.width()/m_viewport.height(), 0.1, 3000);
-    
+
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
     glMultMatrixd(m_rot.data());
@@ -250,6 +251,11 @@ void Plotter3D::drawPlots()
 
         glDrawElements(GL_TRIANGLES, surf->indexes().size(), GL_UNSIGNED_INT, 0);
 
+        fcolor[0] = 0; fcolor[1] = 0; fcolor[2] = 0; fcolor[3] = 1;
+        glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, fcolor);
+        glMaterialfv(GL_BACK, GL_AMBIENT_AND_DIFFUSE, fcolor);
+        glDrawElements(GL_POINTS, surf->indexes().size(), GL_UNSIGNED_INT, 0);
+
         glDisableClientState(GL_VERTEX_ARRAY);  // disable vertex arrays
         glDisableClientState(GL_NORMAL_ARRAY);  // disable normal arrays
         //END draw
diff --git a/analitzaplot/plotter3d.h b/analitzaplot/plotter3d.h
index c19cfdf..9d44737 100644
--- a/analitzaplot/plotter3d.h
+++ b/analitzaplot/plotter3d.h
@@ -149,6 +149,7 @@ class ANALITZAPLOT_EXPORT Plotter3D
         CartesianAxis m_currentAxisIndicator;
         bool m_simpleRotation;
         QVector3D m_simpleRotationVector;
+    QVector3D m_lightpos;
 };
 
 #endif // FUNCTIONSPAINTER3D_H
diff --git a/analitzaplot/private/abstractsurface.cpp \
b/analitzaplot/private/abstractsurface.cpp index b8de47a..e6d05bc 100644
--- a/analitzaplot/private/abstractsurface.cpp
+++ b/analitzaplot/private/abstractsurface.cpp
@@ -157,6 +157,3 @@ QVector3D AbstractSurface::fromParametricArgs(double, double)
 {
     return QVector3D();
 }
-
-    
-    
\ No newline at end of file


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic