Files
firestorm/Gameleap/code/mw4/Libraries/3dsmax4/Include/interval.h
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

60 lines
2.0 KiB
C++

/**********************************************************************
*<
FILE: interval.h
DESCRIPTION: Defines TimeValue and Interval Classes
CREATED BY: Rolf Berteig
HISTORY: created 13 September 1994
950818 - Added methods for setting start/end individually (gus)
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef _INTERVAL_H_
#define _INTERVAL_H_
class Interval {
private:
TimeValue start;
TimeValue end;
public:
/*
Constructors:
*/
CoreExport Interval( TimeValue s, TimeValue e );
Interval() { SetEmpty(); }
int operator==( const Interval& i ) { return( i.start==start && i.end==end ); }
CoreExport int InInterval(const TimeValue t);
int InInterval(const Interval interval) { return InInterval( interval.Start() ) && InInterval( interval.End() ); }
int Empty() { return (start == TIME_NegInfinity) && (end == TIME_NegInfinity); }
void Set ( TimeValue s, TimeValue e ) { start = s; end = e; }
void SetStart ( TimeValue s ) { start = s; }
void SetEnd ( TimeValue e ) { end = e; }
void SetEmpty() { start = TIME_NegInfinity; end = TIME_NegInfinity; }
void SetInfinite() { start = TIME_NegInfinity; end = TIME_PosInfinity; }
void SetInstant(const TimeValue t) { start = end = t; }
TimeValue Start() const { return start; }
TimeValue End() const { return end; }
TimeValue Duration() const { return end-start+TimeValue(1); } // end points included
// intersection of intervals
CoreExport Interval operator&(const Interval i) const;
Interval& operator&=(const Interval i) { return (*this = (*this&i)); }
Interval& operator+=(const TimeValue t) { if (t<start) start=t; if (t>end) end=t; return *this; }
};
#define FOREVER Interval(TIME_NegInfinity, TIME_PosInfinity)
#define NEVER Interval(TIME_NegInfinity, TIME_NegInfinity)
#endif