px3Stream.cpp
Engine/source/T3D/physics/physx3/px3Stream.cpp
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "platform/platform.h" 25#include "T3D/physics/physx3/px3Stream.h" 26 27#include "console/console.h" 28#include "console/consoleTypes.h" 29#include "core/strings/stringFunctions.h" 30 31 32Px3MemOutStream::Px3MemOutStream() : mMemStream(1024) 33{ 34} 35 36Px3MemOutStream::~Px3MemOutStream() 37{ 38} 39 40physx::PxU32 Px3MemOutStream::write(const void *src, physx::PxU32 count) 41{ 42 physx::PxU32 out=0; 43 if(!mMemStream.write(count,src)) 44 return out; 45 46 out = count; 47 return out; 48} 49 50Px3MemInStream::Px3MemInStream(physx::PxU8* data, physx::PxU32 length):mMemStream(length,data) 51{ 52} 53 54physx::PxU32 Px3MemInStream::read(void* dest, physx::PxU32 count) 55{ 56 physx::PxU32 read =0; 57 if(!mMemStream.read(count,dest)) 58 return read; 59 60 read = count; 61 return read; 62} 63 64void Px3MemInStream::seek(physx::PxU32 pos) 65{ 66 mMemStream.setPosition(pos); 67} 68 69physx::PxU32 Px3MemInStream::getLength() const 70{ 71 return mMemStream.getStreamSize(); 72} 73 74physx::PxU32 Px3MemInStream::tell() const 75{ 76 return mMemStream.getPosition(); 77} 78 79Px3ConsoleStream::Px3ConsoleStream() 80{ 81} 82 83Px3ConsoleStream::~Px3ConsoleStream() 84{ 85} 86 87void Px3ConsoleStream::reportError(physx::PxErrorCode::Enum code, const char* message, const char* file, int line) 88{ 89 Con::warnf( "PhysX Warning: %s(%d) : %s", file, line, message ); 90} 91