"Fossies" - the Fresh Open Source Software Archive

Member "aqsis-1.8.2/thirdparty/partio/src/src/tests/testcache.cpp" (24 Aug 2012, 2355 Bytes) of package /linux/privat/aqsis-1.8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2 PARTIO SOFTWARE
    3 Copyright 2010 Disney Enterprises, Inc. All rights reserved
    4 
    5 Redistribution and use in source and binary forms, with or without
    6 modification, are permitted provided that the following conditions are
    7 met:
    8 
    9 * Redistributions of source code must retain the above copyright
   10 notice, this list of conditions and the following disclaimer.
   11 
   12 * Redistributions in binary form must reproduce the above copyright
   13 notice, this list of conditions and the following disclaimer in
   14 the documentation and/or other materials provided with the
   15 distribution.
   16 
   17 * The names "Disney", "Walt Disney Pictures", "Walt Disney Animation
   18 Studios" or the names of its contributors may NOT be used to
   19 endorse or promote products derived from this software without
   20 specific prior written permission from Walt Disney Pictures.
   21 
   22 Disclaimer: THIS SOFTWARE IS PROVIDED BY WALT DISNEY PICTURES AND
   23 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
   24 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
   25 FOR A PARTICULAR PURPOSE, NONINFRINGEMENT AND TITLE ARE DISCLAIMED.
   26 IN NO EVENT SHALL WALT DISNEY PICTURES, THE COPYRIGHT HOLDER OR
   27 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   28 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   29 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   30 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND BASED ON ANY
   31 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   33 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
   34 */
   35 #include <Partio.h>
   36 #include <cassert>
   37 #include <iostream>
   38 
   39 int main(int argc,char* argv[])
   40 {
   41     Partio::ParticlesDataMutable* p=Partio::create();
   42     Partio::ParticleAttribute attr=p->addAttribute("position",Partio::VECTOR,3);
   43     p->addParticle();
   44     float* pos=p->dataWrite<float>(attr,0);
   45     pos[0]=1;pos[1]=2;pos[2]=3;
   46     Partio::write("/tmp/test.bgeo",*p);
   47     p->release();
   48 
   49     Partio::ParticlesInfo* p1=Partio::readCached("/tmp/test.bgeo",false);
   50     Partio::ParticlesInfo* p2=Partio::readCached("/tmp/test.bgeo",false);
   51     assert(p1==p2);
   52     p1->release();p2->release();
   53     Partio::ParticlesInfo* p3=Partio::readCached("/tmp/test.bgeo",false);
   54     p3->release();
   55     //assert(p2!=p3);
   56 
   57     return 0;
   58 }