This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

504
engine/#TMAP32.ASM Normal file
View File

@@ -0,0 +1,504 @@
;************************************************************************************
; MODULE: TMAP32.ASM DATE: DECEMBER 28, 1994
; AUTHOR: SEAN M. KESSLER JUNE 06, 1995
; TARGET: 32 BIT TARGET
; FUNCTION : TEXTURE MAPPING POLYGONS IN PERSPECTIVE
;*************************************************************************************
SMART
.386
.MODEL FLAT
.DATA
.LALL
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\ENGINE\TMAP32.INC
bmData@@mSrcWidth DW 00h
bmData@@mSrcHeight DW 00h
bmData@@mSrcExtent DD 00h
bmData@@mlpSrcPtr DD 00h
bmData@@mDstWidth DW 00h
bmData@@mDstHeight DW 00h
bmData@@mDstExtent DD 00h
bmData@@mlpDstPtr DD 00h
bmData@@mlpDstIndexPtr DD 00h
bmData@@mPrecision DW 4000h
bmData@@mMaskValue DB 0FFh
bmData@@mUseMask DB 00h
MINVALUE EQU -32767
MAXVALUE EQU 32767
MINVERTEX EQU 3
.CODE
LOCALS
divide MACRO varOne,varTwo
mov eax,varOne ; move varOne into eax register
cdq ; convert doubleword in eax to quadword at edx:eax
idiv varTwo ; divide eax/varTwo result to eax, remainder to edx
ENDM
multiply MACRO varOne,varTwo
movzx eax,varOne ; move varOne into eax register
movzx edx,varTwo ; move varTwo into ebx register
imul eax,edx ; perform multiply, result to eax
ENDM
roundEBX MACRO varOne
LOCAL @@return
mov edx,varOne ; move value into edx register
mov ebx,varOne ; move value into ebx register
and edx,00003FFFh ; get remainder into edx register
shr ebx,14 ; get whole number to ebx register
cmp edx,8192 ; if remainder > 8192, increment ebx
jle @@return ; otherwise return
inc ebx ; increment value in ebx
@@return:
ENDM
roundEAX MACRO varOne
LOCAL @@return
mov edx,varOne ; move value into edx register
mov eax,varOne ; move value into eax register
and edx,00003FFFh ; get remainder into edx register
shr eax,14 ; get whole number to eax register
cmp edx,8192 ; if remainder > 8192, increment ebx
jle @@return ; otherwise return
inc eax ; increment value in eax
@@return:
ENDM
getPoint MACRO address,index
movzx eax,index ; move index into eax register
shl eax,02h ; multiply ax by size of far pointer
add eax,address ; add in the address
movzx ebx,[eax].Point@@y ; get the y value to bx register
movzx eax,[eax].Point@@x ; get the x value to ax register
ENDM
newEdge MACRO ; (PureEdge*) in eax, sets edx=1=error, otherwise edx=0
movzx ebx,[eax].PureEdge@@mEdgeDirection ; save edgeDirection
push ebx ; push edgeDirection
push [eax].PureEdge@@mCurrentEdgeEnd ; push currentEdge end (ie) nextEdge index
mov ecx,eax ; move (PureEdge*) to ecx register
call _setupEdge ; attempt to setup new edge
add esp,06h ; readjust the stack
mov edx,eax ; move return code to edx register
ENDM
getSrcDataByte MACRO ; BYTE getSrcDataByte(eax=colRow)
multiply ax,bmData@@mSrcWidth ; multiply (row*width)-> eax
movzx edx,bmData@@mSrcWidth ; move width to edx register
add eax,edx ; add in width (ie) (row*width)+width
mov edx,bmData@@mSrcExtent ; move source bitmap extent to edx
sub edx,eax ; sub result from source bmp extent
add edx,ebx ; add column back in
mov ebx,bmData@@mlpSrcPtr ; move mlpSrcPtr to ebx register
mov cl,byte ptr[ebx+edx] ; get source byte at ebx+edx to cl
ENDM
setDstDataByte MACRO ; void setDstDataByte(cl=charByte)
mov ebx,bmData@@mlpDstIndexPtr ; get scanline pointer to ebx
mov byte ptr[ebx],cl ; move byte into frame bitmap
inc bmData@@mlpDstIndexPtr ; increment scanline pointer
ENDM
setDstIndexPtr MACRO
multiply [esi].PureMap@@myValue,bmData@@mDstWidth ; multiply row*width result to eax
xor edx,edx ; clear edx register
mov dx,bmData@@mDstWidth ; move width into dx register
add eax,edx ; add (row*width)+width
mov edx,bmData@@mDstExtent ; move (width*height) into ebx
sub edx,eax ; calculate addValue-subValue
mov [esi].PureMap@@mBitmapIndex,edx ; save offset into bitmap
ENDM
adjDstIndexPtr MACRO
mov edx,[esi].PureMap@@mBitmapIndex ; retrieve offset into bitmap
movzx ebx,[esi].PureMap@@mxDest ; move column into bx register
add edx,ebx ; now add column number back in
add edx,bmData@@mlpDstPtr ; offset index by start
mov bmData@@mlpDstIndexPtr,edx ; store value into DstIndexPtr
ENDM
increment MACRO ; assumes (PureEdge*) is in eax register, sets carry on error
LOCAL @@newEdge,@@adjTerm,@@error,@@success,@@return
dec [eax].PureEdge@@mRemainingScanLines ; decrement mRemainingScanLines
jz @@newEdge ; if no more scan lines, try to setup new edge
mov ebx,[eax].PureEdge@@mxSourceStep ; get mxSourceStep to ebx register
add ebx,[eax].PureEdge@@mxSource ; add in mxSource
mov [eax].PureEdge@@mxSource,ebx ; replace mxSource with new value
mov ebx,[eax].PureEdge@@mySourceStep ; get mySourceStep into ebx register
add ebx,[eax].PureEdge@@mySource ; add in mySource
mov [eax].PureEdge@@mySource,ebx ; replace mySource with new value
mov bx,[eax].PureEdge@@mxDestLocation ; get mxDestLocation into ebx register
add bx,[eax].PureEdge@@mxStep ; add in mxStep
mov [eax].PureEdge@@mxDestLocation,bx ; replace mxDestLocation with new value
mov bx,[eax].PureEdge@@mxErrorTerm ; get mxErrorTerm to bx register
add bx,[eax].PureEdge@@mxAdjustUp ; add in mxAdjustUp
mov [eax].PureEdge@@mxErrorTerm,bx ; replace mxErrorTerm with new value
cmp bx,00h ; compare mxErrorTerm to zero
jle @@success ; mxErrorTerm is less equal zero
@@adjTerm: ; adjTerm sync address
mov bx,[eax].PureEdge@@mxDestLocation ; get mxDestLocation to bx register
add bx,[eax].PureEdge@@mxDirection ; add in mxDirection
mov [eax].PureEdge@@mxDestLocation,bx ; replace mxDestLocation with new value
mov bx,[eax].PureEdge@@mxErrorTerm ; move mxErrorTerm into bx register
sub bx,[eax].PureEdge@@mxAdjustDown ; add in mxAdjustDown
mov [eax].PureEdge@@mxErrorTerm,bx ; replace mxErrorTerm with new value
jmp @@success ; we're done here
@@newEdge: ; newEdge sync address
newEdge ; attempt to create new edge
cmp edx,0001h ; did prior call fail ?
jne @@success ; no, we're done here
@@error: ; error sync address
stc ; error sets carry
jmp @@return ; jump to return
@@success: ; ok sync address
clc ; success clears carry
@@return: ; return sync address
ENDM
scanOutputLine MACRO ; void scanOutputLine(ecx=(PureEdge*))
LOCAL @@xLoop,@@skipImageBit,@@continue,@@return ; local label
mov edi,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*)lpLeftEdge to ecx register
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource to eax register
mov [esi].PureMap@@mxSource,eax ; move PureEdge::mxSource to PureMap::mxSource
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource to eax register
mov [esi].PureMap@@mySource,eax ; move PureEdge::mySource to PureMap::mySource
mov dx,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax
mov [esi].PureMap@@mxDest,dx ; move PureEdge::mxDestLocation to PureMap::mxDest
mov edi,[esi].PureMap@@mlpRightEdge ; move (PureEdge*)lpRightEdge to ecx register
xor eax,eax ; clear out eax register
mov ax,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax register
mov [esi].PureMap@@mxDestMax,ax ; move PureEdge::mxDestLocation to PureMap::mxDestMax
sub ax,dx ; mxDestMax-mxDest
jz @@return ; if width is zero then return
mov [esi].PureMap@@mDestWidth,eax ; move width into PureMap::mDestWidth
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource into eax
sub eax,[esi].PureMap@@mxSource ; subtract out PureMap::mxSource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mxSourceStep,eax ; move new value to PureMap@@mxSourceStep
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource into eax
sub eax,[esi].PureMap@@mySource ; subtract out PureMap::mySource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mySourceStep,eax ; move new value to PureMap@@mySourceStep
setDstIndexPtr ; set destination index pointer to row/col
@@xLoop: ; xLoop test
mov ax,[esi].PureMap@@mxDest ; move mxDest to ax register
cmp ax,[esi].PureMap@@mxDestMax ; compare mxDest to ax register
jge @@return ; if its greater equal return
cmp ax,bmData@@mDstWidth ; is destination x greater than frame width?
jge @@return ; yes, stop scanning this output line
or ax,ax ; does mxDest extend too far left of frame buffer
jl @@skipImageBit ; if it does then skip putImageBits
adjDstIndexPtr ; adjust index to reflect changed mxDest
@@continue: ; sync address
roundEAX [esi].PureMap@@mySource ; round PureMap@@mySource -> eax (row)
roundEBX [esi].PureMap@@mxSource ; round PureMap@@mxSource -> ebx (col)
getSrcDataByte ; getSrcDataByte at eax=colRow, byteValue gets placed into cl
setDstDataByte ; setDstDataByte at mlpDstIndexPtr,cl=byteValue
@@skipImageBit: ; skipImageBit bypass address
mov eax,[esi].PureMap@@mxSourceStep ; move mxSourceStep to eax
add [esi].PureMap@@mxSource,eax ; add mxSouceStep to mxSource
mov ebx,[esi].PureMap@@mySourceStep ; move mySourceStep to eax
add [esi].PureMap@@mySource,ebx ; add mySourceStep to mySource
inc [esi].PureMap@@mxDest ; increment loop counter
jmp @@xLoop ; loop through xLoop
@@return: ; return sync label
ENDM
scanOutputLineMask MACRO ; void scanOutputLineMask(ecx=(PureEdge*)) - uses mask settings
LOCAL @@xLoop,@@skipImageBit,@@continue,@@return ; local label
mov edi,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*)lpLeftEdge to ecx register
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource to eax register
mov [esi].PureMap@@mxSource,eax ; move PureEdge::mxSource to PureMap::mxSource
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource to eax register
mov [esi].PureMap@@mySource,eax ; move PureEdge::mySource to PureMap::mySource
mov dx,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax
mov [esi].PureMap@@mxDest,dx ; move PureEdge::mxDestLocation to PureMap::mxDest
mov edi,[esi].PureMap@@mlpRightEdge ; move (PureEdge*)lpRightEdge to ecx register
xor eax,eax ; clear out eax register
mov ax,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax register
mov [esi].PureMap@@mxDestMax,ax ; move PureEdge::mxDestLocation to PureMap::mxDestMax
sub ax,dx ; mxDestMax-mxDest
jz @@return ; if width is zero then return
mov [esi].PureMap@@mDestWidth,eax ; move width into PureMap::mDestWidth
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource into eax
sub eax,[esi].PureMap@@mxSource ; subtract out PureMap::mxSource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mxSourceStep,eax ; move new value to PureMap@@mxSourceStep
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource into eax
sub eax,[esi].PureMap@@mySource ; subtract out PureMap::mySource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mySourceStep,eax ; move new value to PureMap@@mySourceStep
setDstIndexPtr ; set destination index pointer to row/col
@@xLoop: ; xLoop test
mov ax,[esi].PureMap@@mxDest ; move mxDest to ax register
cmp ax,[esi].PureMap@@mxDestMax ; compare mxDest to ax register
jge @@return ; if its greater equal return
cmp ax,bmData@@mDstWidth ; is destination x greater than frame width?
jge @@return ; yes, stop scanning this output line
or ax,ax ; does mxDest extend too far left of frame buffer
jl @@skipImageBit ; if it does then skip putImageBits
adjDstIndexPtr ; adjust index to reflect changed mxDest
@@continue: ; sync address
roundEAX [esi].PureMap@@mySource ; round PureMap@@mySource -> eax (row)
roundEBX [esi].PureMap@@mxSource ; round PureMap@@mxSource -> ebx (col)
getSrcDataByte ; getSrcDataByte at eax=colRow, byteValue gets placed into cl
cmp cl,bmData@@mMaskValue ; are we attempting to output a byte in our mask
je @@skipImageBit ; if so then do not set the byte
setDstDataByte ; setDstDataByte at mlpDstIndexPtr,cl=byteValue
@@skipImageBit: ; skipImageBit bypass address
mov eax,[esi].PureMap@@mxSourceStep ; move mxSourceStep to eax
add [esi].PureMap@@mxSource,eax ; add mxSouceStep to mxSource
mov ebx,[esi].PureMap@@mySourceStep ; move mySourceStep to eax
add [esi].PureMap@@mySource,ebx ; add mySourceStep to mySource
inc [esi].PureMap@@mxDest ; increment loop counter
jmp @@xLoop ; loop through xLoop
@@return: ; return sync label
ENDM
_mapTexture proc near ; void mapTexture(PureMap *lpTextureMap)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
pushad ; save all general purpose registers, required.
mov esi,dword ptr[ebp+8] ; move (PureMap*) to esi register
mov edx,[esi].PureMap@@mlpLeftEdge ; move PureMap->mlpLeftEdge to edx
mov bx,[edx].PureEdge@@mMaxVertex ; move left edge mMaxVertex to bx register
getPoint [edx].PureEdge@@mlpDstList,bx ; get point
mov [esi].PureMap@@myValue,bx ; myValue=mLeftEdge[mLeft.maxVertex()].y()
@@forever: ; (ie) while(TRUE)
mov ax,[esi].PureMap@@myValue ; move myValue to ax register
cmp ax,bmData@@mDstHeight ; is myValue greater than frame buffer height
jge @@return ; if so then we're done mapping the texture
cmp ax,00h ; is myValue within frame buffer at all
jl @@skipOutputLine ; if not then skip this output line
cmp bmData@@mUseMask,00h ; are we using mask settings
jne @@scanMask ; if so then scan the output line, excluding masked bits
scanOutputLine ; otherwise just scan the output line
jmp @@skipOutputLine ; jump over the mask code
@@scanMask: ; scanMask sync address
scanOutputLineMask ; scan the output line, apply mask where appropriate
@@skipOutputLine: ; skipOutputLine sync address
mov eax,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*) left edge to eax
increment ; increment along left edge
jc @@return ; if carry set, edge failed to increment, we're done
mov eax,[esi].PureMap@@mlpRightEdge ; move (PureEdge*) right edge to eax
increment ; increment along right edge
jc @@return ; if carry set, edge failed to increment, we're done
inc [esi].PureMap@@myValue ; increment y position
jmp @@forever ; loop until all edges are completed
@@return: ; return sync address
popad ; restore all general purpose registers
pop ebp ; restore old stack frame
retn ; return near to caller
_mapTexture endp
_initEdge proc near ; void initEdge(long edgeType,PureEdge *lpEdge);
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push ebx ; save ebx register
mov ecx,dword ptr[ebp+12] ; move edge ptr to ecx register
call _getMinMaxInfo ; find minimum and maximum vertices
cmp eax,0000h ; make sure previous call returned success
jne @@return ; if not then return
push dword ptr[ebp+8] ; push edge type (-1:leftEdge,1:rightEdge)
push [ecx].PureEdge@@mStartVertex ; push startVertex
call _setupEdge ; now setup the edge
add esp,06h ; readjust the stack
@@return: ; return label
pop ebx ; restore ebx register
pop ebp ; restore old stack frame
retn ; return to caller
_initEdge endp
_setupEdge proc near ; long setupEge(long edgeType,int startVertex);
LOCAL nextVertex:WORD,startVertex:WORD,xDestWidth:WORD,yDestHeight:DWORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; make room for local variables
mov bx,word ptr[ebp+10] ; move edge type to bx register
mov [ecx].PureEdge@@mEdgeDirection,bx ; store edge direction in variable
mov bx,word ptr[ebp+8] ; move startVertex to bx register
mov [ecx].PureEdge@@mStartVertex,bx ; move startVertex into mStartVertex
mov startVertex,bx ; move startVertex into startVertex
@@forever: ; forever loop label
mov bx,startVertex ; move startVertex to bx register
cmp bx,[ecx].PureEdge@@mMinVertex ; is startVertex same as mMinVertex ?
je @@error ; if so then we're all done here
add bx,[ecx].PureEdge@@mEdgeDirection ; add edge direction to startVertex
mov nextVertex,bx ; move result to nextVertex
mov bx,[ecx].PureEdge@@mNumVertexes ; move number of vertexes to bx register
cmp nextVertex,bx ; compare nextVertex to number of vertexes
jge @@zervert ; next vertex is greater eq number of vertexes
cmp nextVertex,00h ; compare nextVertex to zero
jl @@adjvert ; nextVertex is less than zero
jmp @@bypass ; jump over next conditonal
@@zervert: ; handle nextVertex>=number of vertexes
mov nextVertex,00h ; set nextVertex to zero
jmp @@bypass ; jump over next conditional
@@adjvert: ; handle nextVertex<0
dec bx ; decrement value count in bx register
mov nextVertex,bx ; set nextVertex to (numVertex-1)
@@bypass: ; bypass sync address
getPoint [ecx].PureEdge@@mlpDstList,nextVertex ; get mlpDstList[nextVertex]
push bx ; dstList[nextVertex].y() in bx, save it.
getPoint [ecx].PureEdge@@mlpDstList,startVertex ; get mlpDstList[startVertex]
pop ax ; restore first x point to ax
sub ax,bx ; now subtract second x point
mov [ecx].PureEdge@@mRemainingScanLines,ax ; result is mRemainingScanLines
cmp ax,00h ; check scanlines==0
je @@loopNext ; if it's zero, continue
mov yDestHeight,eax ; set yDestHeight
push nextVertex ; save nextVertex value
pop [ecx].PureEdge@@mCurrentEdgeEnd ; restore it to mCurrentEdgeEnd
getPoint [ecx].PureEdge@@mlpSrcList,startVertex ; get mlpSrcList[startVertex]
multiply ax,bmData@@mPrecision ; multiply mxSource by bmData@@mPrecision
mov [ecx].PureEdge@@mxSource,eax ; move srcList[startVertex].x() to mxSource
multiply bx,bmData@@mPrecision ; multiply mySource by bmData@@mPrecision
mov [ecx].PureEdge@@mySource,eax ; move srcList[startVertex].y() to mySource
getPoint [ecx].PureEdge@@mlpSrcList,nextVertex ; get mlpSrcList[nextVertex]
multiply ax,bmData@@mPrecision ; ax by bmData@@mPrecision
mov ebx,[ecx].PureEdge@@mxSource ; mxSource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].x-mxSource-->eax
divide eax,yDestHeight ; divide by yDestHeight, this is mxSourceStep
mov [ecx].PureEdge@@mxSourceStep,eax ; move eax register into mxSourceStep
getPoint [ecx].PureEdge@@mlpSrcList,nextVertex ; get source point
mov eax,ebx ; move point.y into eax register
multiply ax,bmData@@mPrecision ; multiply by precision
mov ebx,[ecx].PureEdge@@mySource ; mySource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].y-mySource-->eax
divide eax,yDestHeight ; divide by yDestHeight, this is mySourceStep
mov [ecx].PureEdge@@mySourceStep,eax ; move eax register into mySourceStep
getPoint [ecx].PureEdge@@mlpDstList,startVertex ; get mlpDstList[startVertex]
mov [ecx].PureEdge@@mxDestLocation,ax ; mxDestLocation=mDstList[startVertex].x()
getPoint [ecx].PureEdge@@mlpDstList,nextVertex ; get dstList[nextVertex]
sub ax,[ecx].PureEdge@@mxDestLocation ; get the width of the segment
mov xDestWidth,ax ; move the width into xDestWidth
cmp xDestWidth,00h ; is the direction negative (ie) left
jl @@negWidth ; yes, handle negative direction
mov [ecx].PureEdge@@mxDirection,01h ; set right direction indicator
mov [ecx].PureEdge@@mxErrorTerm,00h ; set mxErrorTerm to zero
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[ecx].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx
divide eax,ebx ; eax=xDestWidth.mRemainingScanLines
mov [ecx].PureEdge@@mxStep,ax ; move result into mxStep
jmp @@syncOne ; jump over following handler
@@negWidth: ; handle negative direction
mov [ecx].PureEdge@@mxDirection,-1 ; set left direction indicator
neg xDestWidth ; negate the width (ie) make it positive
mov ax,01h ; move one into ax register
sub ax,[ecx].PureEdge@@mRemainingScanLines ; subtract remaining scan lines from 1
mov [ecx].PureEdge@@mxErrorTerm,ax ; move result to mxErrorTerm
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[ecx].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx
divide eax,ebx ; eax=xDestWidth/mRemainingScanLines
neg eax ; negate the result
mov [ecx].PureEdge@@mxStep,ax ; move result back into mxStep
@@syncOne: ; synchronization address
mov [ecx].PureEdge@@mxAdjustUp,dx ; move remainder into mxAdjustUp
push [ecx].PureEdge@@mRemainingScanLines ; save mRemainingScanLines
pop [ecx].PureEdge@@mxAdjustDown ; restore mRemainingScanLines into mxAdjustDown
jmp @@ok ; jump over forever loop
@@loopNext: ; forever loop address
push nextVertex ; save nextVertex on stack
pop [ecx].PureEdge@@mStartVertex ; restore into mStartVertex
push nextVertex ; save nextVertex on stack
pop startVertex ; restore it to local copy of startVertex
jmp @@forever ; continue with loop
@@error: ; error handler
mov eax,0001h ; set ax register to 01h to indicate failure
jmp @@return ; jump over to return label
@@ok: ; success handler
xor eax,eax ; clear out eax register to handle success
@@return: ; return label
add esp,LocalLength ; remove local variables from stack
pop ebp ; restore old stack frame
retn ; return near to caller
_setupEdge endp
_getMinMaxInfo proc near ; long getMinMaxInfo(void)
LOCAL yMin:WORD,yMax:WORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; make room for local variables
push ecx ; save callers ecx register
mov edx,ecx ; move ecx into edx, edx has ptr to PureEdge
cmp [edx].PureEdge@@mNumVertexes,MINVERTEX ; make sure have at least 3 vertexes
jl @@error ; handle error condition
mov yMin,MINVALUE ; start yMin with some low value
mov yMax,MAXVALUE ; start yMax with some high value
xor ecx,ecx ; start at index zero
mov eax,[edx].PureEdge@@mlpDstList ; move address of (Point*) to ebx register
@@iterator: ; loop top
mov bx,[eax].Point@@y ; move point::y to bx register
cmp bx,yMin ; compare with current yMin value
jg @@greater ; point::y greater than current yMin
@@nexttest: ; if I handle the greater condition, still need to do less
cmp bx,yMax ; compare with current yMax value
jl @@less ; point::y less than current yMax
jmp @@looptest ; nuthin, continue with test
@@greater: ; handle greater condition
mov yMin,bx ; set yMin to bx register
mov [edx].PureEdge@@mMinVertex,cx ; move index number of vertex to mMinVertex
jmp @@nexttest ; go perform next test
@@less: ; handle less condition
mov yMax,bx ; set yMax to bx register
mov [edx].PureEdge@@mMaxVertex,cx ; update mMaxVertex with current index
@@looptest: ; falls through to loop
add eax,04h ; add 4 bytes to eax to address next (Point*)
inc cx ; increment cx register
cmp cx,[edx].PureEdge@@mNumVertexes ; have we reeached the number of vertexes yet?
jl @@iterator ; still more vertexes
push [edx].PureEdge@@mMaxVertex ; save mMaxVertex
pop [edx].PureEdge@@mStartVertex ; restore it to mStartVertex
jmp @@ok ; error return sync address
@@error: ; setup for error return code
mov eax,0001h ; move 01h into ax to indicate error
jmp @@return ; jump to return label
@@ok: ; setup for success return code
xor eax,eax ; clear out eax register
@@return: ; return label
pop ecx ; restore callers ecx register
add esp,LocalLength ; pop local variables off stack
pop ebp ; restore old stack frame
retn ; return near to caller
_getMinMaxInfo endp
_setSrcBitmapInfo proc near ; void setSrcBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push eax ; save eax register
push ebx ; save ebx register
mov ax,word ptr[ebp+08h] ; move width into ax register
mov bmData@@mSrcWidth,ax ; move width into bmData@@mSrcWidth
mov bx,word ptr[ebp+0Ch] ; move height into bx register
mov bmData@@mSrcHeight,bx ; move height into bx register
multiply ax,bx ; multiply (width*height)
mov bmData@@mSrcExtent,eax ; (width*height) to mSrcExtent
push dword ptr[ebp+10h] ; save lpBitmapImage on stack
pop bmData@@mlpSrcPtr ; restore in mlpSrcPtr
pop ebx ; restore ebx register
pop eax ; restore eax register
pop ebp ; restore old stack frame
retn ; return near to caller
_setSrcBitmapInfo endp
_setDstBitmapInfo proc near ; void setDstBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push eax ; save eax register
push ebx ; save ebx register
mov ax,word ptr[ebp+08h] ; move width into ax register
mov bmData@@mDstWidth,ax ; move width into mDstWidth
mov bx,word ptr[ebp+0Ch] ; move height into bx register
mov bmData@@mDstHeight,bx ; move height into mDstHeight
multiply ax,bx ; multiply (width*height)
mov bmData@@mDstExtent,eax ; move (width*height) into mDstExtent
push dword ptr[ebp+10h] ; save lpBitmapImage on stack
pop bmData@@mlpDstPtr ; restore in mlpDstPtr
pop ebx ; restore ebx register
pop eax ; restore eax register
pop ebp ; restore old stack frame
retn ; return near to caller
_setDstBitmapInfo endp
_setMaskInfo proc near ; void setMaskInfo(WORD useMask,BYTE maskValue)
push ebp ; save previous stack frame
mov ebp,esp ; create new frame
mov eax,[ebp+08h] ; move useMask into eax register
mov bmData@@mUseMask,al ; move useMask into bmData@@mUseMask
cmp eax,0000h ; check to see if we are using the mask
je @@maskEndProc ; if we're not using mask, don't set mask value
mov eax,[ebp+0Ch] ; move mask value into eax register
mov bmData@@mMaskValue,al ; move mask value into bmData@@mMaskValue
@@maskEndProc: ; end procedure sync address
pop ebp ; restore previous stack frame
retn ; return near to caller
_setMaskInfo endp
public _mapTexture
public _initEdge
public _setSrcBitmapInfo
public _setDstBitmapInfo
public _setMaskInfo
end

258
engine/#UTIL32.ASM Normal file
View File

@@ -0,0 +1,258 @@
;*************************************************************************************
; MODULE: UTIL.ASM DATE: MAY 15, 1998
; AUTHOR: SEAN M. KESSLER
; TARGET: 32 BIT TARGET
; FUNCTION : RESAMPLE FUNCTIONS
;*************************************************************************************
SMART
.386
.MODEL FLAT
.DATA
.CODE
LOCALS
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\COMMON\MATH.INC
setByte MACRO ; setByte, see _lineWINGBlt
LOCAL @@return,@@chkCol,@@endChk ; locals
mov esi,imageBase ; move imageBase to source index register
mov eax,yRunning ; move yRunning to eax register
sar eax,10h ; adjust yRunning, this is row
jl @@return ; if less than zero then we're done
mov ebx,xRunning ; move xRunning to ebx register
sar ebx,10h ; adjust xRunning, this is col
jl @@return ; if less than zero then we're done
cmp eax,[ebp+18h] ; compare row to height
jge @@return ; if row is greater equal height then we're done here
cmp ebx,[ebp+14h] ; compare column to width
jge @@return ; if column is greater equal width then we're done here
mov edx,[ebp+14h] ; move width into bx register
imul eax,edx ; multiply row*width
sub esi,eax ; lpImage-=(row*width)
add esi,edx ; add the width back in, so (row*width)+width
add esi,ebx ; now subtract out the column
mov bl,byte ptr[ebp+1Ch] ; get fill value from stack
mov byte ptr[esi],bl ; move value into bitmap data
@@return:
ENDM
_resampleClip proc near ; short resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClamp)
LOCAL sampleFactor:DWORD,runningFactor:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; adjust stack for local
push esi ; save source index register
push edi ; save destination
push ebx ; save ebx register
mov eax,[ebp+10h] ; move inLen to eax register
cmp eax,0000h ; compare inLen to zero
jle @@errorExit ; if it's less or equal then exit
mov ebx,[ebp+14h] ; move outLen to ebx register
cmp ebx,0000h ; compare outLen to zero
jle @@errorExit ; if it's less or equal then exit
dec eax ; decrement inLen
shl eax,10h ; multiply inLen by 65536L
divide eax,ebx ; divide ((inLen-1L)*65536L)/outLen
mov sampleFactor,eax ; store the factor
dec ebx ; ebx has (outLen-1)
mov ecx,ebx ; copy (outLen-1) to ecx
mov eax,[ebp+18h] ; move outClip to eax register
sub ebx,eax ; subtract (outLen-1L)-outClip, this is clipping region
mov edi,[ebp+0Ch] ; move lpOut to destination index register
add edi,ecx ; edi=lpOut+(outLen-1L)
mov esi,[ebp+08h] ; move lpIn to source index register
multiply ecx,sampleFactor ; multiply (outLen-1)*sampleFactor
mov runningFactor,eax ; save this into runningFactor
@@loopControl: ; loop control sync address
cmp ecx,0000h ; make sure we're within boundary
jl @@exit ; if not then we exit
cmp ecx,ebx ; compare ecx to clipping region
je @@exit ; if it's equal then we're done
mov eax,runningFactor ; move last running factor into eax
round ; round it off
mov dl,byte ptr[esi+eax] ; move source byte to dl register
mov byte ptr[edi],dl ; move source byte to destination address
mov eax,sampleFactor ; move sampleFactor into eax register
sub runningFactor,eax ; subtract from running factor
dec ecx ; decrement counter
dec edi ; advance (backwards) along lpOut array
jmp @@loopControl ; continue processing
@@errorExit: ; error exit return sync address
xor ax,ax ; clear ax register on error
jmp @@endProcedure ; jump to end procedure
@@exit: ; exit sync address
mov ax,01h ; set ax register on success
@@endProcedure: ; end procedure sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
add esp,LocalLength ; remove locals off stack
pop ebp ; restore previous stack frame
retn ; return near to caller
_resampleClip endp
_lineWINGBlt proc near ; void lineWINGBLT(DWORD lpWINGData,Point *lpFirstPoint,Point *lpSecondPoint,DWORD width,DWORD height,WORD value)
LOCAL xRunning:DWORD,yRunning:DWORD,xDelta:DWORD,yDelta:DWORD,xDir:WORD,yDir:WORD, \
imageExtent:DWORD,imageBase:DWORD,steps:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new frame
sub esp,LocalLength ; storage for local symbols
pushad ; save all general purpose registers
mov eax,[ebp+18h] ; move height into eax register
imul eax,[ebp+14h] ; multiply width*height, this is imageExtent
mov imageExtent,eax ; store extent into imageExtent
mov esi,[ebp+08h] ; move wingData into source index register
add esi,imageExtent ; add in imageExtent
mov imageBase,esi ; this is our new imageBase
mov esi,[ebp+0Ch] ; move lpFirstPoint to esi
mov edi,[ebp+10h] ; move lpSecondPoint to edi
mov ax,[esi].Point@@x ; pFirstPoint->x to eax
cmp ax,[edi].Point@@x ; is firstPoint.x == secondPoint.x
jne @@xne ; if x's are not equal then keep going
mov ax,[esi].Point@@y ; pFirstPoint->y to ax
cmp ax,[edi].Point@@y ; is firstPoint.y==secondPoint.y
je @@endLine ; if points are equal no need to draw the line
@@xne:
movsx eax,[esi].Point@@x ; move lpFirstPoint->x to eax
shl eax,10h ; shift into high word
mov xRunning,eax ; this is xRunning
movsx ebx,[esi].Point@@y ; move lpFirstPoint->y to eax
shl ebx,10h ; shift into high word
mov yRunning,ebx ; this is yRunning
mov xDir,01h ; initialize x-direction
mov yDir,01h ; initialize y-direction
movzx eax,[edi].Point@@x ; move secondPoint.x to ax
cmp ax,[esi].Point@@x ; compare secondPoint.x to firstPoint.x
jge @@noxDirChange ; no direction change required
neg xDir ; change line direction along x
@@noxDirChange: ; noxDirChange sync address
movzx ebx,[edi].Point@@y ; move secondPoint.y to ax
cmp bx,[esi].Point@@y ; compare secondPoint.y to firstPoint.y
jge @@noyDirChange ; no direction change requires
neg yDir ; change line direction along y
@@noyDirChange: ; noyDirChange sync address
sub ax,[esi].Point@@x ; move secondPoint.x-firstPoint.x to ax
movsx eax,ax ; adjust sign
mov xDelta,eax ; store difference into xDelta
sub bx,[esi].Point@@y ; move secondPoint.y-firstPoint.y to bx
movsx ebx,bx ; adjust sign
mov yDelta,ebx ; store difference into yDelta
cmp xDelta,00000000h ; is xDelta less than zero
jl @@posxDelta ; if yes then we must adjust xDelta for magnitude
jmp @@skipxFix ; otherwise no adjustment is necessary
@@posxDelta: ; posxDelta sync address
neg xDelta ; make xDelta positive
@@skipxFix: ; skipxFix sync address
cmp yDelta,00000000h ; is yDelta less than zero
jl @@posyDelta ; if yes then we must adjust yDelta for magnitude
jmp @@skipyFix ; otherwise no adjustment is necessary
@@posyDelta: ; posyDelta sync address
neg yDelta ; make yDelta positive
@@skipyFix: ; skipyFix sync address
mov eax,xDelta ; move xDelta into eax register
cmp eax,yDelta ; compare xDelta to yDelta
jge @@xGEy ; handle xDelta>=yDelta
shl eax,10h ; shift xDelta left 16 positions
cmp yDelta,00000000h ; compare yDelta to zero
je @@yEQz ; jump to sync address
divide eax,yDelta ; divide xDelta by yDelta
mov xDelta,eax ; save new xDelta value to xDelta
jmp @@yCMPs ; jump over to sync address
@@yEQz: ; yEQz sync address
mov xDelta,00000001h ; if yDelta is zero then assign one to xDelta
@@yCMPs: ; yCMPs sync address
mov eax,yDelta ; move yDelta to eax register
mov steps,eax ; move yDelta to steps
mov yDelta,10000h ; move 10000h to yDelta
jmp @@startLineDraw ; we're ready to start drawing the line
@@xGEy: ; xGEy sync address
mov eax,yDelta ; move yDelta to eax register
shl eax,10h ; shift left 10h
cmp xDelta,00000000h ; is xDelta zero
jne @@xNEz ; handle xDelta not equal to zero
mov yDelta,00000001h ; if xDelta is zero then yDelta equals one
jmp @@xCMPs ; jump over to sync address
@@xNEz: ; xNEzs sync address
divide eax,xDelta ; divide yDelta by xDelta
mov yDelta,eax ; replace yDelta with new value
@@xCMPs: ; xCMPs sync address
mov eax,xDelta ; move xDelta value into eax register
mov steps,eax ; move xDelta to steps
mov xDelta,10000h ; move 10000h to xDelta
@@startLineDraw: ; startLineDraw sync address
mov ecx,steps ; move steps into ecx register
cmp xDir,0FFFFh ; is xDir negative
je @@checkYDir ; yes it is, now check yDir
cmp yDir,0FFFFh ; is yDir negative
je @@posxDirAndNegyDir ; xDir is positive and yDir is negative
jmp @@posxDirAndPosyDir ; xDir is positive and yDir is positive
@@checkYDir: ; xDir is negative on entry
cmp yDir,0FFFFh ; is yDir negative
je @@negxDirAndNegyDir ; xDir is negative and yDir is negative
@@negxDirAndPosyDir: ; xDir is negative and yDir is positive
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
sub xRunning,eax ; xRunning-=xDelta
mov eax,yDelta ; move yDelta into eax register
add yRunning,eax ; yRunning+=yDelta
dec cx ; decrement cx register
jnz @@negxDirAndPosyDir ; if (cx) continue
jmp @@endLine ; we're done
@@negxDirAndNegyDir: ; xDir==-1&&yDir==-1 sync address
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
sub xRunning,eax ; xRunning-=xDelta
mov eax,yDelta ; move yDelta into eax register
sub yRunning,eax ; yRunning-=yDelta
dec cx ; decrement cx register
jnz @@negxDirAndNegyDir ; if (cx) continue
jmp @@endLine ; we're done
@@posxDirAndNegyDir: ; xDir==1&&yDir==-1 sync address
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
add xRunning,eax ; xRunning+=xDelta
mov eax,yDelta ; move yDelta into eax register
sub yRunning,eax ; yRunning-=yDelta
dec cx ; decrement cx register
jnz @@posxDirAndNegyDir ; if (cx) continue
jmp @@endLine ; we're done here
@@posxDirAndPosyDir: ; xDir==1&&yDir==1
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
add xRunning,eax ; xRunning+=xDelta
mov eax,yDelta ; move yDelta into eax
add yRunning,eax ; yRunning+=yDelta
dec cx ; decrement cx register
jnz @@posxDirAndPosyDir ; if (cx) continue;
@@endLine: ; we're done here
popad ; restore all general purpose registers
add esp,LocalLength ; remove local storage frame
pop ebp ; restore stack frame
retn ; return near to caller
_lineWINGBlt endp
_clearBitmap proc near ; void clearBitmap(DWORD lpBitmapData,DWORD imageExtent)
push edi ; save destination index register
xor eax,eax ; clear eax register
mov edi,[esp+08h] ; move lpBitmapData to esi
mov ecx,[esp+0Ch] ; move bitmap extent to ecx
shr ecx,02h ; divide bitmap extent by sizeof(long)
rep stosd ; clear out the bitmap in chunks of sizeof(long)
pop edi ; restore destination index register
retn ; return near to caller
_clearBitmap endp
_setBits proc near ; void setBits(DWORD lpBitmapData,DWORD imageExtent,BYTE setBit)
push edi ; save destination index register
mov eax,[esp+10h] ; move filler byte into eax register (actually al register)
mov ah,al ; copy filler into high byte
mov cx,ax ; save word at ax into bx
shl eax,10h ; move low word into high word
mov ax,cx ; copy word back into ax
mov edi,[esp+08h] ; move lpBitmapData to esi
mov ecx,[esp+0Ch] ; move bitmap extent to ecx
shr ecx,02h ; divide bitmap extent by sizeof(long)
rep stosd ; clear out the bitmap in chunks of sizeof(long)
pop edi ; restore destination index register
retn ; return near to caller
_setBits endp
public _resampleClip
public _lineWINGBlt
public _clearBitmap
public _setBits
END

25
engine/ANGLE.CPP Normal file
View File

@@ -0,0 +1,25 @@
#include <engine/angle.hpp>
void Triangle::orderPoints(void)
{
Point minPoint;
WORD minIndex;
for(int ptIndex=0;ptIndex<VectorPoints;ptIndex++)
{
if(!ptIndex){minIndex=ptIndex;minPoint=operator[](ptIndex);}
else if((operator[](ptIndex).y()<minPoint.y())||(operator[](ptIndex).y()==minPoint.y()&&operator[](ptIndex).x()<minPoint.x()))
{
minIndex=ptIndex;
minPoint=operator[](ptIndex);
}
}
operator[](minIndex)=operator[](0);
operator[](0)=minPoint;
if((operator[](1).y()<operator[](2).y())||(operator[](1).y()==operator[](2).y()&&operator[](1).x()<operator[](2).x()))
{
minPoint=operator[](2);
operator[](2)=operator[](1);
operator[](1)=minPoint;
}
}

63
engine/ANGLE.HPP Normal file
View File

@@ -0,0 +1,63 @@
#ifndef _ENGINE_TRIANGLE_HPP_
#define _ENGINE_TRIANGLE_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_POINT_HPP_
#include <common/point.hpp>
#endif
class Triangle
{
public:
enum {VectorPoints=3};
Triangle(void);
Triangle(const Triangle &someTriangle);
virtual ~Triangle();
Triangle &operator=(const Triangle &someTriangle);
BOOL operator==(const Triangle &someTriangle);
Point &operator[](WORD vectorIndex);
void orderPoints(void);
private:
Point mTriangle[VectorPoints];
};
inline
Triangle::Triangle(void)
{
}
inline
Triangle::Triangle(const Triangle &someTriangle)
{
*this=someTriangle;
}
inline
Triangle::~Triangle()
{
}
inline
Triangle &Triangle::operator=(const Triangle &someTriangle)
{
mTriangle[0]=someTriangle.mTriangle[0];
mTriangle[1]=someTriangle.mTriangle[1];
mTriangle[2]=someTriangle.mTriangle[2];
return *this;
}
inline
BOOL Triangle::operator==(const Triangle &someTriangle)
{
return (mTriangle[0]==someTriangle.mTriangle[0]&&
mTriangle[1]==someTriangle.mTriangle[1]&&
mTriangle[2]==someTriangle.mTriangle[2]);
}
inline
Point &Triangle::operator[](WORD vectorIndex)
{
return mTriangle[vectorIndex];
}
#endif

62
engine/ANGLE3D.HPP Normal file
View File

@@ -0,0 +1,62 @@
#ifndef _ENGINE_TRIANGLE3D_HPP_
#define _ENGINE_TRIANGLE3D_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _ENGINE_POINT3D_HPP_
#include <engine/point3d.hpp>
#endif
class Triangle3D
{
public:
enum {VectorPoints=3};
Triangle3D(void);
Triangle3D(const Triangle3D &someTriangle3D);
virtual ~Triangle3D();
Triangle3D &operator=(const Triangle3D &someTriangle3D);
BOOL operator==(const Triangle3D &someTriangle3D)const;
Point3D &operator[](WORD vectorIndex);
private:
Point3D mTriangle3D[VectorPoints];
};
inline
Triangle3D::Triangle3D(void)
{
}
inline
Triangle3D::Triangle3D(const Triangle3D &someTriangle3D)
{
*this=someTriangle3D;
}
inline
Triangle3D::~Triangle3D()
{
}
inline
Triangle3D &Triangle3D::operator=(const Triangle3D &someTriangle3D)
{
mTriangle3D[0]=someTriangle3D.mTriangle3D[0];
mTriangle3D[1]=someTriangle3D.mTriangle3D[1];
mTriangle3D[2]=someTriangle3D.mTriangle3D[2];
return *this;
}
inline
BOOL Triangle3D::operator==(const Triangle3D &someTriangle3D)const
{
return (mTriangle3D[0]==someTriangle3D.mTriangle3D[0]&&
mTriangle3D[1]==someTriangle3D.mTriangle3D[1]&&
mTriangle3D[2]==someTriangle3D.mTriangle3D[2]);
}
inline
Point3D &Triangle3D::operator[](WORD vectorIndex)
{
return mTriangle3D[vectorIndex];
}
#endif

25
engine/ASMUTIL.BAK Normal file
View File

@@ -0,0 +1,25 @@
#ifndef _ENGINE_ASMUTIL_HPP_
#define _ENGINE_ASMUTIL_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
class Point;
class PureEdge;
class PureMap;
extern "C"
{
void clearBitmap(DWORD lpBitmapData,DWORD imageExtent);
void setBits(DWORD lpBitmapData,DWORD imageExtent,BYTE charByte);
void lineWINGBlt(DWORD lpWINGData,Point *lpFirstPoint,Point *lpSecondPoint,DWORD width,DWORD imageExtent,WORD value);
void initEdge(int edgeType,PureEdge *lpPureEdge);
void mapTexture(PureMap *lpEdgeMap);
void setMaskInfo(WORD useMask,BYTE maskValue);
void setSrcBitmapInfo(WORD width,WORD height,UHUGE *lpSrcBitmapImage);
void setDstBitmapInfo(WORD width,WORD height,UHUGE *lpDstBitmapImage);
void getSrcDataByte(WORD row,WORD col);
void resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClip);
}
#endif

100
engine/ASMUTIL.HPP Normal file
View File

@@ -0,0 +1,100 @@
#ifndef _ENGINE_ASMUTIL_HPP_
#define _ENGINE_ASMUTIL_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
class Point;
class PureEdge;
class PureMap;
extern "C"
{
void clearBitmap(DWORD lpBitmapData,DWORD imageExtent);
void setBits(DWORD lpBitmapData,DWORD imageExtent,BYTE charByte);
void lineWINGBlt(DWORD lpWINGData,Point *lpFirstPoint,Point *lpSecondPoint,DWORD width,DWORD height,WORD value);
void initEdge(int edgeType,PureEdge *lpPureEdge);
void mapTexture(PureMap *lpEdgeMap);
void setMaskInfo(WORD useMask,BYTE maskValue);
void setSrcBitmapInfo(WORD width,WORD height,unsigned char *lpSrcBitmapImage);
void setDstBitmapInfo(WORD width,WORD height,unsigned char *lpDstBitmapImage);
void getSrcDataByte(WORD row,WORD col);
void resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClip);
}
class ASMRoutines
{
public:
static void clearBitmap(DWORD lpBitmapData,DWORD imageExtent);
static void setBits(DWORD lpBitmapData,DWORD imageExtent,BYTE charByte);
static void line(DWORD lpWINGData,Point *lpFirstPoint,Point *lpSecondPoint,DWORD width,DWORD imageExtent,WORD value);
static void initEdge(int edgeType,PureEdge *lpPureEdge);
static void mapTexture(PureMap *lpEdgeMap);
static void setMaskInfo(WORD useMask,BYTE maskValue);
static void setSrcBitmapInfo(WORD width,WORD height,unsigned char *lpSrcBitmapImage);
static void setDstBitmapInfo(WORD width,WORD height,unsigned char *lpDstBitmapImage);
static void getSrcDataByte(WORD row,WORD col);
static void resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClip);
};
inline
void ASMRoutines::clearBitmap(DWORD lpBitmapData,DWORD imageExtent)
{
::clearBitmap(lpBitmapData,imageExtent);
}
inline
void ASMRoutines::setBits(DWORD lpBitmapData,DWORD imageExtent,BYTE charByte)
{
::setBits(lpBitmapData,imageExtent,charByte);
}
inline
void ASMRoutines::line(DWORD ptrData,Point *lpFirstPoint,Point *lpSecondPoint,DWORD width,DWORD height,WORD value)
{
::lineWINGBlt(ptrData,lpFirstPoint,lpSecondPoint,width,height,value);
}
inline
void ASMRoutines::initEdge(int edgeType,PureEdge *lpPureEdge)
{
::initEdge(edgeType,lpPureEdge);
}
inline
void ASMRoutines::mapTexture(PureMap *lpEdgeMap)
{
::mapTexture(lpEdgeMap);
}
inline
void ASMRoutines::setMaskInfo(WORD useMask,BYTE maskValue)
{
::setMaskInfo(useMask,maskValue);
}
inline
void ASMRoutines::setSrcBitmapInfo(WORD width,WORD height,unsigned char *lpSrcBitmapImage)
{
::setSrcBitmapInfo(width,height,lpSrcBitmapImage);
}
inline
void ASMRoutines::setDstBitmapInfo(WORD width,WORD height,unsigned char *lpDstBitmapImage)
{
::setDstBitmapInfo(width,height,lpDstBitmapImage);
}
inline
void ASMRoutines::getSrcDataByte(WORD row,WORD col)
{
::getSrcDataByte(row,col);
}
inline
void ASMRoutines::resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClip)
{
::resampleClip(lpIn,lpOut,inLen,outLen,outClip);
}
#endif

BIN
engine/ASMVIEW.DSW Normal file

Binary file not shown.

BIN
engine/ASMVIEW.TRW Normal file

Binary file not shown.

113
engine/DEVICE3D.CPP Normal file
View File

@@ -0,0 +1,113 @@
#include <common/math.hpp>
#include <engine/rect3d.hpp>
#include <engine/device3d.hpp>
Device3D::Device3D(GUIWindow &displayWindow,PureDevice &displayDevice)
: PureDevice((HDC)displayDevice), mDisplayWindow(displayWindow)
{
}
void Device3D::line(Point3D &firstPoint3D,Point3D &secondPoint3D,const Pen &somePen)
{
Point firstPoint;
Point secondPoint;
mapCoordinates(firstPoint3D,firstPoint);
mapCoordinates(secondPoint3D,secondPoint);
if(firstPoint.x()>=viewPortWidth())firstPoint.x(viewPortWidth()-1);
if(secondPoint.x()>=viewPortWidth())secondPoint.x(viewPortWidth()-1);
if(firstPoint.x()<0)firstPoint.x(0);
if(secondPoint.x()<0)secondPoint.x(0);
if(firstPoint.y()>=viewPortHeight())firstPoint.y(viewPortHeight()-1);
if(secondPoint.y()>=viewPortHeight())secondPoint.y(viewPortHeight()-1);
if(firstPoint.y()<0)firstPoint.y(0);
if(firstPoint.y()<0)firstPoint.y(0);
// if(!isInView(firstPoint))return;
// if(!isInView(secondPoint))return;
PureDevice::line(firstPoint,secondPoint,somePen);
}
void Device3D::point(Point3D &somePoint3D,RGBColor &someRGBColor)
{
Point somePoint;
mapCoordinates(somePoint3D,somePoint);
setPixel(somePoint,someRGBColor);
}
void Device3D::rect3D(const Rect3D &someRect3D,const Pen &somePen)
{
line(((Vector3D&)(someRect3D.firstPlane()))[0],((Vector3D&)(someRect3D.firstPlane()))[1],somePen);
line(((Vector3D&)(someRect3D.firstPlane()))[1],((Vector3D&)(someRect3D.firstPlane()))[2],somePen);
line(((Vector3D&)(someRect3D.firstPlane()))[2],((Vector3D&)(someRect3D.firstPlane()))[3],somePen);
line(((Vector3D&)(someRect3D.firstPlane()))[3],((Vector3D&)(someRect3D.firstPlane()))[0],somePen);
line(((Vector3D&)(someRect3D.nextPlane()))[0],((Vector3D&)(someRect3D.nextPlane()))[1],somePen);
line(((Vector3D&)(someRect3D.nextPlane()))[1],((Vector3D&)(someRect3D.nextPlane()))[2],somePen);
line(((Vector3D&)(someRect3D.nextPlane()))[2],((Vector3D&)(someRect3D.nextPlane()))[3],somePen);
line(((Vector3D&)(someRect3D.nextPlane()))[3],((Vector3D&)(someRect3D.nextPlane()))[0],somePen);
line(((Vector3D&)(someRect3D.firstPlane()))[0],((Vector3D&)(someRect3D.nextPlane()))[0],somePen);
line(((Vector3D&)(someRect3D.firstPlane()))[1],((Vector3D&)(someRect3D.nextPlane()))[1],somePen);
line(((Vector3D&)(someRect3D.firstPlane()))[2],((Vector3D&)(someRect3D.nextPlane()))[2],somePen);
line(((Vector3D&)(someRect3D.firstPlane()))[3],((Vector3D&)(someRect3D.nextPlane()))[3],somePen);
}
void Device3D::drawAxis(WORD drawFlag)
{
Pen blackPen(RGBColor(0,0,0),2);
Pen whitePen(RGBColor(255,255,255),2);
int maxValue(100);
int minValue(-100);
if(!drawFlag)
{
line(Point3D(minValue,0,0),Point3D(maxValue,0,0),blackPen);
line(Point3D(0,minValue,0),Point3D(0,maxValue,0),blackPen);
line(Point3D(0,0,minValue),Point3D(0,0,maxValue),blackPen);
}
else
{
line(Point3D(minValue,0,0),Point3D(maxValue,0,0),whitePen);
line(Point3D(0,minValue,0),Point3D(0,maxValue,0),whitePen);
line(Point3D(0,0,minValue),Point3D(0,0,maxValue),whitePen);
}
}
void Device3D::drawAxis(const RGBColor &textColor,const RGBColor &bkColor)
{
Pen blackPen(RGBColor(0,0,0),2);
Pen whitePen(RGBColor(255,255,255),2);
int maxValue(100);
int minValue(-100);
setTextColor(textColor);
setBkColor(bkColor);
line(Point3D(minValue,0,0),Point3D(maxValue,0,0),whitePen);
drawText("x",Point3D(maxValue/2,0,0));
drawText(String().fromInt(maxValue),Point3D(maxValue,0,0));
drawText(String().fromInt(minValue),Point3D(minValue,0,0));
line(Point3D(0,minValue,0),Point3D(0,maxValue,0),whitePen);
drawText("y",Point3D(0,maxValue/2,0));
drawText(String().fromInt(maxValue),Point3D(0,maxValue,0));
drawText(String().fromInt(minValue),Point3D(0,minValue,0));
line(Point3D(0,0,minValue),Point3D(0,0,maxValue),whitePen);
drawText("z",Point3D(0,0,maxValue/2));
drawText(String().fromInt(maxValue),Point3D(0,0,maxValue));
drawText(String().fromInt(minValue),Point3D(0,0,minValue));
}
void Device3D::drawText(const String &text,Point3D &point3D,bool useCartesian)
{
Point screenPoint;
mapCoordinates(point3D,screenPoint,useCartesian);
PureDevice::drawText(screenPoint,text);
}

91
engine/DEVICE3D.HPP Normal file
View File

@@ -0,0 +1,91 @@
#ifndef _ENGINE_DEVICE3D_HPP_
#define _ENGINE_DEVICE3D_HPP_
#ifndef _COMMON_GUIWINDOW_HPP_
#include <common/guiwnd.hpp>
#endif
#ifndef _COMMON_PUREDEVICE_HPP_
#include <common/purehdc.hpp>
#endif
#ifndef _COMMON_POINT_HPP_
#include <common/point.hpp>
#endif
#ifndef _ENGINE_POINT3D_HPP_
#include <engine/point3d.hpp>
#endif
#ifndef _ENGINE_VIEWSYSTEM_HPP_
#include <engine/viewsys.hpp>
#endif
class Rect3D;
class Device3D : public PureDevice, public ViewSystem
{
public:
Device3D(GUIWindow &displayWindow);
Device3D(GUIWindow &displayWindow,PureDevice &displayDevice);
Device3D(const Device3D &someDevice3D);
virtual ~Device3D();
Device3D &operator=(const ViewSystem &someViewSystem);
void line(Point3D &firstPoint3D,Point3D &secondPoint3D,const Pen &somePen);
void point(Point3D &somePoint3D,RGBColor &someRGBColor);
void rect3D(const Rect3D &someRect3D,const Pen &somePen);
void drawAxis(WORD drawFlag);
void drawAxis(const RGBColor &textColor,const RGBColor &bkColor);
void drawText(const String &text,Point3D &point3D,bool useCartesian=true);
WORD width(void)const;
WORD height(void)const;
protected:
virtual WORD viewPortWidth(void)const;
virtual WORD viewPortHeight(void)const;
private:
GUIWindow &mDisplayWindow;
};
inline
Device3D::Device3D(GUIWindow &displayWindow)
: PureDevice(displayWindow), mDisplayWindow(displayWindow)
{
}
inline
Device3D::Device3D(const Device3D &someDevice3D)
: PureDevice((PureDevice&)someDevice3D), mDisplayWindow(someDevice3D.mDisplayWindow)
{
}
inline
Device3D::~Device3D()
{
}
inline
Device3D &Device3D::operator=(const ViewSystem &someViewSystem)
{
(ViewSystem&)*this=someViewSystem;
return *this;
}
inline
WORD Device3D::width(void)const
{
return viewPortWidth();
}
inline
WORD Device3D::height(void)const
{
return viewPortHeight();
}
inline
WORD Device3D::viewPortWidth(void)const
{
return mDisplayWindow.width();
}
inline
WORD Device3D::viewPortHeight(void)const
{
return mDisplayWindow.height();
}
#endif

72
engine/DIB3D.CPP Normal file
View File

@@ -0,0 +1,72 @@
#include <engine/dib3d.hpp>
#include <common/vector2d.hpp>
#include <engine/rect3d.hpp>
#include <engine/point3d.hpp>
#include <engine/asmutil.hpp>
CallbackData::ReturnType DIB3D::sizeHandler(CallbackData &someCallbackData)
{
size(mDisplayWindow.width(),mDisplayWindow.height());
return (CallbackData::ReturnType)FALSE;
}
void DIB3D::line(Point3D &firstPoint3D,Point3D &secondPoint3D,BYTE byteValue)
{
Point firstPoint;
Point secondPoint;
mapCoordinates(firstPoint3D,firstPoint);
mapCoordinates(secondPoint3D,secondPoint);
DIBitmap::line(firstPoint,secondPoint,byteValue);
}
void DIB3D::axis(BOOL drawFlag)
{
int blackIndex(0);
int whiteIndex(255);
int maxValue(200);
int minValue(-200);
if(!drawFlag)
{
line(Point3D(minValue,0,0),Point3D(maxValue,0,0),blackIndex);
line(Point3D(0,minValue,0),Point3D(0,maxValue,0),blackIndex);
line(Point3D(0,0,minValue),Point3D(0,0,maxValue),blackIndex);
}
else
{
line(Point3D(minValue,0,0),Point3D(maxValue,0,0),whiteIndex);
line(Point3D(0,minValue,0),Point3D(0,maxValue,0),whiteIndex);
line(Point3D(0,0,minValue),Point3D(0,0,maxValue),whiteIndex);
}
}
void DIB3D::rectangle(const Rect3D &someRect3D,int paletteIndex)
{
line(((Vector3D&)(someRect3D.firstPlane()))[0],((Vector3D&)(someRect3D.firstPlane()))[1],paletteIndex);
line(((Vector3D&)(someRect3D.firstPlane()))[1],((Vector3D&)(someRect3D.firstPlane()))[2],paletteIndex);
line(((Vector3D&)(someRect3D.firstPlane()))[2],((Vector3D&)(someRect3D.firstPlane()))[3],paletteIndex);
line(((Vector3D&)(someRect3D.firstPlane()))[3],((Vector3D&)(someRect3D.firstPlane()))[0],paletteIndex);
line(((Vector3D&)(someRect3D.nextPlane()))[0],((Vector3D&)(someRect3D.nextPlane()))[1],paletteIndex);
line(((Vector3D&)(someRect3D.nextPlane()))[1],((Vector3D&)(someRect3D.nextPlane()))[2],paletteIndex);
line(((Vector3D&)(someRect3D.nextPlane()))[2],((Vector3D&)(someRect3D.nextPlane()))[3],paletteIndex);
line(((Vector3D&)(someRect3D.nextPlane()))[3],((Vector3D&)(someRect3D.nextPlane()))[0],paletteIndex);
line(((Vector3D&)(someRect3D.firstPlane()))[0],((Vector3D&)(someRect3D.nextPlane()))[0],paletteIndex);
line(((Vector3D&)(someRect3D.firstPlane()))[1],((Vector3D&)(someRect3D.nextPlane()))[1],paletteIndex);
line(((Vector3D&)(someRect3D.firstPlane()))[2],((Vector3D&)(someRect3D.nextPlane()))[2],paletteIndex);
line(((Vector3D&)(someRect3D.firstPlane()))[3],((Vector3D&)(someRect3D.nextPlane()))[3],paletteIndex);
}
// virtual overloads
WORD DIB3D::viewPortWidth(void)const
{
return mDisplayWindow.width();
}
WORD DIB3D::viewPortHeight(void)const
{
return mDisplayWindow.height();
}

71
engine/DIB3D.HPP Normal file
View File

@@ -0,0 +1,71 @@
#ifndef _ENGINE_DIB3D_HPP_
#define _ENGINE_DIB3D_HPP_
#ifndef _ENGINE_VIEWSYSTEM_HPP_
#include <engine/viewsys.hpp>
#endif
#ifndef _COMMON_DIBITMAP_HPP_
#include <common/dib.hpp>
#endif
#ifndef _COMMON_CALLBACK_HPP_
#include <common/callback.hpp>
#endif
#ifndef _COMMON_GUIWINDOW_HPP_
#include <common/guiwnd.hpp>
#endif
#ifndef _COMMON_PUREDEVICE_HPP_
#include <common/purehdc.hpp>
#endif
class Point3D;
class Rect3D;
class DIB3D : public DIBitmap, public ViewSystem
{
public:
DIB3D(GUIWindow &someGUIWindow);
DIB3D(GUIWindow &someGUIWindow,const PurePalette &purePalette);
virtual ~DIB3D();
void line(Point3D &firstPoint3D,Point3D &secondPoint,BYTE byteValue);
void rectangle(const Rect3D &someRect3D,int paletteIndex);
void axis(BOOL drawFlag);
protected:
WORD viewPortWidth(void)const;
WORD viewPortHeight(void)const;
private:
WORD operator==(const DIB3D &someDIB3D)const;
CallbackData::ReturnType sizeHandler(CallbackData &someCallbackData);
Callback<DIB3D> mSizeHandler;
GUIWindow &mDisplayWindow;
};
inline
DIB3D::DIB3D(GUIWindow &someGUIWindow)
: DIBitmap(PureDevice(someGUIWindow),someGUIWindow.width(),someGUIWindow.height(),PurePalette(PurePalette::InitSys)),
mDisplayWindow(someGUIWindow)
{
mSizeHandler.setCallback(this,&DIB3D::sizeHandler);
mDisplayWindow.insertHandler(VectorHandler::SizeHandler,&mSizeHandler);
}
inline
DIB3D::DIB3D(GUIWindow &someGUIWindow,const PurePalette &purePalette)
: DIBitmap(PureDevice(someGUIWindow),someGUIWindow.width(),someGUIWindow.height(),purePalette),
mDisplayWindow(someGUIWindow)
{
mSizeHandler.setCallback(this,&DIB3D::sizeHandler);
mDisplayWindow.insertHandler(VectorHandler::SizeHandler,&mSizeHandler);
}
inline
DIB3D::~DIB3D()
{
mDisplayWindow.removeHandler(VectorHandler::SizeHandler,&mSizeHandler);
}
inline
WORD DIB3D::operator==(const DIB3D &someDIB3D)const
{ // private implementation
return FALSE;
}
#endif

686
engine/ENGINE.BAK Normal file
View File

@@ -0,0 +1,686 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
!IF "$(CFG)" == ""
CFG=engine - Win32 Debug
!MESSAGE No configuration specified. Defaulting to engine - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "engine - Win32 Release" && "$(CFG)" != "engine - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Engine.mak" CFG="engine - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "engine - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "engine - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "engine - Win32 Debug"
CPP=cl.exe
!IF "$(CFG)" == "engine - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
ALL : "$(OUTDIR)\Engine.lib"
CLEAN :
-@erase "$(INTDIR)\angle.obj"
-@erase "$(INTDIR)\Device3d.obj"
-@erase "$(INTDIR)\dib3d.obj"
-@erase "$(INTDIR)\Purevsys.obj"
-@erase "$(INTDIR)\spacial.obj"
-@erase "$(INTDIR)\Texture.obj"
-@erase "$(INTDIR)\Viewsys.obj"
-@erase "$(OUTDIR)\Engine.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)/Engine.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
CPP_SBRS=.\.
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/Engine.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/Engine.lib"
LIB32_OBJS= \
"$(INTDIR)\angle.obj" \
"$(INTDIR)\Device3d.obj" \
"$(INTDIR)\dib3d.obj" \
"$(INTDIR)\Purevsys.obj" \
"$(INTDIR)\spacial.obj" \
"$(INTDIR)\Texture.obj" \
"$(INTDIR)\Viewsys.obj" \
".\Msvcobj\tmap32.obj" \
".\Msvcobj\util32.obj" \
".\Msvcobj\vsmap32.obj"
"$(OUTDIR)\Engine.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\exe"
# PROP Intermediate_Dir "msvcobj"
# PROP Target_Dir ""
OUTDIR=.\..\exe
INTDIR=.\msvcobj
ALL : "$(OUTDIR)\msengine.lib"
CLEAN :
-@erase "$(INTDIR)\angle.obj"
-@erase "$(INTDIR)\Device3d.obj"
-@erase "$(INTDIR)\dib3d.obj"
-@erase "$(INTDIR)\Purevsys.obj"
-@erase "$(INTDIR)\spacial.obj"
-@erase "$(INTDIR)\Texture.obj"
-@erase "$(INTDIR)\Viewsys.obj"
-@erase "$(OUTDIR)\msengine.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
"$(INTDIR)" :
if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /Zp1 /MTd /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__FLAT__" /D "STRICT" /Fp"c:\work\exe\msvc42.pch" /YX"windows.h" /c
CPP_PROJ=/nologo /Zp1 /MTd /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D\
"__FLAT__" /D "STRICT" /Fp"c:\work\exe\msvc42.pch" /YX"windows.h"\
/Fo"$(INTDIR)/" /c
CPP_OBJS=.\msvcobj/
CPP_SBRS=.\.
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/Engine.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\exe\msengine.lib"
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/msengine.lib"
LIB32_OBJS= \
"$(INTDIR)\angle.obj" \
"$(INTDIR)\Device3d.obj" \
"$(INTDIR)\dib3d.obj" \
"$(INTDIR)\Purevsys.obj" \
"$(INTDIR)\spacial.obj" \
"$(INTDIR)\Texture.obj" \
"$(INTDIR)\Viewsys.obj" \
".\Msvcobj\tmap32.obj" \
".\Msvcobj\util32.obj" \
".\Msvcobj\vsmap32.obj"
"$(OUTDIR)\msengine.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "engine - Win32 Release"
# Name "engine - Win32 Debug"
!IF "$(CFG)" == "engine - Win32 Release"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\Viewsys.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_VIEWS=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\Viewsys.obj" : $(SOURCE) $(DEP_CPP_VIEWS) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_VIEWS=\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\Viewsys.obj" : $(SOURCE) $(DEP_CPP_VIEWS) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Purevsys.cpp
DEP_CPP_PUREV=\
{$(INCLUDE)}"\.\Line2d.hpp"\
{$(INCLUDE)}"\.\Line3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Polygon.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\Purevsys.obj" : $(SOURCE) $(DEP_CPP_PUREV) "$(INTDIR)"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Texture.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_TEXTU=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Asmutil.hpp"\
{$(INCLUDE)}"\.\Device3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Pureedge.hpp"\
{$(INCLUDE)}"\.\Puremap.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Texture.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\common\array.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Bitmap.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Bmdata.hpp"\
{$(INCLUDE)}"\Common\Bminfo.hpp"\
{$(INCLUDE)}"\Common\Boverlay.hpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Dib.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdata.hpp"\
{$(INCLUDE)}"\Common\Gdata.tpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Palentry.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purebmp.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Purepal.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Rgbquad.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
{$(INCLUDE)}"\Common\Wingblt.hpp"\
{$(INCLUDE)}"\wing\Include\Wing.h"\
{$(INCLUDE)}"\wing\Wing.hpp"\
"$(INTDIR)\Texture.obj" : $(SOURCE) $(DEP_CPP_TEXTU) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_TEXTU=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Asmutil.hpp"\
{$(INCLUDE)}"\.\Device3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Pureedge.hpp"\
{$(INCLUDE)}"\.\Puremap.hpp"\
{$(INCLUDE)}"\.\Texture.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\common\array.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Bitmap.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Bmdata.hpp"\
{$(INCLUDE)}"\Common\Bminfo.hpp"\
{$(INCLUDE)}"\Common\Boverlay.hpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Dib.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdata.hpp"\
{$(INCLUDE)}"\Common\Gdata.tpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Palentry.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purebmp.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Purepal.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Rgbquad.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
{$(INCLUDE)}"\Common\Wingblt.hpp"\
{$(INCLUDE)}"\wing\Include\Wing.h"\
{$(INCLUDE)}"\wing\Wing.hpp"\
"$(INTDIR)\Texture.obj" : $(SOURCE) $(DEP_CPP_TEXTU) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Device3d.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_DEVIC=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Device3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Rect3d.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\Device3d.obj" : $(SOURCE) $(DEP_CPP_DEVIC) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_DEVIC=\
{$(INCLUDE)}"\.\Device3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Rect3d.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\Device3d.obj" : $(SOURCE) $(DEP_CPP_DEVIC) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Msvcobj\vsmap32.obj
!IF "$(CFG)" == "engine - Win32 Release"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Msvcobj\tmap32.obj
!IF "$(CFG)" == "engine - Win32 Release"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dib3d.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_DIB3D=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Asmutil.hpp"\
{$(INCLUDE)}"\.\Dib3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Rect3d.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\common\array.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Bminfo.hpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Dib.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdata.hpp"\
{$(INCLUDE)}"\Common\Gdata.tpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Palentry.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purebmp.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Purepal.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Rgbquad.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\dib3d.obj" : $(SOURCE) $(DEP_CPP_DIB3D) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_DIB3D=\
{$(INCLUDE)}"\.\Asmutil.hpp"\
{$(INCLUDE)}"\.\Dib3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Rect3d.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\common\array.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Bminfo.hpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Dib.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdata.hpp"\
{$(INCLUDE)}"\Common\Gdata.tpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Palentry.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purebmp.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Purepal.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Rgbquad.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\dib3d.obj" : $(SOURCE) $(DEP_CPP_DIB3D) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\spacial.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_SPACI=\
{$(INCLUDE)}"\.\Spacial.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\spacial.obj" : $(SOURCE) $(DEP_CPP_SPACI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_SPACI=\
{$(INCLUDE)}"\.\Spacial.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\spacial.obj" : $(SOURCE) $(DEP_CPP_SPACI) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Msvcobj\util32.obj
!IF "$(CFG)" == "engine - Win32 Release"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\angle.cpp
DEP_CPP_ANGLE=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\angle.obj" : $(SOURCE) $(DEP_CPP_ANGLE) "$(INTDIR)"
# End Source File
# End Target
# End Project
################################################################################

29
engine/ENGINE.DSW Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "engine"=.\engine.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

BIN
engine/ENGINE.OPT Normal file

Binary file not shown.

63
engine/ENGINE.PLG Normal file
View File

@@ -0,0 +1,63 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: engine - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\TERNET~1\LOCALS~1\Temp\RSP2B3.tmp" with contents
[
/nologo /MTd /Zi /Od /I "\work" /I "\parts" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__FLAT__" /D "STRICT" /FR".\msvcobj/" /Fp"\work\exe\msvc42.pch" /YX"windows.h" /Fo".\msvcobj/" /Fd".\msvcobj/" /FD /c
"F:\work\engine\angle.cpp"
"F:\work\engine\Device3d.cpp"
"F:\work\engine\dib3d.cpp"
"F:\work\engine\Purevsys.cpp"
"F:\work\engine\spacial.cpp"
"F:\work\engine\Texture.cpp"
"F:\work\engine\vector3d.cpp"
"F:\work\engine\Viewsys.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\TERNET~1\LOCALS~1\Temp\RSP2B3.tmp"
<h3>Output Window</h3>
Compiling...
angle.cpp
Device3d.cpp
dib3d.cpp
Purevsys.cpp
spacial.cpp
Texture.cpp
vector3d.cpp
Viewsys.cpp
Creating temporary file "C:\DOCUME~1\TERNET~1\LOCALS~1\Temp\RSP2B4.tmp" with contents
[
/nologo /out:"..\exe\msengine.lib"
.\msvcobj\angle.obj
.\msvcobj\Device3d.obj
.\msvcobj\dib3d.obj
.\msvcobj\Purevsys.obj
.\msvcobj\spacial.obj
.\msvcobj\Texture.obj
.\msvcobj\vector3d.obj
.\msvcobj\Viewsys.obj
.\Msvcobj\tmap32.obj
.\Msvcobj\util32.obj
.\Msvcobj\vsmap32.obj
]
Creating command line "link.exe -lib @C:\DOCUME~1\TERNET~1\LOCALS~1\Temp\RSP2B4.tmp"
<h3>Output Window</h3>
Creating library...
.\Msvcobj\tmap32.obj : warning LNK4033: converting object format from OMF to COFF
.\Msvcobj\util32.obj : warning LNK4033: converting object format from OMF to COFF
.\Msvcobj\vsmap32.obj : warning LNK4033: converting object format from OMF to COFF
Creating command line "bscmake.exe /nologo /o"..\exe/engine.bsc" .\msvcobj\angle.sbr .\msvcobj\Device3d.sbr .\msvcobj\dib3d.sbr .\msvcobj\Purevsys.sbr .\msvcobj\spacial.sbr .\msvcobj\Texture.sbr .\msvcobj\vector3d.sbr .\msvcobj\Viewsys.sbr"
Creating browse info file...
<h3>Output Window</h3>
<h3>Results</h3>
msengine.lib - 0 error(s), 3 warning(s)
</pre>
</body>
</html>

BIN
engine/ENGINE.ncb Normal file

Binary file not shown.

BIN
engine/ENGINE16.DSW Normal file

Binary file not shown.

BIN
engine/ENGINE16.IDE Normal file

Binary file not shown.

BIN
engine/ENGINE32.DSW Normal file

Binary file not shown.

BIN
engine/ENGINE32.IDE Normal file

Binary file not shown.

98
engine/ENGINE32.MAK Normal file
View File

@@ -0,0 +1,98 @@
#
# Borland C++ IDE generated makefile
#
.AUTODEPEND
#
# Borland C++ tools
#
IMPLIB = Implib
BCC32 = Bcc32 +BccW32.cfg
TLINK32 = TLink32
TLIB = TLib
BRC32 = Brc32
TASM32 = Tasm32
#
# IDE macros
#
#
# Options
#
IDE_LFLAGS32 = -LC:\BC45\LIB
IDE_RFLAGS32 =
LLATW32_ddbEXEbengine32dlib = -LC:\BC45\LIB -Tpe -aa -c
RLATW32_ddbEXEbengine32dlib = -w32
BLATW32_ddbEXEbengine32dlib = /P32
CNIEAT_ddbEXEbengine32dlib = -IC:\BC45\INCLUDE;..;..\..\PARTS\ -DSTRICT
LNIEAT_ddbEXEbengine32dlib = -x
LEAT_ddbEXEbengine32dlib = $(LLATW32_ddbEXEbengine32dlib)
REAT_ddbEXEbengine32dlib = $(RLATW32_ddbEXEbengine32dlib)
BEAT_ddbEXEbengine32dlib = $(BLATW32_ddbEXEbengine32dlib)
CLATW16_ddbexebcommon32dlib =
LLATW16_ddbexebcommon32dlib =
RLATW16_ddbexebcommon32dlib =
BLATW16_ddbexebcommon32dlib =
CEAT_ddbexebcommon32dlib = $(CEAT_ddbEXEbengine32dlib) $(CLATW16_ddbexebcommon32dlib)
CNIEAT_ddbexebcommon32dlib = -IC:\BC45\INCLUDE;..;..\..\PARTS\ -DSTRICT
LNIEAT_ddbexebcommon32dlib = -x
LEAT_ddbexebcommon32dlib = $(LEAT_ddbEXEbengine32dlib) $(LLATW16_ddbexebcommon32dlib)
REAT_ddbexebcommon32dlib = $(REAT_ddbEXEbengine32dlib) $(RLATW16_ddbexebcommon32dlib)
BEAT_ddbexebcommon32dlib = $(BEAT_ddbEXEbengine32dlib) $(BLATW16_ddbexebcommon32dlib)
CLATW32_vsmap32dasm =
LLATW32_vsmap32dasm =
RLATW32_vsmap32dasm =
BLATW32_vsmap32dasm =
CEAT_vsmap32dasm = $(CEAT_ddbEXEbengine32dlib) $(CLATW32_vsmap32dasm)
CNIEAT_vsmap32dasm = -IC:\BC45\INCLUDE;..;..\..\PARTS\ -DSTRICT
LNIEAT_vsmap32dasm = -x
LEAT_vsmap32dasm = $(LEAT_ddbEXEbengine32dlib) $(LLATW32_vsmap32dasm)
REAT_vsmap32dasm = $(REAT_ddbEXEbengine32dlib) $(RLATW32_vsmap32dasm)
BEAT_vsmap32dasm = $(BEAT_ddbEXEbengine32dlib) $(BLATW32_vsmap32dasm)
CLATW32_tmap32dasm =
LLATW32_tmap32dasm =
RLATW32_tmap32dasm =
BLATW32_tmap32dasm =
CEAT_tmap32dasm = $(CEAT_ddbEXEbengine32dlib) $(CLATW32_tmap32dasm)
CNIEAT_tmap32dasm = -IC:\BC45\INCLUDE;..;..\..\PARTS\ -DSTRICT
LNIEAT_tmap32dasm = -x
LEAT_tmap32dasm = $(LEAT_ddbEXEbengine32dlib) $(LLATW32_tmap32dasm)
REAT_tmap32dasm = $(REAT_ddbEXEbengine32dlib) $(RLATW32_tmap32dasm)
BEAT_tmap32dasm = $(BEAT_ddbEXEbengine32dlib) $(BLATW32_tmap32dasm)
#
# Dependency List
#
Dep_engine32 = \
..\EXE\engine32.lib
engine32 : BccW32.cfg $(Dep_engine32)
echo MakeNode
Dep_ddbEXEbengine32dlib = \
..\exe\common32.lib\
EXEOBJ32\vsmap32.obj\
EXEOBJ32\tmap32.obj\
EXEOBJ32\purevsys.obj\
EXEOBJ32\viewsys.obj\
EXEOBJ32\texture.obj\
EXEOBJ32\device3d.obj
..\EXE\engine32.lib : $(Dep_ddbEXEbengine32dlib)
$(TLIB) $< $(IDE_BFLAGS) $(BEAT_ddbEXEbengine32dlib) @&&|
-+EXEOBJ32\vsmap32.obj &
-+EXEOBJ32\tmap32.obj &
-+EXEOBJ32\purevsys.obj &
-+EXEOBJ32\viewsys.obj &
-+EXEOBJ32\texture.obj &
-+EXEOBJ32\device3d.obj &
-+..\exe\common32.lib
|
EXEOBJ32\vsmap32.obj : vsmap32.asm
$(TASM32) @&&|
vsmap32.asm
|

BIN
engine/ENGINE32.OBR Normal file

Binary file not shown.

BIN
engine/ENGINE32.~DE Normal file

Binary file not shown.

686
engine/Engine.mak Normal file
View File

@@ -0,0 +1,686 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
!IF "$(CFG)" == ""
CFG=engine - Win32 Debug
!MESSAGE No configuration specified. Defaulting to engine - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "engine - Win32 Release" && "$(CFG)" != "engine - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Engine.mak" CFG="engine - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "engine - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "engine - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "engine - Win32 Debug"
CPP=cl.exe
!IF "$(CFG)" == "engine - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
ALL : "$(OUTDIR)\Engine.lib"
CLEAN :
-@erase "$(INTDIR)\angle.obj"
-@erase "$(INTDIR)\Device3d.obj"
-@erase "$(INTDIR)\dib3d.obj"
-@erase "$(INTDIR)\Purevsys.obj"
-@erase "$(INTDIR)\spacial.obj"
-@erase "$(INTDIR)\Texture.obj"
-@erase "$(INTDIR)\Viewsys.obj"
-@erase "$(OUTDIR)\Engine.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)/Engine.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
CPP_SBRS=.\.
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/Engine.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/Engine.lib"
LIB32_OBJS= \
"$(INTDIR)\angle.obj" \
"$(INTDIR)\Device3d.obj" \
"$(INTDIR)\dib3d.obj" \
"$(INTDIR)\Purevsys.obj" \
"$(INTDIR)\spacial.obj" \
"$(INTDIR)\Texture.obj" \
"$(INTDIR)\Viewsys.obj" \
".\Msvcobj\tmap32.obj" \
".\Msvcobj\util32.obj" \
".\Msvcobj\vsmap32.obj"
"$(OUTDIR)\Engine.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\exe"
# PROP Intermediate_Dir "msvcobj"
# PROP Target_Dir ""
OUTDIR=.\..\exe
INTDIR=.\msvcobj
ALL : "$(OUTDIR)\msengine.lib"
CLEAN :
-@erase "$(INTDIR)\angle.obj"
-@erase "$(INTDIR)\Device3d.obj"
-@erase "$(INTDIR)\dib3d.obj"
-@erase "$(INTDIR)\Purevsys.obj"
-@erase "$(INTDIR)\spacial.obj"
-@erase "$(INTDIR)\Texture.obj"
-@erase "$(INTDIR)\Viewsys.obj"
-@erase "$(OUTDIR)\msengine.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
"$(INTDIR)" :
if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /Zp1 /MTd /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__FLAT__" /D "STRICT" /Fp"c:\work\exe\msvc42.pch" /YX"windows.h" /c
CPP_PROJ=/nologo /Zp1 /MTd /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D\
"__FLAT__" /D "STRICT" /Fp"c:\work\exe\msvc42.pch" /YX"windows.h"\
/Fo"$(INTDIR)/" /c
CPP_OBJS=.\msvcobj/
CPP_SBRS=.\.
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/Engine.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\exe\msengine.lib"
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/msengine.lib"
LIB32_OBJS= \
"$(INTDIR)\angle.obj" \
"$(INTDIR)\Device3d.obj" \
"$(INTDIR)\dib3d.obj" \
"$(INTDIR)\Purevsys.obj" \
"$(INTDIR)\spacial.obj" \
"$(INTDIR)\Texture.obj" \
"$(INTDIR)\Viewsys.obj" \
".\Msvcobj\tmap32.obj" \
".\Msvcobj\util32.obj" \
".\Msvcobj\vsmap32.obj"
"$(OUTDIR)\msengine.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "engine - Win32 Release"
# Name "engine - Win32 Debug"
!IF "$(CFG)" == "engine - Win32 Release"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\Viewsys.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_VIEWS=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\Viewsys.obj" : $(SOURCE) $(DEP_CPP_VIEWS) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_VIEWS=\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\Viewsys.obj" : $(SOURCE) $(DEP_CPP_VIEWS) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Purevsys.cpp
DEP_CPP_PUREV=\
{$(INCLUDE)}"\.\Line2d.hpp"\
{$(INCLUDE)}"\.\Line3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Polygon.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\Purevsys.obj" : $(SOURCE) $(DEP_CPP_PUREV) "$(INTDIR)"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Texture.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_TEXTU=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Asmutil.hpp"\
{$(INCLUDE)}"\.\Device3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Pureedge.hpp"\
{$(INCLUDE)}"\.\Puremap.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Texture.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\common\array.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Bitmap.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Bmdata.hpp"\
{$(INCLUDE)}"\Common\Bminfo.hpp"\
{$(INCLUDE)}"\Common\Boverlay.hpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Dib.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdata.hpp"\
{$(INCLUDE)}"\Common\Gdata.tpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Palentry.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purebmp.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Purepal.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Rgbquad.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
{$(INCLUDE)}"\Common\Wingblt.hpp"\
{$(INCLUDE)}"\wing\Include\Wing.h"\
{$(INCLUDE)}"\wing\Wing.hpp"\
"$(INTDIR)\Texture.obj" : $(SOURCE) $(DEP_CPP_TEXTU) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_TEXTU=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Asmutil.hpp"\
{$(INCLUDE)}"\.\Device3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Pureedge.hpp"\
{$(INCLUDE)}"\.\Puremap.hpp"\
{$(INCLUDE)}"\.\Texture.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\common\array.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Bitmap.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Bmdata.hpp"\
{$(INCLUDE)}"\Common\Bminfo.hpp"\
{$(INCLUDE)}"\Common\Boverlay.hpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Dib.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdata.hpp"\
{$(INCLUDE)}"\Common\Gdata.tpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Palentry.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purebmp.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Purepal.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Rgbquad.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
{$(INCLUDE)}"\Common\Wingblt.hpp"\
{$(INCLUDE)}"\wing\Include\Wing.h"\
{$(INCLUDE)}"\wing\Wing.hpp"\
"$(INTDIR)\Texture.obj" : $(SOURCE) $(DEP_CPP_TEXTU) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Device3d.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_DEVIC=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Device3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Rect3d.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\Device3d.obj" : $(SOURCE) $(DEP_CPP_DEVIC) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_DEVIC=\
{$(INCLUDE)}"\.\Device3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Rect3d.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\Device3d.obj" : $(SOURCE) $(DEP_CPP_DEVIC) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Msvcobj\vsmap32.obj
!IF "$(CFG)" == "engine - Win32 Release"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Msvcobj\tmap32.obj
!IF "$(CFG)" == "engine - Win32 Release"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dib3d.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_DIB3D=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\.\angle3d.hpp"\
{$(INCLUDE)}"\.\Asmutil.hpp"\
{$(INCLUDE)}"\.\Dib3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Purevsys.hpp"\
{$(INCLUDE)}"\.\Rect3d.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\common\array.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Bminfo.hpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Dib.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdata.hpp"\
{$(INCLUDE)}"\Common\Gdata.tpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Palentry.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purebmp.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Purepal.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Rgbquad.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\dib3d.obj" : $(SOURCE) $(DEP_CPP_DIB3D) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_DIB3D=\
{$(INCLUDE)}"\.\Asmutil.hpp"\
{$(INCLUDE)}"\.\Dib3d.hpp"\
{$(INCLUDE)}"\.\Point3d.hpp"\
{$(INCLUDE)}"\.\Rect3d.hpp"\
{$(INCLUDE)}"\.\Vector3d.hpp"\
{$(INCLUDE)}"\.\Viewsys.hpp"\
{$(INCLUDE)}"\common\array.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Bminfo.hpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Dib.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdata.hpp"\
{$(INCLUDE)}"\Common\Gdata.tpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Palentry.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purebmp.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Purepal.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Rgbquad.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vector2d.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\dib3d.obj" : $(SOURCE) $(DEP_CPP_DIB3D) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\spacial.cpp
!IF "$(CFG)" == "engine - Win32 Release"
DEP_CPP_SPACI=\
{$(INCLUDE)}"\.\Spacial.hpp"\
{$(INCLUDE)}"\Common\except.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\spacial.obj" : $(SOURCE) $(DEP_CPP_SPACI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
DEP_CPP_SPACI=\
{$(INCLUDE)}"\.\Spacial.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\spacial.obj" : $(SOURCE) $(DEP_CPP_SPACI) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Msvcobj\util32.obj
!IF "$(CFG)" == "engine - Win32 Release"
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\angle.cpp
DEP_CPP_ANGLE=\
{$(INCLUDE)}"\.\angle.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\angle.obj" : $(SOURCE) $(DEP_CPP_ANGLE) "$(INTDIR)"
# End Source File
# End Target
# End Project
################################################################################

85
engine/LINE2D.BAK Normal file
View File

@@ -0,0 +1,85 @@
#ifndef _ENGINE_LINE2D_HPP_
#define _ENGINE_LINE2D_HPP_
#ifndef _COMMON_POINT_HPP_
#include <common/point.hpp>
#endif
class Line2D
{
public:
Line2D(void);
Line2D(const Line2D &someLine2D);
Line2D(const Point &firstPoint,const Point &secondPoint);
virtual ~Line2D();
Line2D &operator=(const Line2D &someLine2D);
BOOL operator==(const Line2D &someLine2D)const;
const Point &firstPoint(void)const;
void firstPoint(const Point &firstPoint);
const Point &secondPoint(void)const;
void secondPoint(const Point &secondPoint);
private:
Point mFirstPoint;
Point mSecondPoint;
};
inline
Line2D::Line2D(void)
{
}
inline
Line2D::Line2D(const Line2D &someLine2D)
{
*this=someLine2D;
}
inline
Line2D::Line2D(const Point &firstPoint,const Point &secondPoint)
: mFirstPoint(firstPoint), mSecondPoint(secondPoint)
{
}
inline
Line2D::~Line2D()
{
}
inline
Line2D &Line2D::operator=(const Line2D &someLine2D)
{
firstPoint(someLine2D.firstPoint());
secondPoint(someLine2D.secondPoint());
return *this;
}
inline
BOOL Line2D::operator==(const Line2D &someLine2D)const
{
return (firstPoint()==someLine2D.firstPoint()&&
secondPoint()==someLine2D.secondPoint());
}
inline
const Point &Line2D::firstPoint(void)const
{
return mFirstPoint;
}
inline
void Line2D::firstPoint(const Point &firstPoint)
{
mFirstPoint=firstPoint;
}
inline
const Point &Line2D::secondPoint(void)const
{
return mSecondPoint;
}
inline
void Line2D::secondPoint(const Point &secondPoint)
{
mSecondPoint=secondPoint;
}
#endif

85
engine/LINE2D.HPP Normal file
View File

@@ -0,0 +1,85 @@
#ifndef _ENGINE_LINE2D_HPP_
#define _ENGINE_LINE2D_HPP_
#ifndef _COMMON_POINT_HPP_
#include <common/point.hpp>
#endif
class Line2D
{
public:
Line2D(void);
Line2D(const Line2D &someLine2D);
Line2D(const Point &firstPoint,const Point &secondPoint);
virtual ~Line2D();
Line2D &operator=(const Line2D &someLine2D);
BOOL operator==(const Line2D &someLine2D)const;
const Point &firstPoint(void)const;
void firstPoint(const Point &firstPoint);
const Point &secondPoint(void)const;
void secondPoint(const Point &secondPoint);
private:
Point mFirstPoint;
Point mSecondPoint;
};
inline
Line2D::Line2D(void)
{
}
inline
Line2D::Line2D(const Line2D &someLine2D)
{
*this=someLine2D;
}
inline
Line2D::Line2D(const Point &firstPoint,const Point &secondPoint)
: mFirstPoint(firstPoint), mSecondPoint(secondPoint)
{
}
inline
Line2D::~Line2D()
{
}
inline
Line2D &Line2D::operator=(const Line2D &someLine2D)
{
firstPoint(someLine2D.firstPoint());
secondPoint(someLine2D.secondPoint());
return *this;
}
inline
BOOL Line2D::operator==(const Line2D &someLine2D)const
{
return (firstPoint()==someLine2D.firstPoint()&&
secondPoint()==someLine2D.secondPoint());
}
inline
const Point &Line2D::firstPoint(void)const
{
return mFirstPoint;
}
inline
void Line2D::firstPoint(const Point &firstPoint)
{
mFirstPoint=firstPoint;
}
inline
const Point &Line2D::secondPoint(void)const
{
return mSecondPoint;
}
inline
void Line2D::secondPoint(const Point &secondPoint)
{
mSecondPoint=secondPoint;
}
#endif

85
engine/LINE3D.BAK Normal file
View File

@@ -0,0 +1,85 @@
#ifndef _ENGINE_LINE3D_HPP_
#define _ENGINE_LINE3D_HPP_
#ifndef _ENGINE_POINT3D_HPP_
#include <engine/point3d.hpp>
#endif
class Line3D
{
public:
Line3D(void);
Line3D(const Line3D &someLine3D);
Line3D(const Point3D &firstPoint,const Point3D &secondPoint);
virtual ~Line3D();
Line3D &operator=(const Line3D &someLine3D);
BOOL operator==(const Line3D &someLine3D)const;
const Point3D &firstPoint(void)const;
void firstPoint(const Point3D &firstPoint);
const Point3D &secondPoint(void)const;
void secondPoint(const Point3D &secondPoint);
private:
Point3D mFirstPoint;
Point3D mSecondPoint;
};
inline
Line3D::Line3D(void)
{
}
inline
Line3D::Line3D(const Line3D &someLine3D)
{
*this=someLine3D;
}
inline
Line3D::Line3D(const Point3D &firstPoint,const Point3D &secondPoint)
: mFirstPoint(firstPoint), mSecondPoint(secondPoint)
{
}
inline
Line3D::~Line3D()
{
}
inline
Line3D &Line3D::operator=(const Line3D &someLine3D)
{
firstPoint(someLine3D.firstPoint());
secondPoint(someLine3D.secondPoint());
return *this;
}
inline
BOOL Line3D::operator==(const Line3D &someLine3D)const
{
return (firstPoint()==someLine3D.firstPoint()&&
secondPoint()==someLine3D.secondPoint());
}
inline
const Point3D &Line3D::firstPoint(void)const
{
return mFirstPoint;
}
inline
void Line3D::firstPoint(const Point3D &firstPoint)
{
mFirstPoint=firstPoint;
}
inline
const Point3D &Line3D::secondPoint(void)const
{
return mSecondPoint;
}
inline
void Line3D::secondPoint(const Point3D &secondPoint)
{
mSecondPoint=secondPoint;
}
#endif

85
engine/LINE3D.HPP Normal file
View File

@@ -0,0 +1,85 @@
#ifndef _ENGINE_LINE3D_HPP_
#define _ENGINE_LINE3D_HPP_
#ifndef _ENGINE_POINT3D_HPP_
#include <engine/point3d.hpp>
#endif
class Line3D
{
public:
Line3D(void);
Line3D(const Line3D &someLine3D);
Line3D(const Point3D &firstPoint,const Point3D &secondPoint);
virtual ~Line3D();
Line3D &operator=(const Line3D &someLine3D);
BOOL operator==(const Line3D &someLine3D)const;
const Point3D &firstPoint(void)const;
void firstPoint(const Point3D &firstPoint);
const Point3D &secondPoint(void)const;
void secondPoint(const Point3D &secondPoint);
private:
Point3D mFirstPoint;
Point3D mSecondPoint;
};
inline
Line3D::Line3D(void)
{
}
inline
Line3D::Line3D(const Line3D &someLine3D)
{
*this=someLine3D;
}
inline
Line3D::Line3D(const Point3D &firstPoint,const Point3D &secondPoint)
: mFirstPoint(firstPoint), mSecondPoint(secondPoint)
{
}
inline
Line3D::~Line3D()
{
}
inline
Line3D &Line3D::operator=(const Line3D &someLine3D)
{
firstPoint(someLine3D.firstPoint());
secondPoint(someLine3D.secondPoint());
return *this;
}
inline
BOOL Line3D::operator==(const Line3D &someLine3D)const
{
return (firstPoint()==someLine3D.firstPoint()&&
secondPoint()==someLine3D.secondPoint());
}
inline
const Point3D &Line3D::firstPoint(void)const
{
return mFirstPoint;
}
inline
void Line3D::firstPoint(const Point3D &firstPoint)
{
mFirstPoint=firstPoint;
}
inline
const Point3D &Line3D::secondPoint(void)const
{
return mSecondPoint;
}
inline
void Line3D::secondPoint(const Point3D &secondPoint)
{
mSecondPoint=secondPoint;
}
#endif

102
engine/POINT3D.HPP Normal file
View File

@@ -0,0 +1,102 @@
#ifndef _ENGINE_POINT3D_HPP_
#define _ENGINE_POINT3D_HPP_
#ifndef _COMMON_POINT_HPP_
#include <common/point.hpp>
#endif
#ifndef _COMMON_MATH_HPP_
#include <common/math.hpp>
#endif
// do not make changes to this class that will alter its size
class Point3D : public Point
{
public:
Point3D(void);
Point3D(short x,short y,short z=0);
Point3D(const Point3D &somePoint3D);
~Point3D();
WORD operator==(const Point3D &somePoint3D)const;
const Point3D &operator=(const Point3D &somePoint3D);
const Point3D &operator-=(const Point3D &somePoint3D);
int operator*(const Point3D &somePoint3D)const;
int distance(const Point3D &somePoint3D)const;
short z(void)const;
void z(short newz);
private:
short mZ;
};
inline
Point3D::Point3D(void)
: mZ(0)
{
}
inline
Point3D::Point3D(short x,short y,short z)
: Point(x,y), mZ(z)
{
}
inline
Point3D::Point3D(const Point3D &somePoint3D)
: mZ(somePoint3D.z())
{
x(somePoint3D.x());
y(somePoint3D.y());
}
inline
short Point3D::z(void)const
{
return mZ;
}
inline
void Point3D::z(short newz)
{
mZ=newz;
}
inline
Point3D::~Point3D()
{
}
inline
WORD Point3D::operator==(const Point3D &somePoint3D)const
{
return (mZ==somePoint3D.mZ && (Point&)(*this)==(Point&)somePoint3D);
}
inline
const Point3D &Point3D::operator=(const Point3D &somePoint3D)
{
mZ=somePoint3D.mZ;
(Point&)(*this)=(Point&)somePoint3D;
return *this;
}
inline
const Point3D &Point3D::operator-=(const Point3D &somePoint3D)
{
mZ-=somePoint3D.mZ;
(Point&)(*this)-=(Point&)somePoint3D;
return *this;
}
inline
int Point3D::operator*(const Point3D &somePoint3D)const
{
return ((int)x()*(int)somePoint3D.x())+((int)y()*(int)somePoint3D.y())+((int)z()*(int)somePoint3D.z());
}
inline
int Point3D::distance(const Point3D &somePoint3D)const
{
int xDiff(somePoint3D.x()-x());
int yDiff(somePoint3D.y()-y());
return (xDiff*xDiff)+(yDiff*yDiff);
}
#endif

106
engine/POLYGON.BAK Normal file
View File

@@ -0,0 +1,106 @@
#ifndef _ENGINE_POLYGON3D_HPP_
#define _ENGINE_POLYGON3D_HPP_
#ifndef _COMMON_GDIPOINT_HPP_
#include <common/gdipoint.hpp>
#endif
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
#ifndef _ENGINE_LINE3D_HPP_
#include <engine/line3d.hpp>
#endif
#ifndef _ENGINE_LINE2D_HPP_
#include <engine/line2d.hpp>
#endif
class Polygon3D : public Block<Line3D>, public Block<Line2D>
{
public:
Polygon3D(void);
Polygon3D(const Polygon3D &somePolygon3D);
virtual ~Polygon3D();
Polygon3D &operator=(const Polygon3D &somePolygon3D);
void insert(const Line3D *pLine3D);
void remove(void);
LONG size(void)const;
private:
void insert(const Polygon3D *pPolygon3D);
void insert(Block<Line3D> &someLine3DBlock);
void insert(Block<Line2D> &someLine2DBlock);
void insert(const Line2D *pLine2D);
Polygon3D &operator+=(const Block<Line3D> &someLine3DBlock);
};
inline
Polygon3D::Polygon3D(void)
{
}
inline
Polygon3D::Polygon3D(const Polygon3D &somePolygon3D)
: Block<Line3D>(somePolygon3D), Block<Line2D>(somePolygon3D)
{
}
inline
Polygon3D::~Polygon3D()
{
}
inline
Polygon3D &Polygon3D::operator=(const Polygon3D &somePolygon3D)
{
(Block<Line3D>&)*this=(Block<Line3D>&)somePolygon3D;
(Block<Line2D>&)*this=(Block<Line2D>&)somePolygon3D;
return *this;
}
inline
Polygon3D &Polygon3D::operator+=(const Block<Line3D> &someLine3DBlock)
{ // private implementation
(Block<Line3D>&)*this+=someLine3DBlock;
return *this;
}
inline
void Polygon3D::insert(const Polygon3D *pPolygon3D)
{
Block<Line3D>::insert((Block<Line3D>&)*pPolygon3D);
Block<Line2D>::insert((Block<Line2D>&)*pPolygon3D);
}
inline
void Polygon3D::insert(const Line3D *pLine3D)
{
Block<Line3D>::insert(pLine3D);
Block<Line2D>::insert(&Line2D());
}
inline
void Polygon3D::insert(Block<Line3D> &/*someLine3DBlock*/)
{ // private implementation
}
inline
void Polygon3D::insert(Block<Line2D> &/*someLine2DBlock*/)
{ // private implementation
}
inline
void Polygon3D::insert(const Line2D * /*pLine2D*/)
{ // private implementation
}
inline
void Polygon3D::remove(void)
{
Block<Line3D>::remove();
Block<Line2D>::remove();
}
inline
LONG Polygon3D::size(void)const
{
return Block<Line3D>::size();
}
#endif

103
engine/POLYGON.HPP Normal file
View File

@@ -0,0 +1,103 @@
#ifndef _ENGINE_POLYGON3D_HPP_
#define _ENGINE_POLYGON3D_HPP_
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
#ifndef _ENGINE_LINE3D_HPP_
#include <engine/line3d.hpp>
#endif
#ifndef _ENGINE_LINE2D_HPP_
#include <engine/line2d.hpp>
#endif
class Polygon3D : public Block<Line3D>, public Block<Line2D>
{
public:
Polygon3D(void);
Polygon3D(const Polygon3D &somePolygon3D);
virtual ~Polygon3D();
Polygon3D &operator=(const Polygon3D &somePolygon3D);
void insert(const Line3D *pLine3D);
void remove(void);
LONG size(void)const;
private:
void insert(const Polygon3D *pPolygon3D);
void insert(Block<Line3D> &someLine3DBlock);
void insert(Block<Line2D> &someLine2DBlock);
void insert(const Line2D *pLine2D);
Polygon3D &operator+=(const Block<Line3D> &someLine3DBlock);
};
inline
Polygon3D::Polygon3D(void)
{
}
inline
Polygon3D::Polygon3D(const Polygon3D &somePolygon3D)
: Block<Line3D>(somePolygon3D), Block<Line2D>(somePolygon3D)
{
}
inline
Polygon3D::~Polygon3D()
{
}
inline
Polygon3D &Polygon3D::operator=(const Polygon3D &somePolygon3D)
{
(Block<Line3D>&)*this=(Block<Line3D>&)somePolygon3D;
(Block<Line2D>&)*this=(Block<Line2D>&)somePolygon3D;
return *this;
}
inline
Polygon3D &Polygon3D::operator+=(const Block<Line3D> &someLine3DBlock)
{ // private implementation
(Block<Line3D>&)*this+=someLine3DBlock;
return *this;
}
inline
void Polygon3D::insert(const Polygon3D *pPolygon3D)
{
Block<Line3D>::insert((Block<Line3D>&)*pPolygon3D);
Block<Line2D>::insert((Block<Line2D>&)*pPolygon3D);
}
inline
void Polygon3D::insert(const Line3D *pLine3D)
{
Block<Line3D>::insert(pLine3D);
Block<Line2D>::insert(&Line2D());
}
inline
void Polygon3D::insert(Block<Line3D> &/*someLine3DBlock*/)
{ // private implementation
}
inline
void Polygon3D::insert(Block<Line2D> &/*someLine2DBlock*/)
{ // private implementation
}
inline
void Polygon3D::insert(const Line2D * /*pLine2D*/)
{ // private implementation
}
inline
void Polygon3D::remove(void)
{
Block<Line3D>::remove();
Block<Line2D>::remove();
}
inline
LONG Polygon3D::size(void)const
{
return Block<Line3D>::size();
}
#endif

72
engine/PUREEDGE.HPP Normal file
View File

@@ -0,0 +1,72 @@
#ifndef _ENGINE_PUREEDGE_HPP_
#define _ENGINE_PUREEDGE_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_POINT_HPP_
#include <common/point.hpp>
#endif
class PureEdge
{
public:
PureEdge(void);
~PureEdge();
void numVertexes(WORD numVertexes);
void setSrcPoints(Point *lpSrcPoints);
void setDstPoints(Point *lpDstPoints);
private:
short mEdgeDirection;
WORD mRemainingScanLines;
WORD mCurrentEdgeEnd;
long mxSource;
long mySource;
long mxSourceStep;
long mySourceStep;
WORD mxDestLocation;
WORD mxStep;
short mxDirection;
short mxErrorTerm;
WORD mxAdjustUp;
WORD mxAdjustDown;
WORD mMaxVertex;
WORD mMinVertex;
WORD mStartVertex;
WORD mNumVertexes;
Point *mlpSrcList;
Point *mlpDstList;
};
inline
PureEdge::PureEdge(void)
: mEdgeDirection(1), mRemainingScanLines(0), mCurrentEdgeEnd(0), mxSource(0.00),
mySource(0.00), mxSourceStep(0.00), mySourceStep(0.00), mxDestLocation(0),
mxStep(0), mxDirection(0), mxErrorTerm(0), mxAdjustUp(0), mxAdjustDown(0),
mMaxVertex(0), mMinVertex(0), mStartVertex(0), mNumVertexes(0), mlpSrcList(0),
mlpDstList(0)
{
}
inline
PureEdge::~PureEdge()
{
}
inline
void PureEdge::numVertexes(WORD numVertexes)
{
mNumVertexes=numVertexes;
}
inline
void PureEdge::setSrcPoints(Point *lpSrcPoints)
{
mlpSrcList=lpSrcPoints;
}
inline
void PureEdge::setDstPoints(Point *lpDstPoints)
{
mlpDstList=lpDstPoints;
}
#endif

41
engine/PUREMAP.HPP Normal file
View File

@@ -0,0 +1,41 @@
#ifndef _ENGINE_PUREMAP_HPP_
#define _ENGINE_PUREMAP_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
class PureEdge;
class PureMap
{
public:
PureMap(PureEdge *lpLeftEdge,PureEdge *lpRightEdge);
~PureMap();
private:
LONG mBitmapIndex;
LONG mxSource;
LONG mySource;
LONG mDestWidth;
LONG mxSourceStep;
LONG mySourceStep;
short mxDest;
short mxDestMax;
short myValue;
PureEdge *mlpLeftEdge;
PureEdge *mlpRightEdge;
};
inline
PureMap::PureMap(PureEdge *lpLeftEdge,PureEdge *lpRightEdge)
: mxSource(0), mySource(0), mDestWidth(0), mxSourceStep(0), mySourceStep(0),
mxDest(0), mxDestMax(0), myValue(0), mlpLeftEdge(lpLeftEdge),
mlpRightEdge(lpRightEdge)
{
}
inline
PureMap::~PureMap()
{
}
#endif

189
engine/PUREVSYS.BAK Normal file
View File

@@ -0,0 +1,189 @@
#ifndef _ENGINE_PUREVIEWSYSTEM_HPP_
#define _ENGINE_PUREVIEWSYSTEM_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_MATH_HPP_
#include <common/math.hpp>
#endif
#ifndef _ENGINE_POINT3D_HPP_
#include <engine/point3d.hpp>
#endif
class PureViewSystem;
class Polygon3D;
class Vector3D;
class Vector2D;
extern "C"
{
void initView(PureViewSystem FAR *lpViewSystem);
void mapCoordinates(Point3D *lpPoint3D,Point *lpPoint,DWORD useCartesianSystem);
void mapVectorCoordinates(Point3D *lpPoint3D,Point *lpPoint,DWORD useCartesianSystem);
void mapPolygonCoordinates(Polygon3D *pPolygon3D);
}
// do not make changes to this class that will alter its size
class PureViewSystem
{
public:
enum MapMode{ScreenSystem=0,CartesianSystem=1};
enum {Precision=16384};
PureViewSystem(void);
PureViewSystem(const PureViewSystem &somePureViewSystem);
PureViewSystem(float cameraTwistDegrees,int viewPlaneDistance,Point3D cameraPoint,Point3D focusPoint);
~PureViewSystem();
PureViewSystem &operator=(const PureViewSystem &somePureViewSystem);
WORD operator==(const PureViewSystem &somePureViewSystem)const;
float cameraTwistDegrees(void)const; // rotation about axis established by camera and focus points
void cameraTwistDegrees(float cameraTwistDegrees);
DWORD viewPlaneDistance(void); // distance from view point to view plane
void viewPlaneDistance(DWORD viewPlaneDistance);
Point3D cameraPoint(void)const; // view reference point (origin of coordinate system)
void cameraPoint(Point3D point3D);
Point3D focusPoint(void)const; // direction is which camera is pointing
void focusPoint(Point3D point3D);
protected:
void translatePoint(const Vector3D &vector3D,Vector2D &vector2D,MapMode mapMode=CartesianSystem);
void translatePoint(Polygon3D &polygon,MapMode mapMode=CartesianSystem);
void translatePoint(Point &dimensionPoint,Point &screenPoint,const Point3D &initialPoint,MapMode mapMode=CartesianSystem);
void mapCoordinates(Point3D &firstPoint3D,Point &firstPoint);
void viewPortWidth(WORD viewPortWidth);
void viewPortHeight(WORD viewPortHeight);
private:
enum {DefaultCameraTwistDegrees=120};
enum {DefaultViewPlaneDistance=50};
enum {DefaultFocusx=0,DefaultFocusy=0,DefaultFocusz=1};
enum {DefaultCamerax=75,DefaultCameray=75,DefaultCameraz=75};
LONG mCameraTwistRadians;
LONG mCosCameraTwistRadians;
LONG mSinCameraTwistRadians;
LONG mCosCameraTwistRadiansSinCameraTwistRadians;
DWORD mViewPlaneDistance;
WORD mViewPortWidth;
WORD mViewPortHeight;
Point3D mCameraPoint;
Point3D mFocusPoint;
};
inline
PureViewSystem::PureViewSystem(void)
: mViewPlaneDistance(DefaultViewPlaneDistance), mViewPortWidth(0), mViewPortHeight(0),
mCameraPoint(Point3D(DefaultCamerax,DefaultCameray,DefaultCameraz)),
mFocusPoint(Point3D(DefaultFocusx,DefaultFocusy,DefaultFocusz))
{
cameraTwistDegrees(DefaultCameraTwistDegrees);
}
inline
PureViewSystem::PureViewSystem(float cameraTwistDegrees,int viewPlaneDistance,Point3D cameraPoint,Point3D focusPoint)
{
PureViewSystem::cameraTwistDegrees(cameraTwistDegrees);
PureViewSystem::viewPlaneDistance(viewPlaneDistance);
PureViewSystem::cameraPoint(cameraPoint);
PureViewSystem::focusPoint(focusPoint);
}
inline
PureViewSystem::~PureViewSystem()
{
}
inline
PureViewSystem::PureViewSystem(const PureViewSystem &somePureViewSystem)
{
*this=somePureViewSystem;
}
inline
PureViewSystem &PureViewSystem::operator=(const PureViewSystem &somePureViewSystem)
{
mCameraTwistRadians=somePureViewSystem.mCameraTwistRadians;
mCosCameraTwistRadians=somePureViewSystem.mCosCameraTwistRadians;
mSinCameraTwistRadians=somePureViewSystem.mSinCameraTwistRadians;
mCosCameraTwistRadiansSinCameraTwistRadians=somePureViewSystem.mCosCameraTwistRadiansSinCameraTwistRadians;
mViewPlaneDistance=somePureViewSystem.mViewPlaneDistance;
mViewPortWidth=somePureViewSystem.mViewPortWidth;
mViewPortHeight=somePureViewSystem.mViewPortHeight;
mCameraPoint=somePureViewSystem.mCameraPoint;
mFocusPoint=somePureViewSystem.mFocusPoint;
return *this;
}
inline
WORD PureViewSystem::operator==(const PureViewSystem &somePureViewSystem)const
{
return (mCameraTwistRadians==somePureViewSystem.mCameraTwistRadians&&
mViewPlaneDistance==somePureViewSystem.mViewPlaneDistance&&
mCameraPoint==somePureViewSystem.mCameraPoint&&
mFocusPoint==somePureViewSystem.mFocusPoint);
}
inline
float PureViewSystem::cameraTwistDegrees(void)const
{
float cameraTwistDegrees((float)mCameraTwistRadians/(float)Precision);
return Math::degrees(cameraTwistDegrees);
}
inline
DWORD PureViewSystem::viewPlaneDistance(void)
{
return mViewPlaneDistance;
}
inline
void PureViewSystem::viewPlaneDistance(DWORD viewPlaneDistance)
{
mViewPlaneDistance=viewPlaneDistance;
}
inline
Point3D PureViewSystem::cameraPoint(void)const
{
return mCameraPoint;
}
inline
void PureViewSystem::cameraPoint(Point3D point3D)
{
mCameraPoint=point3D;
}
inline
Point3D PureViewSystem::focusPoint(void)const
{
return mFocusPoint;
}
inline
void PureViewSystem::focusPoint(Point3D point3D)
{
mFocusPoint=point3D;
}
inline
void PureViewSystem::viewPortWidth(WORD viewPortWidth)
{
mViewPortWidth=viewPortWidth;
}
inline
void PureViewSystem::viewPortHeight(WORD viewPortHeight)
{
mViewPortHeight=viewPortHeight;
}
inline
void PureViewSystem::mapCoordinates(Point3D &firstPoint3D,Point &firstPoint)
{
Point3D point3D(firstPoint3D);
Point point(firstPoint);
initView((PureViewSystem*)this);
::mapCoordinates(&point3D,&point,TRUE);
firstPoint3D=point3D;
firstPoint=point;
}
#endif

52
engine/PUREVSYS.CPP Normal file
View File

@@ -0,0 +1,52 @@
#include <common/vector2d.hpp>
#include <engine/purevsys.hpp>
#include <engine/polygon.hpp>
#include <engine/vector3d.hpp>
void PureViewSystem::translatePoint(const Vector3D &vector3D,Vector2D &vector2D,MapMode mapMode)
{
::initView((PureViewSystem*)this);
::mapVectorCoordinates(&((Vector3D&)vector3D)[0],&vector2D[0],(DWORD)mapMode);
}
void PureViewSystem::translatePoint(Polygon3D &polygon,MapMode /*mapMode*/)
{
::initView((PureViewSystem*)this);
::mapPolygonCoordinates(&polygon);
}
void PureViewSystem::translatePoint(Point &dimensionPoint,Point &screenPoint,const Point3D &initialPoint,MapMode mapMode)
{
Vector3D worldPoints;
Vector2D screenPoints;
worldPoints[0]=initialPoint;
worldPoints[1].x(initialPoint.x()+dimensionPoint.x());
worldPoints[1].y(initialPoint.y());
worldPoints[1].z(initialPoint.z());
worldPoints[2].x(initialPoint.x()+dimensionPoint.x());
worldPoints[2].y(initialPoint.y()-dimensionPoint.y());
worldPoints[2].z(initialPoint.z());
worldPoints[3].x(initialPoint.x());
worldPoints[3].y(initialPoint.y()-dimensionPoint.y());
worldPoints[3].z(initialPoint.z());
translatePoint(worldPoints,screenPoints,mapMode);
dimensionPoint.x((worldPoints[1].x()-worldPoints[0].x())+1);
dimensionPoint.y((worldPoints[2].y()-worldPoints[1].y())+1);
screenPoint.x(screenPoints[0].x());
screenPoint.y(screenPoints[0].y());
}
void PureViewSystem::cameraTwistDegrees(float cameraTwistDegrees)
{
float cameraTwistRadians(Math::radians(cameraTwistDegrees));
float sinCameraTwistRadians(Math::sin(cameraTwistRadians));
float cosCameraTwistRadians(Math::cos(cameraTwistRadians));
float cosCameraTwistRadiansSinCameraTwistRadians(cosCameraTwistRadians*sinCameraTwistRadians);
mCameraTwistRadians=cameraTwistRadians*(LONG)Precision;
mCosCameraTwistRadians=cosCameraTwistRadians*(LONG)Precision;
mSinCameraTwistRadians=sinCameraTwistRadians*(LONG)Precision;
mCosCameraTwistRadiansSinCameraTwistRadians=cosCameraTwistRadiansSinCameraTwistRadians*(LONG)Precision;
}

193
engine/PUREVSYS.HPP Normal file
View File

@@ -0,0 +1,193 @@
#ifndef _ENGINE_PUREVIEWSYSTEM_HPP_
#define _ENGINE_PUREVIEWSYSTEM_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_MATH_HPP_
#include <common/math.hpp>
#endif
#ifndef _ENGINE_POINT3D_HPP_
#include <engine/point3d.hpp>
#endif
#include <stdio.h>
#include <common/string.hpp>
class PureViewSystem;
class Polygon3D;
class Vector3D;
class Vector2D;
extern "C"
{
void initView(PureViewSystem FAR *lpViewSystem);
void mapCoordinates(Point3D *lpPoint3D,Point *lpPoint,DWORD useCartesianSystem);
void mapVectorCoordinates(Point3D *lpPoint3D,Point *lpPoint,DWORD useCartesianSystem);
void mapPolygonCoordinates(Polygon3D *pPolygon3D);
}
// do not make changes to this class that will alter its size
class PureViewSystem
{
public:
enum MapMode{ScreenSystem=0,CartesianSystem=1};
PureViewSystem(void);
PureViewSystem(const PureViewSystem &somePureViewSystem);
PureViewSystem(float cameraTwistDegrees,int viewPlaneDistance,Point3D cameraPoint,Point3D focusPoint);
~PureViewSystem();
PureViewSystem &operator=(const PureViewSystem &somePureViewSystem);
WORD operator==(const PureViewSystem &somePureViewSystem)const;
float cameraTwistDegrees(void)const; // rotation about axis established by camera and focus points
void cameraTwistDegrees(float cameraTwistDegrees);
DWORD viewPlaneDistance(void); // distancle from view point to view plane
void viewPlaneDistance(DWORD viewPlaneDistance);
Point3D cameraPoint(void)const; // view reference point (origin of coordinate system)
void cameraPoint(Point3D point3D);
Point3D focusPoint(void)const; // direction is which camera is pointing
void focusPoint(Point3D point3D);
protected:
void translatePoint(const Vector3D &vector3D,Vector2D &vector2D,MapMode mapMode=CartesianSystem);
void translatePoint(Polygon3D &polygon,MapMode mapMode=CartesianSystem);
void translatePoint(Point &dimensionPoint,Point &screenPoint,const Point3D &initialPoint,MapMode mapMode=CartesianSystem);
void mapCoordinates(Point3D &firstPoint3D,Point &firstPoint,bool useCartesian=true);
void viewPortWidth(WORD viewPortWidth);
void viewPortHeight(WORD viewPortHeight);
private:
enum {Precision=16384};
enum {DefaultCameraTwistDegrees=120};
enum {DefaultViewPlaneDistance=50};
enum {DefaultFocusx=0,DefaultFocusy=0,DefaultFocusz=-1};
enum {DefaultCamerax=75,DefaultCameray=75,DefaultCameraz=75};
LONG mCameraTwistRadians;
LONG mCosCameraTwistRadians;
LONG mSinCameraTwistRadians;
LONG mCosCameraTwistRadiansSinCameraTwistRadians;
DWORD mViewPlaneDistance;
WORD mViewPortWidth;
WORD mViewPortHeight;
Point3D mCameraPoint;
Point3D mFocusPoint;
};
inline
PureViewSystem::PureViewSystem(void)
: mViewPlaneDistance(DefaultViewPlaneDistance), mViewPortWidth(0), mViewPortHeight(0),
mCameraPoint(Point3D(DefaultCamerax,DefaultCameray,DefaultCameraz)),
mFocusPoint(Point3D(DefaultFocusx,DefaultFocusy,DefaultFocusz))
{
cameraTwistDegrees(DefaultCameraTwistDegrees);
}
inline
PureViewSystem::PureViewSystem(float cameraTwistDegrees,int viewPlaneDistance,Point3D cameraPoint,Point3D focusPoint)
{
PureViewSystem::cameraTwistDegrees(cameraTwistDegrees);
PureViewSystem::viewPlaneDistance(viewPlaneDistance);
PureViewSystem::cameraPoint(cameraPoint);
PureViewSystem::focusPoint(focusPoint);
}
inline
PureViewSystem::~PureViewSystem()
{
}
inline
PureViewSystem::PureViewSystem(const PureViewSystem &somePureViewSystem)
{
*this=somePureViewSystem;
}
inline
PureViewSystem &PureViewSystem::operator=(const PureViewSystem &somePureViewSystem)
{
mCameraTwistRadians=somePureViewSystem.mCameraTwistRadians;
mCosCameraTwistRadians=somePureViewSystem.mCosCameraTwistRadians;
mSinCameraTwistRadians=somePureViewSystem.mSinCameraTwistRadians;
mCosCameraTwistRadiansSinCameraTwistRadians=somePureViewSystem.mCosCameraTwistRadiansSinCameraTwistRadians;
mViewPlaneDistance=somePureViewSystem.mViewPlaneDistance;
mViewPortWidth=somePureViewSystem.mViewPortWidth;
mViewPortHeight=somePureViewSystem.mViewPortHeight;
mCameraPoint=somePureViewSystem.mCameraPoint;
mFocusPoint=somePureViewSystem.mFocusPoint;
return *this;
}
inline
WORD PureViewSystem::operator==(const PureViewSystem &somePureViewSystem)const
{
return (mCameraTwistRadians==somePureViewSystem.mCameraTwistRadians&&
mViewPlaneDistance==somePureViewSystem.mViewPlaneDistance&&
mCameraPoint==somePureViewSystem.mCameraPoint&&
mFocusPoint==somePureViewSystem.mFocusPoint);
}
inline
float PureViewSystem::cameraTwistDegrees(void)const
{
float cameraTwistDegrees((float)mCameraTwistRadians/(float)Precision);
return Math::degrees(cameraTwistDegrees);
}
inline
DWORD PureViewSystem::viewPlaneDistance(void)
{
return mViewPlaneDistance;
}
inline
void PureViewSystem::viewPlaneDistance(DWORD viewPlaneDistance)
{
mViewPlaneDistance=viewPlaneDistance;
}
inline
Point3D PureViewSystem::cameraPoint(void)const
{
return mCameraPoint;
}
inline
void PureViewSystem::cameraPoint(Point3D point3D)
{
mCameraPoint=point3D;
}
inline
Point3D PureViewSystem::focusPoint(void)const
{
return mFocusPoint;
}
inline
void PureViewSystem::focusPoint(Point3D point3D)
{
mFocusPoint=point3D;
}
inline
void PureViewSystem::viewPortWidth(WORD viewPortWidth)
{
mViewPortWidth=viewPortWidth;
}
inline
void PureViewSystem::viewPortHeight(WORD viewPortHeight)
{
mViewPortHeight=viewPortHeight;
}
inline
void PureViewSystem::mapCoordinates(Point3D &firstPoint3D,Point &firstPoint,bool useCartesian)
{
Point3D point3D(firstPoint3D);
Point point(firstPoint);
initView((PureViewSystem*)this);
::mapCoordinates(&point3D,&point,useCartesian?CartesianSystem:ScreenSystem);
firstPoint3D=point3D;
firstPoint=point;
}
#endif

90
engine/RECT3D.HPP Normal file
View File

@@ -0,0 +1,90 @@
#ifndef _ENGINE_RECT3D_HPP_
#define _ENGINE_RECT3D_HPP_
#ifndef _ENGINE_VECTOR3D_HPP_
#include <engine/vector3d.hpp>
#endif
class Rect3D
{
public:
Rect3D(void);
Rect3D(const Rect3D &someRect3D);
Rect3D(const Vector3D &firstPlane,int depth);
virtual ~Rect3D();
Rect3D &operator=(const Rect3D &someRect3D);
WORD operator==(const Rect3D &someRect3D)const;
const Vector3D &firstPlane(void)const;
void firstPlane(const Vector3D &firstPlane);
const Vector3D &nextPlane(void)const;
void nextPlane(const Vector3D &nextPlane);
private:
Vector3D mFirstPlane;
Vector3D mNextPlane;
};
inline
Rect3D::Rect3D(void)
{
}
inline
Rect3D::Rect3D(const Rect3D &someRect3D)
{
*this=someRect3D;
}
inline
Rect3D::Rect3D(const Vector3D &firstPlane,int depth)
: mFirstPlane(firstPlane)
{
mNextPlane=mFirstPlane;
mNextPlane[0].z(mFirstPlane[0].z()+depth);
mNextPlane[1].z(mFirstPlane[1].z()+depth);
mNextPlane[2].z(mFirstPlane[2].z()+depth);
mNextPlane[3].z(mFirstPlane[3].z()+depth);
}
inline
Rect3D::~Rect3D()
{
}
inline
Rect3D &Rect3D::operator=(const Rect3D &someRect3D)
{
firstPlane(someRect3D.firstPlane());
nextPlane(someRect3D.nextPlane());
return *this;
}
inline
WORD Rect3D::operator==(const Rect3D &someRect3D)const
{
return (firstPlane()==someRect3D.firstPlane()&&
nextPlane()==someRect3D.nextPlane());
}
inline
const Vector3D &Rect3D::firstPlane(void)const
{
return mFirstPlane;
}
inline
void Rect3D::firstPlane(const Vector3D &firstPlane)
{
mFirstPlane=firstPlane;
}
inline
const Vector3D &Rect3D::nextPlane(void)const
{
return mNextPlane;
}
inline
void Rect3D::nextPlane(const Vector3D &nextPlane)
{
mNextPlane=nextPlane;
}
#endif

128
engine/SAMPLE.BAK Normal file
View File

@@ -0,0 +1,128 @@
;*************************************************************************************
; MODULE: UTIL.ASM DATE: MAY 15, 1998
; AUTHOR: SEAN M. KESSLER
; TARGET: 32 BIT TARGET
; FUNCTION : RESAMPLE FUNCTIONS
;*************************************************************************************
SMART
.386
.MODEL FLAT
.DATA
.CODE
LOCALS
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\COMMON\MATH.INC
_resampleClip proc near ; short resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClamp)
LOCAL sampleFactor:DWORD,runningFactor:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; adjust stack for local
push esi ; save source index register
push edi ; save destination
push ebx ; save ebx register
mov eax,[ebp+10h] ; move inLen to eax register
cmp eax,0000h ; compare inLen to zero
jle @@errorExit ; if it's less or equal then exit
mov ebx,[ebp+14h] ; move outLen to ebx register
cmp ebx,0000h ; compare outLen to zero
jle @@errorExit ; if it's less or equal then exit
dec eax ; decrement inLen
shl eax,10h ; multiply inLen by 65536L
divide eax,ebx ; divide ((inLen-1L)*65536L)/outLen
mov sampleFactor,eax ; store the factor
dec ebx ; ebx has (outLen-1)
mov ecx,ebx ; copy (outLen-1) to ecx
mov eax,[ebp+18h] ; move outClip to eax register
sub ebx,eax ; subtract (outLen-1L)-outClip, this is clipping region
mov edi,[ebp+0Ch] ; move lpOut to destination index register
add edi,ecx ; edi=lpOut+(outLen-1L)
mov esi,[ebp+08h] ; move lpIn to source index register
multiply ecx,sampleFactor ; multiply (outLen-1)*sampleFactor
mov runningFactor,eax ; save this into runningFactor
@@loopControl: ; loop control sync address
cmp ecx,0000h ; make sure we're within boundary
jl @@exit ; if not then we exit
cmp ecx,ebx ; compare ecx to clipping region
je @@exit ; if it's equal then we're done
mov eax,runningFactor ; move last running factor into eax
round ; round it off
mov dl,byte ptr[esi+eax] ; move source byte to dl register
mov byte ptr[edi],dl ; move source byte to destination address
mov eax,sampleFactor ; move sampleFactor into eax register
sub runningFactor,eax ; subtract from running factor
dec ecx ; decrement counter
dec edi ; advance (backwards) along lpOut array
jmp @@loopControl ; continue processing
@@errorExit: ; error exit return sync address
xor ax,ax ; clear ax register on error
jmp @@endProcedure ; jump to end procedure
@@exit: ; exit sync address
mov ax,01h ; set ax register on success
@@endProcedure: ; end procedure sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
add esp,LocalLength ; remove locals off stack
pop ebp ; restore previous stack frame
retn ; return near to caller
_resampleClip endp
if 0
_resampleClip proc near ; void resampleClip(char *lpIn,char *lpOut,int inLen,int outLen,int outClip)
rc@@sampleFactor EQU dword ptr[ebp - size dword]
rc@@runningFactor EQU dword ptr[ebp - ( size dword + size dword)]
rc@@localLength EQU size dword + size dword
push ebp ; save stack frame
mov ebp,esp ; create new stack frame
sub esp,rc@@localLength ; adjust stack for local
push esi ; save source index register
push edi ; save destination
push ebx ; save ebx register
mov eax,[ebp+10h] ; move inLen to eax register
cmp eax,0000h ; compare inLen to zero
jle @@errorExit ; if it's less or equal then exit
mov ebx,[ebp+14h] ; move outLen to ebx register
cmp ebx,0000h ; compare outLen to zero
jle @@errorExit ; if it's less or equal then exit
dec eax ; decrement inLen
shl eax,10h ; multiply inLen by 65536L
divide eax,ebx ; divide ((inLen-1L)*65536L)/outLen
mov rc@@sampleFactor,eax ; store the factor
dec ebx ; ebx has (outLen-1)
mov ecx,ebx ; copy (outLen-1) to ecx
mov eax,[ebp+18h] ; move outClip to eax register
sub ebx,eax ; subtract (outLen-1L)-outClip, this is clipping region
mov edi,[ebp+0Ch] ; move lpOut to destination index register
add edi,ecx ; edi=lpOut+(outLen-1L)
mov esi,[ebp+08h] ; move lpIn to source index register
multiply ecx,rc@@sampleFactor ; multiply (outLen-1)*sampleFactor
mov rc@@runningFactor,eax ; save this into runningFactor
@@loopControl: ; loop control sync address
cmp ecx,0000h ; make sure we're within boundary
jl @@exit ; if not then we exit
cmp ecx,ebx ; compare ecx to clipping region
je @@exit ; if it's equal then we're done
mov eax,rc@@runningFactor ; move last running factor into eax
round ; round it off
mov dl,byte ptr[esi+eax] ; move source byte to dl register
mov byte ptr[edi],dl ; move source byte to destination address
mov eax,rc@@sampleFactor ; move sampleFactor into eax register
sub rc@@runningFactor,eax ; subtract from running factor
dec ecx ; decrement counter
dec edi ; advance (backwards) along lpOut array
jmp @@loopControl ; continue processing
@@errorExit: ; error exit return sync address
xor ax,ax ; clear ax register on error
jmp @@endProcedure ; jump to end procedure
@@exit: ; exit sync address
mov ax,01h ; set ax register on success
@@endProcedure: ; end procedure sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
add esp,rc@@localLength ; remove locals off stack
pop ebp ; restore previous stack frame
retn ; return near to caller
_resampleClip endp
endif
public _resampleClip
END

480
engine/SCRAPS.BAK Normal file
View File

@@ -0,0 +1,480 @@
void PureViewSystem::mapCoordinates(Point3D &firstPoint3D,Point &firstPoint)
{
Point3D point3D(firstPoint3D);
Point point(firstPoint);
initView((PureViewSystem*)this);
::mapCoordinates(&point3D,&point,TRUE);
firstPoint3D=point3D;
firstPoint=point;
}
Cache STRUC
Cache@@mColRow DD ?
Cache@@mCacheData DB ?
Cache@@mCacheStatus DB ?
Cache ENDS
GetCacheData STRUC
GetCacheData@@mColRow DD ?
GetCacheData@@mCacheData DB ?
GetCacheData ENDS
GetCache STRUC
GetCache@@mCacheStatus DB ?
GetCache@@mCacheHits DD ?
GetCache@@mCacheData GetCacheData 05h DUP(?)
GetCache ENDS
if 0
roundEBX [esi].PureMap@@mySource ; convert and round PureMap@@mySource -> ebx (row)
roundEAX [esi].PureMap@@mxSource ; convert and round PureMap@@mxSource -> eax (col)
getSrcDataByte MACRO ; BYTE getSrcDataByte(eax=colRow)
mov ebx,eax ; move colRow to ebx register
multiply bx,bmData@@mSrcWidth ; multiply (row*width)-> eax
movzx edx,bmData@@mSrcWidth ; move width to edx register
add eax,edx ; add in width (ie) (row*width)+width
mov edx,bmData@@mSrcExtent ; move source bitmap extent to edx
sub edx,eax ; sub result from source bmp extent
shr ebx,10h ; ebx gets column
add edx,ebx ; add column back in
mov ebx,bmData@@mlpSrcPtr ; move mlpSrcPtr to ebx register
mov cl,byte ptr[ebx+edx] ; get source byte at ebx+edx to cl
ENDM
endif
bmData@@mMulCache MathCache ?
bmData@@mDivCache MathCache ?
;bmData@@mMulCacheOne DD 00h
;bmData@@mMulCacheTwo DD 00h
;bmData@@mMulCacheVal DD 00h
if 0
multiply MACRO varOne,varTwo
LOCAL @@bypassCache,@@return
movzx eax,varOne ; move varOne into eax register
movzx edx,varTwo ; move varTwo into ebx register
cmp eax,bmData@@mMulCache.MathCache@@mCacheOne ; check first cache item
jne @@bypassCache ; if no hit then perform multiply
cmp edx,bmData@@mMulCache.MathCache@@mCacheTwo ; check second cache item
jne @@bypassCache ; if no hit then perform multiply
mov eax,bmData@@mMulCache.MathCache@@mCacheVal ; cache hit returns associated value
jmp @@return ; we're all through here
@@bypassCache: ; bypass cache sync address
mov bmData@@mMulCache.MathCache@@mCacheOne,eax ; move first param to cache item one
mov bmData@@mMulCache.MathCache@@mCacheTwo,edx ; move second param to cache item two
imul eax,edx ; perform multiply, result to eax
mov bmData@@mMulCache.MathCache@@mCacheVal,eax ; store result to cache
@@return: ; return sync address
ENDM
endif
if 0
divide MACRO varOne,varTwo
LOCAL @@bypassCache,@@return
mov eax,varOne
mov edx,varTwo
cmp eax,bmData@@mDivCache.MathCache@@mCacheOne ; check first cache item
jne @@bypassCache ; if no hit then perform multiply
cmp edx,bmData@@mDivCache.MathCache@@mCacheTwo ; check second cache item
jne @@bypassCache ; if no hit then perform multiply
mov eax,bmData@@mDivCache.MathCache@@mCacheVal ; cache hit returns associated value
jmp @@return ; we're all through here
@@bypassCache:
mov bmData@@mDivCache.MathCache@@mCacheOne,eax ;
mov bmData@@mDivCache.MathCache@@mCacheTwo,edx ;
cdq ; convert doubleword in eax to quadword at edx:eax
idiv varTwo ; divide eax/varTwo result to eax, remainder to edx
mov bmData@@mDivCache.MathCache@@mCacheVal,eax ; store result to cache
@@return:
ENDM
endif
mov bmData@@mMulCache.MathCache@@mCacheOne,00000000h
mov bmData@@mMulCache.MathCache@@mCacheTwo,00000000h
mov bmData@@mMulCache.MathCache@@mCacheVal,00000000h
mov bmData@@mDivCache.MathCache@@mCacheOne,00000000h
mov bmData@@mDivCache.MathCache@@mCacheTwo,00000000h
mov bmData@@mDivCache.MathCache@@mCacheVal,00000000h
void WINGBlt::line(const Point &firstPoint,const Point &secondPoint,BYTE byteValue)
{
LONG xRunning((LONG)firstPoint.x()<<0x10);
LONG yRunning((LONG)firstPoint.y()<<0x10);
LONG xDelta;
LONG yDelta;
short xDir(1);
short yDir(1);
short steps;
if(secondPoint.x()<firstPoint.x())xDir=-1;
if(secondPoint.y()<firstPoint.y())yDir=-1;
xDelta=secondPoint.x()-firstPoint.x();
yDelta=secondPoint.y()-firstPoint.y();
if(xDelta<0)xDelta=-xDelta;
if(yDelta<0)yDelta=-yDelta;
if(xDelta<yDelta)
{
xDelta<<=0x10;
if(yDelta)xDelta/=yDelta;
else xDelta=1L;
steps=yDelta;
yDelta=0x10000;
}
else
{
yDelta<<=0x10;
if(xDelta)yDelta/=xDelta;
else yDelta=1L;
steps=xDelta;
xDelta=0x10000;
}
if(-1==xDir&&-1==yDir)
{
for(short stepIndex=0;stepIndex<steps;stepIndex++)
{
setByte(yRunning>>0x10,xRunning>>0x10,byteValue);
xRunning-=xDelta;
yRunning-=yDelta;
}
}
else if(-1==xDir&&1==yDir)
{
for(short stepIndex=0;stepIndex<steps;stepIndex++)
{
setByte(yRunning>>0x10,xRunning>>0x10,byteValue);
xRunning-=xDelta;
yRunning+=yDelta;
}
}
else if(1==xDir&&-1==yDir)
{
for(short itemIndex=0;itemIndex<steps;itemIndex++)
{
setByte(yRunning>>0x10,xRunning>>0x10,byteValue);
xRunning+=xDelta;
yRunning-=yDelta;
}
}
else if(1==xDir&&1==yDir)
{
for(short itemIndex=0;itemIndex<steps;itemIndex++)
{
setByte(yRunning>>0x10,xRunning>>0x10,byteValue);
xRunning+=xDelta;
yRunning+=yDelta;
}
}
}
#if 0
Texture::Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,WINGBlt &displayBitmap,Device3D &displayDevice)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
mDstPoints3D=dstPoints;
Vector3D temp3DPoint(mDstPoints3D);
Vector2D temp2DPoint(mDstPoints2D);
displayDevice.translatePoint(temp3DPoint,temp2DPoint);
mDstPoints2D=temp2DPoint;
mLeftEdge.numVertexes(Vector3D::VectorPoints);
mRightEdge.numVertexes(Vector3D::VectorPoints);
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
mTexturePoints[3]=Point(0,textureBitmap.height()-1);
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),displayBitmap.getDataPtr());
}
#endif
#if 0
Texture::Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,Bitmap &displayBitmap,Device3D &displayDevice)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
mDstPoints3D=dstPoints;
Vector3D temp3DPoint(mDstPoints3D);
Vector2D temp2DPoint(mDstPoints2D);
displayDevice.translatePoint(temp3DPoint,temp2DPoint);
mDstPoints2D=temp2DPoint;
mLeftEdge.numVertexes(Vector3D::VectorPoints);
mRightEdge.numVertexes(Vector3D::VectorPoints);
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
mTexturePoints[3]=Point(0,textureBitmap.height()-1);
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),displayBitmap.getDataPtr());
}
#endif
#ifndef _ENGINE_SYSTEMOBJECT_HPP_
#define _ENGINE_SYSTEMOBJECT_HPP_
#ifndef _COMMON_VECTOR3D_HPP_
#include <common/vector3d.hpp>
#endif
#ifndef _COMMON_VECTOR2D_HPP_
#include <common/vector2d.hpp>
#endif
class SystemObject : public Vector3D
#if 0
class SystemObject
{
public:
enum Type{TypeSprite,TypeTexture,TypeUnknown};
enum Disposition{Active,Destroyed,Idle};
SystemObject(void);
SystemObject(Vector3D &currentWorldPosition,Vector2D &currentScreenPosition,Type typeInfo);
virtual ~SystemObject();
void worldPosition(Vector3D worldPosition);
void screenPosition(Vector2D screenPosition);
void type(Type type);
void disposition(Disposition disposition);
Vector3D worldPosition(void)const;
Vector2D screenPosition(void)const;
Vector3D prevWorldPosition(void)const;
Vector2D prevScreenPosition(void)const;
Type type(void)const;
Disposition disposition(void)const;
private:
Type mType;
Disposition mDisposition;
Vector3D mCurrentWorldPosition;
Vector3D mLastWorldPosition;
Vector2D mCurrentScreenPosition;
Vector2D mLastScreenPosition;
};
inline
SystemObject::SystemObject(void)
: mType(TypeUnknown), mDisposition(Idle)
{
}
inline
SystemObject::SystemObject(Vector3D &currentWorldPosition,Vector2D &currentScreenPosition,Type type)
: mCurrentWorldPosition(currentWorldPosition), mLastWorldPosition(currentWorldPosition),
mCurrentScreenPosition(currentScreenPosition), mLastScreenPosition(currentScreenPosition), mType(type)
{
}
inline
SystemObject::~SystemObject()
{
}
inline
void SystemObject::worldPosition(Vector3D worldPosition)
{
mLastWorldPosition=mCurrentWorldPosition;
mCurrentWorldPosition=worldPosition;
}
inline
void SystemObject::screenPosition(Vector2D screenPosition)
{
mLastScreenPosition=mCurrentScreenPosition;
mCurrentScreenPosition=screenPosition;
}
inline
void SystemObject::type(SystemObject::Type type)
{
mType=type;
}
inline
void SystemObject::disposition(SystemObject::Disposition disposition)
{
mDisposition=disposition;
}
inline
Vector3D SystemObject::worldPosition(void)const
{
return mCurrentWorldPosition;
}
inline
Vector2D SystemObject::screenPosition(void)const
{
return mCurrentScreenPosition;
}
inline
Vector3D SystemObject::prevWorldPosition(void)const
{
return mLastWorldPosition;
}
inline
Vector2D SystemObject::prevScreenPosition(void)const
{
return mLastScreenPosition;
}
inline
SystemObject::Type SystemObject::type(void)const
{
return mType;
}
inline
SystemObject::Disposition SystemObject::disposition(void)const
{
return mDisposition;
}
#endif
#endif
Point3D first3DPoint(((Vector3D&)(someRect3D.firstPlane()))[0]);
Point3D next3DPoint(((Vector3D&)(someRect3D.firstPlane()))[2]);
Point first2DPoint;
Point next2DPoint;
mapCoordinates(first3DPoint,first2DPoint);
mapCoordinates(next3DPoint,next2DPoint);
floodFill(first2DPoint.midPoint(next2DPoint),RGBColor(0,0,255),RGBColor(255,0,0));
void PureViewSystem::translatePoint(const Vector3D &vector3D,Vector2D &vector2D,MapMode mapMode)
{
::initView((PureViewSystem*)this);
::mapVectorCoordinates(&((Vector3D&)vector3D)[0],&vector2D[0],(DWORD)mapMode);
// ::mapCoordinates(&((Vector3D&)vector3D)[0],&vector2D[0],(DWORD)mapMode);
// ::mapCoordinates(&((Vector3D&)vector3D)[1],&vector2D[1],(DWORD)mapMode);
// ::mapCoordinates(&((Vector3D&)vector3D)[2],&vector2D[2],(DWORD)mapMode);
// ::mapCoordinates(&((Vector3D&)vector3D)[3],&vector2D[3],(DWORD)mapMode);
}
;_clearWINGBlt proc near ; void clearWINGBlt(DWORD lpWINGData,DWORD imageExtent)
; push edi ; save destination index register
; xor eax,eax ; clear eax register
; mov edi,[esp+08h] ; move lpWINGData to esi
; mov ecx,[esp+0Ch] ; move bitmap extent to ecx
; shr ecx,02h ; divide bitmap extent by sizeof(long)
; rep stosd ; clear out the bitmap in chunks of sizeof(long)
; pop edi ; restore destination index register
; retn ; return near to caller
;_clearWINGBlt endp
_proto proc near ; void proto(Polygon3D *pPolygon3D) where Polygon3D=Block<Line3D>
push ebp ; save previous stack frame
mov ebp,esp ; create new stack frame
push edi ; save destination index register
push esi ; save source index register
mov edi,[ebp+08h] ; move pPolygon3D to destination index register
mov ecx,ASMPolygon3D[edi].Polygon3D@@mBlockLine3D.BlockLine3D@@mSize ; how many items in block
mov esi,ASMPolygon3D[edi].Polygon3D@@mBlockLine3D.BlockLine3D@@mContainer ; get to first item
@@protiter: ; iteration sync address
cmp esi,0000h ; is this a valid item
je @@endproc ; if not then we're done
mov edi,Line3DNodePtr[esi].Line3DNodePtr@@mItem ; go fetch item for this node
mov esi,Line3DNodePtr[esi].Line3DNodePtr@@mLine3DNodePtrNext ; go fetch next node
jmp @@protiter ; iterate
@@endproc: ; end proc sync address
pop esi ; restore source index register
pop edi ; restore destination index register
pop ebp ; restore previous stack frame
retn ; return near to caller
_proto endp
Polygon3D polygon3D;
for(int itemIndex=0;itemIndex<20000;itemIndex++)polygon3D.insert(&Line3D(Point3D(1,2,3),Point3D(4,5,6)));
for(int i=0;i<500;i++)mapPolygonCoordinates(&polygon3D);
return FALSE;
#if 0
if 0
_resampleClip proc near ; short resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClamp)
LOCAL sampleFactor:DWORD,runningFactor:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; adjust stack for local
push esi ; save source index register
push edi ; save destination
push ebx ; save ebx register
mov eax,[ebp+10h] ; move inLen to eax register
cmp eax,0000h ; compare inLen to zero
jle @@errorExit ; if it's less or equal then exit
mov ebx,[ebp+14h] ; move outLen to ebx register
cmp ebx,0000h ; compare outLen to zero
jle @@errorExit ; if it's less or equal then exit
dec eax ; decrement inLen
shl eax,10h ; multiply inLen by 65536L
divide eax,ebx ; divide ((inLen-1L)*65536L)/outLen
mov sampleFactor,eax ; store the factor
dec ebx ; ebx has (outLen-1)
mov ecx,ebx ; copy (outLen-1) to ecx
mov eax,[ebp+18h] ; move outClip to eax register
sub ebx,eax ; subtract (outLen-1L)-outClip, this is clipping region
mov edi,[ebp+0Ch] ; move lpOut to destination index register
add edi,ecx ; edi=lpOut+(outLen-1L)
mov esi,[ebp+08h] ; move lpIn to source index register
multiply ecx,sampleFactor ; multiply (outLen-1)*sampleFactor
mov runningFactor,eax ; save this into runningFactor
@@loopControl: ; loop control sync address
cmp ecx,0000h ; make sure we're within boundary
jl @@exit ; if not then we exit
cmp ecx,ebx ; compare ecx to clipping region
je @@exit ; if it's equal then we're done
mov eax,runningFactor ; move last running factor into eax
round ; round it off
mov dl,byte ptr[esi+eax] ; move source byte to dl register
mov byte ptr[edi],dl ; move source byte to destination address
mov eax,sampleFactor ; move sampleFactor into eax register
sub runningFactor,eax ; subtract from running factor
dec ecx ; decrement counter
dec edi ; advance (backwards) along lpOut array
jmp @@loopControl ; continue processing
@@errorExit: ; error exit return sync address
xor ax,ax ; clear ax register on error
jmp @@endProcedure ; jump to end procedure
@@exit: ; exit sync address
mov ax,01h ; set ax register on success
@@endProcedure: ; end procedure sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
add esp,LocalLength ; remove locals off stack
pop ebp ; restore previous stack frame
retn ; return near to caller
_resampleClip endp
endif

552
engine/SCRAPS.TXT Normal file
View File

@@ -0,0 +1,552 @@
void PureViewSystem::mapCoordinates(Point3D &firstPoint3D,Point &firstPoint)
{
Point3D point3D(firstPoint3D);
Point point(firstPoint);
initView((PureViewSystem*)this);
::mapCoordinates(&point3D,&point,TRUE);
firstPoint3D=point3D;
firstPoint=point;
}
Cache STRUC
Cache@@mColRow DD ?
Cache@@mCacheData DB ?
Cache@@mCacheStatus DB ?
Cache ENDS
GetCacheData STRUC
GetCacheData@@mColRow DD ?
GetCacheData@@mCacheData DB ?
GetCacheData ENDS
GetCache STRUC
GetCache@@mCacheStatus DB ?
GetCache@@mCacheHits DD ?
GetCache@@mCacheData GetCacheData 05h DUP(?)
GetCache ENDS
if 0
roundEBX [esi].PureMap@@mySource ; convert and round PureMap@@mySource -> ebx (row)
roundEAX [esi].PureMap@@mxSource ; convert and round PureMap@@mxSource -> eax (col)
getSrcDataByte MACRO ; BYTE getSrcDataByte(eax=colRow)
mov ebx,eax ; move colRow to ebx register
multiply bx,bmData@@mSrcWidth ; multiply (row*width)-> eax
movzx edx,bmData@@mSrcWidth ; move width to edx register
add eax,edx ; add in width (ie) (row*width)+width
mov edx,bmData@@mSrcExtent ; move source bitmap extent to edx
sub edx,eax ; sub result from source bmp extent
shr ebx,10h ; ebx gets column
add edx,ebx ; add column back in
mov ebx,bmData@@mlpSrcPtr ; move mlpSrcPtr to ebx register
mov cl,byte ptr[ebx+edx] ; get source byte at ebx+edx to cl
ENDM
endif
bmData@@mMulCache MathCache ?
bmData@@mDivCache MathCache ?
;bmData@@mMulCacheOne DD 00h
;bmData@@mMulCacheTwo DD 00h
;bmData@@mMulCacheVal DD 00h
if 0
multiply MACRO varOne,varTwo
LOCAL @@bypassCache,@@return
movzx eax,varOne ; move varOne into eax register
movzx edx,varTwo ; move varTwo into ebx register
cmp eax,bmData@@mMulCache.MathCache@@mCacheOne ; check first cache item
jne @@bypassCache ; if no hit then perform multiply
cmp edx,bmData@@mMulCache.MathCache@@mCacheTwo ; check second cache item
jne @@bypassCache ; if no hit then perform multiply
mov eax,bmData@@mMulCache.MathCache@@mCacheVal ; cache hit returns associated value
jmp @@return ; we're all through here
@@bypassCache: ; bypass cache sync address
mov bmData@@mMulCache.MathCache@@mCacheOne,eax ; move first param to cache item one
mov bmData@@mMulCache.MathCache@@mCacheTwo,edx ; move second param to cache item two
imul eax,edx ; perform multiply, result to eax
mov bmData@@mMulCache.MathCache@@mCacheVal,eax ; store result to cache
@@return: ; return sync address
ENDM
endif
if 0
divide MACRO varOne,varTwo
LOCAL @@bypassCache,@@return
mov eax,varOne
mov edx,varTwo
cmp eax,bmData@@mDivCache.MathCache@@mCacheOne ; check first cache item
jne @@bypassCache ; if no hit then perform multiply
cmp edx,bmData@@mDivCache.MathCache@@mCacheTwo ; check second cache item
jne @@bypassCache ; if no hit then perform multiply
mov eax,bmData@@mDivCache.MathCache@@mCacheVal ; cache hit returns associated value
jmp @@return ; we're all through here
@@bypassCache:
mov bmData@@mDivCache.MathCache@@mCacheOne,eax ;
mov bmData@@mDivCache.MathCache@@mCacheTwo,edx ;
cdq ; convert doubleword in eax to quadword at edx:eax
idiv varTwo ; divide eax/varTwo result to eax, remainder to edx
mov bmData@@mDivCache.MathCache@@mCacheVal,eax ; store result to cache
@@return:
ENDM
endif
mov bmData@@mMulCache.MathCache@@mCacheOne,00000000h
mov bmData@@mMulCache.MathCache@@mCacheTwo,00000000h
mov bmData@@mMulCache.MathCache@@mCacheVal,00000000h
mov bmData@@mDivCache.MathCache@@mCacheOne,00000000h
mov bmData@@mDivCache.MathCache@@mCacheTwo,00000000h
mov bmData@@mDivCache.MathCache@@mCacheVal,00000000h
void WINGBlt::line(const Point &firstPoint,const Point &secondPoint,BYTE byteValue)
{
LONG xRunning((LONG)firstPoint.x()<<0x10);
LONG yRunning((LONG)firstPoint.y()<<0x10);
LONG xDelta;
LONG yDelta;
short xDir(1);
short yDir(1);
short steps;
if(secondPoint.x()<firstPoint.x())xDir=-1;
if(secondPoint.y()<firstPoint.y())yDir=-1;
xDelta=secondPoint.x()-firstPoint.x();
yDelta=secondPoint.y()-firstPoint.y();
if(xDelta<0)xDelta=-xDelta;
if(yDelta<0)yDelta=-yDelta;
if(xDelta<yDelta)
{
xDelta<<=0x10;
if(yDelta)xDelta/=yDelta;
else xDelta=1L;
steps=yDelta;
yDelta=0x10000;
}
else
{
yDelta<<=0x10;
if(xDelta)yDelta/=xDelta;
else yDelta=1L;
steps=xDelta;
xDelta=0x10000;
}
if(-1==xDir&&-1==yDir)
{
for(short stepIndex=0;stepIndex<steps;stepIndex++)
{
setByte(yRunning>>0x10,xRunning>>0x10,byteValue);
xRunning-=xDelta;
yRunning-=yDelta;
}
}
else if(-1==xDir&&1==yDir)
{
for(short stepIndex=0;stepIndex<steps;stepIndex++)
{
setByte(yRunning>>0x10,xRunning>>0x10,byteValue);
xRunning-=xDelta;
yRunning+=yDelta;
}
}
else if(1==xDir&&-1==yDir)
{
for(short itemIndex=0;itemIndex<steps;itemIndex++)
{
setByte(yRunning>>0x10,xRunning>>0x10,byteValue);
xRunning+=xDelta;
yRunning-=yDelta;
}
}
else if(1==xDir&&1==yDir)
{
for(short itemIndex=0;itemIndex<steps;itemIndex++)
{
setByte(yRunning>>0x10,xRunning>>0x10,byteValue);
xRunning+=xDelta;
yRunning+=yDelta;
}
}
}
#if 0
Texture::Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,WINGBlt &displayBitmap,Device3D &displayDevice)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
mDstPoints3D=dstPoints;
Vector3D temp3DPoint(mDstPoints3D);
Vector2D temp2DPoint(mDstPoints2D);
displayDevice.translatePoint(temp3DPoint,temp2DPoint);
mDstPoints2D=temp2DPoint;
mLeftEdge.numVertexes(Vector3D::VectorPoints);
mRightEdge.numVertexes(Vector3D::VectorPoints);
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
mTexturePoints[3]=Point(0,textureBitmap.height()-1);
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),displayBitmap.getDataPtr());
}
#endif
#if 0
Texture::Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,Bitmap &displayBitmap,Device3D &displayDevice)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
mDstPoints3D=dstPoints;
Vector3D temp3DPoint(mDstPoints3D);
Vector2D temp2DPoint(mDstPoints2D);
displayDevice.translatePoint(temp3DPoint,temp2DPoint);
mDstPoints2D=temp2DPoint;
mLeftEdge.numVertexes(Vector3D::VectorPoints);
mRightEdge.numVertexes(Vector3D::VectorPoints);
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
mTexturePoints[3]=Point(0,textureBitmap.height()-1);
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),displayBitmap.getDataPtr());
}
#endif
#ifndef _ENGINE_SYSTEMOBJECT_HPP_
#define _ENGINE_SYSTEMOBJECT_HPP_
#ifndef _COMMON_VECTOR3D_HPP_
#include <common/vector3d.hpp>
#endif
#ifndef _COMMON_VECTOR2D_HPP_
#include <common/vector2d.hpp>
#endif
class SystemObject : public Vector3D
#if 0
class SystemObject
{
public:
enum Type{TypeSprite,TypeTexture,TypeUnknown};
enum Disposition{Active,Destroyed,Idle};
SystemObject(void);
SystemObject(Vector3D &currentWorldPosition,Vector2D &currentScreenPosition,Type typeInfo);
virtual ~SystemObject();
void worldPosition(Vector3D worldPosition);
void screenPosition(Vector2D screenPosition);
void type(Type type);
void disposition(Disposition disposition);
Vector3D worldPosition(void)const;
Vector2D screenPosition(void)const;
Vector3D prevWorldPosition(void)const;
Vector2D prevScreenPosition(void)const;
Type type(void)const;
Disposition disposition(void)const;
private:
Type mType;
Disposition mDisposition;
Vector3D mCurrentWorldPosition;
Vector3D mLastWorldPosition;
Vector2D mCurrentScreenPosition;
Vector2D mLastScreenPosition;
};
inline
SystemObject::SystemObject(void)
: mType(TypeUnknown), mDisposition(Idle)
{
}
inline
SystemObject::SystemObject(Vector3D &currentWorldPosition,Vector2D &currentScreenPosition,Type type)
: mCurrentWorldPosition(currentWorldPosition), mLastWorldPosition(currentWorldPosition),
mCurrentScreenPosition(currentScreenPosition), mLastScreenPosition(currentScreenPosition), mType(type)
{
}
inline
SystemObject::~SystemObject()
{
}
inline
void SystemObject::worldPosition(Vector3D worldPosition)
{
mLastWorldPosition=mCurrentWorldPosition;
mCurrentWorldPosition=worldPosition;
}
inline
void SystemObject::screenPosition(Vector2D screenPosition)
{
mLastScreenPosition=mCurrentScreenPosition;
mCurrentScreenPosition=screenPosition;
}
inline
void SystemObject::type(SystemObject::Type type)
{
mType=type;
}
inline
void SystemObject::disposition(SystemObject::Disposition disposition)
{
mDisposition=disposition;
}
inline
Vector3D SystemObject::worldPosition(void)const
{
return mCurrentWorldPosition;
}
inline
Vector2D SystemObject::screenPosition(void)const
{
return mCurrentScreenPosition;
}
inline
Vector3D SystemObject::prevWorldPosition(void)const
{
return mLastWorldPosition;
}
inline
Vector2D SystemObject::prevScreenPosition(void)const
{
return mLastScreenPosition;
}
inline
SystemObject::Type SystemObject::type(void)const
{
return mType;
}
inline
SystemObject::Disposition SystemObject::disposition(void)const
{
return mDisposition;
}
#endif
#endif
Point3D first3DPoint(((Vector3D&)(someRect3D.firstPlane()))[0]);
Point3D next3DPoint(((Vector3D&)(someRect3D.firstPlane()))[2]);
Point first2DPoint;
Point next2DPoint;
mapCoordinates(first3DPoint,first2DPoint);
mapCoordinates(next3DPoint,next2DPoint);
floodFill(first2DPoint.midPoint(next2DPoint),RGBColor(0,0,255),RGBColor(255,0,0));
void PureViewSystem::translatePoint(const Vector3D &vector3D,Vector2D &vector2D,MapMode mapMode)
{
::initView((PureViewSystem*)this);
::mapVectorCoordinates(&((Vector3D&)vector3D)[0],&vector2D[0],(DWORD)mapMode);
// ::mapCoordinates(&((Vector3D&)vector3D)[0],&vector2D[0],(DWORD)mapMode);
// ::mapCoordinates(&((Vector3D&)vector3D)[1],&vector2D[1],(DWORD)mapMode);
// ::mapCoordinates(&((Vector3D&)vector3D)[2],&vector2D[2],(DWORD)mapMode);
// ::mapCoordinates(&((Vector3D&)vector3D)[3],&vector2D[3],(DWORD)mapMode);
}
;_clearWINGBlt proc near ; void clearWINGBlt(DWORD lpWINGData,DWORD imageExtent)
; push edi ; save destination index register
; xor eax,eax ; clear eax register
; mov edi,[esp+08h] ; move lpWINGData to esi
; mov ecx,[esp+0Ch] ; move bitmap extent to ecx
; shr ecx,02h ; divide bitmap extent by sizeof(long)
; rep stosd ; clear out the bitmap in chunks of sizeof(long)
; pop edi ; restore destination index register
; retn ; return near to caller
;_clearWINGBlt endp
_proto proc near ; void proto(Polygon3D *pPolygon3D) where Polygon3D=Block<Line3D>
push ebp ; save previous stack frame
mov ebp,esp ; create new stack frame
push edi ; save destination index register
push esi ; save source index register
mov edi,[ebp+08h] ; move pPolygon3D to destination index register
mov ecx,ASMPolygon3D[edi].Polygon3D@@mBlockLine3D.BlockLine3D@@mSize ; how many items in block
mov esi,ASMPolygon3D[edi].Polygon3D@@mBlockLine3D.BlockLine3D@@mContainer ; get to first item
@@protiter: ; iteration sync address
cmp esi,0000h ; is this a valid item
je @@endproc ; if not then we're done
mov edi,Line3DNodePtr[esi].Line3DNodePtr@@mItem ; go fetch item for this node
mov esi,Line3DNodePtr[esi].Line3DNodePtr@@mLine3DNodePtrNext ; go fetch next node
jmp @@protiter ; iterate
@@endproc: ; end proc sync address
pop esi ; restore source index register
pop edi ; restore destination index register
pop ebp ; restore previous stack frame
retn ; return near to caller
_proto endp
Polygon3D polygon3D;
for(int itemIndex=0;itemIndex<20000;itemIndex++)polygon3D.insert(&Line3D(Point3D(1,2,3),Point3D(4,5,6)));
for(int i=0;i<500;i++)mapPolygonCoordinates(&polygon3D);
return FALSE;
#if 0
if 0
_resampleClip proc near ; short resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClamp)
LOCAL sampleFactor:DWORD,runningFactor:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; adjust stack for local
push esi ; save source index register
push edi ; save destination
push ebx ; save ebx register
mov eax,[ebp+10h] ; move inLen to eax register
cmp eax,0000h ; compare inLen to zero
jle @@errorExit ; if it's less or equal then exit
mov ebx,[ebp+14h] ; move outLen to ebx register
cmp ebx,0000h ; compare outLen to zero
jle @@errorExit ; if it's less or equal then exit
dec eax ; decrement inLen
shl eax,10h ; multiply inLen by 65536L
divide eax,ebx ; divide ((inLen-1L)*65536L)/outLen
mov sampleFactor,eax ; store the factor
dec ebx ; ebx has (outLen-1)
mov ecx,ebx ; copy (outLen-1) to ecx
mov eax,[ebp+18h] ; move outClip to eax register
sub ebx,eax ; subtract (outLen-1L)-outClip, this is clipping region
mov edi,[ebp+0Ch] ; move lpOut to destination index register
add edi,ecx ; edi=lpOut+(outLen-1L)
mov esi,[ebp+08h] ; move lpIn to source index register
multiply ecx,sampleFactor ; multiply (outLen-1)*sampleFactor
mov runningFactor,eax ; save this into runningFactor
@@loopControl: ; loop control sync address
cmp ecx,0000h ; make sure we're within boundary
jl @@exit ; if not then we exit
cmp ecx,ebx ; compare ecx to clipping region
je @@exit ; if it's equal then we're done
mov eax,runningFactor ; move last running factor into eax
round ; round it off
mov dl,byte ptr[esi+eax] ; move source byte to dl register
mov byte ptr[edi],dl ; move source byte to destination address
mov eax,sampleFactor ; move sampleFactor into eax register
sub runningFactor,eax ; subtract from running factor
dec ecx ; decrement counter
dec edi ; advance (backwards) along lpOut array
jmp @@loopControl ; continue processing
@@errorExit: ; error exit return sync address
xor ax,ax ; clear ax register on error
jmp @@endProcedure ; jump to end procedure
@@exit: ; exit sync address
mov ax,01h ; set ax register on success
@@endProcedure: ; end procedure sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
add esp,LocalLength ; remove locals off stack
pop ebp ; restore previous stack frame
retn ; return near to caller
_resampleClip endp
endif
clamp MACRO value
LOCAL @@return
cmp value,0000h
jge @@return
mov value,0000h
@@return:
ENDM
void DIB3D::fillRect(const Rect3D &someRect3D,int paletteIndex)
{
Vector2D vector2D;
mapCoordinates(((Vector3D&)someRect3D.firstPlane())[0],vector2D[0]);
mapCoordinates(((Vector3D&)someRect3D.firstPlane())[1],vector2D[1]);
mapCoordinates(((Vector3D&)someRect3D.firstPlane())[2],vector2D[2]);
mapCoordinates(((Vector3D&)someRect3D.firstPlane())[3],vector2D[3]);
DIBitmap::fillRect(vector2D,paletteIndex);
}
// line(((Vector3D&)(someRect3D.firstPlane()))[0],((Vector3D&)(someRect3D.firstPlane()))[1],paletteIndex);
// line(((Vector3D&)(someRect3D.firstPlane()))[1],((Vector3D&)(someRect3D.firstPlane()))[2],paletteIndex);
// line(((Vector3D&)(someRect3D.firstPlane()))[2],((Vector3D&)(someRect3D.firstPlane()))[3],paletteIndex);
// line(((Vector3D&)(someRect3D.firstPlane()))[3],((Vector3D&)(someRect3D.firstPlane()))[0],paletteIndex);
// line(((Vector3D&)(someRect3D.nextPlane()))[0],((Vector3D&)(someRect3D.nextPlane()))[1],paletteIndex);
// line(((Vector3D&)(someRect3D.nextPlane()))[1],((Vector3D&)(someRect3D.nextPlane()))[2],paletteIndex);
// line(((Vector3D&)(someRect3D.nextPlane()))[2],((Vector3D&)(someRect3D.nextPlane()))[3],paletteIndex);
// line(((Vector3D&)(someRect3D.nextPlane()))[3],((Vector3D&)(someRect3D.nextPlane()))[0],paletteIndex);
// line(((Vector3D&)(someRect3D.firstPlane()))[0],((Vector3D&)(someRect3D.nextPlane()))[0],paletteIndex);
// line(((Vector3D&)(someRect3D.firstPlane()))[1],((Vector3D&)(someRect3D.nextPlane()))[1],paletteIndex);
// line(((Vector3D&)(someRect3D.firstPlane()))[2],((Vector3D&)(someRect3D.nextPlane()))[2],paletteIndex);
// line(((Vector3D&)(someRect3D.firstPlane()))[3],((Vector3D&)(someRect3D.nextPlane()))[3],paletteIndex);
//}
#include <engine/angle3d.hpp>
#include <engine/angle.hpp>
Texture::Texture(const Triangle3D &angle3D,Bitmap &textureBitmap,DIBitmap &displayBitmap,Device3D &displayDevice)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
Triangle angle2D;
displayDevice.mapCoordinates((Triangle3D&)angle3D,angle2D);
mDstPoints2D[0]=angle2D[0];
mDstPoints2D[1]=angle2D[1];
mDstPoints2D[2]=angle2D[2];
mLeftEdge.numVertexes(Triangle::VectorPoints);
mRightEdge.numVertexes(Triangle::VectorPoints);
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
// mLeftEdge.numVertexes(Vector3D::VectorPoints);
// mRightEdge.numVertexes(Vector3D::VectorPoints);
// mTexturePoints[0]=Point(0,0);
// mTexturePoints[1]=Point(textureBitmap.width()-1,0);
// mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
// mTexturePoints[3]=Point(0,textureBitmap.height()-1);
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),(unsigned char*)displayBitmap.ptrData());
}

177
engine/SMK.ERR Normal file
View File

@@ -0,0 +1,177 @@
Assembling: vsmap32.asm
vsmap32.asm(9) : error A2008: syntax error : LOCALS
..\COMMON\WINDOWS.INC(40) : error A2179: structure improperly initialized
..\COMMON\WINDOWS.INC(40) : error A2008: syntax error : in structure
..\COMMON\WINDOWS.INC(41) : error A2179: structure improperly initialized
..\COMMON\WINDOWS.INC(41) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(19) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(19) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(24) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(24) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(25) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(25) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(26) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(26) : error A2065: expected : )
..\COMMON\COMMON.INC(31) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(31) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(32) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(32) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(42) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(42) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(43) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(43) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(46) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(46) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(47) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(47) : error A2008: syntax error : in structure
..\COMMON\COMMON.INC(49) : error A2179: structure improperly initialized
..\COMMON\COMMON.INC(49) : error A2008: syntax error : in structure
..\ENGINE\VSMAP.INC(14) : error A2179: structure improperly initialized
..\ENGINE\VSMAP.INC(14) : error A2008: syntax error : in structure
..\ENGINE\VSMAP.INC(15) : error A2179: structure improperly initialized
..\ENGINE\VSMAP.INC(15) : error A2008: syntax error : in structure
vsmap32.asm(13) : error A2179: structure improperly initialized
vsmap32.asm(13) : error A2008: syntax error : in structure
vsmap32.asm(340) : error A2008: syntax error
vsmap32.asm(405) : error A2008: syntax error
vsmap32.asm(343) : error A2006: undefined symbol : LocalLength
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(27): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(30): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(33): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(36): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(39): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(42): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(45): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(48): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(51): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(54): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(57): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(349) : error A2006: undefined symbol : bestGuess
firstGuess(60): Macro Called From
vsmap32.asm(349): Main Line Code
vsmap32.asm(351) : error A2006: undefined symbol : bestGuess
divide(2): Macro Called From
vsmap32.asm(351): Main Line Code
vsmap32.asm(352) : error A2006: undefined symbol : bestGuess
vsmap32.asm(355) : error A2006: undefined symbol : bestGuess
vsmap32.asm(357) : error A2006: undefined symbol : bestGuess
vsmap32.asm(365) : error A2006: undefined symbol : LocalLength
vsmap32.asm(374) : error A2006: undefined symbol : PureViewSystem@@cameraTwistRadians
vsmap32.asm(375) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(376) : error A2006: undefined symbol : PureViewSystem@@cosCameraTwistRadians
vsmap32.asm(377) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(378) : error A2006: undefined symbol : PureViewSystem@@sinCameraTwistRadians
vsmap32.asm(379) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(380) : error A2006: undefined symbol : PureViewSystem@@cosCameraTwistRadiansSinCameraTwistRadians
vsmap32.asm(381) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(382) : error A2006: undefined symbol : PureViewSystem@@viewPlaneDistance
vsmap32.asm(383) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(384) : error A2006: undefined symbol : PureViewSystem@@viewPortWidth
vsmap32.asm(385) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(386) : error A2006: undefined symbol : PureViewSystem@@viewPortHeight
vsmap32.asm(387) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(388) : error A2006: undefined symbol : PureViewSystem@@cameraPoint
vsmap32.asm(389) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(390) : error A2006: undefined symbol : PureViewSystem@@cameraPoint
vsmap32.asm(391) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(392) : error A2006: undefined symbol : PureViewSystem@@cameraPoint
vsmap32.asm(393) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(394) : error A2006: undefined symbol : PureViewSystem@@focusPoint
vsmap32.asm(395) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(396) : error A2006: undefined symbol : PureViewSystem@@focusPoint
vsmap32.asm(397) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(398) : error A2006: undefined symbol : PureViewSystem@@focusPoint
vsmap32.asm(399) : error A2006: undefined symbol : viewData@@mViewSystem
vsmap32.asm(408) : error A2006: undefined symbol : LocalLength
vsmap32.asm(411) : error A2006: undefined symbol : tempValue
initializeLocal(3): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : viewData@@mViewSystem
initializeLocal(4): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : viewData@@mViewSystem
sMul(3): Macro Called From
initializeLocal(5): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : tempValue
initializeLocal(6): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : tempValue
initializeLocal(7): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : v
initializeLocal(9): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : tempValue
initializeLocal(12): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : tempValue
initializeLocal(13): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : v
initializeLocal(16): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : v
initializeLocal(18): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : viewData@@mViewSystem
initializeLocal(20): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : v
divide(2): Macro Called From
initializeLocal(21): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : aov
initializeLocal(22): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : viewData@@mViewSystem
initializeLocal(23): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : v
divide(2): Macro Called From
initializeLocal(24): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : bov
initializeLocal(25): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : viewData@@mViewSystem
sMul(2): Macro Called From
initializeLocal(26): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : viewData@@mViewSystem
sMul(3): Macro Called From
initializeLocal(26): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : v
divide(2): Macro Called From
initializeLocal(27): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : error A2006: undefined symbol : acov
initializeLocal(28): Macro Called From
vsmap32.asm(411): Main Line Code
vsmap32.asm(411) : fatal error A1012: error count exceeds 100; stopping assembly
sMul(2): Macro Called From
initializeLocal(29): Macro Called From
vsmap32.asm(411): Main Line Code

23
engine/SMK.LST Normal file
View File

@@ -0,0 +1,23 @@
File LINE3D.HPP:
class Line3D
Line3D(void);
Line3D(const Point3D &firstPoint,const Point3D &secondPoint);
Line3D(const Line3D &someLine3D);
~Line3D();
Line3D &operator=(const Line3D &someLine3D);
WORD operator==(const Line3D &someLine3D)const;
Line3D::Line3D(void)
Line3D::Line3D(const Point3D &firstPoint,const Point3D &secondPoint)
Line3D::Line3D(const Line3D &someLine3D)
: mFirstPoint(someLine3D.mFirstPoint), mSecondPoint(someLine3D.mSecondPoint)
Line3D::~Line3D()
Line3D &Line3D::operator=(const Line3D &someLine3D)
mFirstPoint=someLine3D.mFirstPoint;
mSecondPoint=someLine3D.mSecondPoint;
WORD Line3D::operator==(const Line3D &someLine3D)const
return (mFirstPoint==someLine3D.mFirstPoint&&
mSecondPoint==someLine3D.mSecondPoint);
Point3D Line3D::firstPoint(void)const
Point3D Line3D::secondPoint(void)const
void Line3D::firstPoint(const Point3D &firstPoint)
void Line3D::secondPoint(const Point3D &secondPoint)

49
engine/SPACIAL.CPP Normal file
View File

@@ -0,0 +1,49 @@
#include <engine/spacial.hpp>
#include <common/array.hpp>
SpacialTransform::~SpacialTransform()
{
}
BOOL SpacialTransform::transform(Array<int> &srcVector,Array<int> &dstVector,WORD sizeFactor)
{
int inverseFactor((100.00/(float)sizeFactor)*100.00);
int outSegment(inverseFactor);
int inSegment(100);
int nextDestIndex(0);
int accumulator(0);
mNextInputIndex=-1;
dstVector.size((srcVector.size()*sizeFactor)/100.00);
if(!nextInput(srcVector))return FALSE;
while(TRUE)
{
if(outSegment<=inSegment)
{
accumulator+=((inSegment*mCurrentValue)+((100-inSegment)*mNextValue))*outSegment;
inSegment-=outSegment;
outSegment=inverseFactor;
accumulator*=(float)sizeFactor*.000001;
if(nextDestIndex>=dstVector.size())break;
dstVector[nextDestIndex++]=accumulator;
accumulator=0;
}
else
{
accumulator+=((inSegment*mCurrentValue)+((100-inSegment)*mNextValue))*inSegment;
outSegment-=inSegment;
inSegment=100;
if(!nextInput(srcVector))break;
}
}
return false;
}
BOOL SpacialTransform::nextInput(Array<int> &srcVector)
{
if(++mNextInputIndex>=srcVector.size())return FALSE;
mCurrentValue=srcVector[mNextInputIndex];
if(mNextInputIndex+1>=srcVector.size())mNextValue=mCurrentValue;
else mNextValue=srcVector[mNextInputIndex+1];
return TRUE;
}

41
engine/SPACIAL.HPP Normal file
View File

@@ -0,0 +1,41 @@
#ifndef _ENGINE_SPACIALTRANSFORM_HPP_
#define _ENGINE_SPACIALTRANSFROM_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
template <class T>
class Array;
class SpacialTransform
{
public:
SpacialTransform(void);
virtual ~SpacialTransform();
BOOL transform(Array<int> &srcVector,Array<int> &dstVector,WORD sizeFactor);
private:
SpacialTransform(const SpacialTransform &someSpacialTransform);
SpacialTransform &operator=(const SpacialTransform &someSpacialTransform);
BOOL nextInput(Array<int> &srcVector);
int mNextInputIndex;
int mCurrentValue;
int mNextValue;
};
inline
SpacialTransform::SpacialTransform(void)
{
}
inline
SpacialTransform::SpacialTransform(const SpacialTransform &/*someSpacialTransform*/)
{ // private implementation
}
inline
SpacialTransform &SpacialTransform::operator=(const SpacialTransform &/*someSpacialTransform*/)
{ // private implementation
return *this;
}
#endif

103
engine/SYSOBJ.BAK Normal file
View File

@@ -0,0 +1,103 @@
#ifndef _ENGINE_SYSTEMOBJECT_HPP_
#define _ENGINE_SYSTEMOBJECT_HPP_
#ifndef _ENGINE_VECTOR3D_HPP_
#include <engine/vector3d.hpp>
#endif
#ifndef _COMMON_VECTOR2D_HPP_
#include <common/vector2d.hpp>
#endif
class SystemObject
{
public:
enum Disposition{Active,Destroyed,Idle};
SystemObject(void);
SystemObject(Vector3D &currentWorldPosition,Vector2D &currentScreenPosition);
virtual ~SystemObject();
void worldPosition(Vector3D worldPosition);
void screenPosition(Vector2D screenPosition);
void disposition(Disposition disposition);
Vector3D worldPosition(void)const;
Vector2D screenPosition(void)const;
Vector3D prevWorldPosition(void)const;
Vector2D prevScreenPosition(void)const;
Disposition disposition(void)const;
private:
Disposition mDisposition;
Vector3D mCurrentWorldPosition;
Vector3D mLastWorldPosition;
Vector2D mCurrentScreenPosition;
Vector2D mLastScreenPosition;
};
inline
SystemObject::SystemObject(void)
: mDisposition(Idle)
{
}
inline
SystemObject::SystemObject(Vector3D &currentWorldPosition,Vector2D &currentScreenPosition)
: mCurrentWorldPosition(currentWorldPosition), mLastWorldPosition(currentWorldPosition),
mCurrentScreenPosition(currentScreenPosition), mLastScreenPosition(currentScreenPosition)
{
}
inline
SystemObject::~SystemObject()
{
}
inline
void SystemObject::worldPosition(Vector3D worldPosition)
{
mLastWorldPosition=mCurrentWorldPosition;
mCurrentWorldPosition=worldPosition;
}
inline
void SystemObject::screenPosition(Vector2D screenPosition)
{
mLastScreenPosition=mCurrentScreenPosition;
mCurrentScreenPosition=screenPosition;
}
inline
void SystemObject::disposition(SystemObject::Disposition disposition)
{
mDisposition=disposition;
}
inline
Vector3D SystemObject::worldPosition(void)const
{
return mCurrentWorldPosition;
}
inline
Vector2D SystemObject::screenPosition(void)const
{
return mCurrentScreenPosition;
}
inline
Vector3D SystemObject::prevWorldPosition(void)const
{
return mLastWorldPosition;
}
inline
Vector2D SystemObject::prevScreenPosition(void)const
{
return mLastScreenPosition;
}
inline
SystemObject::Disposition SystemObject::disposition(void)const
{
return mDisposition;
}
#endif

103
engine/SYSOBJ.HPP Normal file
View File

@@ -0,0 +1,103 @@
#ifndef _ENGINE_SYSTEMOBJECT_HPP_
#define _ENGINE_SYSTEMOBJECT_HPP_
#ifndef _ENGINE_VECTOR3D_HPP_
#include <engine/vector3d.hpp>
#endif
#ifndef _COMMON_VECTOR2D_HPP_
#include <common/vector2d.hpp>
#endif
class SystemObject
{
public:
enum Disposition{Active,Destroyed,Idle};
SystemObject(void);
SystemObject(Vector3D &currentWorldPosition,Vector2D &currentScreenPosition);
virtual ~SystemObject();
void worldPosition(Vector3D worldPosition);
void screenPosition(Vector2D screenPosition);
void disposition(Disposition disposition);
Vector3D worldPosition(void)const;
Vector2D screenPosition(void)const;
Vector3D prevWorldPosition(void)const;
Vector2D prevScreenPosition(void)const;
Disposition disposition(void)const;
private:
Disposition mDisposition;
Vector3D mCurrentWorldPosition;
Vector3D mLastWorldPosition;
Vector2D mCurrentScreenPosition;
Vector2D mLastScreenPosition;
};
inline
SystemObject::SystemObject(void)
: mDisposition(Idle)
{
}
inline
SystemObject::SystemObject(Vector3D &currentWorldPosition,Vector2D &currentScreenPosition)
: mCurrentWorldPosition(currentWorldPosition), mLastWorldPosition(currentWorldPosition),
mCurrentScreenPosition(currentScreenPosition), mLastScreenPosition(currentScreenPosition)
{
}
inline
SystemObject::~SystemObject()
{
}
inline
void SystemObject::worldPosition(Vector3D worldPosition)
{
mLastWorldPosition=mCurrentWorldPosition;
mCurrentWorldPosition=worldPosition;
}
inline
void SystemObject::screenPosition(Vector2D screenPosition)
{
mLastScreenPosition=mCurrentScreenPosition;
mCurrentScreenPosition=screenPosition;
}
inline
void SystemObject::disposition(SystemObject::Disposition disposition)
{
mDisposition=disposition;
}
inline
Vector3D SystemObject::worldPosition(void)const
{
return mCurrentWorldPosition;
}
inline
Vector2D SystemObject::screenPosition(void)const
{
return mCurrentScreenPosition;
}
inline
Vector3D SystemObject::prevWorldPosition(void)const
{
return mLastWorldPosition;
}
inline
Vector2D SystemObject::prevScreenPosition(void)const
{
return mLastScreenPosition;
}
inline
SystemObject::Disposition SystemObject::disposition(void)const
{
return mDisposition;
}
#endif

BIN
engine/TDCONFIG.TDW Normal file

Binary file not shown.

BIN
engine/TDW.TRW Normal file

Binary file not shown.

64
engine/TEXTURE.BAK Normal file
View File

@@ -0,0 +1,64 @@
#ifndef _ENGINE_TEXTURE_HPP_
#define _ENGINE_TEXTURE_HPP_
#ifndef _COMMON_VECTOR2D_HPP_
#include <common/vector2d.hpp>
#endif
#ifndef _ENGINE_VECTOR3D_HPP_
#include <engine/vector3d.hpp>
#endif
#ifndef _ENGINE_DEVICE3D_HPP_
#include <engine/device3d.hpp>
#endif
#ifndef _ENGINE_PUREEDGE_HPP_
#include <engine/pureedge.hpp>
#endif
#ifndef _ENGINE_PUREMAP_HPP_
#include <engine/puremap.hpp>
#endif
#ifndef _ENGINE_ASMUTIL_HPP_
#include <engine/asmutil.hpp>
#endif
class WINGBlt;
class DIBitmap;
class Bitmap;
class Texture
{
public:
typedef void (Texture::*PMFI)(long pixelPoint,long imagePoint);
Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,Bitmap &displayBitmap,Device3D &displayDevice);
Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,WINGBlt &displayBitmap,Device3D &displayDevice);
Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,DIBitmap &displayBitmap,Device3D &displayDevice);
Texture(const Vector2D &dstPoints,Bitmap &textureBitmap,DIBitmap &displayBitmap);
virtual ~Texture();
void mapTexture(void);
private:
Texture &operator=(const Texture &someTexture);
PureEdge mLeftEdge;
PureEdge mRightEdge;
PureMap mEdgeMap;
Vector2D mTexturePoints;
Vector2D mDstPoints2D;
Vector3D mDstPoints3D;
};
inline
Texture &Texture::operator=(const Texture &/*someTexture*/)
{ // undefined
return *this;
}
inline
Texture::~Texture()
{
}
inline
void Texture::mapTexture(void)
{
::initEdge(-1,&mLeftEdge);
::initEdge(1,&mRightEdge);
::mapTexture(&mEdgeMap);
}
#endif

120
engine/TEXTURE.CPP Normal file
View File

@@ -0,0 +1,120 @@
#include <engine/texture.hpp>
#include <engine/point3d.hpp>
#include <engine/angle3d.hpp>
#include <engine/angle.hpp>
#include <engine/dib3d.hpp>
#include <common/dib.hpp>
#include <common/bitmap.hpp>
Texture::Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,DIB3D &displayBitmap)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
mDstPoints3D=dstPoints;
displayBitmap.translatePoint(mDstPoints3D,mDstPoints2D);
mLeftEdge.numVertexes(Vector3D::VectorPoints);
mRightEdge.numVertexes(Vector3D::VectorPoints);
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
mTexturePoints[3]=Point(0,textureBitmap.height()-1);
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),(unsigned char*)displayBitmap.ptrData());
}
Texture::Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,Bitmap &displayBitmap,Device3D &displayDevice)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
mDstPoints3D=dstPoints;
displayDevice.translatePoint(mDstPoints3D,mDstPoints2D);
mLeftEdge.numVertexes(Vector3D::VectorPoints);
mRightEdge.numVertexes(Vector3D::VectorPoints);
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
mTexturePoints[3]=Point(0,textureBitmap.height()-1);
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),displayBitmap.getDataPtr());
}
Texture::Texture(const Vector2D &dstPoints,Bitmap &textureBitmap,DIBitmap &displayBitmap)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
mDstPoints2D=dstPoints;
mLeftEdge.numVertexes(Vector3D::VectorPoints);
mRightEdge.numVertexes(Vector3D::VectorPoints);
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
mTexturePoints[3]=Point(0,textureBitmap.height()-1);
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),(unsigned char*)displayBitmap.ptrData());
}
Texture::Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,DIBitmap &displayBitmap,Device3D &displayDevice)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
mDstPoints3D=dstPoints;
displayDevice.translatePoint(mDstPoints3D,mDstPoints2D);
mLeftEdge.numVertexes(Vector3D::VectorPoints);
mRightEdge.numVertexes(Vector3D::VectorPoints);
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
mTexturePoints[3]=Point(0,textureBitmap.height()-1);
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),(unsigned char*)displayBitmap.ptrData());
}
Texture::Texture(const Triangle3D &angle3D,Bitmap &textureBitmap,DIBitmap &displayBitmap,Device3D &displayDevice,TriMap triMap)
: mEdgeMap(&mLeftEdge,&mRightEdge)
{
Triangle angle2D;
displayDevice.mapCoordinates((Triangle3D&)angle3D,angle2D);
mDstPoints2D[0]=angle2D[0];
mDstPoints2D[1]=angle2D[1];
mDstPoints2D[2]=angle2D[2];
mLeftEdge.numVertexes(Triangle::VectorPoints);
mRightEdge.numVertexes(Triangle::VectorPoints);
switch(triMap)
{
case MapCenter :
mTexturePoints[0]=Point(0,textureBitmap.height()-1);
mTexturePoints[1]=Point(textureBitmap.width()/2,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
break;
case MapUpperRight :
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,0);
mTexturePoints[2]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
break;
case MapLowerLeft :
mTexturePoints[0]=Point(0,0);
mTexturePoints[1]=Point(textureBitmap.width()-1,textureBitmap.height()-1);
mTexturePoints[2]=Point(0,textureBitmap.height()-1);
break;
}
mLeftEdge.setSrcPoints((Point*)&mTexturePoints);
mLeftEdge.setDstPoints((Point*)&mDstPoints2D);
mRightEdge.setSrcPoints((Point*)&mTexturePoints);
mRightEdge.setDstPoints((Point*)&mDstPoints2D);
::setSrcBitmapInfo(textureBitmap.width(),textureBitmap.height(),textureBitmap.getDataPtr());
::setDstBitmapInfo(displayBitmap.width(),displayBitmap.height(),(unsigned char*)displayBitmap.ptrData());
}

68
engine/TEXTURE.HPP Normal file
View File

@@ -0,0 +1,68 @@
#ifndef _ENGINE_TEXTURE_HPP_
#define _ENGINE_TEXTURE_HPP_
#ifndef _COMMON_VECTOR2D_HPP_
#include <common/vector2d.hpp>
#endif
#ifndef _ENGINE_VECTOR3D_HPP_
#include <engine/vector3d.hpp>
#endif
#ifndef _ENGINE_DEVICE3D_HPP_
#include <engine/device3d.hpp>
#endif
#ifndef _ENGINE_PUREEDGE_HPP_
#include <engine/pureedge.hpp>
#endif
#ifndef _ENGINE_PUREMAP_HPP_
#include <engine/puremap.hpp>
#endif
#ifndef _ENGINE_ASMUTIL_HPP_
#include <engine/asmutil.hpp>
#endif
class DIBitmap;
class Bitmap;
class Triangle3D;
class DIB3D;
class Texture
{
public:
enum TriMap{MapCenter,MapLowerLeft,MapUpperRight};
typedef void (Texture::*PMFI)(long pixelPoint,long imagePoint);
Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,DIB3D &displayBitmap);
Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,Bitmap &displayBitmap,Device3D &displayDevice);
Texture(const Vector3D &dstPoints,Bitmap &textureBitmap,DIBitmap &displayBitmap,Device3D &displayDevice);
Texture(const Vector2D &dstPoints,Bitmap &textureBitmap,DIBitmap &displayBitmap);
Texture(const Triangle3D &angle3D,Bitmap &textureBitmap,DIBitmap &displayBitmap,Device3D &displayDevice,TriMap triMap=MapCenter);
virtual ~Texture();
void mapTexture(void);
private:
enum EdgeType{LeftEdge=-1,RightEdge=1};
Texture &operator=(const Texture &someTexture);
PureEdge mLeftEdge;
PureEdge mRightEdge;
PureMap mEdgeMap;
Vector2D mTexturePoints;
Vector2D mDstPoints2D;
Vector3D mDstPoints3D;
};
inline
Texture &Texture::operator=(const Texture &/*someTexture*/)
{ // undefined
return *this;
}
inline
Texture::~Texture()
{
}
inline
void Texture::mapTexture(void)
{
::initEdge(LeftEdge,&mLeftEdge);
::initEdge(RightEdge,&mRightEdge);
::mapTexture(&mEdgeMap);
}
#endif

589
engine/TMAP16.ASM Normal file
View File

@@ -0,0 +1,589 @@
;*************************************************************************************
; MODULE: TMAP16.ASM DATE: DECEMBER 28,1994
; AUTHOR: SEAN M. KESSLER
; TARGET: 16 BIT TARGET
; FUNCTION : TEXTURE MAPPING POLYGONS IN PERSPECTIVE
;*************************************************************************************
.MODEL LARGE C
.386
.DATA
bmData@@mSrcWidth DW 00h
bmData@@mSrcHeight DW 00h
bmData@@mlpSrcPtr DD 00h
bmData@@mDstWidth DW 00h
bmData@@mDstHeight DW 00h
bmData@@mlpDstPtr DD 00h
MINVALUE EQU -32767
MAXVALUE EQU 32767
MINVERTEX EQU 3
PRECISION EQU 16384
.CODE
LOCALS
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\ENGINE\TMAP16.INC
round MACRO varOne
mov eax,varOne ; move varOne into eax register
mov ebx,eax ; move varOne into ebx register
and ebx,00003FFFh ; get remainder into ebx register
shr eax,14 ; get whole number to eax register
cmp ebx,8192 ; if remainder > 8192, increment eax
db 7Eh ; the next 2 bytes comprise "jle +2" (ie)
db 02h ; jump passed the increment eax instruction
inc eax ; increment value in eax
ENDM
multiply MACRO varOne,varTwo
push bx ; save bx register
mov ax,varOne ; move varOne into ax register
mov bx,varTwo ; move varTwo into bx register
imul bx ; perform the multiply result to dx:ax
push ax ; save ax register result
movzx eax,dx ; move dx register to eax zero extend
shl eax,16 ; shift eax left by a word
pop ax ; restore ax register result
pop bx ; restore bx register
ENDM
divide MACRO varOne,varTwo
push ebx ; save ebx register
mov ebx,varTwo ; move varTwo into ebx register
mov eax,varOne ; move varOne into eax register
cdq ; convert doubleword in eax to quadword at edx:eax
idiv ebx ; divide eax/ebx result to eax, remainder to edx
pop ebx ; restore ebx register
ENDM
getPoint MACRO segment,offset,index
push si ; save source index register
push ds ; save data segment register
push cx ; save cx register
push segment ; save segment on stack
pop ds ; restore to data segment
mov ax,index ; move index to ax register
shl ax,02h ; multiply ax by size of far pointer
mov si,offset ; now move offset address to si
add si,ax ; add in the increment value
xor eax,eax ; clear out eax register
mov ax,ds:[si].Point@@x ; get the x-value to ax register
xor ebx,ebx ; clear out ebx register
mov bx,ds:[si].Point@@y ; get the y-value to bx register
pop cx ; restore saved cx register
pop ds ; restore saved data segment
pop si ; restore save source index register
ENDM
_initEdge proc far ; void initEdge(short edgeType,PureEdge *lpEdge);
push bp ; save callers stack frame
mov bp,sp ; create new stack frame
push di ; save callers destination index register
mov es,[bp+10] ; move segment of data to extra segment
mov di,[bp+8] ; move offset of data to destination index register
assume es ; now assume extra segment for segment loads.
call _getMinMaxInfo ; find minimum and maximum vertexes
cmp ax,00h ; make sure previous call returned success
jne @@return ; if not then we should leave
push word ptr[bp+6] ; push edgeType (-1:leftEdge,1:rightEdge)
push [di].PureEdge@@mStartVertex ; push startVertex
call _setupEdge ; now setup the edge
add sp,04h ; readjust the stack
@@return:
assume @data ; assume old data segment for segment loads
pop di ; restore destination index register
pop bp ; restore callers stack frame
retf ; return to caller
_initEdge endp
_getMinMaxInfo proc near ; short getMinMaxInfo(void)
LOCAL yMin:WORD,yMax:WORD=LocalLength
push bp ; save callers stack frame
mov bp,sp ; create new frame
sub sp,LocalLength ; adjust stack to handle local variables
push cx ; save callers cx register
push si ; save callers source index register
push ds ; save callers data segment register
cmp [di].PureEdge@@mNumVertexes,MINVERTEX ; make sure have at least three vertexes
jl @@error ; otherwise we've got a problem
mov yMin,MINVALUE ; start yMin with some low value
mov yMax,MAXVALUE ; start yMax with some high value
xor cx,cx ; start at index 0
mov ds,[di].PureEdge@@mlpDstList ; segment address of (Point *) to extra segment register
mov si,[di].PureEdge@@mlpDstList+2 ; offset address of (Point *) to source index register
@@iterator: ; loop top
mov bx,ds:[si].Point@@y ; move point::y to bx register
cmp bx,yMin ; compare with current yMin value
jg @@greater ; point::y greater than current yMin
@@nexttest: ; if I handle the greater condition, still need to do less
cmp bx,yMax ; compare with current yMax value
jl @@less ; point::y less than current yMax
jmp @@looptest ; nuthin continue with test
@@greater: ; handle greater equal condition
mov yMin,bx ; set yMin to bx register
mov [di].PureEdge@@mMinVertex,cx ; move index number of vertex to mMinVertex
jmp @@nexttest ; go perform next test
@@less: ; handle less equal condition
mov yMax,bx ; set yMax to bx register
mov [di].PureEdge@@mMaxVertex,cx ; update mMaxVertex with current index
@@looptest: ; falls through to loop
add si,04h ; add 2 bytes to si to bump to next (Point*)
inc cx ; increment cx
cmp cx,[di].PureEdge@@mNumVertexes ; have we reached the number of vertexes yet?
jl @@iterator ; still more vertexes
push [di].PureEdge@@mMaxVertex ; save mMaxVertex
pop [di].PureEdge@@mStartVertex ; restore it to mStartVertex
jmp @@ok ; ok we've got good number of vertexes
@@error: ; setup for error return code
mov ax,01h ; move 01h into ax to indicate error
jmp @@return ; jump to return label
@@ok: ; setup for success return code
xor ax,ax ; clear out ax register
@@return: ; return label
pop ds ; restore callers extra segment register
pop si ; restore callers source index register
pop cx ; restore callers cx register
add sp,LocalLength ; readjust stack for local variables
pop bp ; restore old frame
retn ; return to caller
_getMinMaxInfo endp
_setupEdge proc near ; short setupEdge(short edgeType,short startVertex)
LOCAL nextVertex:WORD,xDestWidth:WORD,yDestHeight:DWORD=LocalLength
push bp ; save old stack frame
mov bp,sp ; create new stack frame
sub sp,LocalLength ; make room for local variables
push si ; save source index register
push ds ; save data segment register
push word ptr[bp+6] ; save edgeType on stack
pop [di].PureEdge@@mEdgeDirection ; restore edgeType to mEdgeDirection
push word ptr[bp+4] ; save startVertex on stack
pop [di].PureEdge@@mStartVertex ; restore startVertex to mStartVertex
@@forever: ; forever loop label
mov bx,[di].PureEdge@@mStartVertex ; move mStartVertex to bx register
cmp bx,[di].PureEdge@@mMinVertex ; is mStartVertex same as mMinVertex ??
je @@error ; if yes then return error status
add bx,[di].PureEdge@@mEdgeDirection ; add edge direction to mStartVertex
mov nextVertex,bx ; move result to nextVertex
mov bx,[di].PureEdge@@mNumVertexes ; move number of vertexes to bx register
cmp nextVertex,bx ; compare nextVertex to number of vertexes
jge @@zervert ; nextVertex is greater eq number of vertexes
cmp nextVertex,00h ; compare nextVertex to zero
jl @@adjVert ; nextVertex is less than zero
jmp @@bypass ; nextVertex is fine
@@zervert: ; handle nextVertex>=number of vertexes
mov nextVertex,00h ; set nextVertex to zero
jmp @@bypass ; jump over next conditional
@@adjVert: ; handle nextVertex<0
dec bx ; decrement value count in bx register
mov nextVertex,bx ; set nextVertex to (numVertex-1).
@@bypass:
getPoint [di].PureEdge@@mlpDstList,[di].PureEdge@@mlpDstList+2,nextVertex
push bx ; dstList[nextVertex].y() in bx , save it
getPoint [di].PureEdge@@mlpDstList,[di].PureEdge@@mlpDstList+2,[di].PureEdge@@mStartVertex
pop ax ; restore first x-point to ax
sub ax,bx ; now subtract second x-point
mov [di].PureEdge@@mRemainingScanLines,ax ; result is mRemainingScanLines
cmp ax,00h ; check scanlines==0
je @@loopNext ; if it's zero, continue
mov yDestHeight,eax ; set yDestHeight
push nextVertex ; save nextVertex value
pop [di].PureEdge@@mCurrentEdgeEnd ; restore it to mCurrentEdgeEnd
getPoint [di].PureEdge@@mlpSrcList+2,[di].PureEdge@@mlpSrcList,[di].PureEdge@@mStartVertex
multiply ax,PRECISION ; multiply mxSource by PRECISION
mov [di].PureEdge@@mxSource,eax ; move srcList[mStartVertex].x() to mxSource
multiply bx,PRECISION ; multiply mySource by PRECISION
mov [di].PureEdge@@mySource,eax ; move srcList[mStartVertex].y() to mySource
getPoint [di].PureEdge@@mlpSrcList+2,[di].PureEdge@@mlpSrcList,nextVertex ; get source point
multiply ax,PRECISION
mov ebx,[di].PureEdge@@mxSource ; mxSource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].x-mxSource-->ax
divide eax,yDestHeight ; divide by yDestHeight, this is mxSourceStep
mov [di].PureEdge@@mxSourceStep,eax ; move eax register into mxSourceStep
getPoint [di].PureEdge@@mlpSrcList+2,[di].PureEdge@@mlpSrcList,nextVertex ; get source point
mov eax,ebx ; move point.y into ax register
multiply ax,PRECISION
mov ebx,[di].PureEdge@@mySource ; mySource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].y-mySource-->ax
divide eax,yDestHeight ; divide by yDestHeight, this is mySourceStep
mov [di].PureEdge@@mySourceStep,eax ; move eax register into mySourceStep
getPoint [di].PureEdge@@mlpDstList,[di].PureEdge@@mlpDstList+2,[di].PureEdge@@mStartVertex
mov [di].PureEdge@@mxDestLocation,ax ; mxDestLocation=mDstList[mStartVertex].x()
getPoint [di].PureEdge@@mlpDstList,[di].PureEdge@@mlpDstList+2,nextVertex ; get dstList[nextVertex]
sub ax,[di].PureEdge@@mxDestLocation ; get the width of the segment
mov xDestWidth,ax ; move width into xDestWidth
cmp xDestWidth,00h ; is the direction negative (ie) left
jl @@negWidth ; yes, handle negative direction
mov [di].PureEdge@@mxDirection,01h ; set right direction indicator
mov [di].PureEdge@@mxErrorTerm,00h ; set mxErrorTerm to zero
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[di].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx zero extend
divide eax,ebx ; eax=xDestWidth/mRemainingScanLines
mov [di].PureEdge@@mxStep,ax ; move result into mxStep
jmp @@syncOne ; jump over following handler
@@negWidth: ; handle negative direction
mov [di].PureEdge@@mxDirection,-1 ; set left direction indicator
neg xDestWidth ; negate the width (ie) make it positive
mov ax,01h ; move a 1 into ax register
sub ax,[di].PureEdge@@mRemainingScanLines ; subtract remaining scan lines from 1
mov [di].PureEdge@@mxErrorTerm,ax ; move result to mxErrorTerm
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[di].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx zero extend
divide eax,ebx ; eax=xDestWidth/mRemainingScanLines
neg eax ; negate the result
mov [di].PureEdge@@mxStep,ax ; move result back into mxStep
@@syncOne: ; synchronization address
movzx eax,xDestWidth ; move xDestWidth into eax register, zero extend
movzx ebx,[di].PureEdge@@mRemainingScanLines ; move mRemainingScanLines into ebx register
divide eax,ebx ; divide xDestWidth/mRemainingScanLines
mov [di].PureEdge@@mxAdjustUp,dx ; move remainder into mxAdjustUp
push [di].PureEdge@@mRemainingScanLines ; save mRemainingScanLines
pop [di].PureEdge@@mxAdjustDown ; restore mRemainingScanLines into mxAdjustDown
jmp @@ok ; jump over forever loop
@@loopNext: ; forever loop address
push nextVertex ; save nextVertex on stack
pop [di].PureEdge@@mStartVertex ; restore to mStartVertex
jmp @@forever ; continue with loop
@@error: ; error handler
mov ax,01h ; set ax register to 01h to indicate failure
jmp @@return ; jump over to return label
@@ok: ; success handler
xor ax,ax ; clear out ax register to handle success
@@return: ; return label
pop ds ; restore data segment register
pop si ; restore source index register
add sp,LocalLength ; readjust stack for local variables
pop bp ; restore old stack frame
retn ; return to caller
_setupEdge endp
_increment proc near ; short increment(PureEdge *lpEdge)
push bp ; save callers stack frame
mov bp,sp ; create new stack frame
push es ; save extra segment register
push di ; save destination index register
mov es,[bp+6] ; move segment of data to extra segment
mov di,[bp+4] ; move offset of data to destination index register
assume es ; now assume extra segment for segment loads.
dec [di].PureEdge@@mRemainingScanLines ; decrement mRemainingScanLines
cmp [di].PureEdge@@mRemainingScanLines,00h ; compare mRemainingScanLines to zero
je @@newEdge ; no more scan lines, try to get to next edge
jmp @@syncOne ; more scan lines, keep going
@@newEdge: ; new edge handler
push [di].PureEdge@@mEdgeDirection ; save edgeDirection
push [di].PureEdge@@mCurrentEdgeEnd ; save currentEdge end (ie) nextEdge index
call _setupEdge ; attempt to setup new edge
add sp,04h ; readjust stack
cmp ax,01h ; did prior call fail?
je @@error ; yes, no more edges
jmp @@ok ; no, keep going
@@syncOne: ; synchronizing address
mov eax,[di].PureEdge@@mxSourceStep ; get mxSourceStep to eax register
add eax,[di].PureEdge@@mxSource ; add in mxSource
mov [di].PureEdge@@mxSource,eax ; replace mxSource with new value
mov eax,[di].PureEdge@@mySourceStep ; get mySourceStep into eax register
add eax,[di].PureEdge@@mySource ; add in mySource
mov [di].PureEdge@@mySource,eax ; replace mySource with new value
mov ax,[di].PureEdge@@mxDestLocation ; get mxDestLocation into ax register
add ax,[di].PureEdge@@mxStep ; add in mxStep
mov [di].PureEdge@@mxDestLocation,ax ; replace mxDestLocation with new value
mov ax,[di].PureEdge@@mxErrorTerm ; get mxErrorTerm to ax register
add ax,[di].PureEdge@@mxAdjustUp ; add in mxAdjustUp
mov [di].PureEdge@@mxErrorTerm,ax ; replace mxErrorTerm with new value
cmp ax,00h ; now compare result to 00h
jg @@adjTerm ; result is greater than zero
jmp @@ok ; result is less equal to zero, we're done
@@adjTerm:
mov ax,[di].PureEdge@@mxDestLocation ; get mxDestLocation to ax register
add ax,[di].PureEdge@@mxDirection ; add in mxDirection
mov [di].PureEdge@@mxDestLocation,ax ; replace mxDestLocation with new value
mov ax,[di].PureEdge@@mxErrorTerm ; move mxErrorTerm into ax register
sub ax,[di].PureEdge@@mxAdjustDown ; add in mxAdjustDown
mov [di].PureEdge@@mxErrorTerm,ax ; replace mxErrorTerm with new value
@@ok: ; ok handler address
xor ax,ax ; set 00h into ax register
jmp @@return ; jump passed next block
@@error: ; error handler address
mov ax,01h ; set 01h into ax register
@@return: ; return handler
assume @data ; assume old data segment for segment loads
pop di ; restore destination index register
pop es ; restore extra segment register
pop bp ; restore stack frame
retn ; return to caller
_increment endp
_mapTexture proc far ; void mapTexture(PureMap *lpTextureMap)
push bp ; save stack frame
mov bp,sp ; create new frame
push di ; save destination index register
push si ; save source index register
push ds ; save data segment register
mov es,word ptr[bp+8] ; move segment (PureMap*) to es register
mov di,word ptr[bp+6] ; move offset (PureMap*) to destination index register
push es:[di].PureMap@@mlpLeftEdge+2 ; save segment mlpLeftEdge
pop ds ; restore segment mlpLeftEdge to ds register
mov si,es:[di].PureMap@@mlpLeftEdge ; move offset mlpLeftEdge to si register
mov cx,ds:[si].PureEdge@@mMaxVertex ; move left edge max vertex to ax register
getPoint ds:[si].PureEdge@@mlpDstList,ds:[si].PureEdge@@mlpDstList+2,cx
mov es:[di].PureMap@@myValue,bx ; myValue=mLeftEdge[mLeftEdge.maxVertex()].y()
@@forever: ; while(TRUE)
push es ; push segment (PureMap*)
push di ; push offset (PureMap*)
call _scanOutputLine ; call scanOutputLine
add sp,04h ; readjust stack
push word ptr es:[di].PureMap@@mlpLeftEdge+2 ; push segment mlpLeftEdge
push word ptr es:[di].PureMap@@mlpLeftEdge ; push offset mlpLeftEdge
call _increment ; increment along left edge
add sp,04h ; readjust stack after call
cmp ax,00h ; check return code
jne @@return ; edge failed to increment, we're done
push word ptr es:[di].PureMap@@mlpRightEdge ; push segment mlpRightEdge
push word ptr es:[di].PureMap@@mlpRightEdge+2 ; push offset mlpRightEdge
call _increment ; increment along right edge
add sp,04h ; readjust stack after call
cmp ax,00h ; check return code
jne @@return ; edge failed to increment, we're done
inc es:[di].PureMap@@myValue ; increment y() position
jmp @@forever ; loop until all edges are completed
@@return: ; return address label
pop ds ; restore data segment register
pop si ; restore source index re
pop di ; restore destination index register
pop bp ; restore old frame
retf ; return to caller
_mapTexture endp
_scanOutputLine proc near
push bp ; save stack frame
mov bp,sp ; create new frame
push es ; save extra segment
push di ; save destination index register
push ds ; save data segment register
push si ; save source index register
mov es,word ptr[bp+6] ; move segment (PureMap*) to extra segment register
mov di,word ptr[bp+4] ; move offset (PureMap*) to destination index register
push es:[di].PureMap@@mlpLeftEdge+2 ; save segment mlpLeftEdge
pop ds ; restore segment mlpLeftEdge to data segment
mov si,es:[di].PureMap@@mlpLeftEdge ; move offset mlpLeftEdge to source index reg
mov eax,ds:[si].PureEdge@@mxSource ; move PureEdge::mxSource to eax register
mov es:[di].PureMap@@mxSource,eax ; move PureEdge::mxSource to PureMap::mxSource
mov eax,ds:[si].PureEdge@@mySource ; move PureEdge::mySource to eax register
mov es:[di].PureMap@@mySource,eax ; move PureEdge::mySource to PureMap::mySource
mov bx,ds:[si].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to bx
mov es:[di].PureMap@@mxDest,bx ; move PureEdge::mxDestLocation to PureMap::mxDest
push word ptr es:[di].PureMap@@mlpRightEdge ; save segment mlpRightEdge
pop ds ; restore segment mlpRightEdge to ds
mov si,word ptr es:[di].PureMap@@mlpRightEdge+2 ; move offset mlpRightEdge to si
xor eax,eax ; to clear out the high word of eax
mov ax,ds:[si].PureEdge@@mxDestLocation ; move PureEdge.mxDestLocation to ax
mov es:[di].PureMap@@mxDestMax,ax ; move PureEdge.mxDestLocation to PureMap.mxDestMap
sub ax,bx ; mxDestMax-mxDest
cmp ax,00h ; check if width is zero
je @@return ; if width is zero just return
mov es:[di].PureMap@@mDestWidth,eax ; move width into PureMap::mDestWidth
mov eax,ds:[si].PureEdge@@mxSource ; move PureEdge::mxSource into eax
sub eax,es:[di].PureMap@@mxSource ; subtract out PureMap::mxSource
divide eax,es:[di].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov es:[di].PureMap@@mxSourceStep,eax ; move new value to PureMap@@mxSourceStep
mov eax,ds:[si].PureEdge@@mySource ; move PureEdge::mySource into eax
sub eax,es:[di].PureMap@@mySource ; subtract out PureMap::mySource
divide eax,es:[di].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov es:[di].PureMap@@mySourceStep,eax ; move new value to PureMap@@mySourceStep
@@xLoop: ; xLoop top
mov ax,es:[di].PureMap@@mxDest ; move mxDest to ax register
cmp ax,es:[di].PureMap@@mxDestMax ; compare mxDest to mxDestMax
jge @@return ; if its greater equal return
cmp es:[di].PureMap@@mxSource,00h ; compare mxSource to zero
jl @@xFix ; if mxSource is less than zero, fix
@@nxtChk: ; sync label to continue with checking
cmp es:[di].PureMap@@mySource,00h ; compare mySource to zero
jl @@yFix ; if mySource is less than zero, fix
jmp @@syncOne ; everything ok, jump over block
@@yFix: ; handle y-fixup
mov es:[di].PureMap@@mySource,00h ; move zero to mySource
jmp @@syncOne ; jump around next handler
@@xFix: ; handle x-fixup
mov es:[di].PureMap@@mxSource,00h ; move zero into mxSource
jmp @@nxtChk ; now look at y-value
@@syncOne: ; synchronization for conditionals
push es ; save extra segment register
mov eax,es:[di].PureMap@@mySource ; move PureMap@@mxSource to eax
round eax ; convert and round
push ax ; save result on stack
mov eax,es:[di].PureMap@@mxSource ; move PureMap@@mySource to eax
round eax ; convert and round
shl eax,16 ; now shift eax left by 16 bits
pop ax ; and restore yValue to low word
movzx ebx,es:[di].PureMap@@mxDest ; move PureMap::mxDest to eax
shl ebx,16 ; shift eax left 16 bits
mov bx,es:[di].PureMap@@myValue ; move PureMap::myValue to ax
call _putImageBits ; call put pixel handler
pop es ; restore extra segment register
mov eax,es:[di].PureMap@@mxSource ; move mxSource to eax register
add eax,es:[di].PureMap@@mxSourceStep ; add in mxSourceStep
mov es:[di].PureMap@@mxSource,eax ; move result to mxSource
mov eax,es:[di].PureMap@@mySource ; move mySource into eax register
add eax,es:[di].PureMap@@mySourceStep ; add in mySourceStep
mov es:[di].PureMap@@mySource,eax ; move result to mySource
inc es:[di].PureMap@@mxDest ; increment loop counter
jmp @@xLoop ; loop through xLoop
@@return: ; return sync label
pop si ; restore source index register
pop ds ; restore data segment register
pop di ; restore destination index register
pop es ; restore extra segment
pop bp ; restore old stack frame
retn ; return to caller
_scanOutputLine endp
_getSrcDataByte proc near ; BYTE getSrcDataByte(WORD row,WORD col)
LOCAL addValue:DWORD=LocalLength
push bp ; save old stack frame
mov bp,sp ; create new stack frame
sub sp,LocalLength ; adjust stack for local variable
push bx ; save bx register
push cx ; save cx register
push dx ; save dx register
push es ; save extra segment register
push di ; save destination index register
mov dx,word ptr[bp+04h] ; move row into dx register
cmp dx,bmData@@mSrcHeight ; is row greater than bitmap height
jge @@error ; if so then return
cmp dx,00h ; is row less than zero
jl @@error ; if so then return error
movzx ebx,word ptr[bp+06h] ; move col into bx register, zero extended
cmp bx,bmData@@mSrcWidth ; is col greater than bitmap width
jge @@error ; if so then return
cmp bx,00h ; is col less than zero
jl @@error ; is so then return error
movzx ecx,bmData@@mSrcWidth ; move width into cx register
mov ax,bmData@@mSrcHeight ; move height into ax register
push dx ; save dx register
multiply ax,cx ; multiply width*height result to eax
pop dx ; restore dx register
mov addValue,eax ; store result to addValue
multiply dx,cx ; multiply row*width result to eax
add eax,ecx ; add (row*width)+width
sub addValue,eax ; calculate addValue-subValue
movzx eax,word ptr[bp+06h] ; move col into bx register, zero extended
add addValue,eax ; now add the column number back in
mov dx,word ptr addValue+02h ; move high word addValue to dx register
mov ax,word ptr addValue ; move low word addValue to ax register
add ax,word ptr bmData@@mlpSrcPtr ; add low word mlpSrcPtr to low word addValue
adc dx,0000h ; add any carry to high word addValue (dx)
shl dx,03h ; multiply dx register by 8 (segment magic)
add dx,word ptr bmData@@mlpSrcPtr+02h ; now add in high word of mlpSrcData
mov es,dx ; move segment into extra segment register
mov di,ax ; move offset into destination index register
xor ax,ax ; clear out ax register
mov al,byte ptr es:[di] ; move byte value into al register
jmp @@return ; jump over error return code
@@error: ; error return label
mov ax,0FF00h ; error places 0FFh in al register
@@return: ; normal return label
pop di ; restore destination index register
pop es ; restore extra segment register
pop dx ; restore dx register
pop cx ; restore cx register
pop bx ; restore bx register
add sp,LocalLength ; adjust stack for local variable
pop bp ; restore stack frame
retn ; return near to caller
_getSrcDataByte endp
_setDstDataByte proc near ; void setDstDataByte(WORD row,WORD col,BYTE byteValue)
LOCAL addValue:DWORD=LocalLength
push bp ; save old stack frame
mov bp,sp ; create new stack frame
sub sp,LocalLength ; adjust stack for local variable
push ax ; save ax register
push bx ; save bx register
push cx ; save cx register
push dx ; save dx register
push es ; save extra segment register
push di ; save destination index register
mov dx,word ptr[bp+04h] ; move row into dx register
cmp dx,bmData@@mDstHeight ; is row greater than bitmap height
jge @@error ; if so then return
cmp dx,00h ; is row less than zero
jl @@error ; if so then return error
movzx ebx,word ptr[bp+06h] ; move col into bx register, zero extended
cmp bx,bmData@@mDstWidth ; is col greater than bitmap width
jge @@error ; if so then return
cmp bx,00h ; is col less than zero
jl @@error ; if so then return error
movzx ecx,bmData@@mDstWidth ; move width into cx register
mov ax,bmData@@mDstHeight ; move height into ax register
push dx ; save dx register
multiply ax,cx ; multiply width*height result to eax
pop dx ; restore dx register
mov addValue,eax ; store result to addValue
multiply dx,cx ; multiply row*width result to eax
add eax,ecx ; add (row*width)+width
sub addValue,eax ; calculate addValue-subValue
movzx eax,word ptr[bp+06h] ; move col into bx register, zero extended
add addValue,eax ; now add the column number back in
mov dx,word ptr addValue+02h ; move high word addValue to dx register
mov ax,word ptr addValue ; move low word addValue to ax register
add ax,word ptr bmData@@mlpDstPtr ; add low word mlpSrcPtr to low word addValue
adc dx,0000h ; add any carry to high word addValue (dx)
shl dx,03h ; multiply dx register by 8 (segment magic)
add dx,word ptr bmData@@mlpDstPtr+02h ; now add in high word of mlpSrcData
mov es,dx ; move segment into extra segment register
mov di,ax ; move offset into destination index register
mov ax,word ptr[bp+08h] ; move byteValue into ax register
mov byte ptr es:[di],al ; move byte value into mlpDstPtr
jmp @@return ; jump over error return code
@@error: ; error return label
mov ax,0FF00h ; error places 0FFh in al register
jmp @@return ; return
@@return: ; normal return label
pop di ; restore destination index register
pop es ; restore extra segment register
pop dx ; restore dx register
pop cx ; restore cx register
pop bx ; restore bx register
pop ax ; restore ax register
add sp,LocalLength ; adjust stack for local variable
pop bp ; restore stack frame
retn ; return near to caller
_setDstDataByte endp
_putImageBits proc near ; void putImageBits(eax dstPoints,ebx srcPoints)
mov cx,ax ; move low word eax to cx register
shr eax,16 ; move high word eax to ax
push ebx ; save ebx register
push ax ; save high word on stack
push cx ; save low word on stack
call _getSrcDataByte ; get source data byte result is in al
add sp,04h ; caller adjusts stack after return
pop ebx ; restore ebx register
cmp ah,0FFh ; check return code
je @@return ; if al==0xFFh call failed
push ax ; push data byte
mov cx,bx ; move low word destination to cx register
shr ebx,16 ; move high word destination to bx
push bx ; save high word on stack
push cx ; save low word on stack
call _setDstDataByte ; set destination data byte
add sp,06h ; caller adjusts stack after return
@@return: ; return label
retn ; return near to caller
_putImageBits endp
_setSrcBitmapInfo proc far ; void setSrcBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push bp ; save old stack frame
mov bp,sp ; create new stack frame
push dword ptr[bp+0Ah] ; push lpBitmapImage onto stack
pop bmData@@mlpSrcPtr ; resore into mlpSrcPtr
push word ptr[bp+08h] ; push srcBitmapHeight onto stack
pop bmData@@mSrcHeight ; restore into mSrcHeight
push word ptr[bp+06h] ; push srcBitmapWidth
pop bmData@@mSrcWidth ; restore into mSrcWidth
pop bp ; restore old stack frame
retf ; return far to caller
_setSrcBitmapInfo endp
_setDstBitmapInfo proc far ; void setSrcBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push bp ; save old stack frame
mov bp,sp ; create new stack frame
push dword ptr[bp+0Ah] ; push lpBitmapImage onto stack
pop bmData@@mlpDstPtr ; resore into mlpSrcPtr
push word ptr[bp+08h] ; push srcBitmapHeight onto stack
pop bmData@@mDstHeight ; restore into mSrcHeight
push word ptr[bp+06h] ; push srcBitmapWidth
pop bmData@@mDstWidth ; restore into mSrcWidth
pop bp ; restore old stack frame
retf ; return far to caller
_setDstBitmapInfo endp
public _initEdge
public _mapTexture
public _setSrcBitmapInfo
public _setDstBitmapInfo
end


42
engine/TMAP16.INC Normal file
View File

@@ -0,0 +1,42 @@
;****************************************************************************
; FILE:TEXTURE.INC
; FUNCTION: INCLUDE FILE FOR ASM TEXTURE MAPPING
; AUTHOR:SEAN M. KESSLER
;****************************************************************************
PureEdge STRUC
PureEdge@@mEdgeDirection DW ?
PureEdge@@mRemainingScanLines DW ?
PureEdge@@mCurrentEdgeEnd DW ?
PureEdge@@mxSource DD ?
PureEdge@@mySource DD ?
PureEdge@@mxSourceStep DD ?
PureEdge@@mySourceStep DD ?
PureEdge@@mxDestLocation DW ?
PureEdge@@mxStep DW ?
PureEdge@@mxDirection DW ?
PureEdge@@mxErrorTerm DW ?
PureEdge@@mxAdjustUp DW ?
PureEdge@@mxAdjustDown DW ?
PureEdge@@mMaxVertex DW ?
PureEdge@@mMinVertex DW ?
PureEdge@@mStartVertex DW ?
PureEdge@@mNumVertexes DW ?
PureEdge@@mlpSrcList DW NEAR PTR ?
PureEdge@@mlpDstList DW NEAR PTR ?
PureEdge ENDS
PureMap STRUC
PureMap@@mxSource DD ?
PureMap@@mySource DD ?
PureMap@@mDestWidth DD ?
PureMap@@mxSourceStep DD ?
PureMap@@mySourceStep DD ?
PureMap@@mxDest DW ?
PureMap@@mxDestMax DW ?
PureMap@@myValue DW ?
PureMap@@mlpLeftEdge DW NEAR PTR ?
PureMap@@mlpRightEdge DW NEAR PTR ?
PureMap ENDS


504
engine/TMAP32.BAK Normal file
View File

@@ -0,0 +1,504 @@
;*************************************************************************************
; MODULE: TMAP32.ASM DATE: DECEMBER 28, 1994
; AUTHOR: SEAN M. KESSLER JUNE 06, 1995
; TARGET: 32 BIT TARGET
; FUNCTION : TEXTURE MAPPING POLYGONS IN PERSPECTIVE
;*************************************************************************************
SMART
.386
.MODEL FLAT
.DATA
.LALL
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\ENGINE\TMAP32.INC
bmData@@mSrcWidth DW 00h
bmData@@mSrcHeight DW 00h
bmData@@mSrcExtent DD 00h
bmData@@mlpSrcPtr DD 00h
bmData@@mDstWidth DW 00h
bmData@@mDstHeight DW 00h
bmData@@mDstExtent DD 00h
bmData@@mlpDstPtr DD 00h
bmData@@mlpDstIndexPtr DD 00h
bmData@@mPrecision DW 4000h
bmData@@mMaskValue DB 0FFh
bmData@@mUseMask DB 00h
MINVALUE EQU -32767
MAXVALUE EQU 32767
MINVERTEX EQU 3
.CODE
LOCALS
divide MACRO varOne,varTwo
mov eax,varOne ; move varOne into eax register
cdq ; convert doubleword in eax to quadword at edx:eax
idiv varTwo ; divide eax/varTwo result to eax, remainder to edx
ENDM
multiply MACRO varOne,varTwo
movzx eax,varOne ; move varOne into eax register
movzx edx,varTwo ; move varTwo into ebx register
imul eax,edx ; perform multiply, result to eax
ENDM
roundEBX MACRO varOne
LOCAL @@return
mov edx,varOne ; move value into edx register
mov ebx,varOne ; move value into ebx register
and edx,00003FFFh ; get remainder into edx register
shr ebx,14 ; get whole number to ebx register
cmp edx,8192 ; if remainder > 8192, increment ebx
jle @@return ; otherwise return
inc ebx ; increment value in ebx
@@return:
ENDM
roundEAX MACRO varOne
LOCAL @@return
mov edx,varOne ; move value into edx register
mov eax,varOne ; move value into eax register
and edx,00003FFFh ; get remainder into edx register
shr eax,14 ; get whole number to eax register
cmp edx,8192 ; if remainder > 8192, increment ebx
jle @@return ; otherwise return
inc eax ; increment value in eax
@@return:
ENDM
getPoint MACRO address,index
movzx eax,index ; move index into eax register
shl eax,02h ; multiply ax by size of far pointer
add eax,address ; add in the address
movzx ebx,[eax].Point@@y ; get the y value to bx register
movzx eax,[eax].Point@@x ; get the x value to ax register
ENDM
newEdge MACRO ; (PureEdge*) in eax, sets edx=1=error, otherwise edx=0
movzx ebx,[eax].PureEdge@@mEdgeDirection ; save edgeDirection
push ebx ; push edgeDirection
push [eax].PureEdge@@mCurrentEdgeEnd ; push currentEdge end (ie) nextEdge index
mov ecx,eax ; move (PureEdge*) to ecx register
call _setupEdge ; attempt to setup new edge
add esp,06h ; readjust the stack
mov edx,eax ; move return code to edx register
ENDM
getSrcDataByte MACRO ; BYTE getSrcDataByte(eax=colRow)
multiply ax,bmData@@mSrcWidth ; multiply (row*width)-> eax
movzx edx,bmData@@mSrcWidth ; move width to edx register
add eax,edx ; add in width (ie) (row*width)+width
mov edx,bmData@@mSrcExtent ; move source bitmap extent to edx
sub edx,eax ; sub result from source bmp extent
add edx,ebx ; add column back in
mov ebx,bmData@@mlpSrcPtr ; move mlpSrcPtr to ebx register
mov cl,byte ptr[ebx+edx] ; get source byte at ebx+edx to cl
ENDM
setDstDataByte MACRO ; void setDstDataByte(cl=charByte)
mov ebx,bmData@@mlpDstIndexPtr ; get scanline pointer to ebx
mov byte ptr[ebx],cl ; move byte into frame bitmap
inc bmData@@mlpDstIndexPtr ; increment scanline pointer
ENDM
setDstIndexPtr MACRO
multiply [esi].PureMap@@myValue,bmData@@mDstWidth ; multiply row*width result to eax
xor edx,edx ; clear edx register
mov dx,bmData@@mDstWidth ; move width into dx register
add eax,edx ; add (row*width)+width
mov edx,bmData@@mDstExtent ; move (width*height) into ebx
sub edx,eax ; calculate addValue-subValue
mov [esi].PureMap@@mBitmapIndex,edx ; save offset into bitmap
ENDM
adjDstIndexPtr MACRO
mov edx,[esi].PureMap@@mBitmapIndex ; retrieve offset into bitmap
movzx ebx,[esi].PureMap@@mxDest ; move column into bx register
add edx,ebx ; now add column number back in
add edx,bmData@@mlpDstPtr ; offset index by start
mov bmData@@mlpDstIndexPtr,edx ; store value into DstIndexPtr
ENDM
increment MACRO ; assumes (PureEdge*) is in eax register, sets carry on error
LOCAL @@newEdge,@@adjTerm,@@error,@@success,@@return
dec [eax].PureEdge@@mRemainingScanLines ; decrement mRemainingScanLines
jz @@newEdge ; if no more scan lines, try to setup new edge
mov ebx,[eax].PureEdge@@mxSourceStep ; get mxSourceStep to ebx register
add ebx,[eax].PureEdge@@mxSource ; add in mxSource
mov [eax].PureEdge@@mxSource,ebx ; replace mxSource with new value
mov ebx,[eax].PureEdge@@mySourceStep ; get mySourceStep into ebx register
add ebx,[eax].PureEdge@@mySource ; add in mySource
mov [eax].PureEdge@@mySource,ebx ; replace mySource with new value
mov bx,[eax].PureEdge@@mxDestLocation ; get mxDestLocation into ebx register
add bx,[eax].PureEdge@@mxStep ; add in mxStep
mov [eax].PureEdge@@mxDestLocation,bx ; replace mxDestLocation with new value
mov bx,[eax].PureEdge@@mxErrorTerm ; get mxErrorTerm to bx register
add bx,[eax].PureEdge@@mxAdjustUp ; add in mxAdjustUp
mov [eax].PureEdge@@mxErrorTerm,bx ; replace mxErrorTerm with new value
cmp bx,00h ; compare mxErrorTerm to zero
jle @@success ; mxErrorTerm is less equal zero
@@adjTerm: ; adjTerm sync address
mov bx,[eax].PureEdge@@mxDestLocation ; get mxDestLocation to bx register
add bx,[eax].PureEdge@@mxDirection ; add in mxDirection
mov [eax].PureEdge@@mxDestLocation,bx ; replace mxDestLocation with new value
mov bx,[eax].PureEdge@@mxErrorTerm ; move mxErrorTerm into bx register
sub bx,[eax].PureEdge@@mxAdjustDown ; add in mxAdjustDown
mov [eax].PureEdge@@mxErrorTerm,bx ; replace mxErrorTerm with new value
jmp @@success ; we're done here
@@newEdge: ; newEdge sync address
newEdge ; attempt to create new edge
cmp edx,0001h ; did prior call fail ?
jne @@success ; no, we're done here
@@error: ; error sync address
stc ; error sets carry
jmp @@return ; jump to return
@@success: ; ok sync address
clc ; success clears carry
@@return: ; return sync address
ENDM
scanOutputLine MACRO ; void scanOutputLine(ecx=(PureEdge*))
LOCAL @@xLoop,@@skipImageBit,@@continue,@@return ; local label
mov edi,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*)lpLeftEdge to ecx register
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource to eax register
mov [esi].PureMap@@mxSource,eax ; move PureEdge::mxSource to PureMap::mxSource
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource to eax register
mov [esi].PureMap@@mySource,eax ; move PureEdge::mySource to PureMap::mySource
mov dx,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax
mov [esi].PureMap@@mxDest,dx ; move PureEdge::mxDestLocation to PureMap::mxDest
mov edi,[esi].PureMap@@mlpRightEdge ; move (PureEdge*)lpRightEdge to ecx register
xor eax,eax ; clear out eax register
mov ax,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax register
mov [esi].PureMap@@mxDestMax,ax ; move PureEdge::mxDestLocation to PureMap::mxDestMax
sub ax,dx ; mxDestMax-mxDest
jz @@return ; if width is zero then return
mov [esi].PureMap@@mDestWidth,eax ; move width into PureMap::mDestWidth
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource into eax
sub eax,[esi].PureMap@@mxSource ; subtract out PureMap::mxSource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mxSourceStep,eax ; move new value to PureMap@@mxSourceStep
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource into eax
sub eax,[esi].PureMap@@mySource ; subtract out PureMap::mySource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mySourceStep,eax ; move new value to PureMap@@mySourceStep
setDstIndexPtr ; set destination index pointer to row/col
@@xLoop: ; xLoop test
mov ax,[esi].PureMap@@mxDest ; move mxDest to ax register
cmp ax,[esi].PureMap@@mxDestMax ; compare mxDest to ax register
jge @@return ; if its greater equal return
cmp ax,bmData@@mDstWidth ; is destination x greater than frame width?
jge @@return ; yes, stop scanning this output line
or ax,ax ; does mxDest extend too far left of frame buffer
jl @@skipImageBit ; if it does then skip putImageBits
adjDstIndexPtr ; adjust index to reflect changed mxDest
@@continue: ; sync address
roundEAX [esi].PureMap@@mySource ; round PureMap@@mySource -> eax (row)
roundEBX [esi].PureMap@@mxSource ; round PureMap@@mxSource -> ebx (col)
getSrcDataByte ; getSrcDataByte at eax=colRow, byteValue gets placed into cl
setDstDataByte ; setDstDataByte at mlpDstIndexPtr,cl=byteValue
@@skipImageBit: ; skipImageBit bypass address
mov eax,[esi].PureMap@@mxSourceStep ; move mxSourceStep to eax
add [esi].PureMap@@mxSource,eax ; add mxSouceStep to mxSource
mov ebx,[esi].PureMap@@mySourceStep ; move mySourceStep to eax
add [esi].PureMap@@mySource,ebx ; add mySourceStep to mySource
inc [esi].PureMap@@mxDest ; increment loop counter
jmp @@xLoop ; loop through xLoop
@@return: ; return sync label
ENDM
scanOutputLineMask MACRO ; void scanOutputLineMask(ecx=(PureEdge*)) - uses mask settings
LOCAL @@xLoop,@@skipImageBit,@@continue,@@return ; local label
mov edi,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*)lpLeftEdge to ecx register
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource to eax register
mov [esi].PureMap@@mxSource,eax ; move PureEdge::mxSource to PureMap::mxSource
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource to eax register
mov [esi].PureMap@@mySource,eax ; move PureEdge::mySource to PureMap::mySource
mov dx,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax
mov [esi].PureMap@@mxDest,dx ; move PureEdge::mxDestLocation to PureMap::mxDest
mov edi,[esi].PureMap@@mlpRightEdge ; move (PureEdge*)lpRightEdge to ecx register
xor eax,eax ; clear out eax register
mov ax,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax register
mov [esi].PureMap@@mxDestMax,ax ; move PureEdge::mxDestLocation to PureMap::mxDestMax
sub ax,dx ; mxDestMax-mxDest
jz @@return ; if width is zero then return
mov [esi].PureMap@@mDestWidth,eax ; move width into PureMap::mDestWidth
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource into eax
sub eax,[esi].PureMap@@mxSource ; subtract out PureMap::mxSource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mxSourceStep,eax ; move new value to PureMap@@mxSourceStep
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource into eax
sub eax,[esi].PureMap@@mySource ; subtract out PureMap::mySource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mySourceStep,eax ; move new value to PureMap@@mySourceStep
setDstIndexPtr ; set destination index pointer to row/col
@@xLoop: ; xLoop test
mov ax,[esi].PureMap@@mxDest ; move mxDest to ax register
cmp ax,[esi].PureMap@@mxDestMax ; compare mxDest to ax register
jge @@return ; if its greater equal return
cmp ax,bmData@@mDstWidth ; is destination x greater than frame width?
jge @@return ; yes, stop scanning this output line
or ax,ax ; does mxDest extend too far left of frame buffer
jl @@skipImageBit ; if it does then skip putImageBits
adjDstIndexPtr ; adjust index to reflect changed mxDest
@@continue: ; sync address
roundEAX [esi].PureMap@@mySource ; round PureMap@@mySource -> eax (row)
roundEBX [esi].PureMap@@mxSource ; round PureMap@@mxSource -> ebx (col)
getSrcDataByte ; getSrcDataByte at eax=colRow, byteValue gets placed into cl
cmp cl,bmData@@mMaskValue ; are we attempting to output a byte in our mask
je @@skipImageBit ; if so then do not set the byte
setDstDataByte ; setDstDataByte at mlpDstIndexPtr,cl=byteValue
@@skipImageBit: ; skipImageBit bypass address
mov eax,[esi].PureMap@@mxSourceStep ; move mxSourceStep to eax
add [esi].PureMap@@mxSource,eax ; add mxSouceStep to mxSource
mov ebx,[esi].PureMap@@mySourceStep ; move mySourceStep to eax
add [esi].PureMap@@mySource,ebx ; add mySourceStep to mySource
inc [esi].PureMap@@mxDest ; increment loop counter
jmp @@xLoop ; loop through xLoop
@@return: ; return sync label
ENDM
_mapTexture proc near ; void mapTexture(PureMap *lpTextureMap)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
pushad ; save all general purpose registers, required.
mov esi,dword ptr[ebp+8] ; move (PureMap*) to esi register
mov edx,[esi].PureMap@@mlpLeftEdge ; move PureMap->mlpLeftEdge to edx
mov bx,[edx].PureEdge@@mMaxVertex ; move left edge mMaxVertex to bx register
getPoint [edx].PureEdge@@mlpDstList,bx ; get point
mov [esi].PureMap@@myValue,bx ; myValue=mLeftEdge[mLeft.maxVertex()].y()
@@forever: ; (ie) while(TRUE)
mov ax,[esi].PureMap@@myValue ; move myValue to ax register
cmp ax,bmData@@mDstHeight ; is myValue greater than frame buffer height
jge @@return ; if so then we're done mapping the texture
cmp ax,00h ; is myValue within frame buffer at all
jl @@skipOutputLine ; if not then skip this output line
cmp bmData@@mUseMask,00h ; are we using mask settings
jne @@scanMask ; if so then scan the output line, excluding masked bits
scanOutputLine ; otherwise just scan the output line
jmp @@skipOutputLine ; jump over the mask code
@@scanMask: ; scanMask sync address
scanOutputLineMask ; scan the output line, apply mask where appropriate
@@skipOutputLine: ; skipOutputLine sync address
mov eax,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*) left edge to eax
increment ; increment along left edge
jc @@return ; if carry set, edge failed to increment, we're done
mov eax,[esi].PureMap@@mlpRightEdge ; move (PureEdge*) right edge to eax
increment ; increment along right edge
jc @@return ; if carry set, edge failed to increment, we're done
inc [esi].PureMap@@myValue ; increment y position
jmp @@forever ; loop until all edges are completed
@@return: ; return sync address
popad ; restore all general purpose registers
pop ebp ; restore old stack frame
retn ; return near to caller
_mapTexture endp
_initEdge proc near ; void initEdge(long edgeType,PureEdge *lpEdge);
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push ebx ; save ebx register
mov ecx,dword ptr[ebp+12] ; move edge ptr to ecx register
call _getMinMaxInfo ; find minimum and maximum vertices
cmp eax,0000h ; make sure previous call returned success
jne @@return ; if not then return
push dword ptr[ebp+8] ; push edge type (-1:leftEdge,1:rightEdge)
push [ecx].PureEdge@@mStartVertex ; push startVertex
call _setupEdge ; now setup the edge
add esp,06h ; readjust the stack
@@return: ; return label
pop ebx ; restore ebx register
pop ebp ; restore old stack frame
retn ; return to caller
_initEdge endp
_setupEdge proc near ; long setupEge(long edgeType,int startVertex);
LOCAL nextVertex:WORD,startVertex:WORD,xDestWidth:WORD,yDestHeight:DWORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; make room for local variables
mov bx,word ptr[ebp+10] ; move edge type to bx register
mov [ecx].PureEdge@@mEdgeDirection,bx ; store edge direction in variable
mov bx,word ptr[ebp+8] ; move startVertex to bx register
mov [ecx].PureEdge@@mStartVertex,bx ; move startVertex into mStartVertex
mov startVertex,bx ; move startVertex into startVertex
@@forever: ; forever loop label
mov bx,startVertex ; move startVertex to bx register
cmp bx,[ecx].PureEdge@@mMinVertex ; is startVertex same as mMinVertex ?
je @@error ; if so then we're all done here
add bx,[ecx].PureEdge@@mEdgeDirection ; add edge direction to startVertex
mov nextVertex,bx ; move result to nextVertex
mov bx,[ecx].PureEdge@@mNumVertexes ; move number of vertexes to bx register
cmp nextVertex,bx ; compare nextVertex to number of vertexes
jge @@zervert ; next vertex is greater eq number of vertexes
cmp nextVertex,00h ; compare nextVertex to zero
jl @@adjvert ; nextVertex is less than zero
jmp @@bypass ; jump over next conditonal
@@zervert: ; handle nextVertex>=number of vertexes
mov nextVertex,00h ; set nextVertex to zero
jmp @@bypass ; jump over next conditional
@@adjvert: ; handle nextVertex<0
dec bx ; decrement value count in bx register
mov nextVertex,bx ; set nextVertex to (numVertex-1)
@@bypass: ; bypass sync address
getPoint [ecx].PureEdge@@mlpDstList,nextVertex ; get mlpDstList[nextVertex]
push bx ; dstList[nextVertex].y() in bx, save it.
getPoint [ecx].PureEdge@@mlpDstList,startVertex ; get mlpDstList[startVertex]
pop ax ; restore first x point to ax
sub ax,bx ; now subtract second x point
mov [ecx].PureEdge@@mRemainingScanLines,ax ; result is mRemainingScanLines
cmp ax,00h ; check scanlines==0
je @@loopNext ; if it's zero, continue
mov yDestHeight,eax ; set yDestHeight
push nextVertex ; save nextVertex value
pop [ecx].PureEdge@@mCurrentEdgeEnd ; restore it to mCurrentEdgeEnd
getPoint [ecx].PureEdge@@mlpSrcList,startVertex ; get mlpSrcList[startVertex]
multiply ax,bmData@@mPrecision ; multiply mxSource by bmData@@mPrecision
mov [ecx].PureEdge@@mxSource,eax ; move srcList[startVertex].x() to mxSource
multiply bx,bmData@@mPrecision ; multiply mySource by bmData@@mPrecision
mov [ecx].PureEdge@@mySource,eax ; move srcList[startVertex].y() to mySource
getPoint [ecx].PureEdge@@mlpSrcList,nextVertex ; get mlpSrcList[nextVertex]
multiply ax,bmData@@mPrecision ; ax by bmData@@mPrecision
mov ebx,[ecx].PureEdge@@mxSource ; mxSource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].x-mxSource-->eax
divide eax,yDestHeight ; divide by yDestHeight, this is mxSourceStep
mov [ecx].PureEdge@@mxSourceStep,eax ; move eax register into mxSourceStep
getPoint [ecx].PureEdge@@mlpSrcList,nextVertex ; get source point
mov eax,ebx ; move point.y into eax register
multiply ax,bmData@@mPrecision ; multiply by precision
mov ebx,[ecx].PureEdge@@mySource ; mySource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].y-mySource-->eax
divide eax,yDestHeight ; divide by yDestHeight, this is mySourceStep
mov [ecx].PureEdge@@mySourceStep,eax ; move eax register into mySourceStep
getPoint [ecx].PureEdge@@mlpDstList,startVertex ; get mlpDstList[startVertex]
mov [ecx].PureEdge@@mxDestLocation,ax ; mxDestLocation=mDstList[startVertex].x()
getPoint [ecx].PureEdge@@mlpDstList,nextVertex ; get dstList[nextVertex]
sub ax,[ecx].PureEdge@@mxDestLocation ; get the width of the segment
mov xDestWidth,ax ; move the width into xDestWidth
cmp xDestWidth,00h ; is the direction negative (ie) left
jl @@negWidth ; yes, handle negative direction
mov [ecx].PureEdge@@mxDirection,01h ; set right direction indicator
mov [ecx].PureEdge@@mxErrorTerm,00h ; set mxErrorTerm to zero
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[ecx].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx
divide eax,ebx ; eax=xDestWidth.mRemainingScanLines
mov [ecx].PureEdge@@mxStep,ax ; move result into mxStep
jmp @@syncOne ; jump over following handler
@@negWidth: ; handle negative direction
mov [ecx].PureEdge@@mxDirection,-1 ; set left direction indicator
neg xDestWidth ; negate the width (ie) make it positive
mov ax,01h ; move one into ax register
sub ax,[ecx].PureEdge@@mRemainingScanLines ; subtract remaining scan lines from 1
mov [ecx].PureEdge@@mxErrorTerm,ax ; move result to mxErrorTerm
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[ecx].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx
divide eax,ebx ; eax=xDestWidth/mRemainingScanLines
neg eax ; negate the result
mov [ecx].PureEdge@@mxStep,ax ; move result back into mxStep
@@syncOne: ; synchronization address
mov [ecx].PureEdge@@mxAdjustUp,dx ; move remainder into mxAdjustUp
push [ecx].PureEdge@@mRemainingScanLines ; save mRemainingScanLines
pop [ecx].PureEdge@@mxAdjustDown ; restore mRemainingScanLines into mxAdjustDown
jmp @@ok ; jump over forever loop
@@loopNext: ; forever loop address
push nextVertex ; save nextVertex on stack
pop [ecx].PureEdge@@mStartVertex ; restore into mStartVertex
push nextVertex ; save nextVertex on stack
pop startVertex ; restore it to local copy of startVertex
jmp @@forever ; continue with loop
@@error: ; error handler
mov eax,0001h ; set ax register to 01h to indicate failure
jmp @@return ; jump over to return label
@@ok: ; success handler
xor eax,eax ; clear out eax register to handle success
@@return: ; return label
add esp,LocalLength ; remove local variables from stack
pop ebp ; restore old stack frame
retn ; return near to caller
_setupEdge endp
_getMinMaxInfo proc near ; long getMinMaxInfo(void)
LOCAL yMin:WORD,yMax:WORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; make room for local variables
push ecx ; save callers ecx register
mov edx,ecx ; move ecx into edx, edx has ptr to PureEdge
cmp [edx].PureEdge@@mNumVertexes,MINVERTEX ; make sure have at least 3 vertexes
jl @@error ; handle error condition
mov yMin,MINVALUE ; start yMin with some low value
mov yMax,MAXVALUE ; start yMax with some high value
xor ecx,ecx ; start at index zero
mov eax,[edx].PureEdge@@mlpDstList ; move address of (Point*) to ebx register
@@iterator: ; loop top
mov bx,[eax].Point@@y ; move point::y to bx register
cmp bx,yMin ; compare with current yMin value
jg @@greater ; point::y greater than current yMin
@@nexttest: ; if I handle the greater condition, still need to do less
cmp bx,yMax ; compare with current yMax value
jl @@less ; point::y less than current yMax
jmp @@looptest ; nuthin, continue with test
@@greater: ; handle greater condition
mov yMin,bx ; set yMin to bx register
mov [edx].PureEdge@@mMinVertex,cx ; move index number of vertex to mMinVertex
jmp @@nexttest ; go perform next test
@@less: ; handle less condition
mov yMax,bx ; set yMax to bx register
mov [edx].PureEdge@@mMaxVertex,cx ; update mMaxVertex with current index
@@looptest: ; falls through to loop
add eax,04h ; add 4 bytes to eax to address next (Point*)
inc cx ; increment cx register
cmp cx,[edx].PureEdge@@mNumVertexes ; have we reeached the number of vertexes yet?
jl @@iterator ; still more vertexes
push [edx].PureEdge@@mMaxVertex ; save mMaxVertex
pop [edx].PureEdge@@mStartVertex ; restore it to mStartVertex
jmp @@ok ; error return sync address
@@error: ; setup for error return code
mov eax,0001h ; move 01h into ax to indicate error
jmp @@return ; jump to return label
@@ok: ; setup for success return code
xor eax,eax ; clear out eax register
@@return: ; return label
pop ecx ; restore callers ecx register
add esp,LocalLength ; pop local variables off stack
pop ebp ; restore old stack frame
retn ; return near to caller
_getMinMaxInfo endp
_setSrcBitmapInfo proc near ; void setSrcBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push eax ; save eax register
push ebx ; save ebx register
mov ax,word ptr[ebp+08h] ; move width into ax register
mov bmData@@mSrcWidth,ax ; move width into bmData@@mSrcWidth
mov bx,word ptr[ebp+0Ch] ; move height into bx register
mov bmData@@mSrcHeight,bx ; move height into bx register
multiply ax,bx ; multiply (width*height)
mov bmData@@mSrcExtent,eax ; (width*height) to mSrcExtent
push dword ptr[ebp+10h] ; save lpBitmapImage on stack
pop bmData@@mlpSrcPtr ; restore in mlpSrcPtr
pop ebx ; restore ebx register
pop eax ; restore eax register
pop ebp ; restore old stack frame
retn ; return near to caller
_setSrcBitmapInfo endp
_setDstBitmapInfo proc near ; void setDstBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push eax ; save eax register
push ebx ; save ebx register
mov ax,word ptr[ebp+08h] ; move width into ax register
mov bmData@@mDstWidth,ax ; move width into mDstWidth
mov bx,word ptr[ebp+0Ch] ; move height into bx register
mov bmData@@mDstHeight,bx ; move height into mDstHeight
multiply ax,bx ; multiply (width*height)
mov bmData@@mDstExtent,eax ; move (width*height) into mDstExtent
push dword ptr[ebp+10h] ; save lpBitmapImage on stack
pop bmData@@mlpDstPtr ; restore in mlpDstPtr
pop ebx ; restore ebx register
pop eax ; restore eax register
pop ebp ; restore old stack frame
retn ; return near to caller
_setDstBitmapInfo endp
_setMaskInfo proc near ; void setMaskInfo(WORD useMask,BYTE maskValue)
push ebp ; save previous stack frame
mov ebp,esp ; create new frame
mov eax,[ebp+08h] ; move useMask into eax register
mov bmData@@mUseMask,al ; move useMask into bmData@@mUseMask
cmp eax,0000h ; check to see if we are using the mask
je @@maskEndProc ; if we're not using mask, don't set mask value
mov eax,[ebp+0Ch] ; move mask value into eax register
mov bmData@@mMaskValue,al ; move mask value into bmData@@mMaskValue
@@maskEndProc: ; end procedure sync address
pop ebp ; restore previous stack frame
retn ; return near to caller
_setMaskInfo endp
public _mapTexture
public _initEdge
public _setSrcBitmapInfo
public _setDstBitmapInfo
public _setMaskInfo
end

45
engine/TMAP32.INC Normal file
View File

@@ -0,0 +1,45 @@
;****************************************************************************
; FILE:TEXTURE.INC
; FUNCTION: INCLUDE FILE FOR ASM TEXTURE MAPPING
; AUTHOR:SEAN M. KESSLER
;****************************************************************************
PureEdge STRUC
PureEdge@@mEdgeDirection DW ?
PureEdge@@mRemainingScanLines DW ?
PureEdge@@mCurrentEdgeEnd DW ?
PureEdge@@mxSource DD ?
PureEdge@@mySource DD ?
PureEdge@@mxSourceStep DD ?
PureEdge@@mySourceStep DD ?
PureEdge@@mxDestLocation DW ?
PureEdge@@mxStep DW ?
PureEdge@@mxDirection DW ?
PureEdge@@mxErrorTerm DW ?
PureEdge@@mxAdjustUp DW ?
PureEdge@@mxAdjustDown DW ?
PureEdge@@mMaxVertex DW ?
PureEdge@@mMinVertex DW ?
PureEdge@@mStartVertex DW ?
PureEdge@@mNumVertexes DW ?
PureEdge@@mlpSrcList DD NEAR PTR ?
PureEdge@@mlpDstList DD NEAR PTR ?
PureEdge ENDS
PureMap STRUC
PureMap@@mBitmapIndex DD ?
PureMap@@mxSource DD ?
PureMap@@mySource DD ?
PureMap@@mDestWidth DD ?
PureMap@@mxSourceStep DD ?
PureMap@@mySourceStep DD ?
PureMap@@mxDest DW ?
PureMap@@mxDestMax DW ?
PureMap@@myValue DW ?
PureMap@@mlpLeftEdge DD NEAR PTR ?
PureMap@@mlpRightEdge DD NEAR PTR ?
PureMap ENDS
MathCache STRUC
MathCache@@mCacheOne DD ?
MathCache@@mCacheTwo DD ?
MathCache@@mCacheVal DD ?
MathCache ENDS

605
engine/TMAP32.TXT Normal file
View File

@@ -0,0 +1,605 @@
;*************************************************************************************
; MODULE: TMAP32.ASM DATE: DECEMBER 28, 1994
; AUTHOR: SEAN M. KESSLER JUNE 06, 1995
; TARGET: 32 BIT TARGET
; FUNCTION : TEXTURE MAPPING POLYGONS IN PERSPECTIVE
;*************************************************************************************
SMART
.386
.MODEL FLAT
.DATA
.LALL
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\ENGINE\TMAP32.INC
;bmData@@mGetCache Cache ?
bmData@@mGetCache GetCache ?
bmData@@mSrcWidth DW 00h
bmData@@mSrcHeight DW 00h
bmData@@mSrcExtent DD 00h
bmData@@mlpSrcPtr DD 00h
bmData@@mDstWidth DW 00h
bmData@@mDstHeight DW 00h
bmData@@mDstExtent DD 00h
bmData@@mDstCacheRow DW 00h
bmData@@mDstCacheMul DD 00h
bmData@@mlpDstPtr DD 00h
bmData@@mlpDstIndexPtr DD 00h
bmData@@mPrecision DW 4000h
bmData@@mMulCacheOne DW 00h
bmData@@mMulCacheTwo DW 00h
bmData@@mMulCacheVal DD 00h
MINVALUE EQU -32767
MAXVALUE EQU 32767
MINVERTEX EQU 3
.CODE
LOCALS
isInGetCache MACRO cacheItem
LOCAL @@return,@@okReturn,@@initCache,@@checkCachePlusOne, \
@@checkCachePlusTwo,@@checkCachePlusThree,@@checkCachePlusFour
cmp bmData@@mGetCache.GetCache@@mCacheStatus,0FFh
je @@initCache
cmp cacheItem,bmData@@mGetCache.GetCache@@mCacheData[0].GetCacheData@@mColRow
jne @@checkCachePlusOne
mov cl,bmData@@mGetCache.GetCache@@mCacheData[0].GetCacheData@@mCacheData
jmp @@okReturn
@@checkCachePlusOne:
cmp cacheItem,bmData@@mGetCache.GetCache@@mCacheData[1].GetCacheData@@mColRow
jne @@checkCachePlusTwo
mov cl,bmData@@mGetCache.GetCache@@mCacheData[1].GetCacheData@@mCacheData
jmp @@okReturn
@@checkCachePlusTwo:
cmp cacheItem,bmData@@mGetCache.GetCache@@mCacheData[2].GetCacheData@@mColRow
jne @@checkCachePlusThree
mov cl,bmData@@mGetCache.GetCache@@mCacheData[2].GetCacheData@@mCacheData
jmp @@okReturn
@@checkCachePlusThree:
cmp cacheItem,bmData@@mGetCache.GetCache@@mCacheData[3].GetCacheData@@mColRow
jne @@checkCachePlusFour
mov cl,bmData@@mGetCache.GetCache@@mCacheData[3].GetCacheData@@mCacheData
jmp @@okReturn
@@checkCachePlusFour:
cmp cacheItem,bmData@@mGetCache.GetCache@@mCacheData[4].GetCacheData@@mColRow
jne @@noGetCache
mov cl,bmData@@mGetCache.GetCache@@mCacheData[4].GetCacheData@@mCacheData
jmp @@okReturn
@@initCache:
mov bmData@@mGetCache.GetCache@@mCacheStatus,00h ; activate cache mechanism
zeroCache
@@noGetCache:
stc
jmp @@return
@@okReturn:
inc bmData@@mGetCache.GetCache@@mCacheHits
clc
@@return:
ENDM
zeroCache MACRO
mov bmData@@mGetCache.GetCache@@mCacheData[0].GetCacheData@@mColRow,0FFFFFFFFh
mov bmData@@mGetCache.GetCache@@mCacheData[0].GetCacheData@@mCacheData,0FFh
mov bmData@@mGetCache.GetCache@@mCacheData[1].GetCacheData@@mColRow,0FFFFFFFFh
mov bmData@@mGetCache.GetCache@@mCacheData[1].GetCacheData@@mCacheData,0FFh
mov bmData@@mGetCache.GetCache@@mCacheData[2].GetCacheData@@mColRow,0FFFFFFFFh
mov bmData@@mGetCache.GetCache@@mCacheData[2].GetCacheData@@mCacheData,0FFh
mov bmData@@mGetCache.GetCache@@mCacheData[3].GetCacheData@@mColRow,0FFFFFFFFh
mov bmData@@mGetCache.GetCache@@mCacheData[3].GetCacheData@@mCacheData,0FFh
mov bmData@@mGetCache.GetCache@@mCacheData[4].GetCacheData@@mColRow,0FFFFFFFFh
mov bmData@@mGetCache.GetCache@@mCacheData[4].GetCacheData@@mCacheData,0FFh
ENDM
rollCache MACRO
mov edx,bmData@@mGetCache.GetCache@@mCacheData[3].GetCacheData@@mColRow
mov bl,bmData@@mGetCache.GetCache@@mCacheData[3].GetCacheData@@mCacheData
mov bmData@@mGetCache.GetCache@@mCacheData[4].GetCacheData@@mColRow,edx
mov bmData@@mGetCache.GetCache@@mCacheData[4].GetCacheData@@mCacheData,bl
mov edx,bmData@@mGetCache.GetCache@@mCacheData[2].GetCacheData@@mColRow
mov bl,bmData@@mGetCache.GetCache@@mCacheData[2].GetCacheData@@mCacheData
mov bmData@@mGetCache.GetCache@@mCacheData[3].GetCacheData@@mColRow,edx
mov bmData@@mGetCache.GetCache@@mCacheData[3].GetCacheData@@mCacheData,bl
mov edx,bmData@@mGetCache.GetCache@@mCacheData[1].GetCacheData@@mColRow
mov bl,bmData@@mGetCache.GetCache@@mCacheData[1].GetCacheData@@mCacheData
mov bmData@@mGetCache.GetCache@@mCacheData[2].GetCacheData@@mColRow,edx
mov bmData@@mGetCache.GetCache@@mCacheData[2].GetCacheData@@mCacheData,bl
mov edx,bmData@@mGetCache.GetCache@@mCacheData[0].GetCacheData@@mColRow
mov bl,bmData@@mGetCache.GetCache@@mCacheData[0].GetCacheData@@mCacheData
mov bmData@@mGetCache.GetCache@@mCacheData[1].GetCacheData@@mColRow,edx
mov bmData@@mGetCache.GetCache@@mCacheData[1].GetCacheData@@mCacheData,bl
ENDM
putCacheColRow MACRO cacheColRow
mov bmData@@mGetCache.GetCache@@mCacheData[0].GetCacheData@@mColRow,cacheColRow
ENDM
putCacheData MACRO cacheData
mov bmData@@mGetCache.GetCache@@mCacheData[0].GetCacheData@@mCacheData,cacheData
ENDM
multiply MACRO varOne,varTwo
LOCAL @@bypassCache,@@return
movzx eax,varOne ; move varOne into eax register
movzx edx,varTwo ; move varTwo into ebx register
cmp ax,bmData@@mMulCacheOne ; check varOne against cache varOne
jne @@bypassCache ; no match, we perform the multiply
cmp dx,bmData@@mMulCacheTwo ; check varTwo against cache varTwo
jne @@bypassCache ; no match, we perform the multiply
mov eax,bmData@@mMulCacheVal ; cache hit, so use the cache value result
jmp @@return ; we're done here
@@bypassCache: ; bypass cache sync address
mov bmData@@mMulCacheOne,ax ; store source into cache source
mov bmData@@mMulCacheTwo,dx ; store destination
imul eax,edx ; perform multiply, result to eax
mov bmData@@mMulCacheVal,eax ; store result into cache result
@@return: ; return sync address
ENDM
divide MACRO varOne,varTwo
mov eax,varOne ; move varOne into eax register
cdq ; convert doubleword in eax to quadword at edx:eax
idiv varTwo ; divide eax/varTwo result to eax, remainder to edx
ENDM
roundEBX MACRO varOne
LOCAL @@return
mov edx,varOne ; move value into edx register
mov ebx,varOne ; move value into ebx register
and edx,00003FFFh ; get remainder into edx register
shr ebx,14 ; get whole number to ebx register
cmp edx,8192 ; if remainder > 8192, increment ebx
jle @@return ; otherwise return
inc ebx ; increment value in ebx
@@return:
ENDM
roundEAX MACRO varOne
LOCAL @@return
mov edx,varOne ; move value into edx register
mov eax,varOne ; move value into eax register
and edx,00003FFFh ; get remainder into edx register
shr eax,14 ; get whole number to eax register
cmp edx,8192 ; if remainder > 8192, increment ebx
jle @@return ; otherwise return
inc eax ; increment value in eax
@@return:
ENDM
getPoint MACRO address,index
movzx eax,index ; move index into eax register
shl eax,02h ; multiply ax by size of far pointer
add eax,address ; add in the address
movzx ebx,[eax].Point@@y ; get the y value to bx register
movzx eax,[eax].Point@@x ; get the x value to ax register
ENDM
newEdge MACRO ; (PureEdge*) in eax, sets edx=1=error, otherwise edx=0
movzx ebx,[eax].PureEdge@@mEdgeDirection ; save edgeDirection
push ebx ; push edgeDirection
push [eax].PureEdge@@mCurrentEdgeEnd ; push currentEdge end (ie) nextEdge index
mov ecx,eax ; move (PureEdge*) to ecx register
call _setupEdge ; attempt to setup new edge
add esp,06h ; readjust the stack
mov edx,eax ; move return code to edx register
ENDM
getSrcDataByte MACRO ; BYTE getSrcDataByte(eax=colRow)
LOCAL @@return,@@bypassCache,@@initCache ; local sync address labels
isInGetCache eax
jc @@bypassCache
jmp @@return
; cmp bmData@@mGetCache.Cache@@mCacheStatus,0FFh ; is cache active yet ??
; je @@initCache ; no, cache has not been intialized
; cmp eax,bmData@@mGetCache.Cache@@mColRow ; check colRow for cache hit
; jne @@bypassCache ; cache was not hit, so do the multiply
; mov cl,bmData@@mGetCache.Cache@@mCacheData ; yes, the cache was hit, use value
; jmp @@return ; now return clean.
;@@initCache: ; init cache sync address
; mov bmData@@mGetCache.Cache@@mCacheStatus,00h ; activate cache mechanism
@@bypassCache: ; bypass cache sync address
rollCache
putCacheColRow ebx
mov ebx,eax ; move colRow to ebx register
; mov bmData@@mGetCache.Cache@@mColRow,eax ; move colRow to cache colRow
multiply bx,bmData@@mSrcWidth ; multiply (row*width)-> eax
xor edx,edx ; clear edx
mov dx,bmData@@mSrcWidth ; move width to edx register
add eax,edx ; add in width (ie) (row*width)+width
mov edx,bmData@@mSrcExtent ; move source bitmap extent to edx
sub edx,eax ; sub result from source bmp extent
shr ebx,10h ; ebx gets column
add edx,ebx ; add column back in
mov ebx,bmData@@mlpSrcPtr ; move mlpSrcPtr to ebx register
mov cl,byte ptr[ebx+edx] ; get source byte at ebx+edx to cl
; mov bmData@@mGetCache.Cache@@mCacheData,cl ; save byte value to cache value
putCacheData cl
@@return: ; return sync address
ENDM
if 0
getSrcDataByte MACRO ; BYTE getSrcDataByte(eax=colRow)
LOCAL @@return,@@bypassCache,@@initCache ; local sync address labels
cmp bmData@@mGetCache.Cache@@mCacheStatus,0FFh ; is cache active yet ??
je @@initCache ; no, cache has not been intialized
cmp eax,bmData@@mGetCache.Cache@@mColRow ; check colRow for cache hit
jne @@bypassCache ; cache was not hit, so do the multiply
mov cl,bmData@@mGetCache.Cache@@mCacheData ; yes, the cache was hit, use value
jmp @@return ; now return clean.
@@initCache: ; init cache sync address
mov bmData@@mGetCache.Cache@@mCacheStatus,00h ; activate cache mechanism
@@bypassCache: ; bypass cache sync address
mov ebx,eax ; move colRow to ebx register
mov bmData@@mGetCache.Cache@@mColRow,eax ; move colRow to cache colRow
multiply bx,bmData@@mSrcWidth ; multiply (row*width)-> eax
xor edx,edx ; clear edx
mov dx,bmData@@mSrcWidth ; move width to edx register
add eax,edx ; add in width (ie) (row*width)+width
mov edx,bmData@@mSrcExtent ; move source bitmap extent to edx
sub edx,eax ; sub result from source bmp extent
shr ebx,10h ; ebx gets column
add edx,ebx ; add column back in
mov ebx,bmData@@mlpSrcPtr ; move mlpSrcPtr to ebx register
mov cl,byte ptr[ebx+edx] ; get source byte at ebx+edx to cl
mov bmData@@mGetCache.Cache@@mCacheData,cl ; save byte value to cache value
@@return: ; return sync address
ENDM
endif
setDstDataByte MACRO ; void setDstDataByte(cl=charByte)
mov ebx,bmData@@mlpDstIndexPtr ; get scanline pointer to ebx
mov byte ptr[ebx],cl ; move byte into frame bitmap
inc bmData@@mlpDstIndexPtr ; increment scanline pointer
ENDM
setDstIndexPtr MACRO
multiply [esi].PureMap@@myValue,bmData@@mDstWidth ; multiply row*width result to eax
xor edx,edx ; clear edx register
mov dx,bmData@@mDstWidth ; move width into dx register
add eax,edx ; add (row*width)+width
mov edx,bmData@@mDstExtent ; move (width*height) into ebx
sub edx,eax ; calculate addValue-subValue
mov bx,[esi].PureMap@@mxDest ; move column into bx register
and ebx,0000FFFFh ; zero out high word of ebx
add edx,ebx ; now add column number back in
mov ebx,bmData@@mlpDstPtr ; move mlpDstPtr to ebx register
add ebx,edx ; add offset to mlpDstPtr
mov bmData@@mlpDstIndexPtr,ebx ; store offset to new index pointer
ENDM
increment MACRO ; assumes (PureEdge*) is in eax register, sets carry on error
LOCAL @@newEdge,@@adjTerm,@@error,@@success,@@return
dec [eax].PureEdge@@mRemainingScanLines ; decrement mRemainingScanLines
jz @@newEdge ; if no more scan lines, try to setup new edge
mov ebx,[eax].PureEdge@@mxSourceStep ; get mxSourceStep to ebx register
add ebx,[eax].PureEdge@@mxSource ; add in mxSource
mov [eax].PureEdge@@mxSource,ebx ; replace mxSource with new value
mov ebx,[eax].PureEdge@@mySourceStep ; get mySourceStep into ebx register
add ebx,[eax].PureEdge@@mySource ; add in mySource
mov [eax].PureEdge@@mySource,ebx ; replace mySource with new value
mov bx,[eax].PureEdge@@mxDestLocation ; get mxDestLocation into ebx register
add bx,[eax].PureEdge@@mxStep ; add in mxStep
mov [eax].PureEdge@@mxDestLocation,bx ; replace mxDestLocation with new value
mov bx,[eax].PureEdge@@mxErrorTerm ; get mxErrorTerm to bx register
add bx,[eax].PureEdge@@mxAdjustUp ; add in mxAdjustUp
mov [eax].PureEdge@@mxErrorTerm,bx ; replace mxErrorTerm with new value
cmp bx,00h ; compare mxErrorTerm to zero
jle @@success ; mxErrorTerm is less equal zero
@@adjTerm: ; adjTerm sync address
mov bx,[eax].PureEdge@@mxDestLocation ; get mxDestLocation to bx register
add bx,[eax].PureEdge@@mxDirection ; add in mxDirection
mov [eax].PureEdge@@mxDestLocation,bx ; replace mxDestLocation with new value
mov bx,[eax].PureEdge@@mxErrorTerm ; move mxErrorTerm into bx register
sub bx,[eax].PureEdge@@mxAdjustDown ; add in mxAdjustDown
mov [eax].PureEdge@@mxErrorTerm,bx ; replace mxErrorTerm with new value
jmp @@success ; we're done here
@@newEdge: ; newEdge sync address
newEdge ; attempt to create new edge
cmp edx,0001h ; did prior call fail ?
jne @@success ; no, we're done here
@@error: ; error sync address
stc ; error sets carry
jmp @@return ; jump to return
@@success: ; ok sync address
clc ; success clears carry
@@return: ; return sync address
ENDM
scanOutputLine MACRO ; void scanOutputLine(ecx=(PureEdge*))
LOCAL @@xLoop,@@skipImageBit,@@continue,@@return ; local label
mov edi,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*)lpLeftEdge to ecx register
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource to eax register
mov [esi].PureMap@@mxSource,eax ; move PureEdge::mxSource to PureMap::mxSource
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource to eax register
mov [esi].PureMap@@mySource,eax ; move PureEdge::mySource to PureMap::mySource
mov dx,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax
mov [esi].PureMap@@mxDest,dx ; move PureEdge::mxDestLocation to PureMap::mxDest
mov edi,[esi].PureMap@@mlpRightEdge ; move (PureEdge*)lpRightEdge to ecx register
xor eax,eax ; clear out eax register
mov ax,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax register
mov [esi].PureMap@@mxDestMax,ax ; move PureEdge::mxDestLocation to PureMap::mxDestMax
sub ax,dx ; mxDestMax-mxDest
jz @@return ; if width is zero then return
mov [esi].PureMap@@mDestWidth,eax ; move width into PureMap::mDestWidth
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource into eax
sub eax,[esi].PureMap@@mxSource ; subtract out PureMap::mxSource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mxSourceStep,eax ; move new value to PureMap@@mxSourceStep
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource into eax
sub eax,[esi].PureMap@@mySource ; subtract out PureMap::mySource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mySourceStep,eax ; move new value to PureMap@@mySourceStep
mov bmData@@mlpDstIndexPtr,00h ; initialize scanline pointer
@@xLoop: ; xLoop test
mov ax,[esi].PureMap@@mxDest ; move mxDest to ax register
cmp ax,[esi].PureMap@@mxDestMax ; compare mxDest to ax register
jge @@return ; if its greater equal return
cmp ax,bmData@@mDstWidth ; is destination x greater than frame width?
jge @@return ; yes, stop scanning this output line
or ax,ax ; does mxDest extend too far left of frame buffer
jl @@skipImageBit ; if it does then skip putImageBits
cmp bmData@@mlpDstIndexPtr,00h ; check the index pointer
jne @@continue ; if it's not null we continue along
setDstIndexPtr ; set destination index pointer to row/col
@@continue: ; sync address
roundEBX [esi].PureMap@@mySource ; convert and round PureMap@@mySource -> ebx
roundEAX [esi].PureMap@@mxSource ; convert and round PureMap@@mxSource -> eax
shl eax,16 ; move column into high word
mov ax,bx ; move row into low word
getSrcDataByte ; getSrcDataByte at eax=colRow, byteValue gets placed into cl
setDstDataByte ; setDstDataByte at mlpDstIndexPtr,cl=byteValue
@@skipImageBit: ; skipImageBit bypass address
mov eax,[esi].PureMap@@mxSourceStep ; move mxSourceStep to eax
add [esi].PureMap@@mxSource,eax ; add mxSouceStep to mxSource
mov ebx,[esi].PureMap@@mySourceStep ; move mySourceStep to eax
add [esi].PureMap@@mySource,ebx ; add mySourceStep to mySource
inc [esi].PureMap@@mxDest ; increment loop counter
jmp @@xLoop ; loop through xLoop
@@return: ; return sync label
ENDM
_mapTexture proc near ; void mapTexture(PureMap *lpTextureMap)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
pushad ; save all general purpose registers, required.
mov esi,dword ptr[ebp+8] ; move (PureMap*) to esi register
mov edx,[esi].PureMap@@mlpLeftEdge ; move PureMap->mlpLeftEdge to edx
mov bx,[edx].PureEdge@@mMaxVertex ; move left edge mMaxVertex to bx register
getPoint [edx].PureEdge@@mlpDstList,bx ; get point
mov [esi].PureMap@@myValue,bx ; myValue=mLeftEdge[mLeft.maxVertex()].y()
@@forever: ; (ie) while(TRUE)
mov ax,[esi].PureMap@@myValue ; move myValue to ax register
cmp ax,bmData@@mDstHeight ; is myValue greater than frame buffer height
jge @@return ; if so then we're done mapping the texture
cmp ax,00h ; is myValue within frame buffer at all
jl @@skipOutputLine ; if not then skip this output line
scanOutputLine ; scan along the output line, (PureMap*) in ecx for macro
@@skipOutputLine: ; skipOutputLine sync address
mov eax,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*) left edge to eax
increment ; increment along left edge
jc @@return ; if carry set, edge failed to increment, we're done
mov eax,[esi].PureMap@@mlpRightEdge ; move (PureEdge*) right edge to eax
increment ; increment along right edge
jc @@return ; if carry set, edge failed to increment, we're done
inc [esi].PureMap@@myValue ; increment y position
jmp @@forever ; loop until all edges are completed
@@return: ; return sync address
popad ; restore all general purpose registers
pop ebp ; restore old stack frame
retn ; return near to caller
_mapTexture endp
_initEdge proc near ; void initEdge(long edgeType,PureEdge *lpEdge);
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push ebx ; save ebx register
mov ecx,dword ptr[ebp+12] ; move edge ptr to ecx register
call _getMinMaxInfo ; find minimum and maximum vertices
cmp eax,0000h ; make sure previous call returned success
jne @@return ; if not then return
push dword ptr[ebp+8] ; push edge type (-1:leftEdge,1:rightEdge)
push [ecx].PureEdge@@mStartVertex ; push startVertex
call _setupEdge ; now setup the edge
add esp,06h ; readjust the stack
@@return: ; return label
pop ebx ; restore ebx register
pop ebp ; restore old stack frame
retn ; return to caller
_initEdge endp
_setupEdge proc near ; long setupEge(long edgeType,int startVertex);
LOCAL nextVertex:WORD,startVertex:WORD,xDestWidth:WORD,yDestHeight:DWORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; make room for local variables
mov bx,word ptr[ebp+10] ; move edge type to bx register
mov [ecx].PureEdge@@mEdgeDirection,bx ; store edge direction in variable
mov bx,word ptr[ebp+8] ; move startVertex to bx register
mov [ecx].PureEdge@@mStartVertex,bx ; move startVertex into mStartVertex
mov startVertex,bx ; move startVertex into startVertex
@@forever: ; forever loop label
mov bx,startVertex ; move startVertex to bx register
cmp bx,[ecx].PureEdge@@mMinVertex ; is startVertex same as mMinVertex ?
je @@error ; if so then we're all done here
add bx,[ecx].PureEdge@@mEdgeDirection ; add edge direction to startVertex
mov nextVertex,bx ; move result to nextVertex
mov bx,[ecx].PureEdge@@mNumVertexes ; move number of vertexes to bx register
cmp nextVertex,bx ; compare nextVertex to number of vertexes
jge @@zervert ; next vertex is greater eq number of vertexes
cmp nextVertex,00h ; compare nextVertex to zero
jl @@adjvert ; nextVertex is less than zero
jmp @@bypass ; jump over next conditonal
@@zervert: ; handle nextVertex>=number of vertexes
mov nextVertex,00h ; set nextVertex to zero
jmp @@bypass ; jump over next conditional
@@adjvert: ; handle nextVertex<0
dec bx ; decrement value count in bx register
mov nextVertex,bx ; set nextVertex to (numVertex-1)
@@bypass: ; bypass sync address
getPoint [ecx].PureEdge@@mlpDstList,nextVertex ; get mlpDstList[nextVertex]
push bx ; dstList[nextVertex].y() in bx, save it.
getPoint [ecx].PureEdge@@mlpDstList,startVertex ; get mlpDstList[startVertex]
pop ax ; restore first x point to ax
sub ax,bx ; now subtract second x point
mov [ecx].PureEdge@@mRemainingScanLines,ax ; result is mRemainingScanLines
cmp ax,00h ; check scanlines==0
je @@loopNext ; if it's zero, continue
mov yDestHeight,eax ; set yDestHeight
push nextVertex ; save nextVertex value
pop [ecx].PureEdge@@mCurrentEdgeEnd ; restore it to mCurrentEdgeEnd
getPoint [ecx].PureEdge@@mlpSrcList,startVertex ; get mlpSrcList[startVertex]
multiply ax,bmData@@mPrecision ; multiply mxSource by bmData@@mPrecision
mov [ecx].PureEdge@@mxSource,eax ; move srcList[startVertex].x() to mxSource
multiply bx,bmData@@mPrecision ; multiply mySource by bmData@@mPrecision
mov [ecx].PureEdge@@mySource,eax ; move srcList[startVertex].y() to mySource
getPoint [ecx].PureEdge@@mlpSrcList,nextVertex ; get mlpSrcList[nextVertex]
multiply ax,bmData@@mPrecision ; ax by bmData@@mPrecision
mov ebx,[ecx].PureEdge@@mxSource ; mxSource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].x-mxSource-->eax
divide eax,yDestHeight ; divide by yDestHeight, this is mxSourceStep
mov [ecx].PureEdge@@mxSourceStep,eax ; move eax register into mxSourceStep
getPoint [ecx].PureEdge@@mlpSrcList,nextVertex ; get source point
mov eax,ebx ; move point.y into eax register
multiply ax,bmData@@mPrecision ; multiply by precision
mov ebx,[ecx].PureEdge@@mySource ; mySource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].y-mySource-->eax
divide eax,yDestHeight ; divide by yDestHeight, this is mySourceStep
mov [ecx].PureEdge@@mySourceStep,eax ; move eax register into mySourceStep
getPoint [ecx].PureEdge@@mlpDstList,startVertex ; get mlpDstList[startVertex]
mov [ecx].PureEdge@@mxDestLocation,ax ; mxDestLocation=mDstList[startVertex].x()
getPoint [ecx].PureEdge@@mlpDstList,nextVertex ; get dstList[nextVertex]
sub ax,[ecx].PureEdge@@mxDestLocation ; get the width of the segment
mov xDestWidth,ax ; move the width into xDestWidth
cmp xDestWidth,00h ; is the direction negative (ie) left
jl @@negWidth ; yes, handle negative direction
mov [ecx].PureEdge@@mxDirection,01h ; set right direction indicator
mov [ecx].PureEdge@@mxErrorTerm,00h ; set mxErrorTerm to zero
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[ecx].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx
divide eax,ebx ; eax=xDestWidth.mRemainingScanLines
mov [ecx].PureEdge@@mxStep,ax ; move result into mxStep
jmp @@syncOne ; jump over following handler
@@negWidth: ; handle negative direction
mov [ecx].PureEdge@@mxDirection,-1 ; set left direction indicator
neg xDestWidth ; negate the width (ie) make it positive
mov ax,01h ; move one into ax register
sub ax,[ecx].PureEdge@@mRemainingScanLines ; subtract remaining scan lines from 1
mov [ecx].PureEdge@@mxErrorTerm,ax ; move result to mxErrorTerm
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[ecx].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx
divide eax,ebx ; eax=xDestWidth/mRemainingScanLines
neg eax ; negate the result
mov [ecx].PureEdge@@mxStep,ax ; move result back into mxStep
@@syncOne: ; synchronization address
mov [ecx].PureEdge@@mxAdjustUp,dx ; move remainder into mxAdjustUp
push [ecx].PureEdge@@mRemainingScanLines ; save mRemainingScanLines
pop [ecx].PureEdge@@mxAdjustDown ; restore mRemainingScanLines into mxAdjustDown
jmp @@ok ; jump over forever loop
@@loopNext: ; forever loop address
push nextVertex ; save nextVertex on stack
pop [ecx].PureEdge@@mStartVertex ; restore into mStartVertex
push nextVertex ; save nextVertex on stack
pop startVertex ; restore it to local copy of startVertex
jmp @@forever ; continue with loop
@@error: ; error handler
mov eax,0001h ; set ax register to 01h to indicate failure
jmp @@return ; jump over to return label
@@ok: ; success handler
xor eax,eax ; clear out eax register to handle success
@@return: ; return label
add esp,LocalLength ; remove local variables from stack
pop ebp ; restore old stack frame
retn ; return near to caller
_setupEdge endp
_getMinMaxInfo proc near ; long getMinMaxInfo(void)
LOCAL yMin:WORD,yMax:WORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; make room for local variables
push ecx ; save callers ecx register
mov edx,ecx ; move ecx into edx, edx has ptr to PureEdge
cmp [edx].PureEdge@@mNumVertexes,MINVERTEX ; make sure have at least 3 vertexes
jl @@error ; handle error condition
mov yMin,MINVALUE ; start yMin with some low value
mov yMax,MAXVALUE ; start yMax with some high value
xor ecx,ecx ; start at index zero
mov eax,[edx].PureEdge@@mlpDstList ; move address of (Point*) to ebx register
@@iterator: ; loop top
mov bx,[eax].Point@@y ; move point::y to bx register
cmp bx,yMin ; compare with current yMin value
jg @@greater ; point::y greater than current yMin
@@nexttest: ; if I handle the greater condition, still need to do less
cmp bx,yMax ; compare with current yMax value
jl @@less ; point::y less than current yMax
jmp @@looptest ; nuthin, continue with test
@@greater: ; handle greater condition
mov yMin,bx ; set yMin to bx register
mov [edx].PureEdge@@mMinVertex,cx ; move index number of vertex to mMinVertex
jmp @@nexttest ; go perform next test
@@less: ; handle less condition
mov yMax,bx ; set yMax to bx register
mov [edx].PureEdge@@mMaxVertex,cx ; update mMaxVertex with current index
@@looptest: ; falls through to loop
add eax,04h ; add 4 bytes to eax to address next (Point*)
inc cx ; increment cx register
cmp cx,[edx].PureEdge@@mNumVertexes ; have we reeached the number of vertexes yet?
jl @@iterator ; still more vertexes
push [edx].PureEdge@@mMaxVertex ; save mMaxVertex
pop [edx].PureEdge@@mStartVertex ; restore it to mStartVertex
jmp @@ok ; error return sync address
@@error: ; setup for error return code
mov eax,0001h ; move 01h into ax to indicate error
jmp @@return ; jump to return label
@@ok: ; setup for success return code
xor eax,eax ; clear out eax register
@@return: ; return label
pop ecx ; restore callers ecx register
add esp,LocalLength ; pop local variables off stack
pop ebp ; restore old stack frame
retn ; return near to caller
_getMinMaxInfo endp
_setSrcBitmapInfo proc near ; void setSrcBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push eax ; save eax register
push ebx ; save ebx register
mov ax,word ptr[ebp+08h] ; move width into ax register
mov bmData@@mSrcWidth,ax ; move width into bmData@@mSrcWidth
mov bx,word ptr[ebp+0Ch] ; move height into bx register
mov bmData@@mSrcHeight,bx ; move height into bx register
multiply ax,bx ; multiply (width*height)
mov bmData@@mSrcExtent,eax ; (width*height) to mSrcExtent
push dword ptr[ebp+10h] ; save lpBitmapImage on stack
pop bmData@@mlpSrcPtr ; restore in mlpSrcPtr
mov bmData@@mGetCache.GetCache@@mCacheStatus,0FFh
mov bmData@@mGetCache.GetCache@@mCacheHits,00000000h
; mov bmData@@mGetCache.Cache@@mColRow,00h ; move zero into cache colRow
; mov bmData@@mGetCache.Cache@@mCacheData,00h ; move zero into cache data
; mov bmData@@mGetCache.Cache@@mCacheStatus,0FFh ; move FFh into cache status
pop ebx ; restore ebx register
pop eax ; restore eax register
pop ebp ; restore old stack frame
retn ; return near to caller
_setSrcBitmapInfo endp
_setDstBitmapInfo proc near ; void setDstBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push eax ; save eax register
push ebx ; save ebx register
mov ax,word ptr[ebp+08h] ; move width into ax register
mov bmData@@mDstWidth,ax ; move width into mDstWidth
mov bx,word ptr[ebp+0Ch] ; move height into bx register
mov bmData@@mDstHeight,bx ; move height into mDstHeight
multiply ax,bx ; multiply (width*height)
mov bmData@@mDstExtent,eax ; move (width*height) into mDstExtent
push dword ptr[ebp+10h] ; save lpBitmapImage on stack
pop bmData@@mlpDstPtr ; restore in mlpDstPtr
mov bmData@@mDstCacheRow,00h ; move zero to cache row
mov bmData@@mDstCacheMul,00h ; move zero to cache multiply result
pop ebx ; restore ebx register
pop eax ; restore eax register
pop ebp ; restore old stack frame
retn ; return near to caller
_setDstBitmapInfo endp
public _mapTexture
public _initEdge
public _setSrcBitmapInfo
public _setDstBitmapInfo
end

504
engine/Tmap32.asm Normal file
View File

@@ -0,0 +1,504 @@
;*************************************************************************************
; MODULE: TMAP32.ASM DATE: DECEMBER 28, 1994
; AUTHOR: SEAN M. KESSLER JUNE 06, 1995
; TARGET: 32 BIT TARGET
; FUNCTION : TEXTURE MAPPING POLYGONS IN PERSPECTIVE
;*************************************************************************************
SMART
.386
.MODEL FLAT
.DATA
.LALL
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\ENGINE\TMAP32.INC
bmData@@mSrcWidth DW 00h
bmData@@mSrcHeight DW 00h
bmData@@mSrcExtent DD 00h
bmData@@mlpSrcPtr DD 00h
bmData@@mDstWidth DW 00h
bmData@@mDstHeight DW 00h
bmData@@mDstExtent DD 00h
bmData@@mlpDstPtr DD 00h
bmData@@mlpDstIndexPtr DD 00h
bmData@@mPrecision DW 4000h
bmData@@mMaskValue DB 0FFh
bmData@@mUseMask DB 00h
MINVALUE EQU -32767
MAXVALUE EQU 32767
MINVERTEX EQU 3
.CODE
LOCALS
divide MACRO varOne,varTwo
mov eax,varOne ; move varOne into eax register
cdq ; convert doubleword in eax to quadword at edx:eax
idiv varTwo ; divide eax/varTwo result to eax, remainder to edx
ENDM
multiply MACRO varOne,varTwo
movzx eax,varOne ; move varOne into eax register
movzx edx,varTwo ; move varTwo into ebx register
imul eax,edx ; perform multiply, result to eax
ENDM
roundEBX MACRO varOne
LOCAL @@return
mov edx,varOne ; move value into edx register
mov ebx,varOne ; move value into ebx register
and edx,00003FFFh ; get remainder into edx register
shr ebx,14 ; get whole number to ebx register
cmp edx,8192 ; if remainder > 8192, increment ebx
jle @@return ; otherwise return
inc ebx ; increment value in ebx
@@return:
ENDM
roundEAX MACRO varOne
LOCAL @@return
mov edx,varOne ; move value into edx register
mov eax,varOne ; move value into eax register
and edx,00003FFFh ; get remainder into edx register
shr eax,14 ; get whole number to eax register
cmp edx,8192 ; if remainder > 8192, increment ebx
jle @@return ; otherwise return
inc eax ; increment value in eax
@@return:
ENDM
getPoint MACRO address,index
movzx eax,index ; move index into eax register
shl eax,02h ; multiply ax by size of far pointer
add eax,address ; add in the address
movzx ebx,[eax].Point@@y ; get the y value to bx register
movzx eax,[eax].Point@@x ; get the x value to ax register
ENDM
newEdge MACRO ; (PureEdge*) in eax, sets edx=1=error, otherwise edx=0
movzx ebx,[eax].PureEdge@@mEdgeDirection ; save edgeDirection
push ebx ; push edgeDirection
push [eax].PureEdge@@mCurrentEdgeEnd ; push currentEdge end (ie) nextEdge index
mov ecx,eax ; move (PureEdge*) to ecx register
call _setupEdge ; attempt to setup new edge
add esp,06h ; readjust the stack
mov edx,eax ; move return code to edx register
ENDM
getSrcDataByte MACRO ; BYTE getSrcDataByte(eax=colRow)
multiply ax,bmData@@mSrcWidth ; multiply (row*width)-> eax
movzx edx,bmData@@mSrcWidth ; move width to edx register
add eax,edx ; add in width (ie) (row*width)+width
mov edx,bmData@@mSrcExtent ; move source bitmap extent to edx
sub edx,eax ; sub result from source bmp extent
add edx,ebx ; add column back in
mov ebx,bmData@@mlpSrcPtr ; move mlpSrcPtr to ebx register
mov cl,byte ptr[ebx+edx] ; get source byte at ebx+edx to cl
ENDM
setDstDataByte MACRO ; void setDstDataByte(cl=charByte)
mov ebx,bmData@@mlpDstIndexPtr ; get scanline pointer to ebx
mov byte ptr[ebx],cl ; move byte into frame bitmap
inc bmData@@mlpDstIndexPtr ; increment scanline pointer
ENDM
setDstIndexPtr MACRO
multiply [esi].PureMap@@myValue,bmData@@mDstWidth ; multiply row*width result to eax
xor edx,edx ; clear edx register
mov dx,bmData@@mDstWidth ; move width into dx register
add eax,edx ; add (row*width)+width
mov edx,bmData@@mDstExtent ; move (width*height) into ebx
sub edx,eax ; calculate addValue-subValue
mov [esi].PureMap@@mBitmapIndex,edx ; save offset into bitmap
ENDM
adjDstIndexPtr MACRO
mov edx,[esi].PureMap@@mBitmapIndex ; retrieve offset into bitmap
movzx ebx,[esi].PureMap@@mxDest ; move column into bx register
add edx,ebx ; now add column number back in
add edx,bmData@@mlpDstPtr ; offset index by start
mov bmData@@mlpDstIndexPtr,edx ; store value into DstIndexPtr
ENDM
increment MACRO ; assumes (PureEdge*) is in eax register, sets carry on error
LOCAL @@newEdge,@@adjTerm,@@error,@@success,@@return
dec [eax].PureEdge@@mRemainingScanLines ; decrement mRemainingScanLines
jz @@newEdge ; if no more scan lines, try to setup new edge
mov ebx,[eax].PureEdge@@mxSourceStep ; get mxSourceStep to ebx register
add ebx,[eax].PureEdge@@mxSource ; add in mxSource
mov [eax].PureEdge@@mxSource,ebx ; replace mxSource with new value
mov ebx,[eax].PureEdge@@mySourceStep ; get mySourceStep into ebx register
add ebx,[eax].PureEdge@@mySource ; add in mySource
mov [eax].PureEdge@@mySource,ebx ; replace mySource with new value
mov bx,[eax].PureEdge@@mxDestLocation ; get mxDestLocation into ebx register
add bx,[eax].PureEdge@@mxStep ; add in mxStep
mov [eax].PureEdge@@mxDestLocation,bx ; replace mxDestLocation with new value
mov bx,[eax].PureEdge@@mxErrorTerm ; get mxErrorTerm to bx register
add bx,[eax].PureEdge@@mxAdjustUp ; add in mxAdjustUp
mov [eax].PureEdge@@mxErrorTerm,bx ; replace mxErrorTerm with new value
cmp bx,00h ; compare mxErrorTerm to zero
jle @@success ; mxErrorTerm is less equal zero
@@adjTerm: ; adjTerm sync address
mov bx,[eax].PureEdge@@mxDestLocation ; get mxDestLocation to bx register
add bx,[eax].PureEdge@@mxDirection ; add in mxDirection
mov [eax].PureEdge@@mxDestLocation,bx ; replace mxDestLocation with new value
mov bx,[eax].PureEdge@@mxErrorTerm ; move mxErrorTerm into bx register
sub bx,[eax].PureEdge@@mxAdjustDown ; add in mxAdjustDown
mov [eax].PureEdge@@mxErrorTerm,bx ; replace mxErrorTerm with new value
jmp @@success ; we're done here
@@newEdge: ; newEdge sync address
newEdge ; attempt to create new edge
cmp edx,0001h ; did prior call fail ?
jne @@success ; no, we're done here
@@error: ; error sync address
stc ; error sets carry
jmp @@return ; jump to return
@@success: ; ok sync address
clc ; success clears carry
@@return: ; return sync address
ENDM
scanOutputLine MACRO ; void scanOutputLine(ecx=(PureEdge*))
LOCAL @@xLoop,@@skipImageBit,@@continue,@@return ; local label
mov edi,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*)lpLeftEdge to ecx register
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource to eax register
mov [esi].PureMap@@mxSource,eax ; move PureEdge::mxSource to PureMap::mxSource
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource to eax register
mov [esi].PureMap@@mySource,eax ; move PureEdge::mySource to PureMap::mySource
mov dx,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax
mov [esi].PureMap@@mxDest,dx ; move PureEdge::mxDestLocation to PureMap::mxDest
mov edi,[esi].PureMap@@mlpRightEdge ; move (PureEdge*)lpRightEdge to ecx register
xor eax,eax ; clear out eax register
mov ax,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax register
mov [esi].PureMap@@mxDestMax,ax ; move PureEdge::mxDestLocation to PureMap::mxDestMax
sub ax,dx ; mxDestMax-mxDest
jz @@return ; if width is zero then return
mov [esi].PureMap@@mDestWidth,eax ; move width into PureMap::mDestWidth
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource into eax
sub eax,[esi].PureMap@@mxSource ; subtract out PureMap::mxSource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mxSourceStep,eax ; move new value to PureMap@@mxSourceStep
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource into eax
sub eax,[esi].PureMap@@mySource ; subtract out PureMap::mySource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mySourceStep,eax ; move new value to PureMap@@mySourceStep
setDstIndexPtr ; set destination index pointer to row/col
@@xLoop: ; xLoop test
mov ax,[esi].PureMap@@mxDest ; move mxDest to ax register
cmp ax,[esi].PureMap@@mxDestMax ; compare mxDest to ax register
jge @@return ; if its greater equal return
cmp ax,bmData@@mDstWidth ; is destination x greater than frame width?
jge @@return ; yes, stop scanning this output line
or ax,ax ; does mxDest extend too far left of frame buffer
jl @@skipImageBit ; if it does then skip putImageBits
adjDstIndexPtr ; adjust index to reflect changed mxDest
@@continue: ; sync address
roundEAX [esi].PureMap@@mySource ; round PureMap@@mySource -> eax (row)
roundEBX [esi].PureMap@@mxSource ; round PureMap@@mxSource -> ebx (col)
getSrcDataByte ; getSrcDataByte at eax=colRow, byteValue gets placed into cl
setDstDataByte ; setDstDataByte at mlpDstIndexPtr,cl=byteValue
@@skipImageBit: ; skipImageBit bypass address
mov eax,[esi].PureMap@@mxSourceStep ; move mxSourceStep to eax
add [esi].PureMap@@mxSource,eax ; add mxSouceStep to mxSource
mov ebx,[esi].PureMap@@mySourceStep ; move mySourceStep to eax
add [esi].PureMap@@mySource,ebx ; add mySourceStep to mySource
inc [esi].PureMap@@mxDest ; increment loop counter
jmp @@xLoop ; loop through xLoop
@@return: ; return sync label
ENDM
scanOutputLineMask MACRO ; void scanOutputLineMask(ecx=(PureEdge*)) - uses mask settings
LOCAL @@xLoop,@@skipImageBit,@@continue,@@return ; local label
mov edi,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*)lpLeftEdge to ecx register
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource to eax register
mov [esi].PureMap@@mxSource,eax ; move PureEdge::mxSource to PureMap::mxSource
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource to eax register
mov [esi].PureMap@@mySource,eax ; move PureEdge::mySource to PureMap::mySource
mov dx,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax
mov [esi].PureMap@@mxDest,dx ; move PureEdge::mxDestLocation to PureMap::mxDest
mov edi,[esi].PureMap@@mlpRightEdge ; move (PureEdge*)lpRightEdge to ecx register
xor eax,eax ; clear out eax register
mov ax,[edi].PureEdge@@mxDestLocation ; move PureEdge::mxDestLocation to ax register
mov [esi].PureMap@@mxDestMax,ax ; move PureEdge::mxDestLocation to PureMap::mxDestMax
sub ax,dx ; mxDestMax-mxDest
jz @@return ; if width is zero then return
mov [esi].PureMap@@mDestWidth,eax ; move width into PureMap::mDestWidth
mov eax,[edi].PureEdge@@mxSource ; move PureEdge::mxSource into eax
sub eax,[esi].PureMap@@mxSource ; subtract out PureMap::mxSource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mxSourceStep,eax ; move new value to PureMap@@mxSourceStep
mov eax,[edi].PureEdge@@mySource ; move PureEdge::mySource into eax
sub eax,[esi].PureMap@@mySource ; subtract out PureMap::mySource
divide eax,[esi].PureMap@@mDestWidth ; now divide by PureMap::mDestWidth
mov [esi].PureMap@@mySourceStep,eax ; move new value to PureMap@@mySourceStep
setDstIndexPtr ; set destination index pointer to row/col
@@xLoop: ; xLoop test
mov ax,[esi].PureMap@@mxDest ; move mxDest to ax register
cmp ax,[esi].PureMap@@mxDestMax ; compare mxDest to ax register
jge @@return ; if its greater equal return
cmp ax,bmData@@mDstWidth ; is destination x greater than frame width?
jge @@return ; yes, stop scanning this output line
or ax,ax ; does mxDest extend too far left of frame buffer
jl @@skipImageBit ; if it does then skip putImageBits
adjDstIndexPtr ; adjust index to reflect changed mxDest
@@continue: ; sync address
roundEAX [esi].PureMap@@mySource ; round PureMap@@mySource -> eax (row)
roundEBX [esi].PureMap@@mxSource ; round PureMap@@mxSource -> ebx (col)
getSrcDataByte ; getSrcDataByte at eax=colRow, byteValue gets placed into cl
cmp cl,bmData@@mMaskValue ; are we attempting to output a byte in our mask
je @@skipImageBit ; if so then do not set the byte
setDstDataByte ; setDstDataByte at mlpDstIndexPtr,cl=byteValue
@@skipImageBit: ; skipImageBit bypass address
mov eax,[esi].PureMap@@mxSourceStep ; move mxSourceStep to eax
add [esi].PureMap@@mxSource,eax ; add mxSouceStep to mxSource
mov ebx,[esi].PureMap@@mySourceStep ; move mySourceStep to eax
add [esi].PureMap@@mySource,ebx ; add mySourceStep to mySource
inc [esi].PureMap@@mxDest ; increment loop counter
jmp @@xLoop ; loop through xLoop
@@return: ; return sync label
ENDM
_mapTexture proc near ; void mapTexture(PureMap *lpTextureMap)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
pushad ; save all general purpose registers, required.
mov esi,dword ptr[ebp+8] ; move (PureMap*) to esi register
mov edx,[esi].PureMap@@mlpLeftEdge ; move PureMap->mlpLeftEdge to edx
mov bx,[edx].PureEdge@@mMaxVertex ; move left edge mMaxVertex to bx register
getPoint [edx].PureEdge@@mlpDstList,bx ; get point
mov [esi].PureMap@@myValue,bx ; myValue=mLeftEdge[mLeft.maxVertex()].y()
@@forever: ; (ie) while(TRUE)
mov ax,[esi].PureMap@@myValue ; move myValue to ax register
cmp ax,bmData@@mDstHeight ; is myValue greater than frame buffer height
jge @@return ; if so then we're done mapping the texture
cmp ax,00h ; is myValue within frame buffer at all
jl @@skipOutputLine ; if not then skip this output line
cmp bmData@@mUseMask,00h ; are we using mask settings
jne @@scanMask ; if so then scan the output line, excluding masked bits
scanOutputLine ; otherwise just scan the output line
jmp @@skipOutputLine ; jump over the mask code
@@scanMask: ; scanMask sync address
scanOutputLineMask ; scan the output line, apply mask where appropriate
@@skipOutputLine: ; skipOutputLine sync address
mov eax,[esi].PureMap@@mlpLeftEdge ; move (PureEdge*) left edge to eax
increment ; increment along left edge
jc @@return ; if carry set, edge failed to increment, we're done
mov eax,[esi].PureMap@@mlpRightEdge ; move (PureEdge*) right edge to eax
increment ; increment along right edge
jc @@return ; if carry set, edge failed to increment, we're done
inc [esi].PureMap@@myValue ; increment y position
jmp @@forever ; loop until all edges are completed
@@return: ; return sync address
popad ; restore all general purpose registers
pop ebp ; restore old stack frame
retn ; return near to caller
_mapTexture endp
_initEdge proc near ; void initEdge(long edgeType,PureEdge *lpEdge);
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push ebx ; save ebx register
mov ecx,dword ptr[ebp+12] ; move edge ptr to ecx register
call _getMinMaxInfo ; find minimum and maximum vertices
cmp eax,0000h ; make sure previous call returned success
jne @@return ; if not then return
push dword ptr[ebp+8] ; push edge type (-1:leftEdge,1:rightEdge)
push [ecx].PureEdge@@mStartVertex ; push startVertex
call _setupEdge ; now setup the edge
add esp,06h ; readjust the stack
@@return: ; return label
pop ebx ; restore ebx register
pop ebp ; restore old stack frame
retn ; return to caller
_initEdge endp
_setupEdge proc near ; long setupEge(long edgeType,int startVertex);
LOCAL nextVertex:WORD,startVertex:WORD,xDestWidth:WORD,yDestHeight:DWORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; make room for local variables
mov bx,word ptr[ebp+10] ; move edge type to bx register
mov [ecx].PureEdge@@mEdgeDirection,bx ; store edge direction in variable
mov bx,word ptr[ebp+8] ; move startVertex to bx register
mov [ecx].PureEdge@@mStartVertex,bx ; move startVertex into mStartVertex
mov startVertex,bx ; move startVertex into startVertex
@@forever: ; forever loop label
mov bx,startVertex ; move startVertex to bx register
cmp bx,[ecx].PureEdge@@mMinVertex ; is startVertex same as mMinVertex ?
je @@error ; if so then we're all done here
add bx,[ecx].PureEdge@@mEdgeDirection ; add edge direction to startVertex
mov nextVertex,bx ; move result to nextVertex
mov bx,[ecx].PureEdge@@mNumVertexes ; move number of vertexes to bx register
cmp nextVertex,bx ; compare nextVertex to number of vertexes
jge @@zervert ; next vertex is greater eq number of vertexes
cmp nextVertex,00h ; compare nextVertex to zero
jl @@adjvert ; nextVertex is less than zero
jmp @@bypass ; jump over next conditonal
@@zervert: ; handle nextVertex>=number of vertexes
mov nextVertex,00h ; set nextVertex to zero
jmp @@bypass ; jump over next conditional
@@adjvert: ; handle nextVertex<0
dec bx ; decrement value count in bx register
mov nextVertex,bx ; set nextVertex to (numVertex-1)
@@bypass: ; bypass sync address
getPoint [ecx].PureEdge@@mlpDstList,nextVertex ; get mlpDstList[nextVertex]
push bx ; dstList[nextVertex].y() in bx, save it.
getPoint [ecx].PureEdge@@mlpDstList,startVertex ; get mlpDstList[startVertex]
pop ax ; restore first x point to ax
sub ax,bx ; now subtract second x point
mov [ecx].PureEdge@@mRemainingScanLines,ax ; result is mRemainingScanLines
cmp ax,00h ; check scanlines==0
je @@loopNext ; if it's zero, continue
mov yDestHeight,eax ; set yDestHeight
push nextVertex ; save nextVertex value
pop [ecx].PureEdge@@mCurrentEdgeEnd ; restore it to mCurrentEdgeEnd
getPoint [ecx].PureEdge@@mlpSrcList,startVertex ; get mlpSrcList[startVertex]
multiply ax,bmData@@mPrecision ; multiply mxSource by bmData@@mPrecision
mov [ecx].PureEdge@@mxSource,eax ; move srcList[startVertex].x() to mxSource
multiply bx,bmData@@mPrecision ; multiply mySource by bmData@@mPrecision
mov [ecx].PureEdge@@mySource,eax ; move srcList[startVertex].y() to mySource
getPoint [ecx].PureEdge@@mlpSrcList,nextVertex ; get mlpSrcList[nextVertex]
multiply ax,bmData@@mPrecision ; ax by bmData@@mPrecision
mov ebx,[ecx].PureEdge@@mxSource ; mxSource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].x-mxSource-->eax
divide eax,yDestHeight ; divide by yDestHeight, this is mxSourceStep
mov [ecx].PureEdge@@mxSourceStep,eax ; move eax register into mxSourceStep
getPoint [ecx].PureEdge@@mlpSrcList,nextVertex ; get source point
mov eax,ebx ; move point.y into eax register
multiply ax,bmData@@mPrecision ; multiply by precision
mov ebx,[ecx].PureEdge@@mySource ; mySource to bx register
sub eax,ebx ; (ie) mlpSrcList[nextVertex].y-mySource-->eax
divide eax,yDestHeight ; divide by yDestHeight, this is mySourceStep
mov [ecx].PureEdge@@mySourceStep,eax ; move eax register into mySourceStep
getPoint [ecx].PureEdge@@mlpDstList,startVertex ; get mlpDstList[startVertex]
mov [ecx].PureEdge@@mxDestLocation,ax ; mxDestLocation=mDstList[startVertex].x()
getPoint [ecx].PureEdge@@mlpDstList,nextVertex ; get dstList[nextVertex]
sub ax,[ecx].PureEdge@@mxDestLocation ; get the width of the segment
mov xDestWidth,ax ; move the width into xDestWidth
cmp xDestWidth,00h ; is the direction negative (ie) left
jl @@negWidth ; yes, handle negative direction
mov [ecx].PureEdge@@mxDirection,01h ; set right direction indicator
mov [ecx].PureEdge@@mxErrorTerm,00h ; set mxErrorTerm to zero
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[ecx].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx
divide eax,ebx ; eax=xDestWidth.mRemainingScanLines
mov [ecx].PureEdge@@mxStep,ax ; move result into mxStep
jmp @@syncOne ; jump over following handler
@@negWidth: ; handle negative direction
mov [ecx].PureEdge@@mxDirection,-1 ; set left direction indicator
neg xDestWidth ; negate the width (ie) make it positive
mov ax,01h ; move one into ax register
sub ax,[ecx].PureEdge@@mRemainingScanLines ; subtract remaining scan lines from 1
mov [ecx].PureEdge@@mxErrorTerm,ax ; move result to mxErrorTerm
movzx eax,xDestWidth ; move xDestWidth to eax zero extend
movzx ebx,[ecx].PureEdge@@mRemainingScanLines ; move mRemainingScanLines to ebx
divide eax,ebx ; eax=xDestWidth/mRemainingScanLines
neg eax ; negate the result
mov [ecx].PureEdge@@mxStep,ax ; move result back into mxStep
@@syncOne: ; synchronization address
mov [ecx].PureEdge@@mxAdjustUp,dx ; move remainder into mxAdjustUp
push [ecx].PureEdge@@mRemainingScanLines ; save mRemainingScanLines
pop [ecx].PureEdge@@mxAdjustDown ; restore mRemainingScanLines into mxAdjustDown
jmp @@ok ; jump over forever loop
@@loopNext: ; forever loop address
push nextVertex ; save nextVertex on stack
pop [ecx].PureEdge@@mStartVertex ; restore into mStartVertex
push nextVertex ; save nextVertex on stack
pop startVertex ; restore it to local copy of startVertex
jmp @@forever ; continue with loop
@@error: ; error handler
mov eax,0001h ; set ax register to 01h to indicate failure
jmp @@return ; jump over to return label
@@ok: ; success handler
xor eax,eax ; clear out eax register to handle success
@@return: ; return label
add esp,LocalLength ; remove local variables from stack
pop ebp ; restore old stack frame
retn ; return near to caller
_setupEdge endp
_getMinMaxInfo proc near ; long getMinMaxInfo(void)
LOCAL yMin:WORD,yMax:WORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; make room for local variables
push ecx ; save callers ecx register
mov edx,ecx ; move ecx into edx, edx has ptr to PureEdge
cmp [edx].PureEdge@@mNumVertexes,MINVERTEX ; make sure have at least 3 vertexes
jl @@error ; handle error condition
mov yMin,MINVALUE ; start yMin with some low value
mov yMax,MAXVALUE ; start yMax with some high value
xor ecx,ecx ; start at index zero
mov eax,[edx].PureEdge@@mlpDstList ; move address of (Point*) to ebx register
@@iterator: ; loop top
mov bx,[eax].Point@@y ; move point::y to bx register
cmp bx,yMin ; compare with current yMin value
jg @@greater ; point::y greater than current yMin
@@nexttest: ; if I handle the greater condition, still need to do less
cmp bx,yMax ; compare with current yMax value
jl @@less ; point::y less than current yMax
jmp @@looptest ; nuthin, continue with test
@@greater: ; handle greater condition
mov yMin,bx ; set yMin to bx register
mov [edx].PureEdge@@mMinVertex,cx ; move index number of vertex to mMinVertex
jmp @@nexttest ; go perform next test
@@less: ; handle less condition
mov yMax,bx ; set yMax to bx register
mov [edx].PureEdge@@mMaxVertex,cx ; update mMaxVertex with current index
@@looptest: ; falls through to loop
add eax,04h ; add 4 bytes to eax to address next (Point*)
inc cx ; increment cx register
cmp cx,[edx].PureEdge@@mNumVertexes ; have we reeached the number of vertexes yet?
jl @@iterator ; still more vertexes
push [edx].PureEdge@@mMaxVertex ; save mMaxVertex
pop [edx].PureEdge@@mStartVertex ; restore it to mStartVertex
jmp @@ok ; error return sync address
@@error: ; setup for error return code
mov eax,0001h ; move 01h into ax to indicate error
jmp @@return ; jump to return label
@@ok: ; setup for success return code
xor eax,eax ; clear out eax register
@@return: ; return label
pop ecx ; restore callers ecx register
add esp,LocalLength ; pop local variables off stack
pop ebp ; restore old stack frame
retn ; return near to caller
_getMinMaxInfo endp
_setSrcBitmapInfo proc near ; void setSrcBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push eax ; save eax register
push ebx ; save ebx register
mov ax,word ptr[ebp+08h] ; move width into ax register
mov bmData@@mSrcWidth,ax ; move width into bmData@@mSrcWidth
mov bx,word ptr[ebp+0Ch] ; move height into bx register
mov bmData@@mSrcHeight,bx ; move height into bx register
multiply ax,bx ; multiply (width*height)
mov bmData@@mSrcExtent,eax ; (width*height) to mSrcExtent
push dword ptr[ebp+10h] ; save lpBitmapImage on stack
pop bmData@@mlpSrcPtr ; restore in mlpSrcPtr
pop ebx ; restore ebx register
pop eax ; restore eax register
pop ebp ; restore old stack frame
retn ; return near to caller
_setSrcBitmapInfo endp
_setDstBitmapInfo proc near ; void setDstBitmapInfo(WORD width,WORD height,UHUGE *lpBitmapImage)
push ebp ; save old stack frame
mov ebp,esp ; create new stack frame
push eax ; save eax register
push ebx ; save ebx register
mov ax,word ptr[ebp+08h] ; move width into ax register
mov bmData@@mDstWidth,ax ; move width into mDstWidth
mov bx,word ptr[ebp+0Ch] ; move height into bx register
mov bmData@@mDstHeight,bx ; move height into mDstHeight
multiply ax,bx ; multiply (width*height)
mov bmData@@mDstExtent,eax ; move (width*height) into mDstExtent
push dword ptr[ebp+10h] ; save lpBitmapImage on stack
pop bmData@@mlpDstPtr ; restore in mlpDstPtr
pop ebx ; restore ebx register
pop eax ; restore eax register
pop ebp ; restore old stack frame
retn ; return near to caller
_setDstBitmapInfo endp
_setMaskInfo proc near ; void setMaskInfo(WORD useMask,BYTE maskValue)
push ebp ; save previous stack frame
mov ebp,esp ; create new frame
mov eax,[ebp+08h] ; move useMask into eax register
mov bmData@@mUseMask,al ; move useMask into bmData@@mUseMask
cmp eax,0000h ; check to see if we are using the mask
je @@maskEndProc ; if we're not using mask, don't set mask value
mov eax,[ebp+0Ch] ; move mask value into eax register
mov bmData@@mMaskValue,al ; move mask value into bmData@@mMaskValue
@@maskEndProc: ; end procedure sync address
pop ebp ; restore previous stack frame
retn ; return near to caller
_setMaskInfo endp
public _mapTexture
public _initEdge
public _setSrcBitmapInfo
public _setDstBitmapInfo
public _setMaskInfo
end

258
engine/UTIL32.ASM Normal file
View File

@@ -0,0 +1,258 @@
;*************************************************************************************
; MODULE: UTIL.ASM DATE: MAY 15, 1998
; AUTHOR: SEAN M. KESSLER
; TARGET: 32 BIT TARGET
; FUNCTION : RESAMPLE FUNCTIONS
;*************************************************************************************
SMART
.386
.MODEL FLAT
.DATA
.CODE
LOCALS
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\COMMON\MATH.INC
setByte MACRO ; setByte, see _lineWINGBlt, see _line
LOCAL @@return,@@chkCol,@@endChk ; locals
mov esi,imageBase ; move imageBase to source index register
mov eax,yRunning ; move yRunning to eax register
sar eax,10h ; adjust yRunning, this is row
jl @@return ; if less than zero then we're done
mov ebx,xRunning ; move xRunning to ebx register
sar ebx,10h ; adjust xRunning, this is col
jl @@return ; if less than zero then we're done
cmp eax,[ebp+18h] ; compare row to height
jge @@return ; if row is greater equal height then we're done here
cmp ebx,[ebp+14h] ; compare column to width
jge @@return ; if column is greater equal width then we're done here
mov edx,[ebp+14h] ; move width into bx register
imul eax,edx ; multiply row*width
sub esi,eax ; lpImage-=(row*width)
add esi,edx ; add the width back in, so (row*width)+width
add esi,ebx ; now subtract out the column
mov bl,byte ptr[ebp+1Ch] ; get fill value from stack
mov byte ptr[esi],bl ; move value into bitmap data
@@return:
ENDM
_resampleClip proc near ; short resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClamp)
LOCAL sampleFactor:DWORD,runningFactor:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; adjust stack for local
push esi ; save source index register
push edi ; save destination
push ebx ; save ebx register
mov eax,[ebp+10h] ; move inLen to eax register
cmp eax,0000h ; compare inLen to zero
jle @@errorExit ; if it's less or equal then exit
mov ebx,[ebp+14h] ; move outLen to ebx register
cmp ebx,0000h ; compare outLen to zero
jle @@errorExit ; if it's less or equal then exit
dec eax ; decrement inLen
shl eax,10h ; multiply inLen by 65536L
divide eax,ebx ; divide ((inLen-1L)*65536L)/outLen
mov sampleFactor,eax ; store the factor
dec ebx ; ebx has (outLen-1)
mov ecx,ebx ; copy (outLen-1) to ecx
mov eax,dword [ebp+18h] ; move outClip to eax register
sub ebx,eax ; subtract (outLen-1L)-outClip, this is clipping region
mov edi,[ebp+0Ch] ; move lpOut to destination index register
add edi,ecx ; edi=lpOut+(outLen-1L)
mov esi,[ebp+08h] ; move lpIn to source index register
multiply ecx,sampleFactor ; multiply (outLen-1)*sampleFactor
mov runningFactor,eax ; save this into runningFactor
@@loopControl: ; loop control sync address
cmp ecx,0000h ; make sure we're within boundary
jl @@exit ; if not then we exit
cmp ecx,ebx ; compare ecx to clipping region
je @@exit ; if it's equal then we're done
mov eax,runningFactor ; move last running factor into eax
round ; round it off
mov dl,byte ptr[esi+eax] ; move source byte to dl register
mov byte ptr[edi],dl ; move source byte to destination address
mov eax,sampleFactor ; move sampleFactor into eax register
sub runningFactor,eax ; subtract from running factor
dec ecx ; decrement counter
dec edi ; advance (backwards) along lpOut array
jmp @@loopControl ; continue processing
@@errorExit: ; error exit return sync address
xor ax,ax ; clear ax register on error
jmp @@endProcedure ; jump to end procedure
@@exit: ; exit sync address
mov ax,01h ; set ax register on success
@@endProcedure: ; end procedure sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
add esp,LocalLength ; remove locals off stack
pop ebp ; restore previous stack frame
retn ; return near to caller
_resampleClip endp
_lineWINGBlt proc near ; void lineWINGBLT(DWORD lpWINGData,Point *lpFirstPoint,Point *lpSecondPoint,DWORD width,DWORD height,WORD value)
LOCAL xRunning:DWORD,yRunning:DWORD,xDelta:DWORD,yDelta:DWORD,xDir:WORD,yDir:WORD, \
imageExtent:DWORD,imageBase:DWORD,steps:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new frame
sub esp,LocalLength ; storage for local symbols
pushad ; save all general purpose registers
mov eax,[ebp+18h] ; move height into eax register
imul eax,[ebp+14h] ; multiply width*height, this is imageExtent
mov imageExtent,eax ; store extent into imageExtent
mov esi,[ebp+08h] ; move wingData into source index register
add esi,imageExtent ; add in imageExtent
mov imageBase,esi ; this is our new imageBase
mov esi,[ebp+0Ch] ; move lpFirstPoint to esi
mov edi,[ebp+10h] ; move lpSecondPoint to edi
mov ax,[esi].Point@@x ; pFirstPoint->x to eax
cmp ax,[edi].Point@@x ; is firstPoint.x == secondPoint.x
jne @@xne ; if x's are not equal then keep going
mov ax,[esi].Point@@y ; pFirstPoint->y to ax
cmp ax,[edi].Point@@y ; is firstPoint.y==secondPoint.y
je @@endLine ; if points are equal no need to draw the line
@@xne:
movsx eax,[esi].Point@@x ; move lpFirstPoint->x to eax
shl eax,10h ; shift into high word
mov xRunning,eax ; this is xRunning
movsx ebx,[esi].Point@@y ; move lpFirstPoint->y to eax
shl ebx,10h ; shift into high word
mov yRunning,ebx ; this is yRunning
mov xDir,01h ; initialize x-direction
mov yDir,01h ; initialize y-direction
movzx eax,[edi].Point@@x ; move secondPoint.x to ax
cmp ax,[esi].Point@@x ; compare secondPoint.x to firstPoint.x
jge @@noxDirChange ; no direction change required
neg xDir ; change line direction along x
@@noxDirChange: ; noxDirChange sync address
movzx ebx,[edi].Point@@y ; move secondPoint.y to ax
cmp bx,[esi].Point@@y ; compare secondPoint.y to firstPoint.y
jge @@noyDirChange ; no direction change requires
neg yDir ; change line direction along y
@@noyDirChange: ; noyDirChange sync address
sub ax,[esi].Point@@x ; move secondPoint.x-firstPoint.x to ax
movsx eax,ax ; adjust sign
mov xDelta,eax ; store difference into xDelta
sub bx,[esi].Point@@y ; move secondPoint.y-firstPoint.y to bx
movsx ebx,bx ; adjust sign
mov yDelta,ebx ; store difference into yDelta
cmp xDelta,00000000h ; is xDelta less than zero
jl @@posxDelta ; if yes then we must adjust xDelta for magnitude
jmp @@skipxFix ; otherwise no adjustment is necessary
@@posxDelta: ; posxDelta sync address
neg xDelta ; make xDelta positive
@@skipxFix: ; skipxFix sync address
cmp yDelta,00000000h ; is yDelta less than zero
jl @@posyDelta ; if yes then we must adjust yDelta for magnitude
jmp @@skipyFix ; otherwise no adjustment is necessary
@@posyDelta: ; posyDelta sync address
neg yDelta ; make yDelta positive
@@skipyFix: ; skipyFix sync address
mov eax,xDelta ; move xDelta into eax register
cmp eax,yDelta ; compare xDelta to yDelta
jge @@xGEy ; handle xDelta>=yDelta
shl eax,10h ; shift xDelta left 16 positions
cmp yDelta,00000000h ; compare yDelta to zero
je @@yEQz ; jump to sync address
divide eax,yDelta ; divide xDelta by yDelta
mov xDelta,eax ; save new xDelta value to xDelta
jmp @@yCMPs ; jump over to sync address
@@yEQz: ; yEQz sync address
mov xDelta,00000001h ; if yDelta is zero then assign one to xDelta
@@yCMPs: ; yCMPs sync address
mov eax,yDelta ; move yDelta to eax register
mov steps,eax ; move yDelta to steps
mov yDelta,10000h ; move 10000h to yDelta
jmp @@startLineDraw ; we're ready to start drawing the line
@@xGEy: ; xGEy sync address
mov eax,yDelta ; move yDelta to eax register
shl eax,10h ; shift left 10h
cmp xDelta,00000000h ; is xDelta zero
jne @@xNEz ; handle xDelta not equal to zero
mov yDelta,00000001h ; if xDelta is zero then yDelta equals one
jmp @@xCMPs ; jump over to sync address
@@xNEz: ; xNEzs sync address
divide eax,xDelta ; divide yDelta by xDelta
mov yDelta,eax ; replace yDelta with new value
@@xCMPs: ; xCMPs sync address
mov eax,xDelta ; move xDelta value into eax register
mov steps,eax ; move xDelta to steps
mov xDelta,10000h ; move 10000h to xDelta
@@startLineDraw: ; startLineDraw sync address
mov ecx,steps ; move steps into ecx register
cmp xDir,0FFFFh ; is xDir negative
je @@checkYDir ; yes it is, now check yDir
cmp yDir,0FFFFh ; is yDir negative
je @@posxDirAndNegyDir ; xDir is positive and yDir is negative
jmp @@posxDirAndPosyDir ; xDir is positive and yDir is positive
@@checkYDir: ; xDir is negative on entry
cmp yDir,0FFFFh ; is yDir negative
je @@negxDirAndNegyDir ; xDir is negative and yDir is negative
@@negxDirAndPosyDir: ; xDir is negative and yDir is positive
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
sub xRunning,eax ; xRunning-=xDelta
mov eax,yDelta ; move yDelta into eax register
add yRunning,eax ; yRunning+=yDelta
dec cx ; decrement cx register
jnz @@negxDirAndPosyDir ; if (cx) continue
jmp @@endLine ; we're done
@@negxDirAndNegyDir: ; xDir==-1&&yDir==-1 sync address
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
sub xRunning,eax ; xRunning-=xDelta
mov eax,yDelta ; move yDelta into eax register
sub yRunning,eax ; yRunning-=yDelta
dec cx ; decrement cx register
jnz @@negxDirAndNegyDir ; if (cx) continue
jmp @@endLine ; we're done
@@posxDirAndNegyDir: ; xDir==1&&yDir==-1 sync address
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
add xRunning,eax ; xRunning+=xDelta
mov eax,yDelta ; move yDelta into eax register
sub yRunning,eax ; yRunning-=yDelta
dec cx ; decrement cx register
jnz @@posxDirAndNegyDir ; if (cx) continue
jmp @@endLine ; we're done here
@@posxDirAndPosyDir: ; xDir==1&&yDir==1
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
add xRunning,eax ; xRunning+=xDelta
mov eax,yDelta ; move yDelta into eax
add yRunning,eax ; yRunning+=yDelta
dec cx ; decrement cx register
jnz @@posxDirAndPosyDir ; if (cx) continue;
@@endLine: ; we're done here
popad ; restore all general purpose registers
add esp,LocalLength ; remove local storage frame
pop ebp ; restore stack frame
retn ; return near to caller
_lineWINGBlt endp
_clearBitmap proc near ; void clearBitmap(DWORD lpBitmapData,DWORD imageExtent)
push edi ; save destination index register
xor eax,eax ; clear eax register
mov edi,[esp+08h] ; move lpBitmapData to esi
mov ecx,[esp+0Ch] ; move bitmap extent to ecx
shr ecx,02h ; divide bitmap extent by sizeof(long)
rep stosd ; clear out the bitmap in chunks of sizeof(long)
pop edi ; restore destination index register
retn ; return near to caller
_clearBitmap endp
_setBits proc near ; void setBits(DWORD lpBitmapData,DWORD imageExtent,BYTE setBit)
push edi ; save destination index register
mov eax,[esp+10h] ; move filler byte into eax register (actually al register)
mov ah,al ; copy filler into high byte
mov cx,ax ; save word at ax into bx
shl eax,10h ; move low word into high word
mov ax,cx ; copy word back into ax
mov edi,[esp+08h] ; move lpBitmapData to esi
mov ecx,[esp+0Ch] ; move bitmap extent to ecx
shr ecx,02h ; divide bitmap extent by sizeof(long)
rep stosd ; clear out the bitmap in chunks of sizeof(long)
pop edi ; restore destination index register
retn ; return near to caller
_setBits endp
public _resampleClip
public _lineWINGBlt
public _clearBitmap
public _setBits
END

258
engine/UTIL32.BAK Normal file
View File

@@ -0,0 +1,258 @@
;*************************************************************************************
; MODULE: UTIL.ASM DATE: MAY 15, 1998
; AUTHOR: SEAN M. KESSLER
; TARGET: 32 BIT TARGET
; FUNCTION : RESAMPLE FUNCTIONS
;*************************************************************************************
SMART
.386
.MODEL FLAT
.DATA
.CODE
LOCALS
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\COMMON\MATH.INC
setByte MACRO ; setByte, see _lineWINGBlt, see _line
LOCAL @@return,@@chkCol,@@endChk ; locals
mov esi,imageBase ; move imageBase to source index register
mov eax,yRunning ; move yRunning to eax register
sar eax,10h ; adjust yRunning, this is row
jl @@return ; if less than zero then we're done
mov ebx,xRunning ; move xRunning to ebx register
sar ebx,10h ; adjust xRunning, this is col
jl @@return ; if less than zero then we're done
cmp eax,[ebp+18h] ; compare row to height
jge @@return ; if row is greater equal height then we're done here
cmp ebx,[ebp+14h] ; compare column to width
jge @@return ; if column is greater equal width then we're done here
mov edx,[ebp+14h] ; move width into bx register
imul eax,edx ; multiply row*width
sub esi,eax ; lpImage-=(row*width)
add esi,edx ; add the width back in, so (row*width)+width
add esi,ebx ; now subtract out the column
mov bl,byte ptr[ebp+1Ch] ; get fill value from stack
mov byte ptr[esi],bl ; move value into bitmap data
@@return:
ENDM
_resampleClip proc near ; short resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen,DWORD outClamp)
LOCAL sampleFactor:DWORD,runningFactor:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; adjust stack for local
push esi ; save source index register
push edi ; save destination
push ebx ; save ebx register
mov eax,[ebp+10h] ; move inLen to eax register
cmp eax,0000h ; compare inLen to zero
jle @@errorExit ; if it's less or equal then exit
mov ebx,[ebp+14h] ; move outLen to ebx register
cmp ebx,0000h ; compare outLen to zero
jle @@errorExit ; if it's less or equal then exit
dec eax ; decrement inLen
shl eax,10h ; multiply inLen by 65536L
divide eax,ebx ; divide ((inLen-1L)*65536L)/outLen
mov sampleFactor,eax ; store the factor
dec ebx ; ebx has (outLen-1)
mov ecx,ebx ; copy (outLen-1) to ecx
mov eax,dword [ebp+18h] ; move outClip to eax register
sub ebx,eax ; subtract (outLen-1L)-outClip, this is clipping region
mov edi,[ebp+0Ch] ; move lpOut to destination index register
add edi,ecx ; edi=lpOut+(outLen-1L)
mov esi,[ebp+08h] ; move lpIn to source index register
multiply ecx,sampleFactor ; multiply (outLen-1)*sampleFactor
mov runningFactor,eax ; save this into runningFactor
@@loopControl: ; loop control sync address
cmp ecx,0000h ; make sure we're within boundary
jl @@exit ; if not then we exit
cmp ecx,ebx ; compare ecx to clipping region
je @@exit ; if it's equal then we're done
mov eax,runningFactor ; move last running factor into eax
round ; round it off
mov dl,byte ptr[esi+eax] ; move source byte to dl register
mov byte ptr[edi],dl ; move source byte to destination address
mov eax,sampleFactor ; move sampleFactor into eax register
sub runningFactor,eax ; subtract from running factor
dec ecx ; decrement counter
dec edi ; advance (backwards) along lpOut array
jmp @@loopControl ; continue processing
@@errorExit: ; error exit return sync address
xor ax,ax ; clear ax register on error
jmp @@endProcedure ; jump to end procedure
@@exit: ; exit sync address
mov ax,01h ; set ax register on success
@@endProcedure: ; end procedure sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
add esp,LocalLength ; remove locals off stack
pop ebp ; restore previous stack frame
retn ; return near to caller
_resampleClip endp
_lineWINGBlt proc near ; void lineWINGBLT(DWORD lpWINGData,Point *lpFirstPoint,Point *lpSecondPoint,DWORD width,DWORD height,WORD value)
LOCAL xRunning:DWORD,yRunning:DWORD,xDelta:DWORD,yDelta:DWORD,xDir:WORD,yDir:WORD, \
imageExtent:DWORD,imageBase:DWORD,steps:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new frame
sub esp,LocalLength ; storage for local symbols
pushad ; save all general purpose registers
mov eax,[ebp+18h] ; move height into eax register
imul eax,[ebp+14h] ; multiply width*height, this is imageExtent
mov imageExtent,eax ; store extent into imageExtent
mov esi,[ebp+08h] ; move wingData into source index register
add esi,imageExtent ; add in imageExtent
mov imageBase,esi ; this is our new imageBase
mov esi,[ebp+0Ch] ; move lpFirstPoint to esi
mov edi,[ebp+10h] ; move lpSecondPoint to edi
mov ax,[esi].Point@@x ; pFirstPoint->x to eax
cmp ax,[edi].Point@@x ; is firstPoint.x == secondPoint.x
jne @@xne ; if x's are not equal then keep going
mov ax,[esi].Point@@y ; pFirstPoint->y to ax
cmp ax,[edi].Point@@y ; is firstPoint.y==secondPoint.y
je @@endLine ; if points are equal no need to draw the line
@@xne:
movsx eax,[esi].Point@@x ; move lpFirstPoint->x to eax
shl eax,10h ; shift into high word
mov xRunning,eax ; this is xRunning
movsx ebx,[esi].Point@@y ; move lpFirstPoint->y to eax
shl ebx,10h ; shift into high word
mov yRunning,ebx ; this is yRunning
mov xDir,01h ; initialize x-direction
mov yDir,01h ; initialize y-direction
movzx eax,[edi].Point@@x ; move secondPoint.x to ax
cmp ax,[esi].Point@@x ; compare secondPoint.x to firstPoint.x
jge @@noxDirChange ; no direction change required
neg xDir ; change line direction along x
@@noxDirChange: ; noxDirChange sync address
movzx ebx,[edi].Point@@y ; move secondPoint.y to ax
cmp bx,[esi].Point@@y ; compare secondPoint.y to firstPoint.y
jge @@noyDirChange ; no direction change requires
neg yDir ; change line direction along y
@@noyDirChange: ; noyDirChange sync address
sub ax,[esi].Point@@x ; move secondPoint.x-firstPoint.x to ax
movsx eax,ax ; adjust sign
mov xDelta,eax ; store difference into xDelta
sub bx,[esi].Point@@y ; move secondPoint.y-firstPoint.y to bx
movsx ebx,bx ; adjust sign
mov yDelta,ebx ; store difference into yDelta
cmp xDelta,00000000h ; is xDelta less than zero
jl @@posxDelta ; if yes then we must adjust xDelta for magnitude
jmp @@skipxFix ; otherwise no adjustment is necessary
@@posxDelta: ; posxDelta sync address
neg xDelta ; make xDelta positive
@@skipxFix: ; skipxFix sync address
cmp yDelta,00000000h ; is yDelta less than zero
jl @@posyDelta ; if yes then we must adjust yDelta for magnitude
jmp @@skipyFix ; otherwise no adjustment is necessary
@@posyDelta: ; posyDelta sync address
neg yDelta ; make yDelta positive
@@skipyFix: ; skipyFix sync address
mov eax,xDelta ; move xDelta into eax register
cmp eax,yDelta ; compare xDelta to yDelta
jge @@xGEy ; handle xDelta>=yDelta
shl eax,10h ; shift xDelta left 16 positions
cmp yDelta,00000000h ; compare yDelta to zero
je @@yEQz ; jump to sync address
divide eax,yDelta ; divide xDelta by yDelta
mov xDelta,eax ; save new xDelta value to xDelta
jmp @@yCMPs ; jump over to sync address
@@yEQz: ; yEQz sync address
mov xDelta,00000001h ; if yDelta is zero then assign one to xDelta
@@yCMPs: ; yCMPs sync address
mov eax,yDelta ; move yDelta to eax register
mov steps,eax ; move yDelta to steps
mov yDelta,10000h ; move 10000h to yDelta
jmp @@startLineDraw ; we're ready to start drawing the line
@@xGEy: ; xGEy sync address
mov eax,yDelta ; move yDelta to eax register
shl eax,10h ; shift left 10h
cmp xDelta,00000000h ; is xDelta zero
jne @@xNEz ; handle xDelta not equal to zero
mov yDelta,00000001h ; if xDelta is zero then yDelta equals one
jmp @@xCMPs ; jump over to sync address
@@xNEz: ; xNEzs sync address
divide eax,xDelta ; divide yDelta by xDelta
mov yDelta,eax ; replace yDelta with new value
@@xCMPs: ; xCMPs sync address
mov eax,xDelta ; move xDelta value into eax register
mov steps,eax ; move xDelta to steps
mov xDelta,10000h ; move 10000h to xDelta
@@startLineDraw: ; startLineDraw sync address
mov ecx,steps ; move steps into ecx register
cmp xDir,0FFFFh ; is xDir negative
je @@checkYDir ; yes it is, now check yDir
cmp yDir,0FFFFh ; is yDir negative
je @@posxDirAndNegyDir ; xDir is positive and yDir is negative
jmp @@posxDirAndPosyDir ; xDir is positive and yDir is positive
@@checkYDir: ; xDir is negative on entry
cmp yDir,0FFFFh ; is yDir negative
je @@negxDirAndNegyDir ; xDir is negative and yDir is negative
@@negxDirAndPosyDir: ; xDir is negative and yDir is positive
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
sub xRunning,eax ; xRunning-=xDelta
mov eax,yDelta ; move yDelta into eax register
add yRunning,eax ; yRunning+=yDelta
dec cx ; decrement cx register
jnz @@negxDirAndPosyDir ; if (cx) continue
jmp @@endLine ; we're done
@@negxDirAndNegyDir: ; xDir==-1&&yDir==-1 sync address
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
sub xRunning,eax ; xRunning-=xDelta
mov eax,yDelta ; move yDelta into eax register
sub yRunning,eax ; yRunning-=yDelta
dec cx ; decrement cx register
jnz @@negxDirAndNegyDir ; if (cx) continue
jmp @@endLine ; we're done
@@posxDirAndNegyDir: ; xDir==1&&yDir==-1 sync address
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
add xRunning,eax ; xRunning+=xDelta
mov eax,yDelta ; move yDelta into eax register
sub yRunning,eax ; yRunning-=yDelta
dec cx ; decrement cx register
jnz @@posxDirAndNegyDir ; if (cx) continue
jmp @@endLine ; we're done here
@@posxDirAndPosyDir: ; xDir==1&&yDir==1
setByte ; set the byte
mov eax,xDelta ; move xDelta into eax register
add xRunning,eax ; xRunning+=xDelta
mov eax,yDelta ; move yDelta into eax
add yRunning,eax ; yRunning+=yDelta
dec cx ; decrement cx register
jnz @@posxDirAndPosyDir ; if (cx) continue;
@@endLine: ; we're done here
popad ; restore all general purpose registers
add esp,LocalLength ; remove local storage frame
pop ebp ; restore stack frame
retn ; return near to caller
_lineWINGBlt endp
_clearBitmap proc near ; void clearBitmap(DWORD lpBitmapData,DWORD imageExtent)
push edi ; save destination index register
xor eax,eax ; clear eax register
mov edi,[esp+08h] ; move lpBitmapData to esi
mov ecx,[esp+0Ch] ; move bitmap extent to ecx
shr ecx,02h ; divide bitmap extent by sizeof(long)
rep stosd ; clear out the bitmap in chunks of sizeof(long)
pop edi ; restore destination index register
retn ; return near to caller
_clearBitmap endp
_setBits proc near ; void setBits(DWORD lpBitmapData,DWORD imageExtent,BYTE setBit)
push edi ; save destination index register
mov eax,[esp+10h] ; move filler byte into eax register (actually al register)
mov ah,al ; copy filler into high byte
mov cx,ax ; save word at ax into bx
shl eax,10h ; move low word into high word
mov ax,cx ; copy word back into ax
mov edi,[esp+08h] ; move lpBitmapData to esi
mov ecx,[esp+0Ch] ; move bitmap extent to ecx
shr ecx,02h ; divide bitmap extent by sizeof(long)
rep stosd ; clear out the bitmap in chunks of sizeof(long)
pop edi ; restore destination index register
retn ; return near to caller
_setBits endp
public _resampleClip
public _lineWINGBlt
public _clearBitmap
public _setBits
END

182
engine/VECTOR.HPP Normal file
View File

@@ -0,0 +1,182 @@
#ifndef _ENGINE_VECTOR_HPP_
#define _ENGINE_VECTOR_HPP_
#ifndef _ENGINE_POINT3D_HPP_
#include <engine/point3d.hpp>
#endif
class Vector
{
public:
Vector(void);
Vector(const Vector &vector);
Vector(int xScalar,int yScalar,int zScalar);
Vector(const Point3D &firstPoint,const Point3D &secondPoint);
virtual ~Vector();
Vector &operator=(const Vector &vector);
BOOL operator==(const Vector &vector);
Vector operator+(const Vector &vector);
Vector operator*(const Vector &vector);
int xScalar(void)const;
void xScalar(int xScalar);
int yScalar(void)const;
void yScalar(int yScalar);
int zScalar(void)const;
void zScalar(int zScalar);
void vector(const Point3D &firstPoint,const Point3D &secondPoint);
int length(void)const;
int magnitude(void)const;
void normal(Vector &vector)const;
void normal(void);
int dot(const Vector &vector)const;
private:
int mxScalar;
int myScalar;
int mzScalar;
};
inline
Vector::Vector(void)
: mxScalar(0), myScalar(0), mzScalar(0)
{
}
inline
Vector::Vector(int xScalar,int yScalar,int zScalar)
: mxScalar(xScalar), myScalar(yScalar), mzScalar(zScalar)
{
}
inline
Vector::Vector(const Point3D &firstPoint,const Point3D &secondPoint)
{
vector(firstPoint,secondPoint);
}
inline
Vector::Vector(const Vector &vector)
{
*this=vector;
}
inline
Vector::~Vector()
{
}
inline
Vector &Vector::operator=(const Vector &vector)
{
xScalar(vector.xScalar());
yScalar(vector.yScalar());
zScalar(vector.zScalar());
return *this;
}
inline
BOOL Vector::operator==(const Vector &vector)
{
return (xScalar()==vector.xScalar()&&
yScalar()==vector.yScalar()&&
zScalar()==vector.zScalar());
}
inline
Vector Vector::operator+(const Vector &vector)
{
return Vector(xScalar()+vector.xScalar(),yScalar()+vector.yScalar(),zScalar()+vector.zScalar());
}
inline
Vector Vector::operator*(const Vector &vector)
{
return Vector((yScalar()*vector.zScalar()-zScalar()*vector.yScalar()),zScalar()*vector.xScalar()-xScalar()*vector.zScalar(),xScalar()*vector.yScalar()-yScalar()*vector.xScalar());
}
inline
int Vector::xScalar(void)const
{
return mxScalar;
}
inline
void Vector::xScalar(int xScalar)
{
mxScalar=xScalar;
}
inline
int Vector::yScalar(void)const
{
return myScalar;
}
inline
void Vector::yScalar(int yScalar)
{
myScalar=yScalar;
}
inline
int Vector::zScalar(void)const
{
return mzScalar;
}
inline
void Vector::zScalar(int zScalar)
{
mzScalar=zScalar;
}
inline
void Vector::vector(const Point3D &firstPoint,const Point3D &secondPoint)
{
xScalar(secondPoint.x()-firstPoint.x());
yScalar(secondPoint.y()-firstPoint.y());
zScalar(secondPoint.z()-firstPoint.z());
}
inline
int Vector::length(void)const
{
int vLength(.5*(xScalar()*xScalar())+(yScalar()*yScalar())+(zScalar()*zScalar()));
if(vLength<0)vLength=-vLength;
return vLength;
}
inline
int Vector::magnitude(void)const
{
return length();
}
inline
void Vector::normal(Vector &vector)const
{
int vLength(length());
if(!vLength)
{
vector.xScalar(0);
vector.yScalar(0);
vector.zScalar(0);
}
else
{
vector.xScalar(xScalar()/vLength);
vector.yScalar(yScalar()/vLength);
vector.zScalar(zScalar()/vLength);
}
}
inline
void Vector::normal(void)
{
normal(*this);
}
inline
int Vector::dot(const Vector &vector)const
{
return (xScalar()*vector.xScalar())+(yScalar()*vector.yScalar())+(zScalar()*vector.zScalar());
}
#endif

26
engine/VECTOR3D.CPP Normal file
View File

@@ -0,0 +1,26 @@
#include <engine/vector3d.hpp>
void Vector3D::normalize(void)
{
mNormalVector.xScalar(0);
mNormalVector.yScalar(0);
mNormalVector.zScalar(0);
Point3D currVertex;
Point3D nextVertex;
for(int index=0;index<VectorPoints;index++)
{
if(index==VectorPoints-1)nextVertex=mVector3D[0];
else nextVertex=mVector3D[index+1];
currVertex=mVector3D[index];
mNormalVector.xScalar(mNormalVector.xScalar()+((currVertex.y()-nextVertex.y())*(currVertex.z()+nextVertex.z())));
mNormalVector.yScalar(mNormalVector.yScalar()+((currVertex.z()-nextVertex.z())*(currVertex.x()+nextVertex.x())));
mNormalVector.zScalar(mNormalVector.zScalar()+((currVertex.x()-nextVertex.x())*(currVertex.y()+nextVertex.y())));
}
if(mNormalVector.xScalar()<0)mNormalVector.xScalar(-1);
else if(mNormalVector.xScalar()>0)mNormalVector.xScalar(1);
if(mNormalVector.yScalar()<0)mNormalVector.yScalar(-1);
else if(mNormalVector.yScalar()>0)mNormalVector.yScalar(1);
if(mNormalVector.zScalar()<0)mNormalVector.zScalar(-1);
else if(mNormalVector.zScalar()>0)mNormalVector.zScalar(1);
}

96
engine/VECTOR3D.HPP Normal file
View File

@@ -0,0 +1,96 @@
#ifndef _ENGINE_VECTOR3D_HPP_
#define _ENGINE_VECTOR3D_HPP_
#ifndef _COMMON_ASSERT_HPP_
#include <common/assert.hpp>
#endif
#ifndef _ENGINE_POINT3D_HPP_
#include <engine/point3d.hpp>
#endif
#ifndef _ENGINE_VECTOR_HPP_
#include <engine/vector.hpp>
#endif
class Vector3D
{
public:
enum {VectorPoints=4};
Vector3D(void);
Vector3D(const Vector3D &someVector3D);
Vector3D(const Point3D &firstPoint,const Point3D &secondPoint,const Point3D &thirdPoint,const Point3D &fourthPoint);
virtual ~Vector3D();
Vector3D &operator=(const Vector3D &someVector3D);
WORD operator==(const Vector3D &someVector3D)const;
Point3D &operator[](WORD vectorIndex);
const Vector &getNormal(void)const;
void setNormal(const Vector &normal);
void normalize(void);
private:
Point3D mVector3D[VectorPoints];
Vector mNormalVector;
};
inline
Vector3D::Vector3D(void)
{
}
inline
Vector3D::Vector3D(const Vector3D &someVector3D)
{
mVector3D[0]=((Vector3D&)someVector3D)[0];
mVector3D[1]=((Vector3D&)someVector3D)[1];
mVector3D[2]=((Vector3D&)someVector3D)[2];
mVector3D[3]=((Vector3D&)someVector3D)[3];
}
inline
Vector3D::Vector3D(const Point3D &firstPoint,const Point3D &secondPoint,const Point3D &thirdPoint,const Point3D &fourthPoint)
{
mVector3D[0]=firstPoint;
mVector3D[1]=secondPoint;
mVector3D[2]=thirdPoint;
mVector3D[3]=fourthPoint;
}
inline
Vector3D::~Vector3D()
{
}
inline
Vector3D &Vector3D::operator=(const Vector3D &someVector3D)
{
mVector3D[0]=((Vector3D&)someVector3D)[0];
mVector3D[1]=((Vector3D&)someVector3D)[1];
mVector3D[2]=((Vector3D&)someVector3D)[2];
mVector3D[3]=((Vector3D&)someVector3D)[3];
return *this;
}
inline
WORD Vector3D::operator==(const Vector3D &someVector3D)const
{
return (mVector3D[0]==((Vector3D&)someVector3D)[0]&&
mVector3D[1]==((Vector3D&)someVector3D)[1]&&
mVector3D[2]==((Vector3D&)someVector3D)[2]&&
mVector3D[3]==((Vector3D&)someVector3D)[3]);
}
inline
Point3D &Vector3D::operator[](WORD vectorIndex)
{
return mVector3D[vectorIndex];
}
inline
const Vector &Vector3D::getNormal(void)const
{
return mNormalVector;
}
inline
void Vector3D::setNormal(const Vector &normal)
{
mNormalVector=normal;
}
#endif

23
engine/VIEWSYS.CPP Normal file
View File

@@ -0,0 +1,23 @@
#include <engine/viewsys.hpp>
#include <common/vector2d.hpp>
WORD ViewSystem::viewPortWidth(void)const
{
return FALSE;
}
WORD ViewSystem::viewPortHeight(void)const
{
return FALSE;
}
WORD ViewSystem::isInView(const Vector3D &vector3D)
{
Vector2D vector2D;
PureViewSystem::viewPortWidth(viewPortWidth());
PureViewSystem::viewPortHeight(viewPortHeight());
PureViewSystem::translatePoint(vector3D,vector2D);
if(!isInView(vector2D[0])&&!isInView(vector2D[1])&&!isInView(vector2D[2])&&!isInView(vector2D[3]))return FALSE;
return TRUE;
}

90
engine/VIEWSYS.HPP Normal file
View File

@@ -0,0 +1,90 @@
#ifndef _ENGINE_VIEWSYSTEM_HPP_
#define _ENGINE_VIEWSYSTEM_HPP_
#ifndef _ENGINE_PUREVIEWSYSTEM_HPP_
#include <engine/purevsys.hpp>
#endif
#ifndef _ENGINE_TRIANGLE3D_HPP_
#include <engine/angle3d.hpp>
#endif
#ifndef _ENGINE_TRIANGLE_HPP_
#include <engine/angle.hpp>
#endif
class ViewSystem : public PureViewSystem
{
public:
ViewSystem(void);
virtual ~ViewSystem();
void translatePoint(const Vector3D &vector3D,Vector2D &vector2D,PureViewSystem::MapMode mapMode=CartesianSystem);
void translatePoint(Polygon3D &polygon,PureViewSystem::MapMode mapMode=CartesianSystem);
void translatePoint(Point &dimensionPoint,Point &screenPoint,const Point3D &initialPoint,PureViewSystem::MapMode mapMode=CartesianSystem);
void mapCoordinates(Point3D &firstPoint3D,Point &firstPoint,bool useCartesian=true);
void mapCoordinates(Triangle3D &triangle3D,Triangle &triangle);
WORD isInView(const Point &somePoint)const;
WORD isInView(const Vector3D &vector3D);
protected:
virtual WORD viewPortWidth(void)const=0;
virtual WORD viewPortHeight(void)const=0;
private:
};
inline
ViewSystem::ViewSystem(void)
{
}
inline
ViewSystem::~ViewSystem()
{
}
inline
WORD ViewSystem::isInView(const Point &somePoint)const
{
if(somePoint.x()>viewPortWidth()||somePoint.x()<0)return FALSE;
if(somePoint.y()>viewPortHeight()||somePoint.y()<0)return FALSE;
return TRUE;
}
inline
void ViewSystem::translatePoint(const Vector3D &vector3D,Vector2D &vector2D,PureViewSystem::MapMode mapMode)
{
PureViewSystem::viewPortWidth(viewPortWidth());
PureViewSystem::viewPortHeight(viewPortHeight());
PureViewSystem::translatePoint(vector3D,vector2D,mapMode);
}
inline
void ViewSystem::translatePoint(Polygon3D &polygon,PureViewSystem::MapMode mapMode)
{
PureViewSystem::viewPortWidth(viewPortWidth());
PureViewSystem::viewPortHeight(viewPortHeight());
PureViewSystem::translatePoint(polygon,mapMode);
}
inline
void ViewSystem::translatePoint(Point &dimensionPoint,Point &screenPoint,const Point3D &initialPoint,PureViewSystem::MapMode mapMode)
{
PureViewSystem::viewPortWidth(viewPortWidth());
PureViewSystem::viewPortHeight(viewPortHeight());
PureViewSystem::translatePoint(dimensionPoint,screenPoint,initialPoint,mapMode);
}
inline
void ViewSystem::mapCoordinates(Point3D &firstPoint3D,Point &firstPoint,bool useCartesian)
{
PureViewSystem::viewPortWidth(viewPortWidth());
PureViewSystem::viewPortHeight(viewPortHeight());
PureViewSystem::mapCoordinates(firstPoint3D,firstPoint,useCartesian);
}
inline
void ViewSystem::mapCoordinates(Triangle3D &triangle3D,Triangle &triangle)
{
PureViewSystem::viewPortWidth(viewPortWidth());
PureViewSystem::viewPortHeight(viewPortHeight());
PureViewSystem::mapCoordinates(triangle3D[0],triangle[0]);
PureViewSystem::mapCoordinates(triangle3D[1],triangle[1]);
PureViewSystem::mapCoordinates(triangle3D[2],triangle[2]);
}
#endif

81
engine/VSMAP.BAK Normal file
View File

@@ -0,0 +1,81 @@
; **************************************************************************
; FILE:VSMAP16.INC
; FUNCTION: INCLUDEE FILE FOR ASMVIEW.ASM (VIEW SYSTEM MAPPER)
; AUTHOR: SEAN M. KESSLER
;****************************************************************************
Point3D STRUC
Point3D@@xyPoint Point <>
Point3D@@Point@@z DW ?
Point3D ENDS
ViewSystem STRUC
PureViewSystem@@cameraTwistRadians DD ?
PureViewSystem@@cosCameraTwistRadians DD ?
PureViewSystem@@sinCameraTwistRadians DD ?
PureViewSystem@@cosCameraTwistRadiansSinCameraTwistRadians DD ?
PureViewSystem@@viewPlaneDistance DD ?
PureViewSystem@@viewPortWidth DW ?
PureViewSystem@@viewPortHeight DW ?
PureViewSystem@@cameraPoint Point3D ?
PureViewSystem@@focusPoint Point3D ?
ViewSystem ENDS
Line3D STRUC
PLine3D TYPEDEF NEAR PTR Line3D
PPLine3D TYPEDEF NEAR PTR PLine3D
Line3D@@vfptr DD ?
Line3D@@mFirstPoint Point3D ?
Line3D@@mSecondPoint Point3D ?
Line3D ENDS
Line2D STRUC
PLine2D TYPEDEF NEAR PTR Line2D
PPLine2D TYPEDEF NEAR PTR PLine2D
Line2D@@vfptr DD ?
Line2D@@mFirstPoint Point ?
Line2D@@mSecondPoint Point ?
Line2D ENDS
Line3DNodePtr STRUC
PLine3DNodePtr TYPEDEF NEAR PTR Line3DNodePtr
PPLine3DNodePtr TYPEDEF NEAR PTR PLine3DNodePtr
Line3DNodePtr@@vfptr DD ?
Line3DNodePtr@@mLine3DNodePtrNext PLine3DNodePtr ?
Line3DNodePtr@@mLine3DNodePtrPrev PLine3DNodePtr ?
Line3DNodePtr@@mItem PLine3D ?
Line3DNodePtr ENDS
Line2DNodePtr STRUC
PLine2DNodePtr TYPEDEF NEAR PTR Line2DNodePtr
PPLine2DNodePtr TYPEDEF NEAR PTR PLine2DNodePtr
Line2DNodePtr@@vfptr DD ?
Line2DNodePtr@@mLine2DNodePtrNext PLine2DNodePtr ?
Line2DNodePtr@@mLine2DNodePtrPrev PLine2DNodePtr ?
Line2DNodePtr@@mItem PLine2D ?
Line2DNodePtr ENDS
BlockLine3D STRUC
BlockLine3D@@mSize DD ?
BlockLine3D@@mLastIndexReferenced DD ?
BlockLine3D@@mLastObjectReferenced PLine3DNodePtr ?
BlockLine3D@@mLastObjectInserted PLine3DNodePtr ?
BlockLine3D@@mContainer PLine3DNodePtr ?
BlockLine3D ENDS
BlockLine2D STRUC
BlockLine2D@@mSize DD ?
BlockLine2D@@mlastIndexReferenced DD ?
BlockLine2D@@mLastObjectReferenced PLine2DNodePtr ?
BlockLine2D@@mlastObjectInserted PLine2DNodePtr ?
BlockLine2D@@mContainer PLine2DNodePtr ?
BlockLine2D ENDS
Polygon3D STRUC
PPolygon3D TYPEDEF NEAR PTR Polygon3D
Polygon3D@@vfptr DD ?
Polygon3D@@mBlockLine3D BlockLine3D ?
Polygon3D@@vfptr2 DD ?
Polygon3D@@mBlockLine2D BlockLine2D ?
Polygon3D ENDS

81
engine/VSMAP.INC Normal file
View File

@@ -0,0 +1,81 @@
; **************************************************************************
; FILE:VSMAP16.INC
; FUNCTION: INCLUDEE FILE FOR ASMVIEW.ASM (VIEW SYSTEM MAPPER)
; AUTHOR: SEAN M. KESSLER
;****************************************************************************
Point3D STRUC
Point3D@@xyPoint Point <>
Point3D@@Point@@z DW ?
Point3D ENDS
ViewSystem STRUC
PureViewSystem@@cameraTwistRadians DD ?
PureViewSystem@@cosCameraTwistRadians DD ?
PureViewSystem@@sinCameraTwistRadians DD ?
PureViewSystem@@cosCameraTwistRadiansSinCameraTwistRadians DD ?
PureViewSystem@@viewPlaneDistance DD ?
PureViewSystem@@viewPortWidth DW ?
PureViewSystem@@viewPortHeight DW ?
PureViewSystem@@cameraPoint Point3D ?
PureViewSystem@@focusPoint Point3D ?
ViewSystem ENDS
Line3D STRUC
PLine3D TYPEDEF NEAR PTR Line3D
PPLine3D TYPEDEF NEAR PTR PLine3D
Line3D@@vfptr DD ?
Line3D@@mFirstPoint Point3D ?
Line3D@@mSecondPoint Point3D ?
Line3D ENDS
Line2D STRUC
PLine2D TYPEDEF NEAR PTR Line2D
PPLine2D TYPEDEF NEAR PTR PLine2D
Line2D@@vfptr DD ?
Line2D@@mFirstPoint Point ?
Line2D@@mSecondPoint Point ?
Line2D ENDS
Line3DNodePtr STRUC
PLine3DNodePtr TYPEDEF NEAR PTR Line3DNodePtr
PPLine3DNodePtr TYPEDEF NEAR PTR PLine3DNodePtr
Line3DNodePtr@@vfptr DD ?
Line3DNodePtr@@mLine3DNodePtrNext PLine3DNodePtr ?
Line3DNodePtr@@mLine3DNodePtrPrev PLine3DNodePtr ?
Line3DNodePtr@@mItem PLine3D ?
Line3DNodePtr ENDS
Line2DNodePtr STRUC
PLine2DNodePtr TYPEDEF NEAR PTR Line2DNodePtr
PPLine2DNodePtr TYPEDEF NEAR PTR PLine2DNodePtr
Line2DNodePtr@@vfptr DD ?
Line2DNodePtr@@mLine2DNodePtrNext PLine2DNodePtr ?
Line2DNodePtr@@mLine2DNodePtrPrev PLine2DNodePtr ?
Line2DNodePtr@@mItem PLine2D ?
Line2DNodePtr ENDS
BlockLine3D STRUC
BlockLine3D@@mSize DD ?
BlockLine3D@@mLastIndexReferenced DD ?
BlockLine3D@@mLastObjectReferenced PLine3DNodePtr ?
BlockLine3D@@mLastObjectInserted PLine3DNodePtr ?
BlockLine3D@@mContainer PLine3DNodePtr ?
BlockLine3D ENDS
BlockLine2D STRUC
BlockLine2D@@mSize DD ?
BlockLine2D@@mlastIndexReferenced DD ?
BlockLine2D@@mLastObjectReferenced PLine2DNodePtr ?
BlockLine2D@@mlastObjectInserted PLine2DNodePtr ?
BlockLine2D@@mContainer PLine2DNodePtr ?
BlockLine2D ENDS
Polygon3D STRUC
PPolygon3D TYPEDEF NEAR PTR Polygon3D
Polygon3D@@vfptr DD ?
Polygon3D@@mBlockLine3D BlockLine3D ?
Polygon3D@@vfptr2 DD ?
Polygon3D@@mBlockLine2D BlockLine2D ?
Polygon3D ENDS

433
engine/VSMAP16.ASM Normal file
View File

@@ -0,0 +1,433 @@
;*************************************************************************************
; MODULE: VSMAP16.ASM DATE: APRIL 18,1995
; AUTHOR: SEAN M. KESSLER
; TARGET: 16 BIT LARGE MODEL
; FUNCTION : VIEW SYSTEM OBJECT MAPPER
;*************************************************************************************
.MODEL LARGE C
.386
LOCALS
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\ENGINE\VSMAP.INC
.DATA
viewData@@mViewSystem ViewSystem ?
viewData@@mPrecision DD 00004000h
calculateTempx MACRO
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosCameraTwistRadians to eax
lMul eax,bov ; multiply cosCameraTwistRadians by bov
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinCameraTwistRadians to eax
lMul eax,acov ; multiply sinCameraTwistRadians by bov
pop ebx ; restore prior result to ebx
sub ebx,eax ; subtract prior result by current result
movsx eax,es:[di].Point3D@@xyPoint.Point@@x ; move point3D.x into ebx register
lMul eax,ebx ; multiply point3D.x by result
round eax ; round off result
push eax ; save result
mov eax,bov ; move bov into eax register
neg eax ; negate bov (eax)
mov ebx,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwist to ebx
lMul eax,ebx ; multiply, result to eax
push eax ; save the result
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwist to eax
lMul eax,acov ; multiply, result to eax
pop ebx ; restore previous result
sub ebx,eax ; subtract last result from previous
movsx eax,es:[di].Point3D@@xyPoint.Point@@y ; move point3D.y to eax
lMul eax,ebx ; multiply point3D.y by last result
round eax ; round off result
pop ebx ; restore first result
add ebx,eax ; add to current result
movsx eax,viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@x ; move cameraPoint.x to eax
sub ebx,eax ; sub out cameraPoint.x
mov tempx,ebx ; move result to tempx
ENDM
calculateTempy MACRO
mov eax,aov ; move aov to eax register
neg eax ; negate aov
mov ebx,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwist to ebx
lMul eax,ebx ; multiply cosTwist*aov
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwist to eax
lMul eax,bcov ; sinTwist*bcov -> eax
pop ebx ; restore last result
sub ebx,eax ; subtract curr result from last result
movsx eax,es:[di].Point3D@@xyPoint.Point@@x ; move point3D.x to eax
lMul eax,ebx ; multiply it out
round eax ; round off result
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwist to eax
lMul eax,aov ; sinTwist*aov -> eax
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwist to eax
lMul eax,bcov ; cosTwist*bcov -> eax
pop ebx ; restore last result
sub ebx,eax ; subtract curr result from last result
movsx eax,es:[di].Point3D@@xyPoint.Point@@y ; move point3D.y to eax
lMul eax,ebx ; multiply last result by point3D.y
round eax ; round off the result
pop ebx ; restore prior result
add ebx,eax ; add prior result to current result
push ebx ; save new result
movsx ebx,es:[di].Point3D@@Point@@z ; move point3D.z to ebx
lMul ebx,v ; now multiply by curr v
movsx ebx,viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@y ; move cameraPoint.y to eax
sub eax,ebx ; sub out last result
pop ebx ; restore prior result
add eax,ebx ; add prior result to current result
mov tempy,eax ; store result in tempy
ENDM
calculateTempz MACRO
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; move focusPoint.x to ebx
lMul eax,ebx ; multiply it out
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; mov sinTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; move focusPoint.y to ebx
lMul eax,ebx ; multiply it out
pop ebx ; restore previous result to ebx
add eax,ebx ; add previous result to current
movsx ebx,es:[di].Point3D@@xyPoint.Point@@x ; move point3D.x to ebx
lMul eax,ebx ; multiply previous result by point3D.x
round eax ; round off the result
push eax ; save the result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; mov focusPoint.x to ebx
neg ebx ; negate focusPointy.x
lMul eax,ebx ; multiply focusPoint.x by sinTwistRadians
push eax ; save the result
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; mov focusPoint.y to ebx
lMul eax,ebx ; multiply focusPoint.y by cosTwistRadians
pop ebx ; restore previous result to ebx
add eax,ebx ; add current result to previous result
movsx ebx,es:[di].Point3D@@xyPoint.Point@@y ; move point3D.y to ebx
lMul eax,ebx ; multiply previous result by point3D.y
round eax ; round off the result
pop ebx ; restore previous result
add eax,ebx ; add curent result to previous
push eax ; save the result
movsx eax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z ; mov focusPoint.z to eax
movsx ebx,es:[di].Point3D@@Point@@z ; mov point3D.z to ebx
lMul eax,ebx ; multiply focusPoint.z by point3D.z
pop ebx ; restore previous result
add eax,ebx ; add current result to previous result
movsx ebx,viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@Point@@z ; move cameraPoint.z to ebx
sub eax,ebx ; subtract cameraPoint.z from curr result
mov tempz,eax ; move result to tempz
ENDM
calculatePoint2D MACRO
LOCAL @@screenPointZero,@@return
mov es,word ptr[bp+0Ch] ; move segment (Point *) to extra segment register
mov di,word ptr[bp+0Ah] ; move offset (Point *) to destination index register
cmp tempz,0000h ; is the z-point zero ??
je @@screenPointZero ; it's zero, so set screen point to (0,0)
mov eax,tempz ; move tempz into eax register
lMul eax,viewData@@mPrecision ; multiply tempz by precision
mov ebx,viewData@@mViewSystem.PureViewSystem@@viewPlaneDistance ; move viewPlaneDistance into ebx
divide eax,ebx ; divide tempz by viewPlaneDistance
push eax ; save the result ...
push eax ; twice
mov eax,tempx ; move tempx into eax
lMul eax,viewData@@mPrecision ; multiply tempx by precision
pop ebx ; restore previous result
divide eax,ebx ; divide current result by previous
mov es:[di].Point.Point@@x,ax ; store the result into Point.x
mov eax,tempy ; move tempy into eax
lMul eax,viewData@@mPrecision ; multiply tempy by precision
pop ebx ; restore tempz/viewPlaneDistance
divide eax,ebx ; divide tempx/(tempz/viewPlaneDistance)
mov es:[di].Point.Point@@y,ax ; store the result into Point.y
jmp @@return ; we're all done here
@@screenPointZero: ; screenPointZero sync address
mov es:[di].Point.Point@@x,0000h ; zero out screen point-x
mov es:[di].Point.Point@@y,0000h ; zero out screen point-y
@@return:
ENDM
calculateCartesianPoints MACRO
LOCAL @@return
cmp dword ptr[bp+0Eh],00000001h ; are we using cartesian mapping ??
jne @@return ; if not then return
movzx eax,viewData@@mViewSystem.PureViewSystem@@viewPortWidth ; move viewPortWidth to eax
divide eax,02h ; divide viewPortWidth by two
movsx ebx,es:[di].Point.Point@@x ; move point.x to ebx register
add eax,ebx ; add (viewPortWidth/2)+point.x
mov es:[di].Point.Point@@x,ax ; store result back to point.x
movzx eax,viewData@@mViewSystem.PureViewSystem@@viewPortHeight ; move viewPortHeight to eax
divide eax,02h ; divide viewPortHeight by two
movsx ebx,es:[di].Point.Point@@y ; move point.y to ebx
add eax,ebx ; add (viewPortHeight/2)+point.y
mov es:[di].Point.Point@@y,ax ; store result back to point.y
@@return:
ENDM
initializeLocal MACRO
LOCAL @@adjustValueOne,@@syncOne,@@zerCheckOne,@@zerCheckTwo,@@zerCheckThree,@@protZero,@@return
xor eax,eax ; clear out eax register
mov tempValue,0001h ; put one into tempValue
mov ax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z ; move focusPoint.z to eax
sMul ax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z ; square z-point
sub tempValue,eax ; subtract result from one
cmp tempValue,0000h ; compare tempValue to zero
jge @@adjustValueOne ; jump if greater equal
mov v,00001h ; move one into v
jmp @@syncOne ; jump around next block
@@adjustValueOne: ; value adjust code
neg tempValue ; negate tempValue
push word ptr [tempValue] ; push high word
push word ptr [tempValue+02h] ; push low word
call _sqrt ; get the square root
add sp,04h ; readjust the stack
mov v,eax ; move sqrt into v
@@syncOne: ; sync address
cmp v,0000h ; is v zero ??
je @@protZero ; if it is then set locals to one
movzx eax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; move focusPoint.x to eax
divide eax,v ; divide focusPoint.x by v
mov aov,eax ; mov result to aov
movzx eax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; move focusPoint.y to eax
divide eax,v ; divide focusPoint.y by v
mov bov,eax ; move result to bov
sMul viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x
divide eax,v ; divide result by v
mov acov,eax ; move result to acov
sMul viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y
divide eax,v ; divide result by v
mov bcov,eax ; move result to bcov
cmp aov,0000h ; compare aov to zero
jne @@zerCheckOne ; it's not zero so do next check
mov aov,0001h ; it's zero so set it to one
@@zerCheckOne: ; next check sync address
cmp bov,0000h ; compare bov to zero
jne @@zerCheckTwo ; it's not zero so do next check
mov bov,0001h ; it's zero so set it to one
@@zerCheckTwo: ; next check sync address
cmp acov,0000h ; compare acov to zero
jne @@zerCheckThree ; it's not zero so do next check
mov acov,0001h ; it's zero so set it to one
@@zerCheckThree: ; next check sync address
cmp bcov,0000h ; compare bcov to zero
jne @@return ; it's not zero so we're done
mov bcov,0001h ; it's zero so set it to one
jmp @@return ; we're all done checking for zero's
@@protZero: ; sync address
mov bov,0001h ; move one into bov
mov aov,0001h ; move one into aov
mov acov,0001h ; move one into acov
mov bcov,0001h ; move one into bcov
@@return: ; return sync address
ENDM
; The seeding below allows the MaClaurin series (for square root calcualtion) to converge much
; faster than if a random seed were used. The seeding works by selecting a known square root
; value in between the selected ranges. This proves to be faster, in general, than the standard
; library square root function, and can often times be twice as fast as the standard library.
firstGuess MACRO
LOCAL @@seedHund,@@seedFiveHund,@@seedThousand,@@seedFiveThousand,@@seedTenThousand,@@seedFiftyThousand, \
@@seedHundThousand,@@seedFiveHundThousand,@@seedMillion,@seedFiveMillion,@@seedTemMillion,@@seedOther
cmp ecx,0064h ; compare value one hundred
jle @@seedHund ; jump if less equal
cmp ecx,01F4h ; compare value to five hundred
jle @@seedFiveHund ; jump if less equal
cmp ecx,03E8h ; compare value to one thousand
jle @@seedThousand ; jump if less equal
cmp ecx,1388h ; compare value to five thousand
jle @@seedFiveThousand ; jump if less equal
cmp ecx,2710h ; compare value to ten thousand
jle @@seedTenThousand ; jump if less equal
cmp ecx,0C350h ; compare value to fifty thousand
jle @@seedFiftyThousand ; jump if less equal
cmp ecx,186A0h ; compare value to one hundred thousand
jle @@seedHundThousand ; jump if less equal
cmp ecx,7A120h ; compare value to five hundred thousand
jle @@seedFiveHundThousand ; jump if less equal
cmp ecx,0F4240h ; compare value to one million
jle @@seedMillion ; jump if less equal
cmp ecx,4C4B40h ; compare value to five million
jle @@seedFiveMillion ; jump if less equal
cmp ecx,989680h ; compare value to ten million
jle @@seedTenMillion ; jump if less equal
jmp @@seedOther ; jump to default seed handler
@@seedHund: ; sync address
mov bestGuess,0007h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveHund: ; sync address
mov bestGuess,0010h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedThousand: ; sync address
mov bestGuess,001Bh ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveThousand: ; sync address
mov bestGuess,0037h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedTenThousand: ; sync address
mov bestGuess,0057h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiftyThousand: ; sync address
mov bestGuess,00ADh ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedHundThousand: ; sync address
mov bestGuess,0112h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveHundThousand: ; sync address
mov bestGuess,0224h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedMillion: ; sync address
mov bestGuess,0362h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveMillion: ; sync address
mov bestGuess,06C4h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedTenMillion: ; sync address
mov bestGuess,0AB3h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedOther: ; sync address
mov bestGuess,0C5Ah ; set initial guess
ENDM
sMul MACRO varOne,varTwo ; short multiplication
push bx ; save bx register
mov ax,varOne ; move varOne into ax register
mov bx,varTwo ; move varTwo into bx register
imul bx ; perform the multiply result to dx:ax
push ax ; save ax register result
movzx eax,dx ; move dx register to eax zero extend
shl eax,16 ; shift eax left by a word
pop ax ; restore ax register result
pop bx ; restore bx register
ENDM
lMul MACRO varOne,varTwo ; long multiplication
push ebx ; save ebx register
mov eax,varOne ; move varOne into eax register
mov ebx,varTwo ; move varTwo into ebx register
imul ebx ; multiply eax by ebx result to eax:edx
pop ebx ; restore ebx register
ENDM
round MACRO varOne ; round down floating point values stored as longs
LOCAL @@roundNeg,@@roundPos,@@return,@@noinc
mov eax,varOne ; move varOne into eax register
cmp eax,0000h ; is eax register less than zero ??
pushf ; save flags
jl @@roundNeg ; if it is, we must take special measure
jmp @@roundPos ; otherwise round just round it
@@roundNeg: ; sync address
neg eax ; negate eax
@@roundPos: ; roundPos sync flag
mov edx,eax ; move varOne into edx register
and edx,00003FFFh ; get remainder into edx register
shr eax,14 ; get whole number to eax register
cmp edx,8192 ; if remainder > 8192, increment eax
jle @@noinc ; otherwise skip passed increment code
inc eax ; increment value in eax
@@noinc: ; no increment sync address
popf ; restore flags
jge @@return ; if value was not negative hust return
neg eax ; otherwise make it negative again
@@return: ; return sync flag
ENDM
divide MACRO varOne,varTwo ; destroyes eax,edx,ebx
LOCAL @@return,@@increment
mov ebx,varTwo ; move varTwo into ebx register
mov eax,varOne ; move varOne into eax register
cdq ; convert doubleword in eax to quadword at edx:eax
idiv ebx ; divide eax/ebx result to eax, rem to edx
shr ebx,01h ; divide varTwo by two
cmp edx,ebx ; check to see if we have to bump eax
jge @@increment ; yes we do
jmp @@return ; no we dont
@@increment: ; increment sync address
inc eax ; increment eax
@@return: ; return sync address
ENDM
.CODE
_sqrt proc near
LOCAL bestGuess:DWORD=LocalLength
push bp ; save stack frame
mov bp,sp ; create new frame
sub sp,LocalLength ; adjust stack for local variables
mov ecx,dword ptr[bp+4] ; move target into ecx register
cmp ecx,0001h ; is target one ??
je @@noop ; is target equal to one ??
cmp ecx,0000h ; is target equal to zero ??
jle @@erop ; set error if target is less equal zero.
firstGuess ; select the first guess value
@@nextGuess: ; next guess sync address
divide ecx,bestGuess ; divide target by best guess
add eax,bestGuess ; add in best guess
shr eax,0001h ; divide eax by two
adc eax,0000h ; add in any carry
cmp eax,bestGuess ; is the result the same, or greater, than our last result??
je @@return ; if so then we're not getting any closer
mov bestGuess,eax ; result is next best guess
jmp @@nextGuess ; if not then continue along
@@erop: ; erop sync address
xor eax,eax ; errors in which we must set return to zero
jmp @@return ; jump over next handler
@@noop: ; null operation sync address
mov eax,0001h ; errors return one in eax register
@@return: ; return sync address
add sp,LocalLength ; readjust stack for local variables
pop bp ; restore stack frame
retn ; return near to caller
_sqrt endp
_initView proc far ; void initView(ViewSystem *lpViewSystem)
push bp ; save stack frame
mov bp,sp ; create new frame
push es ; save extra segment register
push di ; save destination index register
mov di,word ptr[bp+06h] ; move ViewSystem offset into source index register
mov es,word ptr[bp+08h] ; move ViewSystem segment into extra segment register
mov eax,es:[di].PureViewSystem@@cameraTwistRadians ; move cameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@cameraTwistRadians,eax ; copy same to local
mov eax,es:[di].PureViewSystem@@cosCameraTwistRadians ; move cosCameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians,eax ; copy same to local
mov eax,es:[di].PureViewSystem@@sinCameraTwistRadians ; move sinCameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians,eax ; copy same to local
mov eax,es:[di].PureViewSystem@@cosCameraTwistRadiansSinCameraTwistRadians ; move cosCameraTwistRadiansSinCameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadiansSinCameraTwistRadians,eax ; copy same to local
mov eax,es:[di].PureViewSystem@@viewPlaneDistance ; move viewPlaneDistance to eax
mov viewData@@mViewSystem.PureViewSystem@@viewPlaneDistance,eax ; copy same to local
mov ax,es:[di].PureViewSystem@@viewPortWidth ; move viewPortWidth to eax
mov viewData@@mViewSystem.PureViewSystem@@viewPortWidth,ax ; copy same to local
mov ax,es:[di].PureViewSystem@@viewPortHeight ; move viewPortHeight to eax
mov viewData@@mViewSystem.PureViewSystem@@viewPortHeight,ax ; copy same to local
mov ax,es:[di].PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@x ; move cameraPoint.x to ax
mov viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@x,ax ; copy same to local
mov ax,es:[di].PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@y ; move cameraPoint.y to ax
mov viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@y,ax ; copy same to local
mov ax,es:[di].PureViewSystem@@cameraPoint.Point3D@@Point@@z ; move cameraPoint.z to ax
mov viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@Point@@z,ax ; copy same to local
mov ax,es:[di].PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; move focusPoint.x to ax
mov viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x,ax ; copy same to local
mov ax,es:[di].PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; move focusPoint.y to ax
mov viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y,ax ; copy same to local
mov ax,es:[di].PureViewSystem@@focusPoint.Point3D@@Point@@z ; move focusPoint.z to ax
mov viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z,ax ; copy same to local
pop di ; restore destination index register
pop es ; restore extra segment register
pop bp ; restore old frame
retf ; return far to caller
_initView endp
_mapCoordinates proc far ; void mapCoordinates(const Point3D *lpPoint3D,Point *lpPoint,WORD useCartesianSystem)
LOCAL tempValue:DWORD,v:DWORD,aov:DWORD,bov:DWORD,acov:DWORD,bcov:DWORD,tempx:DWORD,tempy:DWORD,tempz:DWORD=LocalLength
push bp ; save old stack frame
mov bp,sp ; create new frame
sub sp,LocalLength ; adjust stack for local variables
push es ; save extra segment register
push di ; save destination index register
mov es,word ptr[bp+08h] ; move segment (Point3D *) to extra segment register
mov di,word ptr[bp+06h] ; move offset (Point3D *) to destination index register
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
calculatePoint2D ; calculate the screen points
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
@@return:
pop di ; restore destination index register
pop es ; restore extra segment register
add sp,LocalLength ; adjust stack for local variables
pop bp ; restore old frame
retf ; return far to caller
_mapCoordinates endp
public _initView
public _mapCoordinates
END

529
engine/VSMAP32.ASM Normal file
View File

@@ -0,0 +1,529 @@
;*************************************************************************************
; MODULE: VSMAP32.ASM DATE: APRIL 20,1995
; AUTHOR: SEAN M. KESSLER
; TARGET: 32 BIT FLAT MODEL
; FUNCTION : VIEW SYSTEM OBJECT MAPPER
; MODIFIED MARCH 9, 1998 TO HANDLE POLYGON MAPPING
;*************************************************************************************
.386
.MODEL FLAT
LOCALS
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\ENGINE\VSMAP.INC
.DATA
viewData@@mViewSystem ViewSystem ?
viewData@@mPrecision DD 00004000h
calculateTempx MACRO
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosCameraTwistRadians to eax
lMul eax,bov ; multiply cosCameraTwistRadians by bov
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinCameraTwistRadians to eax
lMul eax,acov ; multiply sinCameraTwistRadians by bov
pop ebx ; restore prior result to ebx
sub ebx,eax ; subtract prior result by current result
movsx eax,[edi].Point3D@@xyPoint.Point@@x ; move point3D.x into ebx register
lMul eax,ebx ; multiply point3D.x by result
round eax ; round off result
push eax ; save result
mov eax,bov ; move bov into eax register
neg eax ; negate bov (eax)
mov ebx,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwist to ebx
lMul eax,ebx ; multiply, result to eax
push eax ; save the result
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwist to eax
lMul eax,acov ; multiply, result to eax
pop ebx ; restore previous result
sub ebx,eax ; subtract last result from previous
movsx eax,[edi].Point3D@@xyPoint.Point@@y ; move point3D.y to eax
lMul eax,ebx ; multiply point3D.y by last result
round eax ; round off result
pop ebx ; restore first result
add ebx,eax ; add to current result
movsx eax,viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@x ; move cameraPoint.x to eax
sub ebx,eax ; sub out cameraPoint.x
mov tempx,ebx ; move result to tempx
ENDM
calculateTempy MACRO
mov eax,aov ; move aov to eax register
neg eax ; negate aov
mov ebx,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwist to ebx
lMul eax,ebx ; multiply cosTwist*aov
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwist to eax
lMul eax,bcov ; sinTwist*bcov -> eax
pop ebx ; restore last result
sub ebx,eax ; subtract curr result from last result
movsx eax,[edi].Point3D@@xyPoint.Point@@x ; move point3D.x to eax
lMul eax,ebx ; multiply it out
round eax ; round off result
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwist to eax
lMul eax,aov ; sinTwist*aov -> eax
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwist to eax
lMul eax,bcov ; cosTwist*bcov -> eax
pop ebx ; restore last result
sub ebx,eax ; subtract curr result from last result
movsx eax,[edi].Point3D@@xyPoint.Point@@y ; move point3D.y to eax
lMul eax,ebx ; multiply last result by point3D.y
round eax ; round off the result
pop ebx ; restore prior result
add ebx,eax ; add prior result to current result
push ebx ; save new result
movsx ebx,[edi].Point3D@@Point@@z ; move point3D.z to ebx
lMul ebx,v ; now multiply by curr v
movsx ebx,viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@y ; move cameraPoint.y to eax
sub eax,ebx ; sub out last result
pop ebx ; restore prior result
add eax,ebx ; add prior result to current result
mov tempy,eax ; store result in tempy
ENDM
calculateTempz MACRO
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; move focusPoint.x to ebx
lMul eax,ebx ; multiply it out
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; mov sinTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; move focusPoint.y to ebx
lMul eax,ebx ; multiply it out
pop ebx ; restore previous result to ebx
add eax,ebx ; add previous result to current
movsx ebx,[edi].Point3D@@xyPoint.Point@@x ; move point3D.x to ebx
lMul eax,ebx ; multiply previous result by point3D.x
round eax ; round off the result
push eax ; save the result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; mov focusPoint.x to ebx
neg ebx ; negate focusPointy.x
lMul eax,ebx ; multiply focusPoint.x by sinTwistRadians
push eax ; save the result
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; mov focusPoint.y to ebx
lMul eax,ebx ; multiply focusPoint.y by cosTwistRadians
pop ebx ; restore previous result to ebx
add eax,ebx ; add current result to previous result
movsx ebx,[edi].Point3D@@xyPoint.Point@@y ; move point3D.y to ebx
lMul eax,ebx ; multiply previous result by point3D.y
round eax ; round off the result
pop ebx ; restore previous result
add eax,ebx ; add curent result to previous
push eax ; save the result
movsx eax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z ; mov focusPoint.z to eax
movsx ebx,[edi].Point3D@@Point@@z ; mov point3D.z to ebx
lMul eax,ebx ; multiply focusPoint.z by point3D.z
pop ebx ; restore previous result
add eax,ebx ; add current result to previous result
movsx ebx,viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@Point@@z ; move cameraPoint.z to ebx
sub eax,ebx ; subtract cameraPoint.z from curr result
mov tempz,eax ; move result to tempz
ENDM
calculatePoint2D MACRO
LOCAL @@screenPointZero,@@return
cmp tempz,0000h ; is the z-point zero ??
je @@screenPointZero ; it's zero, so set screen point to (0,0)
mov eax,tempz ; move tempz into eax register
lMul eax,viewData@@mPrecision ; multiply tempz by precision
mov ebx,viewData@@mViewSystem.PureViewSystem@@viewPlaneDistance ; move viewPlaneDistance into ebx
divide eax,ebx ; divide tempz by viewPlaneDistance
push eax ; save the result ...
push eax ; twice
mov eax,tempx ; move tempx into eax
lMul eax,viewData@@mPrecision ; multiply tempx by precision
pop ebx ; restore previous result
divide eax,ebx ; divide current result by previous
mov [edi].Point.Point@@x,ax ; store the result into Point.x
mov eax,tempy ; move tempy into eax
lMul eax,viewData@@mPrecision ; multiply tempy by precision
pop ebx ; restore tempz/viewPlaneDistance
divide eax,ebx ; divide tempx/(tempz/viewPlaneDistance)
mov [edi].Point.Point@@y,ax ; store the result into Point.y
jmp @@return ; we're all done here
@@screenPointZero: ; screenPointZero sync address
mov [edi].Point.Point@@x,0000h ; zero out screen point-x
mov [edi].Point.Point@@y,0000h ; zero out screen point-y
@@return:
ENDM
calculateCartesianPoints MACRO
LOCAL @@return
cmp eax,0001h ; is mode one ??
jne @@return ; if not then return
movzx eax,viewData@@mViewSystem.PureViewSystem@@viewPortWidth ; move viewPortWidth to eax
divide eax,02h ; divide viewPortWidth by two
movsx ebx,[edi].Point.Point@@x ; move point.x to ebx register
add eax,ebx ; add (viewPortWidth/2)+point.x
mov [edi].Point.Point@@x,ax ; store result back to point.x
movzx eax,viewData@@mViewSystem.PureViewSystem@@viewPortHeight ; move viewPortHeight to eax
divide eax,02h ; divide viewPortHeight by two
movsx ebx,[edi].Point.Point@@y ; move point.y to ebx
add eax,ebx ; add (viewPortHeight/2)+point.y
mov [edi].Point.Point@@y,ax ; store result back to point.y
@@return:
ENDM
initializeLocal MACRO
LOCAL @@adjustValueOne,@@syncOne,@@zerCheckOne,@@zerCheckTwo,@@zerCheckThree,@@protZero,@@return
xor eax,eax ; clear out eax register
mov tempValue,0001h ; put one into tempValue
mov ax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z ; move focusPoint.z to eax
sMul ax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z ; square z-point
sub tempValue,eax ; subtract result from one
cmp tempValue,0000h ; compare tempValue to zero
jge @@adjustValueOne ; jump if greater equal
mov v,00001h ; move one into v
jmp @@syncOne ; jump around next block
@@adjustValueOne: ; value adjust code
neg tempValue ; negate tempValue
push tempValue ; push tempValue
call _sqrt ; get the square root
add esp,04h ; readjust the stack
mov v,eax ; move sqrt into v
@@syncOne: ; sync address
cmp v,0000h ; is v zero ??
je @@protZero ; if it is then set locals to one
movzx eax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; move focusPoint.x to eax
divide eax,v ; divide focusPoint.x by v
mov aov,eax ; mov result to aov
movzx eax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; move focusPoint.y to eax
divide eax,v ; divide focusPoint.y by v
mov bov,eax ; move result to bov
sMul viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x
divide eax,v ; divide result by v
mov acov,eax ; move result to acov
sMul viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y
divide eax,v ; divide result by v
mov bcov,eax ; move result to bcov
cmp aov,0000h ; compare aov to zero
jne @@zerCheckOne ; it's not zero so do next check
mov aov,0001h ; it's zero so set it to one
@@zerCheckOne: ; next check sync address
cmp bov,0000h ; compare bov to zero
jne @@zerCheckTwo ; it's not zero so do next check
mov bov,0001h ; it's zero so set it to one
@@zerCheckTwo: ; next check sync address
cmp acov,0000h ; compare acov to zero
jne @@zerCheckThree ; it's not zero so do next check
mov acov,0001h ; it's zero so set it to one
@@zerCheckThree: ; next check sync address
cmp bcov,0000h ; compare bcov to zero
jne @@return ; it's not zero so we're done
mov bcov,0001h ; it's zero so set it to one
jmp @@return ; we're all done checking for zero's
@@protZero: ; sync address
mov bov,0001h ; move one into bov
mov aov,0001h ; move one into aov
mov acov,0001h ; move one into acov
mov bcov,0001h ; move one into bcov
@@return: ; return sync address
ENDM
; The seeding below allows the MaClaurin series (for square root calcualtion) to converge much
; faster than if a random seed were used. The seeding works by selecting a known square root
; value in between the selected ranges. This proves to be faster, in general, than the standard
; library square root function, and can often times be twice as fast as the standard library.
firstGuess MACRO
LOCAL @@seedHund,@@seedFiveHund,@@seedThousand,@@seedFiveThousand,@@seedTenThousand,@@seedFiftyThousand, \
@@seedHundThousand,@@seedFiveHundThousand,@@seedMillion,@seedFiveMillion,@@seedTemMillion,@@seedOther
cmp ecx,0064h ; compare value one hundred
jle @@seedHund ; jump if less equal
cmp ecx,01F4h ; compare value to five hundred
jle @@seedFiveHund ; jump if less equal
cmp ecx,03E8h ; compare value to one thousand
jle @@seedThousand ; jump if less equal
cmp ecx,1388h ; compare value to five thousand
jle @@seedFiveThousand ; jump if less equal
cmp ecx,2710h ; compare value to ten thousand
jle @@seedTenThousand ; jump if less equal
cmp ecx,0C350h ; compare value to fifty thousand
jle @@seedFiftyThousand ; jump if less equal
cmp ecx,186A0h ; compare value to one hundred thousand
jle @@seedHundThousand ; jump if less equal
cmp ecx,7A120h ; compare value to five hundred thousand
jle @@seedFiveHundThousand ; jump if less equal
cmp ecx,0F4240h ; compare value to one million
jle @@seedMillion ; jump if less equal
cmp ecx,4C4B40h ; compare value to five million
jle @@seedFiveMillion ; jump if less equal
cmp ecx,989680h ; compare value to ten million
jle @@seedTenMillion ; jump if less equal
jmp @@seedOther ; jump to default seed handler
@@seedHund: ; sync address
mov bestGuess,0007h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveHund: ; sync address
mov bestGuess,0010h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedThousand: ; sync address
mov bestGuess,001Bh ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveThousand: ; sync address
mov bestGuess,0037h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedTenThousand: ; sync address
mov bestGuess,0057h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiftyThousand: ; sync address
mov bestGuess,00ADh ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedHundThousand: ; sync address
mov bestGuess,0112h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveHundThousand: ; sync address
mov bestGuess,0224h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedMillion: ; sync address
mov bestGuess,0362h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveMillion: ; sync address
mov bestGuess,06C4h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedTenMillion: ; sync address
mov bestGuess,0AB3h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedOther: ; sync address
mov bestGuess,0C5Ah ; set initial guess
ENDM
sMul MACRO varOne,varTwo ; short multiplication
push bx ; save bx register
mov ax,varOne ; move varOne into ax register
mov bx,varTwo ; move varTwo into bx register
imul bx ; perform the multiply result to dx:ax
push ax ; save ax register result
movzx eax,dx ; move dx register to eax zero extend
shl eax,16 ; shift eax left by a word
pop ax ; restore ax register result
pop bx ; restore bx register
ENDM
lMul MACRO varOne,varTwo ; long multiplication
push ebx ; save ebx register
mov eax,varOne ; move varOne into eax register
mov ebx,varTwo ; move varTwo into ebx register
imul ebx ; multiply eax by ebx result to eax:edx
pop ebx ; restore ebx register
ENDM
round MACRO varOne ; round down floating point values stored as longs
LOCAL @@roundNeg,@@roundPos,@@return,@@noinc
mov eax,varOne ; move varOne into eax register
cmp eax,0000h ; is eax register less than zero ??
pushf ; save flags
jl @@roundNeg ; if it is, we must take special measure
jmp @@roundPos ; otherwise round just round it
@@roundNeg: ; sync address
neg eax ; negate eax
@@roundPos: ; roundPos sync flag
mov edx,eax ; move varOne into edx register
and edx,00003FFFh ; get remainder into edx register
shr eax,14 ; get whole number to eax register
cmp edx,8192 ; if remainder > 8192, increment eax
jle @@noinc ; otherwise skip passed increment code
inc eax ; increment value in eax
@@noinc: ; no increment sync address
popf ; restore flags
jge @@return ; if value was not negative hust return
neg eax ; otherwise make it negative again
@@return: ; return sync flag
ENDM
divide MACRO varOne,varTwo ; destroyes eax,edx,ebx
LOCAL @@return,@@increment,@@zero
mov ebx,varTwo ; move varTwo into ebx register
cmp ebx,0000h ; are we going to divide by zero
je @@zero ; if so then we'll just return zero
mov eax,varOne ; move varOne into eax register
cdq ; convert doubleword in eax to quadword at edx:eax
idiv ebx ; divide eax/ebx result to eax, rem to edx
shr ebx,01h ; divide varTwo by two
cmp edx,ebx ; check to see if we have to bump eax
jge @@increment ; yes we do
jmp @@return ; no we dont
@@zero: ; zero handler sync address
xor eax,eax ; zero out the return
jmp @@return ; we're done here
@@increment: ; increment sync address
inc eax ; increment eax
@@return: ; return sync address
ENDM
.CODE
_sqrt proc near
LOCAL bestGuess:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new frame
sub esp,LocalLength ; adjust stack for locals
mov ecx,[ebp+08h] ; move target into ecx register
cmp ecx,0001h ; is target one ??
je @@noop ; is target equal to one ??
cmp ecx,0000h ; is target equal to zero ??
jle @@erop ; set error if target is less equal zero.
firstGuess ; select the first guess value
@@nextGuess: ; next guess sync address
divide ecx,bestGuess ; divide target by best guess
add eax,bestGuess ; add in best guess
shr eax,0001h ; divide eax by two
adc eax,0000h ; add in any carry
cmp eax,bestGuess ; is the result the same, or greater, than our last result??
je @@return ; if so then we're not getting any closer
mov bestGuess,eax ; result is next best guess
jmp @@nextGuess ; if not then continue along
@@erop: ; erop sync address
xor eax,eax ; errors in which we must set return to zero
jmp @@return ; jump over next handler
@@noop: ; null operation sync address
mov eax,0001h ; errors return one in eax register
@@return: ; return sync address
add esp,LocalLength ; readjust stack for locals
pop ebp ; restore old stack frame
retn ; return near to caller
_sqrt endp
_initView proc near ; void initView(ViewSystem *lpViewSystem)
push ebp ; save stack frame
mov ebp,esp ; create new frame
push edi ; save destination index register
mov edi,[ebp+08h] ; move ViewSystem offset into destination index register
mov eax,[edi].PureViewSystem@@cameraTwistRadians ; move cameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@cameraTwistRadians,eax ; copy same to local
mov eax,[edi].PureViewSystem@@cosCameraTwistRadians ; move cosCameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians,eax ; copy same to local
mov eax,[edi].PureViewSystem@@sinCameraTwistRadians ; move sinCameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians,eax ; copy same to local
mov eax,[edi].PureViewSystem@@cosCameraTwistRadiansSinCameraTwistRadians ; move cosCameraTwistRadiansSinCameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadiansSinCameraTwistRadians,eax ; copy same to local
mov eax,[edi].PureViewSystem@@viewPlaneDistance ; move viewPlaneDistance to eax
mov viewData@@mViewSystem.PureViewSystem@@viewPlaneDistance,eax ; copy same to local
mov ax,[edi].PureViewSystem@@viewPortWidth ; move viewPortWidth to eax
mov viewData@@mViewSystem.PureViewSystem@@viewPortWidth,ax ; copy same to local
mov ax,[edi].PureViewSystem@@viewPortHeight ; move viewPortHeight to eax
mov viewData@@mViewSystem.PureViewSystem@@viewPortHeight,ax ; copy same to local
mov ax,[edi].PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@x ; move cameraPoint.x to ax
mov viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@x,ax ; copy same to local
mov ax,[edi].PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@y ; move cameraPoint.y to ax
mov viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@y,ax ; copy same to local
mov ax,[edi].PureViewSystem@@cameraPoint.Point3D@@Point@@z ; move cameraPoint.z to ax
mov viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@Point@@z,ax ; copy same to local
mov ax,[edi].PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; move focusPoint.x to ax
mov viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x,ax ; copy same to local
mov ax,[edi].PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; move focusPoint.y to ax
mov viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y,ax ; copy same to local
mov ax,[edi].PureViewSystem@@focusPoint.Point3D@@Point@@z ; move focusPoint.z to ax
mov viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z,ax ; copy same to local
pop edi ; restore destination index register
pop ebp ; restore old frame
retn ; return far to caller
_initView endp
_mapCoordinates proc near ; void mapCoordinates(const Point3D *lpPoint3D,Point *lpPoint,WORD useCartesianSystem)
LOCAL tempValue:DWORD,v:DWORD,aov:DWORD,bov:DWORD,acov:DWORD,bcov:DWORD,tempx:DWORD,tempy:DWORD,tempz:DWORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new frame
sub esp,LocalLength ; adjust stack for local variables
pushad ; save all general purpose registers, caller may use inline expansion
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
@@return: ; return sync address
popad ; restore all general purpose registers
add esp,LocalLength ; adjust stack for local variables
pop ebp ; restore old frame
retn ; return near to caller
_mapCoordinates endp
_mapVectorCoordinates proc near ; void mapCoordinates(const Point3D *lpPoint3D,Point *lpPoint,WORD useCartesianSystem)
push ebp ; save frame
mov ebp,esp ; create new frame
pushad ; save all general purpose registers
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
add edi,size Point3D ; increment edi to point to Point3D[1]
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
add edi,size Point ; increment edi to point to Point[1]
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
add edi,size Point3D*2 ; increment edi to point to Point3D[1]
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
add edi,size Point*2 ; increment edi to point to Point[1]
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
add edi,size Point3D*3 ; increment edi to point to Point3D[1]
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
add edi,size Point*3 ; increment edi to point to Point[1]
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
popad ; restore all general purpose registers
pop ebp ; restore previous frame
retn ; return near to caller
_mapVectorCoordinates endp
_mapPolygonCoordinates proc near ; void mapPolygonCoordinates(Polygon *pPolygon)
push ebp ; save prior stack frame
mov ebp,esp ; create new stack frame
push esi ; save source index register
push edi ; save destination index register
mov esi,[ebp+08h] ; move pPolygon into source index register
mov ecx,Polygon3D[esi].Polygon3D@@mBlockLine3D.BlockLine3D@@mSize ; move Line3D item count into ecx register
cmp ecx,0000h ; are there any lines in the Line3D block?
je @@endproc ; if not then we're done here
cmp ecx,Polygon3D[esi].Polygon3D@@mBlockLine2D.BlockLine2D@@mSize ; check Line3D count against Line2D count
jne @@endproc ; must have same number of Line3D's as Line2D's
mov edi,Polygon3D[esi].Polygon3D@@mBlockLine3D.BlockLine3D@@mContainer ; get to Line3D container
mov esi,Polygon3D[esi].Polygon3D@@mBlockLine2D.BlockLine2D@@mContainer ; get to Line2D container
@@protiter: ; iteration sync address
cmp edi,0000h ; is this a valid 3D container?
je @@endproc ; if not then we're done here
mov eax,Line3DNodePtr[edi].Line3DNodePtr@@mItem ; move Line3D ptr to eax
lea eax,Line3D[eax].Line3D@@mFirstPoint ; eax contains first Point3D ptr
mov ebx,Line2DNodePtr[esi].Line2DNodePtr@@mItem ; move Line2D ptr to ebx
lea ebx,Line2D[ebx].Line2D@@mFirstPoint ; ebx contains first Point2D ptr
push 0001h ; use cartesian coordinate system
push ebx ; save Point2D ptr
push eax ; save Point3D ptr
call _mapCoordinates ; map the coordinates
add esp,000Ch ; adjust stack after call
mov eax,Line3DNodePtr[edi].Line3DNodePtr@@mItem ; move Line3D ptr to eax
lea eax,Line3D[eax].Line3D@@mSecondPoint ; eax contains first Point3D ptr
mov ebx,Line2DNodePtr[esi].Line2DNodePtr@@mItem ; move Line2D ptr to ebx
lea ebx,Line2D[ebx].Line2D@@mSecondPoint ; ebx contains first Point2D ptr
push 0001h ; use cartesian coordinate system
push ebx ; save Point2D ptr
push eax ; save Point3D ptr
call _mapCoordinates ; map the coordinates
add esp,000Ch ; adjust stack after call
mov edi,Line3DNodePtr[edi].Line3DNodePtr@@mLine3DNodePtrNext ; advance to next element in Line3D block
mov esi,Line2DNodePtr[esi].Line2DNodePtr@@mLine2DNodePtrNext ; advance to next element in Line2D block
jmp @@protiter ; continue iteration through polygon
@@endproc: ; endproc sync address
pop edi ; restore destination index register
pop esi ; restore source index register
pop ebp ; restore previous stack frame
retn ; return near to caller
_mapPolygonCoordinates endp
public _initView
public _mapCoordinates
public _mapVectorCoordinates
public _mapPolygonCoordinates
END

529
engine/VSMAP32.BAK Normal file
View File

@@ -0,0 +1,529 @@
;*************************************************************************************
; MODULE: VSMAP32.ASM DATE: APRIL 20,1995
; AUTHOR: SEAN M. KESSLER
; TARGET: 32 BIT FLAT MODEL
; FUNCTION : VIEW SYSTEM OBJECT MAPPER
; MODIFIED MARCH 9, 1998 TO HANDLE POLYGON MAPPING
;*************************************************************************************
.386
.MODEL FLAT
LOCALS
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\ENGINE\VSMAP.INC
.DATA
viewData@@mViewSystem ViewSystem ?
viewData@@mPrecision DD 00004000h
calculateTempx MACRO
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosCameraTwistRadians to eax
lMul eax,bov ; multiply cosCameraTwistRadians by bov
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinCameraTwistRadians to eax
lMul eax,acov ; multiply sinCameraTwistRadians by bov
pop ebx ; restore prior result to ebx
sub ebx,eax ; subtract prior result by current result
movsx eax,[edi].Point3D@@xyPoint.Point@@x ; move point3D.x into ebx register
lMul eax,ebx ; multiply point3D.x by result
round eax ; round off result
push eax ; save result
mov eax,bov ; move bov into eax register
neg eax ; negate bov (eax)
mov ebx,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwist to ebx
lMul eax,ebx ; multiply, result to eax
push eax ; save the result
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwist to eax
lMul eax,acov ; multiply, result to eax
pop ebx ; restore previous result
sub ebx,eax ; subtract last result from previous
movsx eax,[edi].Point3D@@xyPoint.Point@@y ; move point3D.y to eax
lMul eax,ebx ; multiply point3D.y by last result
round eax ; round off result
pop ebx ; restore first result
add ebx,eax ; add to current result
movsx eax,viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@x ; move cameraPoint.x to eax
sub ebx,eax ; sub out cameraPoint.x
mov tempx,ebx ; move result to tempx
ENDM
calculateTempy MACRO
mov eax,aov ; move aov to eax register
neg eax ; negate aov
mov ebx,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwist to ebx
lMul eax,ebx ; multiply cosTwist*aov
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwist to eax
lMul eax,bcov ; sinTwist*bcov -> eax
pop ebx ; restore last result
sub ebx,eax ; subtract curr result from last result
movsx eax,[edi].Point3D@@xyPoint.Point@@x ; move point3D.x to eax
lMul eax,ebx ; multiply it out
round eax ; round off result
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwist to eax
lMul eax,aov ; sinTwist*aov -> eax
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwist to eax
lMul eax,bcov ; cosTwist*bcov -> eax
pop ebx ; restore last result
sub ebx,eax ; subtract curr result from last result
movsx eax,[edi].Point3D@@xyPoint.Point@@y ; move point3D.y to eax
lMul eax,ebx ; multiply last result by point3D.y
round eax ; round off the result
pop ebx ; restore prior result
add ebx,eax ; add prior result to current result
push ebx ; save new result
movsx ebx,[edi].Point3D@@Point@@z ; move point3D.z to ebx
lMul ebx,v ; now multiply by curr v
movsx ebx,viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@y ; move cameraPoint.y to eax
sub eax,ebx ; sub out last result
pop ebx ; restore prior result
add eax,ebx ; add prior result to current result
mov tempy,eax ; store result in tempy
ENDM
calculateTempz MACRO
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; move focusPoint.x to ebx
lMul eax,ebx ; multiply it out
push eax ; save result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; mov sinTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; move focusPoint.y to ebx
lMul eax,ebx ; multiply it out
pop ebx ; restore previous result to ebx
add eax,ebx ; add previous result to current
movsx ebx,[edi].Point3D@@xyPoint.Point@@x ; move point3D.x to ebx
lMul eax,ebx ; multiply previous result by point3D.x
round eax ; round off the result
push eax ; save the result
mov eax,viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians ; move sinTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; mov focusPoint.x to ebx
neg ebx ; negate focusPointy.x
lMul eax,ebx ; multiply focusPoint.x by sinTwistRadians
push eax ; save the result
mov eax,viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians ; move cosTwistRadians to eax
movsx ebx,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; mov focusPoint.y to ebx
lMul eax,ebx ; multiply focusPoint.y by cosTwistRadians
pop ebx ; restore previous result to ebx
add eax,ebx ; add current result to previous result
movsx ebx,[edi].Point3D@@xyPoint.Point@@y ; move point3D.y to ebx
lMul eax,ebx ; multiply previous result by point3D.y
round eax ; round off the result
pop ebx ; restore previous result
add eax,ebx ; add curent result to previous
push eax ; save the result
movsx eax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z ; mov focusPoint.z to eax
movsx ebx,[edi].Point3D@@Point@@z ; mov point3D.z to ebx
lMul eax,ebx ; multiply focusPoint.z by point3D.z
pop ebx ; restore previous result
add eax,ebx ; add current result to previous result
movsx ebx,viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@Point@@z ; move cameraPoint.z to ebx
sub eax,ebx ; subtract cameraPoint.z from curr result
mov tempz,eax ; move result to tempz
ENDM
calculatePoint2D MACRO
LOCAL @@screenPointZero,@@return
cmp tempz,0000h ; is the z-point zero ??
je @@screenPointZero ; it's zero, so set screen point to (0,0)
mov eax,tempz ; move tempz into eax register
lMul eax,viewData@@mPrecision ; multiply tempz by precision
mov ebx,viewData@@mViewSystem.PureViewSystem@@viewPlaneDistance ; move viewPlaneDistance into ebx
divide eax,ebx ; divide tempz by viewPlaneDistance
push eax ; save the result ...
push eax ; twice
mov eax,tempx ; move tempx into eax
lMul eax,viewData@@mPrecision ; multiply tempx by precision
pop ebx ; restore previous result
divide eax,ebx ; divide current result by previous
mov [edi].Point.Point@@x,ax ; store the result into Point.x
mov eax,tempy ; move tempy into eax
lMul eax,viewData@@mPrecision ; multiply tempy by precision
pop ebx ; restore tempz/viewPlaneDistance
divide eax,ebx ; divide tempx/(tempz/viewPlaneDistance)
mov [edi].Point.Point@@y,ax ; store the result into Point.y
jmp @@return ; we're all done here
@@screenPointZero: ; screenPointZero sync address
mov [edi].Point.Point@@x,0000h ; zero out screen point-x
mov [edi].Point.Point@@y,0000h ; zero out screen point-y
@@return:
ENDM
calculateCartesianPoints MACRO
LOCAL @@return
cmp eax,0001h ; is mode one ??
jne @@return ; if not then return
movzx eax,viewData@@mViewSystem.PureViewSystem@@viewPortWidth ; move viewPortWidth to eax
divide eax,02h ; divide viewPortWidth by two
movsx ebx,[edi].Point.Point@@x ; move point.x to ebx register
add eax,ebx ; add (viewPortWidth/2)+point.x
mov [edi].Point.Point@@x,ax ; store result back to point.x
movzx eax,viewData@@mViewSystem.PureViewSystem@@viewPortHeight ; move viewPortHeight to eax
divide eax,02h ; divide viewPortHeight by two
movsx ebx,[edi].Point.Point@@y ; move point.y to ebx
add eax,ebx ; add (viewPortHeight/2)+point.y
mov [edi].Point.Point@@y,ax ; store result back to point.y
@@return:
ENDM
initializeLocal MACRO
LOCAL @@adjustValueOne,@@syncOne,@@zerCheckOne,@@zerCheckTwo,@@zerCheckThree,@@protZero,@@return
xor eax,eax ; clear out eax register
mov tempValue,0001h ; put one into tempValue
mov ax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z ; move focusPoint.z to eax
sMul ax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z ; square z-point
sub tempValue,eax ; subtract result from one
cmp tempValue,0000h ; compare tempValue to zero
jge @@adjustValueOne ; jump if greater equal
mov v,00001h ; move one into v
jmp @@syncOne ; jump around next block
@@adjustValueOne: ; value adjust code
neg tempValue ; negate tempValue
push tempValue ; push tempValue
call _sqrt ; get the square root
add esp,04h ; readjust the stack
mov v,eax ; move sqrt into v
@@syncOne: ; sync address
cmp v,0000h ; is v zero ??
je @@protZero ; if it is then set locals to one
movzx eax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; move focusPoint.x to eax
divide eax,v ; divide focusPoint.x by v
mov aov,eax ; mov result to aov
movzx eax,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; move focusPoint.y to eax
divide eax,v ; divide focusPoint.y by v
mov bov,eax ; move result to bov
sMul viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x
divide eax,v ; divide result by v
mov acov,eax ; move result to acov
sMul viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z,viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y
divide eax,v ; divide result by v
mov bcov,eax ; move result to bcov
cmp aov,0000h ; compare aov to zero
jne @@zerCheckOne ; it's not zero so do next check
mov aov,0001h ; it's zero so set it to one
@@zerCheckOne: ; next check sync address
cmp bov,0000h ; compare bov to zero
jne @@zerCheckTwo ; it's not zero so do next check
mov bov,0001h ; it's zero so set it to one
@@zerCheckTwo: ; next check sync address
cmp acov,0000h ; compare acov to zero
jne @@zerCheckThree ; it's not zero so do next check
mov acov,0001h ; it's zero so set it to one
@@zerCheckThree: ; next check sync address
cmp bcov,0000h ; compare bcov to zero
jne @@return ; it's not zero so we're done
mov bcov,0001h ; it's zero so set it to one
jmp @@return ; we're all done checking for zero's
@@protZero: ; sync address
mov bov,0001h ; move one into bov
mov aov,0001h ; move one into aov
mov acov,0001h ; move one into acov
mov bcov,0001h ; move one into bcov
@@return: ; return sync address
ENDM
; The seeding below allows the MaClaurin series (for square root calcualtion) to converge much
; faster than if a random seed were used. The seeding works by selecting a known square root
; value in between the selected ranges. This proves to be faster, in general, than the standard
; library square root function, and can often times be twice as fast as the standard library.
firstGuess MACRO
LOCAL @@seedHund,@@seedFiveHund,@@seedThousand,@@seedFiveThousand,@@seedTenThousand,@@seedFiftyThousand, \
@@seedHundThousand,@@seedFiveHundThousand,@@seedMillion,@seedFiveMillion,@@seedTemMillion,@@seedOther
cmp ecx,0064h ; compare value one hundred
jle @@seedHund ; jump if less equal
cmp ecx,01F4h ; compare value to five hundred
jle @@seedFiveHund ; jump if less equal
cmp ecx,03E8h ; compare value to one thousand
jle @@seedThousand ; jump if less equal
cmp ecx,1388h ; compare value to five thousand
jle @@seedFiveThousand ; jump if less equal
cmp ecx,2710h ; compare value to ten thousand
jle @@seedTenThousand ; jump if less equal
cmp ecx,0C350h ; compare value to fifty thousand
jle @@seedFiftyThousand ; jump if less equal
cmp ecx,186A0h ; compare value to one hundred thousand
jle @@seedHundThousand ; jump if less equal
cmp ecx,7A120h ; compare value to five hundred thousand
jle @@seedFiveHundThousand ; jump if less equal
cmp ecx,0F4240h ; compare value to one million
jle @@seedMillion ; jump if less equal
cmp ecx,4C4B40h ; compare value to five million
jle @@seedFiveMillion ; jump if less equal
cmp ecx,989680h ; compare value to ten million
jle @@seedTenMillion ; jump if less equal
jmp @@seedOther ; jump to default seed handler
@@seedHund: ; sync address
mov bestGuess,0007h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveHund: ; sync address
mov bestGuess,0010h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedThousand: ; sync address
mov bestGuess,001Bh ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveThousand: ; sync address
mov bestGuess,0037h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedTenThousand: ; sync address
mov bestGuess,0057h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiftyThousand: ; sync address
mov bestGuess,00ADh ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedHundThousand: ; sync address
mov bestGuess,0112h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveHundThousand: ; sync address
mov bestGuess,0224h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedMillion: ; sync address
mov bestGuess,0362h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedFiveMillion: ; sync address
mov bestGuess,06C4h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedTenMillion: ; sync address
mov bestGuess,0AB3h ; set initial guess
jmp @@nextGuess ; jump to next guess
@@seedOther: ; sync address
mov bestGuess,0C5Ah ; set initial guess
ENDM
sMul MACRO varOne,varTwo ; short multiplication
push bx ; save bx register
mov ax,varOne ; move varOne into ax register
mov bx,varTwo ; move varTwo into bx register
imul bx ; perform the multiply result to dx:ax
push ax ; save ax register result
movzx eax,dx ; move dx register to eax zero extend
shl eax,16 ; shift eax left by a word
pop ax ; restore ax register result
pop bx ; restore bx register
ENDM
lMul MACRO varOne,varTwo ; long multiplication
push ebx ; save ebx register
mov eax,varOne ; move varOne into eax register
mov ebx,varTwo ; move varTwo into ebx register
imul ebx ; multiply eax by ebx result to eax:edx
pop ebx ; restore ebx register
ENDM
round MACRO varOne ; round down floating point values stored as longs
LOCAL @@roundNeg,@@roundPos,@@return,@@noinc
mov eax,varOne ; move varOne into eax register
cmp eax,0000h ; is eax register less than zero ??
pushf ; save flags
jl @@roundNeg ; if it is, we must take special measure
jmp @@roundPos ; otherwise round just round it
@@roundNeg: ; sync address
neg eax ; negate eax
@@roundPos: ; roundPos sync flag
mov edx,eax ; move varOne into edx register
and edx,00003FFFh ; get remainder into edx register
shr eax,14 ; get whole number to eax register
cmp edx,8192 ; if remainder > 8192, increment eax
jle @@noinc ; otherwise skip passed increment code
inc eax ; increment value in eax
@@noinc: ; no increment sync address
popf ; restore flags
jge @@return ; if value was not negative hust return
neg eax ; otherwise make it negative again
@@return: ; return sync flag
ENDM
divide MACRO varOne,varTwo ; destroyes eax,edx,ebx
LOCAL @@return,@@increment,@@zero
mov ebx,varTwo ; move varTwo into ebx register
cmp ebx,0000h ; are we going to divide by zero
je @@zero ; if so then we'll just return zero
mov eax,varOne ; move varOne into eax register
cdq ; convert doubleword in eax to quadword at edx:eax
idiv ebx ; divide eax/ebx result to eax, rem to edx
shr ebx,01h ; divide varTwo by two
cmp edx,ebx ; check to see if we have to bump eax
jge @@increment ; yes we do
jmp @@return ; no we dont
@@zero: ; zero handler sync address
xor eax,eax ; zero out the return
jmp @@return ; we're done here
@@increment: ; increment sync address
inc eax ; increment eax
@@return: ; return sync address
ENDM
.CODE
_sqrt proc near
LOCAL bestGuess:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new frame
sub esp,LocalLength ; adjust stack for locals
mov ecx,[ebp+08h] ; move target into ecx register
cmp ecx,0001h ; is target one ??
je @@noop ; is target equal to one ??
cmp ecx,0000h ; is target equal to zero ??
jle @@erop ; set error if target is less equal zero.
firstGuess ; select the first guess value
@@nextGuess: ; next guess sync address
divide ecx,bestGuess ; divide target by best guess
add eax,bestGuess ; add in best guess
shr eax,0001h ; divide eax by two
adc eax,0000h ; add in any carry
cmp eax,bestGuess ; is the result the same, or greater, than our last result??
je @@return ; if so then we're not getting any closer
mov bestGuess,eax ; result is next best guess
jmp @@nextGuess ; if not then continue along
@@erop: ; erop sync address
xor eax,eax ; errors in which we must set return to zero
jmp @@return ; jump over next handler
@@noop: ; null operation sync address
mov eax,0001h ; errors return one in eax register
@@return: ; return sync address
add esp,LocalLength ; readjust stack for locals
pop ebp ; restore old stack frame
retn ; return near to caller
_sqrt endp
_initView proc near ; void initView(ViewSystem *lpViewSystem)
push ebp ; save stack frame
mov ebp,esp ; create new frame
push edi ; save destination index register
mov edi,[ebp+08h] ; move ViewSystem offset into destination index register
mov eax,[edi].PureViewSystem@@cameraTwistRadians ; move cameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@cameraTwistRadians,eax ; copy same to local
mov eax,[edi].PureViewSystem@@cosCameraTwistRadians ; move cosCameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadians,eax ; copy same to local
mov eax,[edi].PureViewSystem@@sinCameraTwistRadians ; move sinCameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@sinCameraTwistRadians,eax ; copy same to local
mov eax,[edi].PureViewSystem@@cosCameraTwistRadiansSinCameraTwistRadians ; move cosCameraTwistRadiansSinCameraTwistRadians to eax
mov viewData@@mViewSystem.PureViewSystem@@cosCameraTwistRadiansSinCameraTwistRadians,eax ; copy same to local
mov eax,[edi].PureViewSystem@@viewPlaneDistance ; move viewPlaneDistance to eax
mov viewData@@mViewSystem.PureViewSystem@@viewPlaneDistance,eax ; copy same to local
mov ax,[edi].PureViewSystem@@viewPortWidth ; move viewPortWidth to eax
mov viewData@@mViewSystem.PureViewSystem@@viewPortWidth,ax ; copy same to local
mov ax,[edi].PureViewSystem@@viewPortHeight ; move viewPortHeight to eax
mov viewData@@mViewSystem.PureViewSystem@@viewPortHeight,ax ; copy same to local
mov ax,[edi].PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@x ; move cameraPoint.x to ax
mov viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@x,ax ; copy same to local
mov ax,[edi].PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@y ; move cameraPoint.y to ax
mov viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@xyPoint.Point@@y,ax ; copy same to local
mov ax,[edi].PureViewSystem@@cameraPoint.Point3D@@Point@@z ; move cameraPoint.z to ax
mov viewData@@mViewSystem.PureViewSystem@@cameraPoint.Point3D@@Point@@z,ax ; copy same to local
mov ax,[edi].PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x ; move focusPoint.x to ax
mov viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@x,ax ; copy same to local
mov ax,[edi].PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y ; move focusPoint.y to ax
mov viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@xyPoint.Point@@y,ax ; copy same to local
mov ax,[edi].PureViewSystem@@focusPoint.Point3D@@Point@@z ; move focusPoint.z to ax
mov viewData@@mViewSystem.PureViewSystem@@focusPoint.Point3D@@Point@@z,ax ; copy same to local
pop edi ; restore destination index register
pop ebp ; restore old frame
retn ; return far to caller
_initView endp
_mapCoordinates proc near ; void mapCoordinates(const Point3D *lpPoint3D,Point *lpPoint,WORD useCartesianSystem)
LOCAL tempValue:DWORD,v:DWORD,aov:DWORD,bov:DWORD,acov:DWORD,bcov:DWORD,tempx:DWORD,tempy:DWORD,tempz:DWORD=LocalLength
push ebp ; save old stack frame
mov ebp,esp ; create new frame
sub esp,LocalLength ; adjust stack for local variables
pushad ; save all general purpose registers, caller may use inline expansion
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
@@return: ; return sync address
popad ; restore all general purpose registers
add esp,LocalLength ; adjust stack for local variables
pop ebp ; restore old frame
retn ; return near to caller
_mapCoordinates endp
_mapVectorCoordinates proc near ; void mapCoordinates(const Point3D *lpPoint3D,Point *lpPoint,WORD useCartesianSystem)
push ebp ; save frame
mov ebp,esp ; create new frame
pushad ; save all general purpose registers
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
add edi,size Point3D ; increment edi to point to Point3D[1]
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
add edi,size Point ; increment edi to point to Point[1]
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
add edi,size Point3D*2 ; increment edi to point to Point3D[1]
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
add edi,size Point*2 ; increment edi to point to Point[1]
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
mov edi,[ebp+08h] ; move (Point3D *) to destination index register
add edi,size Point3D*3 ; increment edi to point to Point3D[1]
initializeLocal ; initialize local variables
calculateTempx ; calculate tempx value
calculateTempy ; calculate tempy value
calculateTempz ; calculate tempz value
mov edi,[ebp+0Ch] ; move (Point*) to destination index register
add edi,size Point*3 ; increment edi to point to Point[1]
calculatePoint2D ; calculate the screen points
mov eax,[ebp+10h] ; move mode into eax
calculateCartesianPoints ; convert screen points to cartesian points (if need be)
popad ; restore all general purpose registers
pop ebp ; restore previous frame
retn ; return near to caller
_mapVectorCoordinates endp
_mapPolygonCoordinates proc near ; void mapPolygonCoordinates(Polygon *pPolygon)
push ebp ; save prior stack frame
mov ebp,esp ; create new stack frame
push esi ; save source index register
push edi ; save destination index register
mov esi,[ebp+08h] ; move pPolygon into source index register
mov ecx,Polygon3D[esi].Polygon3D@@mBlockLine3D.BlockLine3D@@mSize ; move Line3D item count into ecx register
cmp ecx,0000h ; are there any lines in the Line3D block?
je @@endproc ; if not then we're done here
cmp ecx,Polygon3D[esi].Polygon3D@@mBlockLine2D.BlockLine2D@@mSize ; check Line3D count against Line2D count
jne @@endproc ; must have same number of Line3D's as Line2D's
mov edi,Polygon3D[esi].Polygon3D@@mBlockLine3D.BlockLine3D@@mContainer ; get to Line3D container
mov esi,Polygon3D[esi].Polygon3D@@mBlockLine2D.BlockLine2D@@mContainer ; get to Line2D container
@@protiter: ; iteration sync address
cmp edi,0000h ; is this a valid 3D container?
je @@endproc ; if not then we're done here
mov eax,Line3DNodePtr[edi].Line3DNodePtr@@mItem ; move Line3D ptr to eax
lea eax,Line3D[eax].Line3D@@mFirstPoint ; eax contains first Point3D ptr
mov ebx,Line2DNodePtr[esi].Line2DNodePtr@@mItem ; move Line2D ptr to ebx
lea ebx,Line2D[ebx].Line2D@@mFirstPoint ; ebx contains first Point2D ptr
push 0001h ; use cartesian coordinate system
push ebx ; save Point2D ptr
push eax ; save Point3D ptr
call _mapCoordinates ; map the coordinates
add esp,000Ch ; adjust stack after call
mov eax,Line3DNodePtr[edi].Line3DNodePtr@@mItem ; move Line3D ptr to eax
lea eax,Line3D[eax].Line3D@@mSecondPoint ; eax contains first Point3D ptr
mov ebx,Line2DNodePtr[esi].Line2DNodePtr@@mItem ; move Line2D ptr to ebx
lea ebx,Line2D[ebx].Line2D@@mSecondPoint ; ebx contains first Point2D ptr
push 0001h ; use cartesian coordinate system
push ebx ; save Point2D ptr
push eax ; save Point3D ptr
call _mapCoordinates ; map the coordinates
add esp,000Ch ; adjust stack after call
mov edi,Line3DNodePtr[edi].Line3DNodePtr@@mLine3DNodePtrNext ; advance to next element in Line3D block
mov esi,Line2DNodePtr[esi].Line2DNodePtr@@mLine2DNodePtrNext ; advance to next element in Line2D block
jmp @@protiter ; continue iteration through polygon
@@endproc: ; endproc sync address
pop edi ; restore destination index register
pop esi ; restore source index register
pop ebp ; restore previous stack frame
retn ; return near to caller
_mapPolygonCoordinates endp
public _initView
public _mapCoordinates
public _mapVectorCoordinates
public _mapPolygonCoordinates
END

62
engine/ViewSysImpl.hpp Normal file
View File

@@ -0,0 +1,62 @@
#ifndef _ENGINE_VIEWSYSTEMIMPL_HPP_
#define _ENGINE_VIEWSYSTEMIMPL_HPP_
#ifndef _ENGINE_VIEWSYSTEM_HPP_
#include <engine/viewsys.hpp>
#endif
class ViewSystemImpl : public ViewSystem
{
public:
ViewSystemImpl();
ViewSystemImpl(unsigned short width,unsigned short height);
virtual ~ViewSystemImpl();
void viewPortWidth(unsigned short viewPortWidth);
void viewPortHeight(unsigned short viewPortHeight);
virtual WORD viewPortHeight(void)const;
virtual WORD viewPortWidth(void)const;
private:
unsigned short mViewPortWidth;
unsigned short mViewPortHeight;
};
inline
ViewSystemImpl::ViewSystemImpl()
: mViewPortWidth(0), mViewPortHeight(0)
{
}
inline
ViewSystemImpl::ViewSystemImpl(unsigned short width,unsigned short height)
: mViewPortWidth(width), mViewPortHeight(height)
{
}
inline
ViewSystemImpl::~ViewSystemImpl()
{
}
inline
void ViewSystemImpl::viewPortWidth(unsigned short viewPortWidth)
{
mViewPortWidth=viewPortWidth;
}
inline
void ViewSystemImpl::viewPortHeight(unsigned short viewPortHeight)
{
mViewPortHeight=viewPortHeight;
}
inline
WORD ViewSystemImpl::viewPortHeight(void)const
{
return mViewPortHeight;
}
inline
WORD ViewSystemImpl::viewPortWidth(void)const
{
return mViewPortWidth;
}
#endif

202
engine/engine.001 Normal file
View File

@@ -0,0 +1,202 @@
# Microsoft Developer Studio Project File - Name="engine" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=engine - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "engine.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "engine.mak" CFG="engine - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "engine - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "engine - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
!IF "$(CFG)" == "engine - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\exe"
# PROP Intermediate_Dir ".\msvcobj"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /Zp1 /MTd /Z7 /Od /I "\work" /I "\parts" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__FLAT__" /D "STRICT" /Fp"c:\work\exe\msvc42.pch" /YX"windows.h" /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\exe\msengine.lib"
!ENDIF
# Begin Target
# Name "engine - Win32 Release"
# Name "engine - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\angle.cpp
# End Source File
# Begin Source File
SOURCE=.\Device3d.cpp
# End Source File
# Begin Source File
SOURCE=.\dib3d.cpp
# End Source File
# Begin Source File
SOURCE=.\Purevsys.cpp
# End Source File
# Begin Source File
SOURCE=.\spacial.cpp
# End Source File
# Begin Source File
SOURCE=.\Texture.cpp
# End Source File
# Begin Source File
SOURCE=.\Msvcobj\tmap32.obj
# End Source File
# Begin Source File
SOURCE=.\Msvcobj\util32.obj
# End Source File
# Begin Source File
SOURCE=.\vector3d.cpp
# End Source File
# Begin Source File
SOURCE=.\Viewsys.cpp
# End Source File
# Begin Source File
SOURCE=.\Msvcobj\vsmap32.obj
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\angle.hpp
# End Source File
# Begin Source File
SOURCE=.\angle3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Asmutil.hpp
# End Source File
# Begin Source File
SOURCE=.\Device3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Dib3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Line2d.hpp
# End Source File
# Begin Source File
SOURCE=.\Line3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Point3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Polygon.hpp
# End Source File
# Begin Source File
SOURCE=.\Pureedge.hpp
# End Source File
# Begin Source File
SOURCE=.\Puremap.hpp
# End Source File
# Begin Source File
SOURCE=.\Purevsys.hpp
# End Source File
# Begin Source File
SOURCE=.\Rect3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Spacial.hpp
# End Source File
# Begin Source File
SOURCE=.\Texture.hpp
# End Source File
# Begin Source File
SOURCE=.\Vector3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Viewsys.hpp
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

208
engine/engine.dsp Normal file
View File

@@ -0,0 +1,208 @@
# Microsoft Developer Studio Project File - Name="engine" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=engine - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "engine.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "engine.mak" CFG="engine - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "engine - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "engine - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "engine - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\exe"
# PROP Intermediate_Dir ".\msvcobj"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MTd /Zi /Od /I "\work" /I "\parts" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__FLAT__" /D "STRICT" /FR /Fp"\work\exe\msvc42.pch" /YX"windows.h" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\exe\msengine.lib"
!ENDIF
# Begin Target
# Name "engine - Win32 Release"
# Name "engine - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\angle.cpp
# End Source File
# Begin Source File
SOURCE=.\Device3d.cpp
# End Source File
# Begin Source File
SOURCE=.\dib3d.cpp
# End Source File
# Begin Source File
SOURCE=.\Purevsys.cpp
# End Source File
# Begin Source File
SOURCE=.\spacial.cpp
# End Source File
# Begin Source File
SOURCE=.\Texture.cpp
# End Source File
# Begin Source File
SOURCE=.\vector3d.cpp
# End Source File
# Begin Source File
SOURCE=.\Viewsys.cpp
# End Source File
# Begin Source File
SOURCE=.\Msvcobj\tmap32.obj
# End Source File
# Begin Source File
SOURCE=.\Msvcobj\util32.obj
# End Source File
# Begin Source File
SOURCE=.\Msvcobj\vsmap32.obj
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\angle.hpp
# End Source File
# Begin Source File
SOURCE=.\angle3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Asmutil.hpp
# End Source File
# Begin Source File
SOURCE=.\Device3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Dib3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Line2d.hpp
# End Source File
# Begin Source File
SOURCE=.\Line3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Point3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Polygon.hpp
# End Source File
# Begin Source File
SOURCE=.\Pureedge.hpp
# End Source File
# Begin Source File
SOURCE=.\Puremap.hpp
# End Source File
# Begin Source File
SOURCE=.\Purevsys.hpp
# End Source File
# Begin Source File
SOURCE=.\Rect3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Spacial.hpp
# End Source File
# Begin Source File
SOURCE=.\Texture.hpp
# End Source File
# Begin Source File
SOURCE=.\Vector3d.hpp
# End Source File
# Begin Source File
SOURCE=.\Viewsys.hpp
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

BIN
engine/engine.mdp Normal file

Binary file not shown.