Ejemplo n.º 1
0
void
Viewer::draw()
{
  alwaysAssertM(render_system, "Rendersystem not created");

  render_system->setColorClearValue(ColorRGB(0, 0, 0));
  render_system->clear();

  if (pcloud)
  {
    render_system->setMatrixMode(Graphics::RenderSystem::MatrixMode::MODELVIEW); render_system->pushMatrix();
    render_system->setMatrixMode(Graphics::RenderSystem::MatrixMode::PROJECTION); render_system->pushMatrix();

      camera = cameraFromBBox(pcloud->getAABB(), width, height, rotation);
      render_system->setCamera(camera);

      Real scale = pcloud->getAABB().getExtent().length();
      pcloud->draw(*render_system, (show_normals ? 0.05 * scale : -1));

      if (show_bbox)
      {
        render_system->setColor(ColorRGB(1, 1, 0));
        drawOutlineBox(pcloud->getAABB());
      }

    render_system->setMatrixMode(Graphics::RenderSystem::MatrixMode::PROJECTION); render_system->popMatrix();
    render_system->setMatrixMode(Graphics::RenderSystem::MatrixMode::MODELVIEW); render_system->popMatrix();
  }

  glutSwapBuffers();
}
void OsmAnd::MapPresentationEnvironment_P::initialize()
{
    _defaultBackgroundColorAttribute = owner->resolvedStyle->getAttribute(QLatin1String("defaultColor"));
    _defaultBackgroundColor = ColorRGB(0xf1, 0xee, 0xe8);

    _shadowOptionsAttribute = owner->resolvedStyle->getAttribute(QLatin1String("shadowRendering"));
    _shadowMode = ShadowMode::NoShadow;
    _shadowColor = ColorRGB(0x96, 0x96, 0x96);

    _polygonMinSizeToDisplayAttribute = owner->resolvedStyle->getAttribute(QLatin1String("polygonMinSizeToDisplay"));
    _polygonMinSizeToDisplay = 0.0;

    _roadDensityZoomTileAttribute = owner->resolvedStyle->getAttribute(QLatin1String("roadDensityZoomTile"));
    _roadDensityZoomTile = 0;

    _roadsDensityLimitPerTileAttribute = owner->resolvedStyle->getAttribute(QLatin1String("roadsDensityLimitPerTile"));
    _roadsDensityLimitPerTile = 0;

    _defaultSymbolPathSpacingAttribute = owner->resolvedStyle->getAttribute(QLatin1String("defaultSymbolPathSpacing"));
    _defaultSymbolPathSpacing = 0.0f;

    _defaultBlockPathSpacingAttribute = owner->resolvedStyle->getAttribute(QLatin1String("defaultBlockPathSpacing"));
    _defaultBlockPathSpacing = 0.0f;

    _globalPathPaddingAttribute = owner->resolvedStyle->getAttribute(QLatin1String("globalPathPadding"));
    _globalPathPadding = 0.0f;

    _desiredStubsStyle = MapStubStyle::Unspecified;
}
Ejemplo n.º 3
0
//----------------------------------------------------------------------------
TriMesh* InverseKinematics::CreatePlane ()
{
    int iVertexQuantity = 4;
    int iTriangleQuantity = 2;

    Vector3f* akVertex = new Vector3f[iVertexQuantity];
    float fSize = 16.0f;
    akVertex[0] = Vector3f(-fSize,-fSize,-0.1f);
    akVertex[1] = Vector3f(+fSize,-fSize,-0.1f);
    akVertex[2] = Vector3f(+fSize,+fSize,-0.1f);
    akVertex[3] = Vector3f(-fSize,+fSize,-0.1f);

    ColorRGB* akColor = new ColorRGB[iVertexQuantity];
    akColor[0] = ColorRGB(0.0f,0.0f,0.25f);
    akColor[1] = ColorRGB(0.0f,0.0f,0.50f);
    akColor[2] = ColorRGB(0.0f,0.0f,0.75f);
    akColor[3] = ColorRGB(0.0f,0.0f,1.00f);

    int* aiConnect = new int[3*iTriangleQuantity];
    aiConnect[0] = 0; aiConnect[1] = 1; aiConnect[2] = 2;
    aiConnect[3] = 0; aiConnect[4] = 2; aiConnect[5] = 3;

    TriMesh* pkPlane = new TriMesh(iVertexQuantity,akVertex,NULL,akColor,
        NULL,iTriangleQuantity,aiConnect);

    return pkPlane;
}
Ejemplo n.º 4
0
World::World() {
    pointLights = new std::vector<PointLight*>();
    sceneObjects = new std::vector<SceneObject*>();
    ambientColor = ColorRGB(0.02, 0.02, 0.02);
    backgroundColor = ColorRGB(0.1, 0.1, 0.1);
    backgroundEnabled = true;
}
Ejemplo n.º 5
0
//----------------------------------------------------------------------------
void Boolean2D::OnDisplay ()
{
    ClearScreen();

    DrawPolySolid(*mPoly0, ColorRGB(255, 0, 0));
    DrawPolySolid(*mPoly1, ColorRGB(0, 255, 0));
    if (mActive)
    {
        DrawPolySolid(*mActive, ColorRGB(0, 0, 255));
    }

    WindowApplication2::OnDisplay();
}
Ejemplo n.º 6
0
void OsmAnd::MapPresentationEnvironment_P::initialize()
{
    _roadDensityZoomTile = 0;
    _roadsDensityLimitPerTile = 0;
    _shadowRenderingMode = 0;
    _shadowRenderingColor = ColorRGB(0x96, 0x96, 0x96);
    _polygonMinSizeToDisplay = 0.0;
    _defaultBgColor = ColorRGB(0xf1, 0xee, 0xe8);

    owner->style->resolveAttribute(QLatin1String("defaultColor"), _attributeRule_defaultColor);
    owner->style->resolveAttribute(QLatin1String("shadowRendering"), _attributeRule_shadowRendering);
    owner->style->resolveAttribute(QLatin1String("polygonMinSizeToDisplay"), _attributeRule_polygonMinSizeToDisplay);
    owner->style->resolveAttribute(QLatin1String("roadDensityZoomTile"), _attributeRule_roadDensityZoomTile);
    owner->style->resolveAttribute(QLatin1String("roadsDensityLimitPerTile"), _attributeRule_roadsDensityLimitPerTile);
}
Ejemplo n.º 7
0
bool PhongMetalMaterial::specularDirection(const ONB& uvw, const Vector3D& v_in, const Vector3D& p, const Vector2D& uv,
        Vector2D& seed, ColorRGB& color, Vector3D& v_out)
{
    float phi = 2* PI* seed.getX();
    //the phong exponent is stored in the red value for the texture at that point
    float exponent = phong_exp->value(uv, p).getRed();
    float cosTheta = pow(1-seed.getY(), 1.0/(exponent+1));
    float sinTheta = sqrt(1-cosTheta*cosTheta);
    float x = cos(phi) * sinTheta;
    float y = sin(phi) * sinTheta;
    float z = cosTheta;


    ONB basis;
    Vector3D w = v_in - 2*dotProduct(v_in, uvw.w())*uvw.w();
    basis.initFromW(w);

    //color = R->value(uv, p);
    ColorRGB r = R->value(uv, p);
    float c = 1 - (dotProduct(v_in, uvw.w()));
    color = r + (ColorRGB(1, 1, 1) + (-r))*(c*c*c*c*c);
    v_out = x*basis.u() + y*basis.v() + z*basis.w();

    if(exponent <10000) seed.scramble();
    return (dotProduct(v_out, uvw.w()) >0 );

}
Ejemplo n.º 8
0
//----------------------------------------------------------------------------
void BallRubberBand::OnDisplay ()
{
    ClearScreen();

    const int halfSize = mWidth/2, sizeM1 = mWidth-1;
    const double dHalfSize = (double)halfSize;

    // Draw the coordinate axes.
    ColorRGB gray(192, 192, 192);
    DrawLine(0, halfSize, sizeM1, halfSize, gray);
    DrawLine(halfSize, 0, halfSize, sizeM1, gray);

    // Draw the ball's path.  The orbit starts in green, finishes in blue,
    // and is a blend of the two colors between.
    int numPositions = (int)mPosition.size();
    float invNumPositions = 1.0f/numPositions;
    for (int i = 0; i < numPositions-1; ++i)
    {
        float w = i*invNumPositions, omw = 1.0f - w;
        unsigned char blue = (unsigned char)(255.0f*omw);
        unsigned char green = (unsigned char)(255.0f*w);
        int x0 = (int)(mPosition[i].X() + dHalfSize + 0.5);
        int y0 = (int)(mPosition[i].Y() + dHalfSize + 0.5);
        int x1 = (int)(mPosition[i+1].X() + dHalfSize + 0.5);
        int y1 = (int)(mPosition[i+1].Y() + dHalfSize + 0.5);
        DrawLine(x0, y0, x1, y1, ColorRGB(0, green, blue));
    }

    WindowApplication2::OnDisplay();
}
Ejemplo n.º 9
0
int main()
{
	// Build scene
	SceneList scene;
	
	scene.push_back(new Sphere(Point3(-320,0,50), 200.0f, ColorRGBA(255,0,0,255)));
	scene.push_back(new Sphere(Point3(320, 0, 50), 200.0f, ColorRGBA(0, 0, 255, 255)));
	scene.push_back(new Sphere(Point3(0, 0, -50), 200.0f, ColorRGBA(0, 255, 0, 255)));
	scene.push_back(new Plane(Vector3(0,1,0), Vector3(0, -150, 0), ColorRGBA(255,255,255,255)));
	
	// Render the scene
	RayTraceSettings settings;
	settings.resolutionWidth  = 600;
	settings.resolutionHeight = 480;
	settings.depth = 255;
	settings.clearColor = ColorRGB(50,50,50);
	settings.eyePosition = Point3(0, 0, 600);
	
	RayTracer rayTracer(settings);
	rayTracer.renderScene(scene);
	
	rayTracer.saveToFile("rayTracerTest.tga");

	// Clean up the scene
	std::for_each(scene.begin(), scene.end(), deleteDynamicObject());
	
	return 0;
}
Ejemplo n.º 10
0
/**********************************************************************************************************************
*   Scene::InitializeScene
*
*   Initialize scene
**********************************************************************************************************************/
bool Scene::InitializeScene(
    __in const unsigned int width,   ///< Scene width
    __in const unsigned int height,  ///< Scene height
    __in SceneCamera* pCamera) ///< Camera handle
{
    ///@todo Initialize scene with a scene file, parse it and populate
    /// object and light list

    m_screenWidth  = width;
    m_screenHeight = height;

    m_pSceneCamera = pCamera;


    ///@note This is a statically initialized scene. I need to dynamically parse a scene file and initialize
    
    // Clear object list
    m_vObjectList.clear();

    // Create a sphere and ass to list
    SceneObject* pSphere = new Sphere(Vector3D(0.0,0.0,10.0, false),
                                      1.0,
                                      "Sphere",
                                      ColorRGB(),
                                      SceneObjectMaterial());
    m_vObjectList.push_back(pSphere);
    
    return true;
}
Ejemplo n.º 11
0
//----------------------------------------------------------------------------
Cloth::Cloth ()
    :
    Application("Cloth",0,0,640,480,ColorRGB(0.85f,0.85f,1.00f))
{
    m_pkSpline = NULL;
    m_pkModule = NULL;
}
Ejemplo n.º 12
0
		void Properties70::parse(Reader &reader, const Reader::Node &node) {
			properties.clear();
			if (!node.properties.empty()) throw new Exception("Properties70 isn't supposed to have direct properties");
			Reader::Node pnode;
			Reader::NodeChildren children = node.children;
			while (reader.next(pnode, children)) {
				if (pnode.name != NodeName::P) throw new Exception("Properties70 can only have P subnodes");
				PropertyValue value;
				std::string key = pnode.properties.at(0).getString();

				value.stype = pnode.properties.at(1).getString();
				value.constructor = pnode.properties.at(2).getString();
				value.flags = pnode.properties.at(3).getString();

				if (value.stype == "bool") {
					value.value.set(!! pnode.properties.at(4).getInt32());
				} else if
					(  value.stype == "Vector3D"
					|| value.stype == "Lcl Translation"
					|| value.stype == "Lcl Rotation"
					|| value.stype == "Lcl Scaling") {
					value.value.set(Vector3D(pnode.properties.at(4).getDouble(), pnode.properties.at(5).getDouble(), pnode.properties.at(6).getDouble()));
				} else if (value.stype == "ColorRGB") {
					value.value.set(ColorRGB(pnode.properties.at(4).getDouble(), pnode.properties.at(5).getDouble(), pnode.properties.at(6).getDouble()));
				} else if (value.stype == "object") {
					// well... no value.
				} else if (pnode.properties.size() != 5) {
					throw Exception("cannot handle unknown Properties70 multi-valued/value-less entry");
				} else {
					value.value = pnode.properties.at(4).value();
				}

				properties.emplace(key, value);
			}
		}
