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 |
int Offset[]={1,-1,0,0}; for( int i= 0; i < 4; ++i ) { int iX= iCenterX + iOffset[ i ]; int iY= iCenterY - iOffset[ 3 - i ]; } |
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 |
// TODO: Koordinaten der Vertices eines Würfels mit den Abmessungen fWidth * fHeight * fDepth berechnen. const float fDeltaX = fWidth / 2; const float fDeltaY = fHeight / 2; const float fDeltaZ = fDepth / 2; std::vector<Vector3f> positions; positions.reserve( 8 ); for( unsigned int n = 0; n < 8; n++ ) { positions[ n ].x = ( ( n & 0b100 ) ? +fDeltaX : -fDeltaX ); positions[ n ].y = ( ( n & 0b010 ) ? +fDeltaY : -fDeltaY ); positions[ n ].z = ( ( n & 0b001 ) ? +fDeltaZ : -fDeltaZ ); } // TODO: Die Vertices im Buffer 'positions' per Index referenzieren /* 3------------/7 / | / | 2------------6 | | | | | | 1---------|--5 | / | / |/ |/ 0------------4 y^ /z |/ o----> x Bitcode-Interpretation als Koordinate: xyz ||| 0 = 0b000 1 = 0b001 2 = 0b010 3 = 0b011 4 = 0b100 5 = 0b101 6 = 0b110 7 = 0b111 */ |
Dieser Beitrag wurde bereits 5 mal editiert, zuletzt von »the[V]oid« (04.07.2010, 05:28)
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 |
inline void AABB::BoxCorners(Vec3 (&pts)[8]) const { //! 0-3 - bottom vertices //! 4-7 - top vertices for (uint32 i = 0; i < 8; ++i) { pts[i][0] = m_pts[(i >> 1) & 1][0]; pts[i][1] = m_pts[(i >> 2) & 1][1]; pts[i][2] = m_pts[((i >> 1) ^ i) & 1][2]; } } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
static inline int Log2(uint32 val) { static const uint32 bias = -127; float tmp; _asm { fild [val] fstp [tmp] xor eax, eax mov eax, [tmp] and eax, 0x7F800000 shr eax, 23 add eax, bias } } |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »David_pb« (04.07.2010, 13:18)
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 |
/* Input: - No VertexBuffer - No InputLayout - 1 IndexBuffer (later) - PT: Triangle List - DrawIndexed 6 Indices IndexBuffer: 0, 2, 1, 2, 3, 1 Generating Positions: X Y Z W -1.0, -1.0, 0.0, 1.0 1.0, -1.0, 0.0, 1.0 -1.0, 1.0, 0.0, 1.0 1.0, 1.0, 0.0, 1.0 */ //VertexShader float4 FullscreenQuadVS(uint VertexID : SV_VertexID) : SV_POSITION { float4 vPosition= float4(-1, -1, 0, 1); if(In.VertexID & 1) vPosition.x= 1; if(In.VertexID & 2) vPosition.y= 1; return(vPosition); } |
Werbeanzeige