Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Administrator
Zitat von »"chrissi"«
könntest du vielleicht so eine Art Tutorial zum Theme Landschaftdesign mit Octress und Lightmaps herausbringen etc.
Administrator
Zitat von »"Patrick"«
ÄÄhme ich würde bei Allem Respekt davon abraten. Denn David macht das mit einem Model und nicht mit einer Heightmap, nun bis jetzt empfinde ich das Terrain nicht sehr Dynamisch (also bei Granaten Explosionen keine Krater)
Anonymous
unregistriert
Zitat von »"deadlus"«
Das mit den Height-maps würd mich schon interessieren. Kennt da vielleicht jemand ne deutsche tut? englisch tut´s notfalls auch
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
void CTerrain::CreateTerrain(char *Filename, float xs, float ys) { unsigned char aHeightMap[TERRAIN_X + 1][TERRAIN_Y + 1]; D3DVERTEX* pVertexData; short* pIndexData; ifstream File; //load height information from file File.open(Filename,ios::binary); for(unsigned y = 0;y < (TERRAIN_Y + 1);++y) { for(unsigned x = 0;x < (TERRAIN_X + 1);++x) { File.get(aHeightMap[x][y]); } } File.close(); //create vertex buffer and fill in vertcies g_App.GetDevice()->CreateVertexBuffer(sizeof(D3DVERTEX) * m_dwTerrainVertices,D3DUSAGE_WRITEONLY,D3DFVF_CUSTOMVERTEX,D3DPOOL_MANAGED,&m_pTerrainVB,NULL); m_pTerrainVB->Lock(0,0,(void**)&pVertexData,0); for(y = 0;y < (TERRAIN_Y + 1);++y) { for(unsigned x = 0;x < (TERRAIN_X + 1);++x) { pVertexData[x + y * (TERRAIN_X + 1)].fX = (float)x; pVertexData[x + y * (TERRAIN_X + 1)].fY = (float)y; pVertexData[x + y * (TERRAIN_X + 1)].fZ = (float)aHeightMap[x][y] / 15.0f; pVertexData[x + y * (TERRAIN_X + 1)].dwColor = 0xffffffff; } } m_pTerrainVB->Unlock(); //create index buffer and fill in indices g_App.GetDevice()->CreateIndexBuffer(sizeof(short) * m_dwTerrainPrimitives * 3,D3DUSAGE_WRITEONLY,D3DFMT_INDEX16,D3DPOOL_MANAGED,&m_pTerrainIB,NULL); m_pTerrainIB->Lock(0,0,(void**)&pIndexData,0); for(y = 0;y < TERRAIN_Y;++y) { for(unsigned x = 0;x < TERRAIN_X;++x) { *pIndexData++ = x + y * (TERRAIN_X + 1); *pIndexData++ = x + 1 + y * (TERRAIN_X + 1); *pIndexData++ = x + 1 + (y + 1) * (TERRAIN_X + 1); *pIndexData++ = x + y * (TERRAIN_X + 1); *pIndexData++ = x + 1 + (y + 1) * (TERRAIN_X + 1); *pIndexData++ = x + (y + 1) * (TERRAIN_X + 1); } } m_pTerrainIB->Unlock(); } |
Werbeanzeige