Ejemplo n.º 13
0
const ColorRGB Scene3D::traceRay(const Ray& ray, int depth) const
{

	float closest_t_value = NO_INTERSECT;
	const SceneObject* closest_object = findClosest(ray, closest_t_value);

	if (closest_object == 0)
		return ColorRGB(0,0,0);

	ColorRGB retColor(0,0,0);


	for (int i = 0; i < lights.size(); i++)
	{
		Vector3D normL = ((*lights[i]).get_position()-ray.getPointAt(closest_t_value)).normalize();
		Vector3D normN = (*closest_object).surface_normal(ray.getPointAt(closest_t_value));

		retColor += (*lights[i]).get_color()*(*closest_object).get_color()*std::max((normL*normN),float(0));
		
		if (depth < 6 && (*closest_object).get_reflectivity() > 0)
		{
				Ray reflected_ray = ray.reflect(ray.getPointAt(closest_t_value), (*closest_object).surface_normal(ray.getPointAt(closest_t_value)));
				ColorRGB reflection_color = traceRay(reflected_ray, depth+1);
				retColor+= (*closest_object).get_reflectivity()*reflection_color;
		}
		
	}	


	return retColor;
}
Ejemplo n.º 14
0
//----------------------------------------------------------------------------
ColorRGB ColorRGB::operator* (float fScalar) const
{
    return ColorRGB(
        fScalar*m_afTuple[0],
        fScalar*m_afTuple[1],
        fScalar*m_afTuple[2]);
}
Ejemplo n.º 15
0
//----------------------------------------------------------------------------
ColorRGB ColorRGB::operator+ (const ColorRGB& rkC) const
{
    return ColorRGB(
        m_afTuple[0] + rkC.m_afTuple[0],
        m_afTuple[1] + rkC.m_afTuple[1],
        m_afTuple[2] + rkC.m_afTuple[2]);
}
Ejemplo n.º 16
0
ColorRGB
ColorRGB::jetColorMap(Real val)
{
  val = Math::clamp(val, 0, 1);
  return ColorRGB(ColorRGBInternal::base(val - 0.25),
                  ColorRGBInternal::base(val),
                  ColorRGBInternal::base(val + 0.25));
}
Ejemplo n.º 17
0
//----------------------------------------------------------------------------
GelatinCube::GelatinCube ()
    :
    Application("GelatinCube",0,0,640,480,
        ColorRGB(0.713725f,0.807843f,0.929411f))
{
    m_pkSpline = NULL;
    m_pkModule = NULL;
}
Ejemplo n.º 18
0
//----------------------------------------------------------------------------
Rope::Rope ()
    :
    Application("Rope",0,0,640,480,ColorRGB(0.75f,0.85f,0.95f))
{
    m_pkSpline = NULL;
    m_pkModule = NULL;
    m_fLastIdle = 0.0f;
}
Ejemplo n.º 19
0
CornellBox::CornellBox() : 
    SceneObject(
        glm::translate<float>(0, 0, -40) *
        glm::scale<float>(20, 20, 20) *
        glm::translate<float>(-0.5, -0.5, 0.5),
        ColorRGB()) {
    _calculateGeometry();
}
Ejemplo n.º 20
0
 /** Get a unit magnitude color by dividing by the magnitude. */
 ColorRGB unit() const
 {
   Real len = length();
   if (std::abs(len) < 32 * std::numeric_limits<Real>::min())
     return ColorRGB(0, 0, 0);
   else
     return *this / len;
 }
