Ignore:
Timestamp:
Mar 13, 2013, 9:57:03 AM (12 years ago)
Author:
ldelgass
Message:

Fix camera reset for nanovis. Includes refactoring of vector/matrix classes
in nanovis to consolidate into vrmath library. Also add preliminary canonical
view control to clients for testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/ConvexPolygon.cpp

    r3452 r3492  
    2121#include "Trace.h"
    2222
     23using namespace vrmath;
     24
    2325ConvexPolygon::ConvexPolygon(VertexVector newvertices)
    2426{
     
    2729
    2830void
    29 ConvexPolygon::transform(const Mat4x4& mat)
     31ConvexPolygon::transform(const Matrix4x4d& mat)
    3032{
    3133    VertexVector tmp = vertices;
     
    3335
    3436    for (unsigned int i = 0; i < tmp.size(); i++) {
    35         Vector4 vec = tmp[i];
     37        Vector4f vec = tmp[i];
    3638        vertices.push_back(mat.transform(vec));
    3739    }
     
    3941
    4042void
    41 ConvexPolygon::translate(const Vector4& shift)
     43ConvexPolygon::translate(const Vector4f& shift)
    4244{
    4345    VertexVector tmp = vertices;
     
    4547
    4648    for (unsigned int i = 0; i < tmp.size(); i++) {
    47         Vector4 vec = tmp[i];
    48         vertices.push_back(vec+shift);
     49        Vector4f vec = tmp[i];
     50        vertices.push_back(vec + shift);
    4951    }
    5052}
     
    5456
    5557bool
    56 ConvexPolygon::clip(Plane& clipPlane, bool copyToTexcoord)
     58ConvexPolygon::clip(nv::Plane& clipPlane, bool copyToTexcoord)
    5759{
    5860    if (vertices.size() == 0) {
     
    7476    // add it to the new list as well.
    7577
    76     Vector4 plane = clipPlane.getCoeffs();
     78    Vector4f plane = clipPlane.getCoeffs();
    7779
    7880    // This implementation is based on the Mesa 3D library (MIT license)
     
    149151
    150152void
    151 ConvexPolygon::emit(bool useTexture, const Vector3& shift, const Vector3& scale)
     153ConvexPolygon::emit(bool useTexture, const Vector3f& shift, const Vector3f& scale)
    152154{
    153155    if (vertices.size() >= 3) {
     
    156158                glTexCoord4fv((float *)&(vertices[i]));
    157159            }
    158             Vector4 tmp = (vertices[i]);
    159             Vector4 shift_4d = Vector4(shift.x, shift.y, shift.z, 0);
     160            Vector4f tmp = (vertices[i]);
     161            Vector4f shift_4d = Vector4f(shift.x, shift.y, shift.z, 0);
    160162            tmp = tmp + shift_4d;
    161163            tmp.x = tmp.x * scale.x;
Note: See TracChangeset for help on using the changeset viewer.