root/OpenSceneGraph/trunk/src/osgPlugins/ive/FadeText.cpp @ 13041

Revision 13041, 1.8 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1/**********************************************************************
2 *
3 *    FILE:            FadeText.cpp
4 *
5 *    DESCRIPTION:    Read/Write osgText::FadeText in binary format to disk.
6 *
7 *    CREATED BY:        Auto generated by iveGenerator
8 *                    and later modified by Rune Schmidt Jensen.
9 *
10 *    HISTORY:        Created 27.3.2003
11 *
12 *    Copyright 2003 VR-C
13 **********************************************************************/
14
15#include "Exception.h"
16#include "FadeText.h"
17#include "Text.h"
18#include "Drawable.h"
19#include "Object.h"
20
21#include <osgDB/FileUtils>
22#include <osgDB/FileNameUtils>
23#include <osg/Notify>
24
25using namespace ive;
26
27void FadeText::write(DataOutputStream* out){
28    // Write FadeText's identification.
29    out->writeInt(IVEFADETEXT);
30    // If the osg class is inherited by any other class we should also write this to file.
31    osgText::Text*  text = dynamic_cast<osgText::Text*>(this);
32    if(text){
33        ((ive::Text*)(text))->write(out);
34    }
35    else
36        out_THROW_EXCEPTION("FadeText::write(): Could not cast this osgText::FadeText to an osgText::Tex.");
37
38    // Write FadeText's properties.
39    out->writeFloat(getFadeSpeed());
40}
41
42void FadeText::read(DataInputStream* in){
43    // Read FadeText's identification.
44    int id = in->peekInt();
45    if(id == IVEFADETEXT){
46
47        id = in->readInt();
48        // If the osg class is inherited by any other class we should also read this from file.
49        osgText::Text*  text = dynamic_cast<osgText::Text*>(this);
50        if(text){
51            ((ive::Text*)(text))->read(in);
52        }
53        else
54            in_THROW_EXCEPTION("FadeText::read(): Could not cast this osgText::FadeText to an osgText::Text.");
55
56        setFadeSpeed(in->readFloat());
57    }
58    else{
59        in_THROW_EXCEPTION("FadeText::read(): Expected FadeText identification.");
60    }
61}
Note: See TracBrowser for help on using the browser.