Ejemplo n.º 21
0
//----------------------------------------------------------------------------
DrawImplicitSurface::DrawImplicitSurface ()
    :
    Application2("DrawImplicitSurface",0,0,g_iSize,g_iSize,
        ColorRGB(1.0f,1.0f,1.0f)),
    m_kRT(F,DF,g_iSize,g_iSize)
{
    m_iMaxSample = 100;
    m_bBlur = false;
}
Ejemplo n.º 22
0
void HouseScene::start() {

    camera->position = glm::vec4(-6.5f,30,-261, 1);
    camera->movement_speed = 100;
    camera->rotation_speed /= 2;
    camera->have_skybox = false;



    white = game->texture_manager->load_png("white_pixel.png", GAME);
    white_normal = game->texture_manager->load_png("normal_pixel.png", GAME);

    camera->background = ColorRGB(0,0,0);

    point_light_shader.create("LightPass/point", ENGINE);

    light[0].transform.set_position(0, 100, 200);
    auto* p = light[0].add_component<PointLight>();
    p->model.material.set_shader(&point_light_shader);
    p->set_diffuse_color(255, 150, 120);
    p->diffuse_intensity = 3;
    p->attenuation = .0005;
    p->specular_intensity =25;
    p->set_specular_color(255, 150,120);



    //Directional light
    dir_light_shader.create("LightPass/directional", ENGINE);


    material.create("Geometry/material", GAME);

    //sponza - sibenik
    sponza.add_component(game->mesh_manager->load_model("sponza", Owner::GAME, material));
    sponza.transform.set_position(0, 0, 0);
    sponza.transform.set_rotation(0, 90, 0);

    sponza.transform.set_scale(.2f,.2f,.2f);

    auto* l = sponza.add_component<DirectionalLight>();
    l->model.material.set_shader(&dir_light_shader);
    l->set_rotation(-70, 10, 0);
    l->diffuse_intensity = 2;
    l->set_diffuse_color(255, 235, 200);
    l->specular_intensity = 30.0;
    l->set_specular_color(255, 235, 200);
    l->ambient_intensity = .25f;
    l->set_ambient_color(255, 235, 200);
    l->blur = 2;
    l->shadow_strength = .8f;

    material.set_uniform("g_Time", 0);
    material.set_uniform("g_Power", 0);


}
Ejemplo n.º 23
0
//----------------------------------------------------------------------------
MapTextureToQuad::MapTextureToQuad ()
    :
    Application2("MapTextureToQuad",0,0,256,256,ColorRGB(1.0f,1.0f,1.0f))
{
    m_pkMap = NULL;
    m_pkImage = NULL;
    m_bMouseDown = false;
    m_iSelected = -1;
}
Ejemplo n.º 24
0
//----------------------------------------------------------------------------
void WrigglingSnake::CreateSnakeHead ()
{
    // Create the snake head as a paraboloid that is attached to the last
    // ring of vertices on the snake body.  These vertices are generated
    // for t = 1.
    int iSliceSamples = m_spkSnakeBody->GetSliceSamples();

    // number of rays (determined by slice samples of tube surface)
    int iRQ = iSliceSamples - 1;

    // number of shells (your choice, specified in application constructor)
    int iSQ = m_iShellQuantity, iSQm1 = iSQ-1;

    // generate vertices (to be filled in by UpdateSnakeHead)
    int iVQuantity = 1 + iRQ*iSQm1;
    Vector3f* akVertex = new Vector3f[iVQuantity];

    // generate vertex colors coordinates
    ColorRGB* akColor = new ColorRGB[iVQuantity];
    for (int i = 0; i < iVQuantity; i++)
        akColor[i] = ColorRGB(0.0f,0.25f,0.0f);

    // generate triangles
    int iTQuantity = iRQ*(2*iSQm1-1);
    int* aiConnect = new int[3*iTQuantity];
    int* piConnect = aiConnect;
    int iT = 0;
    for (int iR0 = iRQ-1, iR1 = 0; iR1 < iRQ; iR0 = iR1++)
    {
        *piConnect++ = 0;
        *piConnect++ = 1+iSQm1*iR0;
        *piConnect++ = 1+iSQm1*iR1;
        iT++;
        for (int iS = 1; iS < iSQm1 ; iS++)
        {
            int i00 = iS+iSQm1*iR0;
            int i01 = iS+iSQm1*iR1;
            int i10 = i00+1;
            int i11 = i01+1;
            *piConnect++ = i00;
            *piConnect++ = i10;
            *piConnect++ = i11;
            *piConnect++ = i00;
            *piConnect++ = i11;
            *piConnect++ = i01;
            iT += 2;
        }
    }

    assert( iT == iTQuantity );

    m_spkSnakeHead = new TriMesh(iVQuantity,akVertex,NULL,akColor,NULL,
        iTQuantity,aiConnect);

    m_spkSnakeRoot->AttachChild(m_spkSnakeHead);
    UpdateSnakeHead();
}
Ejemplo n.º 25
0
int ThrowRayOnScene(Ray3D ray, const Scene *sc, Intersection *intersection) {
    float dist, far_dist = FLT_MAX;
    Intersection test;
    size_t i, l;
    for(i=0 ; i<sc->nbSpheres ; ++i) {
        if(!TestRaySphereIntersection(ray, sc->spheres[i], &test))
            continue;
        dist = SqrNorm(Vector(ray.origin, test.position));
        if(dist >= far_dist)
            continue;
        far_dist = dist;
        *intersection = test;
    }

    if(far_dist == FLT_MAX)
        return 0;

    Color3f lights_contrib = ColorRGB(0,0,0);
    for(l=0 ; l<sc->nbLights ; ++l) {
        const Light *light = &sc->lights[l];

        Vector3D lvec = Normalize(
            Vector(intersection->position, light->position)
        );
        const float strength = DotProduct(intersection->normal, lvec);
        if(strength <= 0.f)
            continue;
        lights_contrib = AddColors(
            lights_contrib,
            MultColors(
                intersection->color, 
                MultColors(
                    light->color,
                    ColorRGB(strength, strength, strength)
                )
            )
        );
    }
    intersection->color = lights_contrib;

    return 1;
}
Ejemplo n.º 26
0
	void OccupancyGrid::initialize()
	{
		for (size_t i = 0; i < height; i++)
		{
			for (size_t j = 0; j < width; j++)
			{
				cells[i][j].c = ColorRGB(0.0f, 0.0f, 0.0f);
				cells[i][j].v = -1;
			}
		}
	}
