home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / quake_src / r_alias68k.s < prev    next >
Encoding:
Text File  |  2000-06-17  |  6.3 KB  |  288 lines

  1. * Copyright (C) 1996-1997 Id Software, Inc. 
  2. * This program is free software; you can redistribute it and/or 
  3. * modify it under the terms of the GNU General Public License 
  4. * as published by the Free Software Foundation; either version 2 
  5. * of the License, or (at your option) any later version. 
  6. * This program is distributed in the hope that it will be useful, 
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of 
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   
  9. * See the GNU General Public License for more details. 
  10. * You should have received a copy of the GNU General Public License 
  11. * along with this program; if not, write to the Free Software 
  12. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
  13.  
  14. **
  15. ** Quake for AMIGA
  16. ** r_alias.c assembler implementations by Frank Wille <frank@phoenix.owl.de>
  17. **
  18.  
  19.         XREF    _aliastransform
  20.         XREF    _r_avertexnormals
  21.         XREF    _r_plightvec
  22.         XREF    _r_ambientlight
  23.         XREF    _r_shadelight
  24.         XREF    _ziscale
  25.         XREF    _aliasxscale
  26.         XREF    _aliasyscale
  27.         XREF    _aliasxcenter
  28.         XREF    _aliasycenter
  29.  
  30.         XDEF    _R_AliasTransformVector
  31.         XDEF    _R_AliasTransformFinalVert
  32.         XDEF    _R_AliasProjectFinalVert
  33.  
  34.  
  35. FV_V                    =       0
  36. FV_FLAGS                =       24
  37. FV_RESERVED             =       28
  38. FV_SIZEOF               =       32
  39. FV_SIZEOF_EXP           =       5
  40.  
  41. TV_V                    =       0
  42. TV_LIGHTNORMALINDEX     =       3
  43.  
  44. SV_ONSEAM               =       0
  45. SV_S                    =       4
  46. SV_T                    =       8
  47.  
  48.         fpu
  49.  
  50.  
  51.  
  52.  
  53. ******************************************************************************
  54. *
  55. *       void _R_AliasTransformVector (vec3_t in, vec3_t out)
  56. *
  57. ******************************************************************************
  58.  
  59.         cnop    0,4
  60. _R_AliasTransformVector
  61.  
  62. *****   stackframe
  63.  
  64.         rsreset
  65. .fpuregs        rs.x    4
  66.         rs.l    1
  67. .in             rs.l    1
  68. .out            rs.l    1
  69.  
  70.         fmovem.x        fp2-fp5,-(sp)
  71.         move.l  .in(sp),a0
  72.         move.l  .out(sp),a1
  73.         fmove.s (a0)+,fp0
  74.         fmove.s (a0)+,fp1
  75.         fmove.s (a0)+,fp2
  76.         lea     _aliastransform,a0
  77.         fmove.s (a0)+,fp3
  78.         fmul    fp0,fp3
  79.         fmove.s (a0)+,fp4
  80.         fmul    fp1,fp4
  81.         fadd    fp4,fp3
  82.         fmove.s (a0)+,fp4
  83.         fmul    fp2,fp4
  84.         fadd    fp4,fp3
  85.         fadd.s  (a0)+,fp3
  86.         fmove.s fp3,(a1)+
  87.         fmove.s (a0)+,fp3
  88.         fmul    fp0,fp3
  89.         fmove.s (a0)+,fp4
  90.         fmul    fp1,fp4
  91.         fadd    fp4,fp3
  92.         fmove.s (a0)+,fp4
  93.         fmul    fp2,fp4
  94.         fadd    fp4,fp3
  95.         fadd.s  (a0)+,fp3
  96.         fmove.s fp3,(a1)+
  97.         fmul.s  (a0)+,fp0
  98.         fmul.s  (a0)+,fp1
  99.         fadd    fp1,fp0
  100.         fmul.s  (a0)+,fp2
  101.         fadd    fp2,fp0
  102.         fadd.s  (a0)+,fp0
  103.         fmove.s fp0,(a1)+
  104.         fmovem.x        (sp)+,fp2-fp5
  105.         rts
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112. ******************************************************************************
  113. *
  114. *       void _R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av,
  115. *                                      trivertx_t *pverts, stvert_t *pstverts)
  116. *
  117. ******************************************************************************
  118.  
  119.         cnop    0,4
  120. _R_AliasTransformFinalVert
  121.  
  122. *****   stackframe
  123.  
  124.         rsreset
  125. .fpuregs        rs.x    3
  126. .intregs        rs.l    1
  127.         rs.l    1
  128. .fv             rs.l    1
  129. .av             rs.l    1
  130. .tv             rs.l    1
  131. .sv             rs.l    1
  132.  
  133.  
  134.         move.l  a2,-(sp)
  135.         fmovem.x        fp2-fp4,-(sp)
  136.         move.l  .av(sp),a1
  137.         move.l  .tv(sp),a2
  138.  
  139. *        av->fv[0] = DotProduct(pverts->v, aliastransform[0]) +
  140. *                        aliastransform[0][3];
  141. *        av->fv[1] = DotProduct(pverts->v, aliastransform[1]) +
  142. *                        aliastransform[1][3];
  143. *        av->fv[2] = DotProduct(pverts->v, aliastransform[2]) +
  144. *                        aliastransform[2][3];
  145.  
  146.         lea     _aliastransform,a0
  147.         moveq   #0,d0
  148.         move.b  (a2),d0
  149.         fmove.l d0,fp0
  150.         move.b  1(a2),d0
  151.         fmove.l d0,fp1
  152.         move.b  2(a2),d0
  153.         fmove.l d0,fp2
  154.         fmove.s (a0)+,fp3
  155.         fmul    fp0,fp3
  156.         fmove.s (a0)+,fp4
  157.         fmul    fp1,fp4
  158.         fadd    fp4,fp3
  159.         fmove.s (a0)+,fp4
  160.         fmul    fp2,fp4
  161.         fadd    fp4,fp3
  162.         fadd.s  (a0)+,fp3
  163.         fmove.s fp3,(a1)+
  164.         fmove.s (a0)+,fp3
  165.         fmul    fp0,fp3
  166.         fmove.s (a0)+,fp4
  167.         fmul    fp1,fp4
  168.         fadd    fp4,fp3
  169.         fmove.s (a0)+,fp4
  170.         fmul    fp2,fp4
  171.         fadd    fp4,fp3
  172.         fadd.s  (a0)+,fp3
  173.         fmove.s fp3,(a1)+
  174.         fmove.s (a0)+,fp3
  175.         fmul    fp0,fp3
  176.         fmove.s (a0)+,fp4
  177.         fmul    fp1,fp4
  178.         fadd    fp4,fp3
  179.         fmove.s (a0)+,fp4
  180.         fmul    fp2,fp4
  181.         fadd    fp4,fp3
  182.         fadd.s  (a0)+,fp3
  183.         fmove.s fp3,(a1)+
  184.  
  185. *        fv->v[2] = pstverts->s;
  186. *        fv->v[3] = pstverts->t;
  187. *
  188. *        fv->flags = pstverts->onseam;
  189.  
  190.         move.l  .fv(sp),a0
  191.         move.l  .sv(sp),a1
  192.         move.l  SV_S(a1),8(a0)
  193.         move.l  SV_T(a1),12(a0)
  194.         move.l  SV_ONSEAM(a1),FV_FLAGS(a0)
  195.  
  196. *        plightnormal = r_avertexnormals[pverts->lightnormalindex];
  197. *        lightcos = DotProduct (plightnormal, r_plightvec);
  198. *        temp = r_ambientlight;
  199.  
  200.         lea     _r_avertexnormals,a1
  201.         moveq   #0,d0
  202.         move.b  TV_LIGHTNORMALINDEX(a2),d0
  203.         muls    #12,d0
  204.         add.l   d0,a1
  205.         lea     _r_plightvec,a2
  206.         fmove.s (a2)+,fp0
  207.         fmove.s (a2)+,fp1
  208.         fmove.s (a2)+,fp2
  209.         fmul.s  (a1)+,fp0
  210.         fmul.s  (a1)+,fp1
  211.         fadd    fp1,fp0
  212.         fmul.s  (a1)+,fp2
  213.         fadd    fp2,fp0
  214.         move.l  _r_ambientlight,d0
  215.  
  216. *        if (lightcos < 0)
  217. *        {
  218. *                temp += (int)(r_shadelight * lightcos);
  219. *
  220. *        // clamp; because we limited the minimum ambient and shading light, we
  221. *        // don't have to clamp low light, just bright
  222. *                if (temp < 0)
  223. *                        temp = 0;
  224. *        }
  225. *
  226. *        fv->v[4] = temp;
  227.  
  228.         ftst    fp0
  229.         fboge.b .cont
  230.         fmul.s  _r_shadelight,fp0
  231.         fmove.l fp0,d1
  232.         add.l   d1,d0
  233.         bge.b   .cont
  234.         moveq   #0,d0
  235. .cont
  236.         move.l  d0,16(a0)
  237.         fmovem.x        (sp)+,fp2-fp4
  238.         move.l  (sp)+,a2
  239.         rts
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247. ******************************************************************************
  248. *
  249. *       void _R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av,)
  250. *
  251. ******************************************************************************
  252.  
  253.         cnop    0,4
  254. _R_AliasProjectFinalVert
  255.  
  256. *****   stackframe
  257.  
  258.         rsreset
  259.         rs.l    1
  260. .fv             rs.l    1
  261. .av             rs.l    1
  262.  
  263.  
  264.         move.l  .av(sp),a0
  265.         move.l  .fv(sp),a1
  266.         fmove.s 8(a0),fp0
  267.         fmove.s #1,fp1
  268.         fdiv    fp0,fp1
  269.         fmove.s _ziscale,fp0
  270.         fmul    fp1,fp0
  271.         fmove.l fp0,20(a1)
  272.         fmove.s _aliasxscale,fp0
  273.         fmul    fp1,fp0
  274.         fmul.s  (a0),fp0
  275.         fadd.s  _aliasxcenter,fp0
  276.         fmove.l fp0,(a1)
  277.         fmul.s  _aliasyscale,fp1
  278.         fmul.s  4(a0),fp1
  279.         fadd.s  _aliasycenter,fp1
  280.         fmove.l fp1,4(a1)
  281.         rts
  282.