Ihave slimmed the code down so i can place it here, the code is from my test bed program so I apologise for the scrapiness.
When run it produces very different values between ans# and ASDF#. Given that the range of results in ans# should be -800 to +800, when the result is 800ish ASDF# returns a result of 40ish? If you would like to RUN the code i will need to send over a few(well quite a lot) of extra stuff. The code will not run without a world being generated first(about 4Gbytes).
Code: Select all
5300 REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
5310 REM 333333333333333333333333333 render scene 333333333333333333333333333
5320 REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
5330 hp% = (playingWidth%DIV2)+1
5340 X1# = playingWidth%*COS(indexY+line1Correction)+hp%
5350 Z1# = playingWidth%*SIN(indexY+line1Correction)+hp%
5360 X2# = -playingWidth%*COS(indexY-line1Correction)+hp%
5370 Z2# = -playingWidth%*SIN(indexY-line1Correction)+hp%
5380
5390 IF ABS(X2#-X1#) > 0.01 THEN slope# = (Z2#-Z1#)/(X2#-X1#) ELSE slope# = &FFFFFF
5400
5410 red = 1
5420 green = 2
5430 IF X2#=<X1# THEN
5440 red = 2
5450 green = 1
5460 ENDIF
5470 IF X2#<=X1# THEN
5480 SWAP X1#,X2#
5490 SWAP Z1#,Z2#
5500 ENDIF
5510
5520 FOR TX% = 0 TO playingWidth%-1
5530 FOR TZ% = 0 TO playingWidth%-1
5540
5550 CALL answer
5560 ASDF# = ans#
5570 TZTWO% = TZ%
5580 TXTWO% = TX%
5590 slope2# = slope#
5600 Z1TWO# = Z1#
5610 X1TWO# = X1#
5620
5630 ans# = (TZ%)-((TX%)*slope#)-Z1#+(X1#*slope#)
5640
5650 IF indexY <> PI/2 THEN
5660 IF ans# <= 0 THEN render% = green ELSE render% = red
5670 ELSE
5680 IF ans# <= 0 THEN render% = red ELSE render% = green
5690 ENDIF
5700
5710
5720
5730 IF render% = 2 THEN
5740 T% = vertArea%((TX%+offsetVX%)MODplayingWidth%,(TZ%+offsetVZ%)MODplayingWidth%)
5750 REM AAAAAAAAAAAAAAAAAAA BBBBBBBBBBB CCCCCCCCCCC
5760 SYS DevCon.IASetVertexBuffers%, DevCon%, 0, 1, ^vertexBuffers%(T%), ^stride%(1), ^offset%(1) : REM set the vertexBuffer, stride and offset for shader "vertexShaders%(0)"
5770 REM A :- address of vertex buffer to be used; buffers contain the vertices fro each section of the landscape
5780 REM B :- address of the stride to be used; stride is length of each vertices data
5790 REM C :- address of the offset; offset is where in the list of vertices to start
5800 tot% = totalVertices%(TX%+offsetVX%,TZ%+offsetVZ%)
5810 REM CALL renderTest
5820 SYS DevCon.Draw%, DevCon%, totalVertices%(TX%+offsetVX%,TZ%+offsetVZ%), 0 : REM render the scene(vertexBuffer vertices) with offset 0 and number of vertices - totalVertices%(x,z)
5830 ENDIF
5840 NEXT
5850 NEXT
5860 REM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
5870 REM 333333333333333333333333333 render scene 333333333333333333333333333
5880 REM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
5890 REM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
5900 REM 222222222222222222222222222 set Shaders and render scene 222222222222222222222222222
5910 REM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
5920
5930 SYS SwapChain.Present%, textureTEXT%(100), 0, 0 : REM swap the current window buffer for the next and be ready to start again
5940 VDU4
5950 fps% += 1
5960 PRINTTAB(0,0) 100*fps%/TIME
5970 PRINT ASDF# ," ", ans#
5980 PRINT TZTWO% ," ", TZ%
5990 PRINT TXTWO% ," ", TX%
6000 PRINT slope2# ," ", slope#
6010 PRINT Z1TWO# ," ", Z1#
6020 PRINT X1TWO# ," ", X1#
6030 UNTIL FALSE
CALL answer is the routine sent yesterday
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023