1.用ogre來繪製乙個立方體
manualobject* cube;
cube = mscenemgr->createmanualobject("cube");
cube->begin("cubematerial");
// 頂點
cube->position( -100, -100, -100); //0
cube->colour(0.0, 0.0, 0.0);
cube->position( 100, -100, -100); //1
cube->colour(1.0, 0.0, 0.0);
cube->position( 100, -100, 100); //2
cube->colour(1.0, 0.0, 1.0);
cube->position( -100, -100, 100); //3
cube->colour(0.0, 0.0, 1.0);
cube->position( -100, 100, -100); //4
cube->colour(0.0, 1.0, 0.0);
cube->position( 100, 100, -100); //5
cube->colour(1.0, 1.0, 0.0);
cube->position( 100, 100, 100); //6
cube->colour(1.0, 1.0, 1.0);
cube->position( -100, 100, 100); //7
cube->colour(0.0, 1.0, 1.0);
索引 cube->********(0, 2, 1);
cube->********(0, 2, 3);
cube->********(3, 4, 0);
cube->********(3, 7, 4);
cube->********(4, 7, 6);
cube->********(4, 6, 5);
cube->********(5, 2, 1);
cube->********(5, 6, 2);
cube->********(0, 4, 1);
cube->********(5, 1, 4);
cube->********(3, 6, 7);
cube->********(3, 2, 6);
cube->end();
scenenode* sn = mscenemgr->getrootscenenode()->createchildscenenode(); sn->attachobject(cube);
2.在上個立方體的基礎上加上6個貼圖
// 建立六個紋理
/// 下面, begin的第乙個引數為要設定的材質名稱
cube->begin("q", renderoperation::ot_********_fan);
cube->position( -100, -100, -100); //0
cube->texturecoord(1, 0);
cube->position( 100, -100, -100); //1
cube->texturecoord(0, 0);
cube->position( 100, -100, 100); //2
cube->texturecoord(0, 1);
cube->position( -100, -100, 100); //3
cube->texturecoord(1, 1);
cube->end();
/// 左面
cube->begin("a", renderoperation::ot_********_fan);
cube->position( -100, -100, 100); //3
cube->texturecoord(1, 0);
cube->position( -100, 100, 100); //7
cube->texturecoord(0, 0);
cube->position( -100, 100, -100); //4
cube->texturecoord(0, 1);
cube->position( -100, -100, -100); //0
cube->texturecoord(1, 1);
cube->end();
/// 上面
cube->begin("z", renderoperation::ot_********_fan);
cube->position( -100, 100, -100); //4
cube->texturecoord(1, 0);
cube->position( -100, 100, 100); //7
cube->texturecoord(0, 0);
cube->position( 100, 100, 100); //6
cube->texturecoord(0, 1);
cube->position( 100, 100, -100); //5
cube->texturecoord(1, 1);
cube->end();
/// 右面
cube->begin("x", renderoperation::ot_********_fan);
cube->position( 100, -100, -100); //1
cube->texturecoord(1, 0);
cube->position( 100, 100, -100); //5
cube->texturecoord(0, 0);
cube->position( 100, 100, 100); //6
cube->texturecoord(0, 1);
cube->position( 100, -100, 100); //2
cube->texturecoord(1, 1);
cube->end();
/// 前面
cube->begin("s", renderoperation::ot_********_fan);
cube->position( 100, -100, -100); //1
cube->texturecoord(1, 0);
cube->position( -100, -100, -100); //0
cube->texturecoord(0, 0);
cube->position( -100, 100, -100); //4
cube->texturecoord(0, 1);
cube->position( 100, 100, -100); //5
cube->texturecoord(1, 1);
cube->end();
/// 後面
cube->begin("w", renderoperation::ot_********_fan);
cube->position( 100, -100, 100); //2
cube->texturecoord(1, 0);
cube->position( 100, 100, 100); //6
cube->texturecoord(0, 0);
cube->position( -100, 100, 100); //7
cube->texturecoord(0, 1);
cube->position( -100, -100, 100); //3
cube->texturecoord(1, 1);
cube->end();
OGRE手動控制骨骼動畫
在ogre中,動畫主要有骨骼動畫,變形動畫,姿態動畫。在我們使用骨骼動畫的時候,通常是在maya 3dmax等動畫軟體中做的動畫,讓其存入.skeleton檔案中,然後在程式中匯入這段動畫。我們還可以手動控制每段骨骼的動作 範例 用ogre的嚮導程式生成乙個sample 1 首先,新增全域性變數 b...
繪製學習曲線,以確定模型的學習狀況
繪製學習曲線,以確定模型的學習狀況 from sklearn.svm import linearsvc from sklearn.learning curve import learning curve 繪製學習曲線,以確定模型的狀況 defplot learning curve estimator...
ogre手動建立視窗需要實現的東西
手動建立視窗需要負責的事項 1.讀取配置檔案並記錄log full screen yes video mode 1024 x 1280 colourdepth fsaa fsaaquality vsync usenvperfhud 所有可能的引數 left toptitle parentwindow...