1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version.  The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * OpenSceneGraph Public License for more details.
12 */
13 #include <osg/FrameStamp>
14 
15 using namespace osg;
16 
17 FrameStamp::FrameStamp():Referenced(true)
18 {
19     _frameNumber=0;
20     _referenceTime=0;
21     _simulationTime=0;
22 
23     tm_sec=0;            /* Seconds.        [0-60] (1 leap second) */
24     tm_min=0;            /* Minutes.        [0-59] */
25     tm_hour=0;           /* Hours.          [0-23] */
26     tm_mday=0;           /* Day.            [1-31] */
27     tm_mon=0;            /* Month.          [0-11] */
28     tm_year=0;           /* Year            - 1900.  */
29     tm_wday=0;           /* Day of week.    [0-6] */
30     tm_yday=0;           /* Days in year.   [0-365]    */
31     tm_isdst=0;           /* DST.           [-1/0/1]*/
32 }
33 
34 FrameStamp::FrameStamp(const FrameStamp& fs):Referenced(true)
35 {
36     _frameNumber = fs._frameNumber;
37     _referenceTime = fs._referenceTime;
38     _simulationTime = fs._simulationTime;
39 
40     tm_sec = fs.tm_sec;            /* Seconds.    [0-60] (1 leap second) */
41     tm_min = fs.tm_min;            /* Minutes.    [0-59] */
42     tm_hour = fs.tm_hour;            /* Hours.    [0-23] */
43     tm_mday = fs.tm_mday;            /* Day.        [1-31] */
44     tm_mon = fs.tm_mon;            /* Month.    [0-11] */
45     tm_year = fs.tm_year;            /* Year    - 1900.  */
deleteRenderBuffer(unsigned int contextID,GLuint rb)46     tm_wday = fs.tm_wday;            /* Day of week.    [0-6] */
47     tm_yday = fs.tm_yday;            /* Days in year.[0-365]    */
48     tm_isdst = fs.tm_isdst;            /* DST.        [-1/0/1]*/
49 }
50 
51 FrameStamp::~FrameStamp()
52 {
53 }
54 
55 FrameStamp& FrameStamp::operator = (const FrameStamp& fs)
56 {
flushDeletedRenderBuffers(unsigned int contextID,double,double & availableTime)57     if (this==&fs) return *this;
58 
59     _frameNumber = fs._frameNumber;
60     _referenceTime = fs._referenceTime;
61     _simulationTime = fs._simulationTime;
62 
63     tm_sec = fs.tm_sec;            /* Seconds.    [0-60] (1 leap second) */
64     tm_min = fs.tm_min;            /* Minutes.    [0-59] */
65     tm_hour = fs.tm_hour;            /* Hours.    [0-23] */
66     tm_mday = fs.tm_mday;            /* Day.        [1-31] */
67     tm_mon = fs.tm_mon;            /* Month.    [0-11] */
68     tm_year = fs.tm_year;            /* Year    - 1900.  */
69     tm_wday = fs.tm_wday;            /* Day of week.    [0-6] */
70     tm_yday = fs.tm_yday;            /* Days in year.[0-365]    */
71     tm_isdst = fs.tm_isdst;            /* DST.        [-1/0/1]*/
72 
73     return *this;
74 }
75 
76 void FrameStamp::setCalendarTime(const tm& ct)
77 {
78     tm_sec = ct.tm_sec;            /* Seconds.    [0-60] (1 leap second) */
79     tm_min = ct.tm_min;            /* Minutes.    [0-59] */
80     tm_hour = ct.tm_hour;            /* Hours.    [0-23] */
81     tm_mday = ct.tm_mday;            /* Day.        [1-31] */
82     tm_mon = ct.tm_mon;            /* Month.    [0-11] */
83     tm_year = ct.tm_year;            /* Year    - 1900.  */
84     tm_wday = ct.tm_wday;            /* Day of week.    [0-6] */
85     tm_yday = ct.tm_yday;            /* Days in year.[0-365]    */
discardDeletedRenderBuffers(unsigned int contextID)86     tm_isdst = ct.tm_isdst;            /* DST.        [-1/0/1]*/
87 }
88 
89 void FrameStamp::getCalendarTime(tm& ct) const
90 {
91     ct.tm_sec = tm_sec;            /* Seconds.    [0-60] (1 leap second) */
92     ct.tm_min = tm_min;            /* Minutes.    [0-59] */
93     ct.tm_hour = tm_hour;            /* Hours.    [0-23] */
RenderBuffer()94     ct.tm_mday = tm_mday;            /* Day.        [1-31] */
95     ct.tm_mon = tm_mon;            /* Month.    [0-11] */
96     ct.tm_year = tm_year;            /* Year    - 1900.  */
97     ct.tm_wday = tm_wday;            /* Day of week.    [0-6] */
98     ct.tm_yday = tm_yday;            /* Days in year.[0-365]    */
99     ct.tm_isdst = tm_isdst;            /* DST.        [-1/0/1]*/
100 }
101