void init_objects()
    {
      { // plane
        ogl::CPlaneObjectBuilder* pObjectBuilder = new ogl::CPlaneObjectBuilder;
        pObjectBuilder->setWidth(20.0f);
        pObjectBuilder->setHeight(20.0f);
        pObjectBuilder->setSubdivisions(1);
        // pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
        pObjectP = pObjectBuilder->build();
        delete pObjectBuilder;
      }
      { // box from box-builder
//        ogl::CBoxObjectBuilder* pObjectBuilder = new ogl::CBoxObjectBuilder;
//        pObjectBuilder->setWidth(1.0f);
//        pObjectBuilder->setHeight(1.0f);
//        pObjectBuilder->setDepth(1.0f);
//        pObject = pObjectBuilder->build();
//        pObject->setM(math::translate(0.0f, -1.0f, 5.0f) * math::scale(10.0f));
//        delete pObjectBuilder;
      }
      { // random mesh
        ogl::CAssimpObjectBuilder* pObjectBuilder = new ogl::CAssimpObjectBuilder;
        pObjectBuilder->setFile("box/box.obj");
        pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
        pObject1 = pObjectBuilder->build();
        pObject1->setM(math::translate(0.0f, 0.0f, 2.0f));
        delete pObjectBuilder;
      }
      { // skybox
        ogl::CAssimpObjectBuilder* pObjectBuilder = new ogl::CAssimpObjectBuilder;
        pObjectBuilder->setFile("skybox/skydome.obj");
        pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
        pObjectS = pObjectBuilder->build();
        pObjectS->setM(math::scale(20.0f));
        delete pObjectBuilder;
      }
      { // billboarding
        ogl::CPlaneObjectBuilder* pObjectBuilder = new ogl::CPlaneObjectBuilder;
        pObjectBuilder->setWidth(18.0f);
        pObjectBuilder->setHeight(18.0f);
        pObjectBuilder->setSubdivisions(6);
        // pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
        pObjectB = pObjectBuilder->build();
        delete pObjectBuilder;
        
        ogl::CPngTextureBuilder* pTextureBuilder = new ogl::CPngTextureBuilder;
        pTextureBuilder->setFile("monster.png");
        ogl::CTexture* pTexture = pTextureBuilder->build();
        pTexture->setWrapping(ogl::CTexture::EWrapping::CLAMP_TO_BORDER);
        delete pTextureBuilder;
        
        ogl::CMaterial* pMaterial = new ogl::CMaterial;
        pMaterial->setTexture(ogl::CTexture::EScope::DIFFUSE, pTexture);
        
        pObjectB->setMode(GL_POINTS);
        pObjectB->getShape(0)->setMaterial(pMaterial);
      }
    }
 void init_objects()
 {
   { // plane
     ogl::CPlaneObjectBuilder* pObjectBuilder = new ogl::CPlaneObjectBuilder;
     pObjectBuilder->setWidth(10.0f);
     pObjectBuilder->setHeight(10.0f);
     pObjectBuilder->setSubdivisions(10);
     //pObjectBuilder->addOption(ogl::CPlaneObjectBuilder::REPEAT_UV);
     pObjectBuilder->addOption(ogl::CPlaneObjectBuilder::TANGENTS);
     //pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
     pObjectP = pObjectBuilder->build();
     
     ogl::CDdsTextureBuilder* pTextureBuilder = new ogl::CDdsTextureBuilder;
     pTextureBuilder->setFile("ground/rocks_d.dds");
     pObjectP->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::DIFFUSE, pTextureBuilder->build());
     pTextureBuilder->setFile("ground/rocks_h.dds");
     pObjectP->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::HEIGHT, pTextureBuilder->build()); // displacement
     
     delete pObjectBuilder;
   }
   {
     ogl::CAssimpObjectBuilder* pObjectBuilder = new ogl::CAssimpObjectBuilder;
     pObjectBuilder->setFile("monkey/monkey.obj");
     pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
     pObject0 = pObjectBuilder->build();
     pObject0->setM(math::translate(0.0f, 2.0f, 0.0f) * math::rotate(-90.0f, math::X));
     delete pObjectBuilder;
   }
 }
Exemplo n.º 3
0
 void load_objects()
 {
   ogl::CBoxObjectBuilder* pObjectBuilder = new ogl::CBoxObjectBuilder;
   pObjectBuilder->setWidth(1.0f);
   pObjectBuilder->setHeight(1.0f);
   pObjectBuilder->setDepth(1.0f);
   pObject = pObjectBuilder->build();
   pObject->setM(math::rotate(45.0f, math::Z) * math::translate(0.0f, 0.0f, 4.0f));
   delete pObjectBuilder;
 }
    void init_objects()
    {
        {
            ogl::CPlaneObjectBuilder* pObjectBuilder = new ogl::CPlaneObjectBuilder;
            pObjectBuilder->setWidth(10.0f);
            pObjectBuilder->setHeight(10.0f);
            pObjectBuilder->setSubdivisions(1);
            // pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
            pObjectQ = pObjectBuilder->build();
            delete pObjectBuilder;
        }
        {
//        ogl::CBoxObjectBuilder* pObjectBuilder = new ogl::CBoxObjectBuilder;
//        pObjectBuilder->setWidth(1.0f);
//        pObjectBuilder->setHeight(1.0f);
//        pObjectBuilder->setDepth(1.0f);
//        pObject = pObjectBuilder->build();
//        pObject->setM(math::translate(0.0f, -1.0f, 5.0f) * math::scale(10.0f));
//        delete pObjectBuilder;
        }
        {
            ogl::CAssimpObjectBuilder* pObjectBuilder = new ogl::CAssimpObjectBuilder;
            pObjectBuilder->setFile("box/box.obj");
            pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
            pObject1 = pObjectBuilder->build();
            pObject1->setM(math::translate(0.0f, 0.0f, 2.0f));
            delete pObjectBuilder;
        }

        {
            ogl::CAssimpObjectBuilder* pObjectBuilder = new ogl::CAssimpObjectBuilder;
            pObjectBuilder->setFile("skybox/skydome.obj");
            pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
            pObjectS = pObjectBuilder->build();
            pObjectS->setM(math::scale(20.0f));
            delete pObjectBuilder;
        }
    }