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
C-/C++-Quelltext |
|
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 |
if(device_->SetRenderState(D3DRS_LIGHTING, false) != D3D_OK) { EX(L"Failed to set render-state(lightning)!"); } if(device_->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) != D3D_OK) { EX(L"Failed to set render-state(culling)!"); } D3DMATRIX matrix; identity(&matrix); matrix._11 = 2.0f/(float)width_; matrix._22 = 2.0f/(float)height_ ; matrix._33 = 1.0f / (farPlane - nearPlane); matrix._43 = nearPlane / (nearPlane - farPlane); if(device_->SetTransform(D3DTS_PROJECTION, &matrix) != D3D_OK) { EX(L"Failed to set orthogonal matrix!"); } identity(&matrix); matrix._22 = -1.0f; matrix._41 = -((float)width_ * 0.5f); matrix._42 = ((float)height_ * 0.5f); matrix._43 = nearPlane + 0.1f; if(device_->SetTransform(D3DTS_VIEW, &matrix) != D3D_OK) { EX(L"Failed to set view matrix!"); } |
C-/C++-Quelltext |
|
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 |
customvertex sprite[] = { // X Y Z Farbe { 0.0f, 0.0f, 0.5f, 0xFF0FFFFF}, { (float)width_, 0.0f, 0.5f, 0xFF0FFFFF}, { (float)width_, (float)height_, 0.5f, 0xFF0FFFFF} }; if(direct3d::getInstance().getDevice()->CreateVertexBuffer(sizeof(sprite), 0, 0, D3DPOOL_DEFAULT, &vertexbuffer_, NULL) != D3D_OK) { EX(L"Failed to create vertex buffer!"); } customvertex *vertices = NULL; if(vertexbuffer_->Lock(0, sizeof(sprite), (void**)&vertices, 0) != D3D_OK) { EX(L"Lock();"); } memcpy(vertices, sprite, sizeof(sprite)); if (vertexbuffer_->Unlock() != D3D_OK) { EX(L"Unlock();"); } if(direct3d::getInstance().getDevice()->SetFVF(FVF_XYZ_D) != D3D_OK) { EX(L"SetFVF()!"); } identity(&translationMatrix_); translate(5, 5, 0.0f, &translationMatrix_); if(direct3d::getInstance().getDevice()->SetTransform(D3DTS_WORLD, &translationMatrix_) != D3D_OK) { EX(L"SetTransform()!"); } if(direct3d::getInstance().getDevice()->SetStreamSource(0, vertexbuffer_, 0, sizeof(customvertex)) != D3D_OK) { EX(L"SetStreamSource()!"); } if(direct3d::getInstance().getDevice()->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1) != D3D_OK) { EX(L"DrawPrimitive()!"); } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 |
//Linkshändige orthogonale Projektionsmatrix erstellen OMEGA_API ogMatrix ogMatrixProjectionOrthoLH(const float fWidth, const float fHeight, const float fNear, const float fFar) { const float fValue = 1.f / (fFar - fNear); return ogMatrix(2.f / fWidth, 0.0f, 0.0f, 0.0f, 0.0f, 2.f / fHeight, 0.0f, 0.0f, 0.0f, 0.0f, fValue, 0.0f, 0.0f, 0.0f, -fValue * fNear, 1.0f); } |
Werbeanzeige