Exemplo n.º 1
0
void runTests(bool write,BinaryDataHandler &pMem)
{
    runTest  (write,pMem, std::string("Hallo") );
    runTest1 (write,pMem, Time(222.22) );
    runTest  (write,pMem, Color3f(1.1,2.2,3.3) );
    runTest  (write,pMem, Color4f(1.1,2.2,3.3,4.4) );
    runTest  (write,pMem, Color3ub(1,2,3) );
    runTest  (write,pMem, Color4ub(1,2,3,4) );
    runTest  (write,pMem, DynamicVolume(DynamicVolume::BOX_VOLUME) );
    runTest  (write,pMem, DynamicVolume(DynamicVolume::SPHERE_VOLUME) );
    runTest1 (write,pMem, BitVector(0xabcd) );
    runTest  (write,pMem, Plane(Vec3f(1.0,0),0.222) );
    runTest  (write,pMem, Matrix(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) );
    runTest  (write,pMem, Quaternion(Vec3f(1,2,3),22) );
    runTest2<bool>(write,pMem, true );
    runTest  (write,pMem, Int8(-22) );
    runTest  (write,pMem, UInt8(11) );
    runTest  (write,pMem, Int16(-10233) );
    runTest  (write,pMem, UInt16(20233) );
    runTest  (write,pMem, Int32(-222320233) );
    runTest  (write,pMem, UInt32(522320233) );
    runTest<Int64>  (write,pMem, Int64(-522323334) );
    runTest  (write,pMem, UInt64(44523423) );
    runTest  (write,pMem, Real32(22.333224) );
    runTest  (write,pMem, Real64(52.334534533224) );
    runTest  (write,pMem, Vec2f(1.1,2.2) );
    runTest  (write,pMem, Vec3f(1.1,2.2,3.3) );
    runTest  (write,pMem, Vec4f(1.1,2.2,3.3,4.4) );
    runTest  (write,pMem, Pnt2f(1.1,2.2) );
    runTest  (write,pMem, Pnt2d(1.1,2.2) );
    runTest  (write,pMem, Pnt3f(1.1,2.2,3.3) );
    runTest  (write,pMem, Pnt3d(1.1,2.2,3.3) );
    runTest  (write,pMem, Pnt4f(1.1,2.2,3.3,4.4) );
    runTest  (write,pMem, Pnt4d(1.1,2.2,3.3,4.4) );
}
Exemplo n.º 2
0
// Helper function to create an untrimmed rational OSG::Surface Core+Node
// from the controlpoints, dimensions in U & V,
// knotvectors in U & V and the desired error and material.
NodePtr makeSurface(const int numcps, const float xyzw[][4],
                    const int dimU, const int dimV,
                    const int numknotsU, const float *knotsU,
                    const int numknotsV, const float *knotsV,
                    const float error, const MaterialPtr &mat)
{
    SurfacePtr surface;
    NodePtr ret = makeCoredNode<Surface>(&surface);
    GeoPositions4fPtr cps = GeoPositions4f::create();
    int i;
    beginEditCP(cps, GeoPositions4f::GeoPropDataFieldMask);
    {
        cps->clear();
        for (i = 0; i < numcps; ++i)
        {
            cps->getField().push_back(Pnt4f(xyzw[i][0], xyzw[i][1],
                                            xyzw[i][2], xyzw[i][3]));
        }
    }
    endEditCP(cps, GeoPositions4f::GeoPropDataFieldMask);
    beginEditCP(surface);
    {
        // let's clear the trimming
        surface->removeCurves();
        // set up dimensions and knot vectors:
        surface->setDimU( dimU );
        surface->setDimV( dimV );
        surface->editMFKnotsU()->clear();
        for (i = 0; i < numknotsU; ++i)
        {
            surface->editMFKnotsU()->push_back(knotsU[i]);
        }
        surface->editMFKnotsV()->clear();
        for (i = 0; i < numknotsV; ++i)
        {
            surface->editMFKnotsV()->push_back(knotsV[i]);
        }
        // set control points
        surface->setControlPoints(cps);
        // set error
        surface->setError(error);
        // and finally set the material
        surface->setMaterial(mat);
    }
    endEditCP(surface);
    return ret;
}
Exemplo n.º 3
0
void Component::setClipBottomRight(const Pnt2f &value)
{
    setClipBounds(Pnt4f(ComponentBase::getClipBounds()[0],ComponentBase::getClipBounds()[1], value[0], value[1]));
}
Exemplo n.º 4
0
void Component::setClipTopLeft    (const Pnt2f &value)
{
    setClipBounds(Pnt4f(value[0], value[1], ComponentBase::getClipBounds()[2],ComponentBase::getClipBounds()[3]));
}