Contenu connexe
Similaire à 190821 delphi (20)
Plus de Hyeon-Woo Sa (10)
190821 delphi
- 2. 장점
- 윈도 아래 모든 부분을 프로그래밍 가능
- 높은 생산성
- 간결한 코드…?
- c++과 비슷한 low level 프로그래밍 가능
- 빠른 컴파일 속도
- 버전별 호환성이 좋음
- 멀티 플렛폼 지원을 위해 발전 중
- 4. 델파이 vs c#
- 순수 네이티브 / net 가상 머신 위에서 도는
- 메모리 관리
- 20년째 같은 개발환경 / 변화 실버라이트, WPF….
- 7. 햇갈림
- C++ / Delphi
- / (나누기) / div(정수 나누기) / (실수 나누기)
- % / mod
- ! / not
- 12. - if (NOT list.Count > 0) then ~~~~~
- NOT 연산자의 우선순위가 높다
- NOT list.Count를 먼저 해버림
- count가 0 이면
- ~0 이라 -1이 나옴..
- -1 > 0 이라 if문을 넘어간다
- 13. 으아아아 미친
- 델파이의 식별자 (변수 명, 함수 명)은 대소문자를 구분하지 않는다.
- Setter를 정의하면 대입 연산자 := 사용 시 자동으로 setter가 호출된다.
- 16. d3dPenel render
Vector3 originDir, dir;
GetCenterRay(&originDir, &dir);
float x, z;
x = originDir.x - dir.x * originDir.y / dir.y;
z = originDir.z - dir.z * originDir.y / dir.y;
- 17. terrain render
//버퍼 락
if (viewTile1_)
{
pMesh_->LockVertexBuffer(D3DLOCK_NOSYSLOCK,
(void**)&pVertices);
pMesh_->LockAttributeBuffer(D3DLOCK_NOSYSLOCK, &pAttribute);
pMesh_->LockIndexBuffer(D3DLOCK_NOSYSLOCK, (void**)&pIndices);
}
- 18. terrain render
//버퍼 락
if (viewTile2_)
{
pMesh2_->LockVertexBuffer(D3DLOCK_NOSYSLOCK,
(void**)&pVertices2);
pMesh2_->LockAttributeBuffer(D3DLOCK_NOSYSLOCK, &pAttribute2);
pMesh2_->LockIndexBuffer(D3DLOCK_NOSYSLOCK,
(void**)&pIndices2);
- 19. if (viewTile1_ || viewTile2_)
{
for (auto tc : terrainList_)
if (텍셀이 시야 범위 안인가)
tc->FillVertices(&pVertices, &pAttribute, &pVertices2, &pAttribute2, ix,
iz, viewRange_, &cellCount, &cellCount2);
if (viewTile1_)
memset(pAttribute, 0xff, 2 * ((2 * viewRange_ - 1) * (2 * viewRange_ - 1) -
cellCount) * sizeof(DWORD));
if (viewTile2_)
memset(pAttribute2, 0xff, 2 * ((2 * viewRange_ - 1) * (2 * viewRange_ - 1) -
cellCount2) * sizeof(DWORD));
}
- 20. FillVertics
int x1 = qMax(0, qMin(x - viewRange + 1, 255));
int x2 = qMax(0, qMin(x + viewRange - 1, 255));
int z1 = qMax(0, qMin(z - viewRange + 1, 255));
int z2 = qMax(0, qMin(z + viewRange - 1, 255));
-> cellVisible[255][255] memset
- 21. FillVertics
Vector3 vHeight;
for (int i = x1; i <= x2; ++i) {
for (int j = z1; j <= z2; ++j) {
vHeight = Vector3((indexX_ * 256 + i) * CELL_SIZE, 0, (indexZ_ * 256 + j) *
CELL_SIZE);
vHeight.y = terrainMgr->heightmap2_ ? heightMap2_[i][j] : heightMap_[i][j];
cellVisible_[i][j] = CullObject(&vHeight, 1);
}
}
- 22. FillVertics
for (셀 x1 ~ x2, z1~z2)
if (!보이는셀) continue;
for (int k = 0; k < terrainMgr->textureMgr_->curList.size(); ++k) {
//attribue 버퍼 셋팅
**attribute = k; ++(*attribute);
**attribute = k; ++(*attribute);
done = true;
break;
}
- 23. // 보조선 보기
if (viewTile1_)
for (int i = 0; i < cellCount; ++i)
{
pIndices[0] = i * 4; pIndices[1] = i * 4 + 2;
pIndices[2] = i * 4 + 1; pIndices[3] = i * 4;
pIndices[4] = i * 4 + 3; pIndices[5] = i * 4 + 2;
pIndices += 6;
}
pMesh_->UnlockIndexBuffer();
pMesh_->UnlockAttributeBuffer();
pMesh_->UnlockVertexBuffer();
- 24. if (viewTile2_)
for (int i = 0; i < cellCount2; ++i)
{
pIndices2[0] = i * 4; pIndices2[1] = i * 4 + 2;
pIndices2[2] = i * 4 + 1; pIndices2[3] = i * 4;
pIndices2[4] = i * 4 + 3; pIndices2[5] = i * 4 + 2;
pIndices2 += 6;
}
pMesh2_->UnlockIndexBuffer();
pMesh2_->UnlockAttributeBuffer();
pMesh2_->UnlockVertexBuffer();