Example #1
0
FilledVectorNode::FilledVectorNode(const ArgList& args)
    : VectorNode(args),
      m_pFillShape(new Shape(MaterialInfo(GL_REPEAT, GL_REPEAT, false)))
{
    m_FillTexHRef = args.getArgVal<UTF8String>("filltexhref"); 
    setFillTexHRef(m_FillTexHRef);
    m_sFillColorName = args.getArgVal<string>("fillcolor");
    m_FillColor = colorStringToColor(m_sFillColorName);
}
Example #2
0
WorldState::WorldState()
{
    // make sure that the world can hold at least 5 of each object
    // before it needs to reallocate memory
    shaders.reserve(5);
    lights.reserve(5);
    materials.reserve(5);
    textures.reserve(3);

    // start with one light and material by default
    lights.push_back(LightInfo());
    materials.push_back(MaterialInfo());
}
Example #3
0
void RasterNode::setArgs(const ArgList& args)
{
    AreaNode::setArgs(args);
    if ((!ispow2(m_MaxTileSize.x) && m_MaxTileSize.x != -1)
            || (!ispow2(m_MaxTileSize.y) && m_MaxTileSize.y != -1)) 
    {
        throw Exception(AVG_ERR_OUT_OF_RANGE, 
                "maxtilewidth and maxtileheight must be powers of two.");
    }
    bool bMipmap = args.getArgVal<bool>("mipmap");
    m_Material = MaterialInfo(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, bMipmap);
    m_pSurface = new OGLSurface();
}
Example #4
0
Shape* VectorNode::createDefaultShape() const
{
    return new Shape(MaterialInfo(GL_REPEAT, GL_CLAMP_TO_EDGE, false));
}
Example #5
0
 SystemPrimitiveData(){ materialsInfo_.push_back( MaterialInfo() ); }
Example #6
0
void World::loadScene(string filename) {
    // for as4, you can optionally hard-code the scene.  For as5 and as6 it must be loaded from a file.

    if (_FINAL_PROJ) {
        vec4 eye(0.0, 0.0, 0, 1.0);
        vec4 LL(-1.0, -1.0, -3.0, 1.0);
        vec4 UL(-1.0, 1.0, -3.0, 1.0);
        vec4 LR(1.0, -1.0, -3.0, 1.0);
        vec4 UR(1.0, 1.0, -3.0, 1.0);

        _view = Viewport(eye, LL, UL, LR, UR, IMAGE_WIDTH, IMAGE_HEIGHT, 1);

        _lights[LIGHT_DIRECTIONAL].push_back(
            Light(0, vec3(0.5,0.5,-0.5),
                  LightInfo(LIGHT_DIRECTIONAL, vec3(.4, .8, 1.2))));
        _lights[LIGHT_POINT].push_back(
            Light(vec3(0.0,0.0,-14.0), vec3(0.5,0.5,-0.5),
                  LightInfo(LIGHT_POINT, vec3(1.39, 0.2, 0.2))));

        _ambientLight = vec3(.5,.2,.2);
        /*
        _spheres.push_back(Sphere(vec4(-2.5,-1.5,-17.0,1.0), 2.0,
        					MaterialInfo(vec3(.4, .5, .9),
        					.1, .5, .5, 150, 1.0)));
        _spheres.push_back(Sphere(vec4(0.0,4.0,-25.0,1.0), 2.5,
        					MaterialInfo(vec3(.9, .4, .5),
        					.4, .2, .5, 20, 0.0)));
        _spheres.push_back(Sphere(vec4(1.5,-1.5,-10.0,1.0), 1.0,
        					MaterialInfo(vec3(.5, .9, .4),
        					.5, .5, .3, 4, .5)));
        */

        _cubes.push_back(Cube(vec4(-3.5,-3.5,-15.0,1.0), 1.5, MaterialInfo(vec3(.4, .5, .9),
                              .1, .5, .5, 150, 1.0)));

        _cubes.push_back(Cube(vec4(2.0, 1.5, -10,1.0), 1.5, MaterialInfo(vec3(.9, .4, .5),
                              .4, .2, .5, 20, 0.0)));

        _cubes.push_back(Cube(vec4(-3.5,4,-120.0,1.0), 3, MaterialInfo(vec3(.5, .9, .4),
                              .5, .5, .3, 4, .5)));

        _cubes.push_back(Cube(vec4(3.5,-4,-250.0,1.0), 3.5, MaterialInfo(vec3(.5, .9, .4),
                              .5, .5, .3, 4, .5)));

        ksmMod = kspMod = 1.0;
    }

    else if (_ASSIGNMENT >= 5) {
        scene = new Scene(filename);

        loadInstance(scene->getRoot());

        if (_ASSIGNMENT >= 6)
            _bb = new BoundingBox(_spheres, 0);
    }

    if (_ASSIGNMENT <= 4) {
        //vec4 eye(0.0, 0.0, 0, 1.0);
        //vec4 LL(-1.0, -1.0, -3.0, 1.0);
        //vec4 UL(-1.0, 1.0, -3.0, 1.0);
        //vec4 LR(1.0, -1.0, -3.0, 1.0);
        //vec4 UR(1.0, 1.0, -3.0, 1.0);

        //_view = Viewport(eye, LL, UL, LR, UR, IMAGE_WIDTH, IMAGE_HEIGHT);

        //_lights[LIGHT_DIRECTIONAL].push_back(
        //						Light(0, vec3(0.5,0.5,-0.5),
        //						LightInfo(LIGHT_DIRECTIONAL, vec3(.4, .8, 1.2))));
        //_lights[LIGHT_POINT].push_back(
        //						Light(vec3(0.0,0.0,-14.0), vec3(0.5,0.5,-0.5),
        //						LightInfo(LIGHT_POINT, vec3(1.39, 0.2, 0.2))));

        //_ambientLight = vec3(.5,.2,.2);

        //_spheres.push_back(Sphere(vec4(-2.5,-1.5,-17.0,1.0), 2.0,
        //					MaterialInfo(vec3(.4, .5, .9),
        //					.1, .5, .5, 150, 1.0)));
        //_spheres.push_back(Sphere(vec4(0.0,4.0,-25.0,1.0), 2.5,
        //					MaterialInfo(vec3(.9, .4, .5),
        //					.4, .2, .5, 20, 0.0)));
        //_spheres.push_back(Sphere(vec4(1.5,-1.5,-10.0,1.0), 1.0,
        //					MaterialInfo(vec3(.5, .9, .4),
        //					.5, .5, .3, 4, .5)));

        //ksmMod = kspMod = 1.0;
    }
}