• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            4D星宇

            c++

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              57 隨筆 :: 0 文章 :: 39 評論 :: 0 Trackbacks

            #

            posted @ 2008-05-04 15:37 bloodbao 閱讀(171) | 評論 (1)編輯 收藏

            //Function to create a NewtonCollision from irrlicht mesh 
            NewtonCollision 
            *CreateCollisionFromMesh(NewtonWorld *nWorld, scene::IMesh *mesh) 

              
            //Get number of vertices 
              u32 nVertices 
            = 0, nMeshBuffer; 
              
            for( nMeshBuffer = 0 ; nMeshBuffer < mesh->getMeshBufferCount(); ++nMeshBuffer) 
              { 
                scene::IMeshBuffer 
            *buffer = mesh->getMeshBuffer(nMeshBuffer); 
                nVertices 
            += buffer->getVertexCount(); 
              } 

              
            // allocate block for positions of every vertex in mesh, no need to delete 
              
            // anything, the array cleans up for us. 
              core::
            array<core::vector3df> vertices; 
              vertices.reallocate(nVertices); 

              
            //Get mesh buffers and copy face vertices 
              
            for( nMeshBuffer = 0 ; nMeshBuffer < mesh->getMeshBufferCount(); ++nMeshBuffer) 
              { 
                scene::IMeshBuffer 
            *buffer = mesh->getMeshBuffer(nMeshBuffer); 

                
            // handle the irrlicht supported vertex types 
                switch(buffer
            ->getVertexType()) 
                { 
                
            case video::EVT_STANDARD: 
                  { 
                    video::S3DVertex
            * verts = (video::S3DVertex*)buffer->getVertices(); 
                    
            for(u32 v = 0; v < buffer->getVertexCount(); ++v) 
                      vertices.push_back(verts[v].Pos); 
                  } 
                  break; 

                
            case video::EVT_2TCOORDS: 
                  { 
                    video::S3DVertex2TCoords
            * verts = (video::S3DVertex2TCoords*)buffer->getVertices(); 
                    
            for(u32 v = 0; v < buffer->getVertexCount(); ++v) 
                      vertices.push_back(verts[v].Pos); 
                  } 
                  break; 

                
            case video::EVT_TANGENTS: 
                  { 
                    video::S3DVertexTangents
            * verts = (video::S3DVertexTangents*)buffer->getVertices(); 
                    
            for(u32 v = 0; v < buffer->getVertexCount(); ++v) 
                      vertices.push_back(verts[v].Pos); 
                  } 
                  break; 

                default: 
                  return 
            0// don't know vertex type! bail. 
                } 
              } 

              
            //Create Newton collision object 
              return NewtonCreateConvexHull(nWorld, nVertices, 
            &vertices[0].X, sizeof(core::vector3df), NULL); 
            }

            core::
            array<f32> vertices; 
            vertices.reallocate(nVertices 
            * 3); 

            // each loop should be updated 
            for(u32 v = 0; v < buffer->getVertexCount(); ++v) 

              vertices.push_back(verts[v].Pos.X); 
              vertices.push_back(verts[v].Pos.Y); 
              vertices.push_back(verts[v].Pos.Z); 


            // this should be passed to the convex hull function 
            return NewtonCreateConvexHull(nWorld, nVertices, 
            &vertices[0], sizeof(f32 * 3), NULL);
            posted @ 2008-05-04 12:20 bloodbao 閱讀(260) | 評論 (0)編輯 收藏

            IRRLICHT的實現:
            1.波浪是如何實現的?
            先對每個點計算高度,

            void addWave(vector3df& dest, const vector3df source, f32 time

                 dest.Y 
            = source.Y +
             (sinf(((source.X
            /WaveLength) + time)) * WaveHeight) +
             (cosf(((source.Z
            /WaveLength) + time)) * WaveHeight);
            }


            然后再計算法線,
            recalculateNormals(Mesh);
            2.ATMOSphere
            太陽嘛,就是個跟隨時間移動的BILLBOARD,邊緣最好加上霧化效果。
            3.地形編輯器代碼

            if( Terrain && !RightMouseDown && Terrain->getTriangleSelector() )
            {
            LastMousePosition.set( Device
            ->getCursorControl()->getPosition().X, Device->   getCursorControl()->getPosition().Y );
            //計算從鼠標位置到觀察點的射線
            core::line3df line 
            = CollisionMgr->getRayFromScreenCoordinates( 
             core::position2d
            <s32>( LastMousePosition.X, LastMousePosition.Y ) );
            //計算以交點為中心,一定半徑范圍內的點
            core::vector3df spherePosition;
            if( CollisionMgr->getClosestVertex( line, Terrain->getTriangleSelector(), 
             spherePosition, CurrentVertexIndex ) )
                  {
                   LeftMouseDown 
            = true;

                   
            // Get all vertices with the circle
                   SelectedTerrainVertices.clear();
                   core::vector3df intersection;
                   scene::SCollisionTriangle tri;
                   
            if( CollisionMgr->getCollisionPoint( line, Terrain->getTriangleSelector(), intersection, tri ) )
                   {
                    u32 count 
            = 0;
                    SelectedTerrainVertices.reallocate( Terrain
            ->getTriangleSelector()->getTriangleCount() );
                    Terrain
            ->getTriangleSelector()->getVerticesInRadius( SelectedTerrainVertices.pointer(), Terrain->getTriangleSelector()->getTriangleCount(), count, intersection, RedCircleRadius );
                    SelectedTerrainVertices.set_used( count );
                   }

                   return 
            true;
                  }
                 }

            posted @ 2008-05-04 12:17 bloodbao 閱讀(211) | 評論 (0)編輯 收藏

            posted @ 2008-05-01 16:40 bloodbao 閱讀(196) | 評論 (0)編輯 收藏

            posted @ 2008-05-01 11:16 bloodbao 閱讀(190) | 評論 (0)編輯 收藏

            現將場景編輯器測試版上傳,望廣大朋友測試,多謝!
            經過一周的改寫,完成部分功能,這個版本非完全版。
            下載地址:http://pickup.mofile.com/7877768148587694
            共享提取碼:7877768148587694
            圖片在本博客都有!
            VISTA下測試通過!
            嗯,顯卡至少要DX9吧,下一階段把草地,水面,碰撞補齊!

            posted @ 2008-04-30 19:22 bloodbao 閱讀(224) | 評論 (1)編輯 收藏

                                          郁悶,重寫架構
            IRRLICHT的SVN更新到最新版后,出現很多BUG,一調試就出錯。
            原因是用到了FKEDITOR的架構,不適合我的需求,所以下定決心重寫架構,
            還要加上一些腳本支持。
            希望能盡快完工,以便找到工作。
            哎,哪家公司要我啊?
            posted @ 2008-04-26 19:53 bloodbao 閱讀(193) | 評論 (0)編輯 收藏

            各種動作:直飛,翻轉,旋轉。。。

            posted @ 2008-04-24 17:17 bloodbao 閱讀(237) | 評論 (0)編輯 收藏

            posted @ 2008-04-24 16:50 bloodbao 閱讀(134) | 評論 (0)編輯 收藏

            posted @ 2008-04-24 16:48 bloodbao 閱讀(195) | 評論 (0)編輯 收藏

            僅列出標題
            共6頁: 1 2 3 4 5 6 
            国产福利电影一区二区三区久久久久成人精品综合 | 94久久国产乱子伦精品免费 | 97久久精品人人澡人人爽| 久久精品国产精品亜洲毛片| 亚洲国产精品综合久久一线| 久久久久亚洲精品无码蜜桃| 国产午夜精品理论片久久| 久久综合鬼色88久久精品综合自在自线噜噜 | 99久久99久久精品国产| 久久久这里只有精品加勒比| 久久九九全国免费| 久久精品国产久精国产一老狼| 中文字幕一区二区三区久久网站 | 久久久久亚洲AV无码网站| 久久99热这里只有精品国产| 久久精品国产亚洲精品2020 | 伊人久久大香线焦综合四虎| 亚洲午夜久久久久妓女影院| 久久久网中文字幕| 麻豆精品久久精品色综合| 久久久一本精品99久久精品88| 97久久精品人人澡人人爽| 99久久精品午夜一区二区| 久久综合给合综合久久| 国产精品欧美久久久久天天影视 | 97久久久久人妻精品专区 | 2021久久国自产拍精品| 99精品国产综合久久久久五月天| 久久99国产精品成人欧美| 久久久久久a亚洲欧洲aⅴ| 2021久久精品国产99国产精品| 亚洲国产精品久久久天堂| 亚洲精品无码久久千人斩| 狠狠色狠狠色综合久久| 久久精品国产男包| 久久国产色AV免费观看| 久久婷婷激情综合色综合俺也去| 看久久久久久a级毛片| 久久精品国产亚洲AV无码娇色| 人人狠狠综合久久88成人| 久久久久亚洲AV无码网站|