Ejemplo n.º 27
0
//----------------------------------------------------------------------------
WaterDropFormation::WaterDropFormation ()
    :
    Application("WaterDropFormation",0,0,640,480,ColorRGB(0.5f,0.0f,1.0f))
{
    m_pkSpline = NULL;
    m_pkCircle = NULL;
    m_akCtrlPoint = NULL;
    m_akTarget = NULL;
    m_fSimTime = 0.0f;
    m_fSimDelta = 0.05f;
}
Ejemplo n.º 28
0
//----------------------------------------------------------------------------
WrigglingSnake::WrigglingSnake ()
    :
    Application("WrigglingSnake",0,0,640,480,
        ColorRGB(1.0f,0.823529f,0.607843f))
{
    m_iNumCtrl = 32;
    m_iDegree = 3;
    m_pkCenter = NULL;
    m_afAmplitude = new float[m_iNumCtrl];
    m_afPhase = new float[m_iNumCtrl];
    m_iShellQuantity = 4;
}
Ejemplo n.º 29
0
Environment::Environment()
{
    sun.setDiffuse(ColorRGB(0.7,0.7,0.7));
    sun.setDirection(0.3,-0.5,0.3);
    sun.setShininess(7);
    sun.setSpecular(0.3,0.3,0.3);
    ambient.setColor(0.3,0.3,0.3);
    changed=true;
    wireframe=false;
    shadow=true;
    light=true;
}
Ejemplo n.º 30
0
void CornellBox::_calculateGeometry() {
    
    v0 = glm::vec3(0, 0, 1);
    v1 = glm::vec3(1, 0, 1);
    v2 = glm::vec3(0, 1, 1);
    v3 = glm::vec3(1, 1, 1);
    v4 = glm::vec3(0, 0, -2);
    v5 = glm::vec3(1, 0, -2);
    v6 = glm::vec3(0, 1, -2);
    v7 = glm::vec3(1, 1, -2);
    
    l0 = glm::vec3(0.4, 0.99, -0.9);
    l1 = glm::vec3(0.6, 0.99, -0.9);
    l2 = glm::vec3(0.4, 0.99, -1.1);
    l3 = glm::vec3(0.6, 0.99, -1.1);
    
    //bottom
    triangles.push_back(new Triangle(localToWorld, v0, v4, v1, ColorRGB(0.5, 0.5, 0.4)));
    triangles.push_back(new Triangle(localToWorld, v1, v4, v5, ColorRGB(0.5, 0.5, 0.4)));
    
    //left
    triangles.push_back(new Triangle(localToWorld, v0, v2, v4, ColorRGB(1.0, 0.0, 0.0)));
    triangles.push_back(new Triangle(localToWorld, v2, v6, v4, ColorRGB(1.0, 0.0, 0.0)));
    
    //right
    triangles.push_back(new Triangle(localToWorld, v1, v5, v3, ColorRGB(0.0, 1.0, 0.0)));
    triangles.push_back(new Triangle(localToWorld, v3, v5, v7, ColorRGB(0.0, 1.0, 0.0)));
    
    //top
    triangles.push_back(new Triangle(localToWorld, v2, v3, v6, ColorRGB(0.5, 0.5, 0.4)));
    triangles.push_back(new Triangle(localToWorld, v3, v7, v6, ColorRGB(0.5, 0.5, 0.4)));
    
    //back
    triangles.push_back(new Triangle(localToWorld, v4, v6, v5, ColorRGB(0.5, 0.5, 0.4)));
    triangles.push_back(new Triangle(localToWorld, v5, v6, v7, ColorRGB(0.5, 0.5, 0.4)));
    
    //light
//     triangles.push_back(new Triangle(localToWorld, l0, l2, l1, ColorRGB(1.0, 1.0, 1.0)));
//     triangles.push_back(new Triangle(localToWorld, l1, l2, l3, ColorRGB(1.0, 1.0, 1.0)));
}