/****************************************************************************** libx42 - skinned vertex animation library Copyright (C) 2007 HermitWorks Entertainment Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA. ******************************************************************************/ #ifndef INC_MEMSTREAM_H #define INC_MEMSTREAM_H /* Some macros to make working with x42memStream_t a bit easier. */ #define stream_next( stm ) {((stm)->pStreamZero = (void*)((byte*)(stm)->pStreamZero + (stm)->stride));} #define stream_currptr( stm, T ) ((T*)(stm)->pStreamZero) #define stream_currf( stm ) stream_currptr( stm, float ) #define stream_currub( stm ) stream_currptr( stm, byte ) #define stream_emit1f( stm, x, y ) {stream_currf( stm )[0] = (x); stream_next( stm )} #define stream_emit2f( stm, x, y ) {stream_currf( stm )[0] = (x); stream_currf( stm )[1] = (y); stream_next( stm )} #define stream_emit3f( stm, x, y, z ) {stream_currf( stm )[0] = (x); stream_currf( stm )[1] = (y); stream_currf( stm )[2] = (z); stream_next( stm );} #define stream_emit1fv( stm, v ) {stream_currf( stm )[0] = (v)[0]; stream_next( stm );} #define stream_emit2fv( stm, v ) {stream_currf( stm )[0] = (v)[0]; stream_currf( stm )[1] = (v)[1]; stream_next( stm );} #define stream_emit3fv( stm, v ) {stream_currf( stm )[0] = (v)[0]; stream_currf( stm )[1] = (v)[1]; stream_currf( stm )[2] = (v)[2]; stream_next( stm );} #define stream_emit4ub( stm, x, y, z, w ) {stream_currub( stm )[0] = x; stream_currub( stm )[1] = y; stream_currub( stm )[2] = z; stream_currub( stm )[3] = w; stream_next( stm );} #define stream_emit4ubv( stm, v ) {*stream_currptr( stm, uint ) = *(uint*)(v); stream_next( stm );} #endif