Пример #1
0
    void ModelContainerView::doGraphics() {
        i_App->renderDevice->clear();
        RenderDevice *rd = i_App->renderDevice;

        rd->setProjectionAndCameraMatrix(i_App->debugCamera);

        LightingParameters lighting(GameTime(toSeconds(10, 00, AM)));
        //i_SkyRef->render(rd,lighting);
        rd->setAmbientLightColor(Color4(Color3::blue()));
        rd->enableLighting();

        GLight light =GLight::directional(i_App->debugController.getPosition() + i_App->debugController.getLookVector()*2,Color3::white());
        rd->setLight(0,light);


        Array<std::string > keys = iTriVarTable.getKeys();
        Array<std::string>::ConstIterator i = keys.begin();
        while(i != keys.end()) {
            VAR* var = iTriVarTable.get(*i);
            Array<int> indexArray = iTriIndexTable.get(*i);

            rd->beginIndexedPrimitives();
            rd->setVertexArray(*var);
            rd->sendIndices(RenderDevice::LINES, indexArray);
            rd->endIndexedPrimitives();
            ++i;
        }
        i_App->renderDevice->disableLighting();

        for(int i=0; i<gBoxArray.size(); ++i) {
            AABox b = gBoxArray[i];
            Draw::box(b,rd,Color3::red());
        }

        if(iDrawLine) {
            Draw::lineSegment(LineSegment::fromTwoPoints(iPos1, iPos2), rd, iColor, 3);

            if(myfound) {
                Draw::lineSegment(LineSegment::fromTwoPoints(p1, p2), rd, iColor, 3);
                Draw::lineSegment(LineSegment::fromTwoPoints(p2, p3), rd, iColor, 3);
                Draw::lineSegment(LineSegment::fromTwoPoints(p3, p1), rd, iColor, 3);
                Draw::sphere(Sphere(p4,0.5),rd, iColor);
                Draw::sphere(Sphere(p5,0.5),rd, Color3::green());
            }
        }
    }