Path: chuka.playstation.co.uk!news From: SCEE Developer Support Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Sprite Z Ordering Date: Wed, 16 Apr 1997 13:48:03 +0100 Organization: Sony Computer Entertainment Europe Lines: 68 Message-ID: <3354CA83.3A4A@interactive.sony.com> References: <01bc49e3$259ecfe0$250ce8c3@cma> NNTP-Posting-Host: 194.203.13.10 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (Win95; I) Chris Allmark wrote: > > I hate the manuals. How the hell do you expect me to find out any useful > routines when they're "lumped" together under the catch-all of "Graphics > Functions", didja ever think to perhaps break it down a little into > "SPRITES", "3D", "PALETTE MANAGEMENT" etc. or does everything just get a > "please refer to the Net Yaroze Members' Web site" note at the bottom ? Sorry about the relative lack of strucure in the manuals, they are under ongoing improvement > > Anyway, I've been trying to knock together a few basic sprite management > routines etc. and I'm a bit confused. I had assumed that the GsSortSprite() > and GsSortFastSprite() functions sort the OT info, and account for thing > such as Z axis (depth) via the pri (position in OT) member. I can't get it > to display anything unless I use 0. The GsSortSprite (etc) functions that register sprites into OTs take a priority position argument; this allows you to put them anywhere. For a game using several 2d layers, each behind the other, this is nice and simple. To represent 3d objects with sprites, the width and height of the sprite need sorting, and its priority must be calculated by transforming the object's position into screen coordinates; the demo tunelfin (and others) includes a SortSpritePosition (or somesuch) function that does just this, this function shows a basic world-to-screen conversion with perspective. If you really can't get anything to display at priorities other than zero, I must suspect the main loop display code; the most straightforward way to build a game main loop is to grab the basic shell which sets up an OT, handles objects, registers drawing requests in the OT, waits for VSync, etc; the point being that building up your own is more time-consuming and error-prone. > > ...and another thing can anyone explain to me the values of PACKET for > GsSetWorkBase - I've seen values such as 1000*24, or 1000 * (20+4) etc. but > can't any explaination as to why these values are used. > > Thanks y'all. > -- > Chris Allmark, Zoo Software Solutions > "If you can't plug it in - We don't use it !" The values for the size of the PACKET arrays are partly arbitrary; basically, every primitive requires up to 24 PACKETS; and the PACKET scratchpad must be enough for all the primitives we want to draw. Given we don't want to have to calculate the exact number each time, we just set an upper limit, hence you may often see sample code like this #define PACKET_MAX1 24 // max number of packets per primitive #define PACKET_MAX2 2048 // max number of primitives we want to draw PACKET GpuPacketArea[2][PACKET_MAX1 * PACKET_MAX2]; or something similar. Lewis