コード例 #1
0
    MeshNode* SceneCreator::CreateCornellBox() {
        MeshPtr box = MeshCreator::CreateCube(10, 1, Vector<3,float>(1.0f, 1.0f, 1.0f), true);
        
        IDataBlockPtr color = Float4DataBlockPtr(new DataBlock<4, float>(box->GetGeometrySet()->GetSize()));
        for (unsigned int i = 0; i < color->GetSize(); ++i)
            color->SetElement(i, Vector<4, float>(1.0, 1.0, 1.0, 1.0));
        
        box->GetGeometrySet()->AddAttributeList("color", color);

        IDataBlockPtr colors = box->GetGeometrySet()->GetColors();
        Vector<4,float> red(1.0f, 0.0f, 0.0f, 1.0f);
        colors->SetElement(8, red);
        colors->SetElement(9, red);
        colors->SetElement(10, red);
        colors->SetElement(11, red);
        Vector<4,float> blue(0.0f, 0.0f, 0.8f, 1.0f);
        colors->SetElement(12, blue);
        colors->SetElement(13, blue);
        colors->SetElement(14, blue);
        colors->SetElement(15, blue);
        // Vector<4,float> transparent(0.0f, 0.0f, 0.8f, 0.0f);
        // colors->SetElement(16, transparent);
        // colors->SetElement(17, transparent);
        // colors->SetElement(18, transparent);
        // colors->SetElement(19, transparent);
        
        return new MeshNode(box);
    }
コード例 #2
0
 ISceneNode* SceneCreator::CreateSmallBox() {
     MeshPtr box = MeshCreator::CreateCube(3, 1, Vector<3,float>(1.0f, 1.0f, 1.0f));
     
     IDataBlockPtr color = Float4DataBlockPtr(new DataBlock<4, float>(box->GetGeometrySet()->GetSize()));
     for (unsigned int i = 0; i < color->GetSize(); ++i)
         color->SetElement(i, Vector<4, float>(1.0, 1.0, 1.0, 1.0));
     
     box->GetGeometrySet()->AddAttributeList("color", color);
     
     return new MeshNode(box);
 }
コード例 #3
0
 MeshPtr Rotate(MeshPtr mesh, Quaternion<float> rotate) {
     GeometrySetPtr newGeom = Rotate(mesh->GetGeometrySet(), rotate);
     
     return MeshPtr(new Mesh(mesh->GetIndices(),
                             mesh->GetType(),
                             newGeom,
                             mesh->GetMaterial(),
                             mesh->GetIndexOffset(),
                             mesh->GetDrawingRange()));
 }
コード例 #4
0
 MeshPtr Translate(MeshPtr mesh, Vector<3, float> move) {
     GeometrySetPtr newGeom = Translate(mesh->GetGeometrySet(), move);
     
     return MeshPtr(new Mesh(mesh->GetIndices(),
                             mesh->GetType(),
                             newGeom,
                             mesh->GetMaterial(),
                             mesh->GetIndexOffset(),
                             mesh->GetDrawingRange()));
 }