MPQC
3.0.0-alpha
render.h
1
//
2
// render.h
3
//
4
// Copyright (C) 1996 Limit Point Systems, Inc.
5
//
6
// Author: Curtis Janssen <cljanss@limitpt.com>
7
// Maintainer: LPS
8
//
9
// This file is part of the SC Toolkit.
10
//
11
// The SC Toolkit is free software; you can redistribute it and/or modify
12
// it under the terms of the GNU Library General Public License as published by
13
// the Free Software Foundation; either version 2, or (at your option)
14
// any later version.
15
//
16
// The SC Toolkit is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
// GNU Library General Public License for more details.
20
//
21
// You should have received a copy of the GNU Library General Public License
22
// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
//
25
// The U.S. Government is granted a limited license as per AL 91-7.
26
//
27
28
#ifndef _util_render_render_h
29
#define _util_render_render_h
30
31
#include <util/class/class.h>
32
#include <util/render/appearance.h>
33
#include <util/render/material.h>
34
#include <util/render/transform.h>
35
#include <util/render/stack.h>
36
37
namespace
sc
{
38
39
class
RenderedObject;
40
class
AnimatedObject;
41
class
RenderedObjectSet;
42
class
RenderedSphere;
43
class
RenderedPolygons;
44
class
RenderedPolylines;
45
46
class
Render
:
public
DescribedClass
{
47
protected
:
48
Ref<Material>
default_material_;
49
Ref<Appearance>
default_appearance_;
50
Ref<Transform>
default_transform_;
51
52
Stack<Ref<Material>
> material_stack_;
53
Stack<Ref<Appearance>
> appearance_stack_;
54
Stack<Ref<Transform>
> transform_stack_;
55
56
virtual
void
push_material(
const
Ref<Material>
& m);
57
virtual
void
push_appearance(
const
Ref<Appearance>
& a);
58
virtual
void
push_transform(
const
Ref<Transform>
& t);
59
virtual
Ref<Material>
pop_material();
60
virtual
Ref<Appearance>
pop_appearance();
61
virtual
Ref<Transform>
pop_transform();
62
63
public
:
64
Render
();
65
Render
(
const
Ref<KeyVal>
&);
66
virtual
~
Render
();
67
68
Ref<Material>
default_material() {
return
default_material_; }
69
Ref<Appearance>
default_appearance() {
return
default_appearance_; }
70
Ref<Transform>
default_transform() {
return
default_transform_; }
71
void
default_material(
const
Ref<Material>
& m) { default_material_ = m; }
72
void
default_appearance(
const
Ref<Appearance>
& a) {default_appearance_ = a;}
73
void
default_transform(
const
Ref<Transform>
& t) {default_transform_ = t;}
74
75
virtual
void
clear() = 0;
76
77
virtual
void
render(
const
Ref<RenderedObject>
&);
78
virtual
void
animate(
const
Ref<AnimatedObject>
&);
79
80
virtual
void
set(
const
Ref<RenderedObjectSet>
&);
81
virtual
void
sphere(
const
Ref<RenderedSphere>
&);
82
virtual
void
polygons(
const
Ref<RenderedPolygons>
&) = 0;
83
virtual
void
polylines(
const
Ref<RenderedPolylines>
&) = 0;
84
};
85
86
87
class
FileRender
:
public
Render
{
88
protected
:
89
char
* filename_;
90
char
* basename_;
91
std::streambuf *sbuf_;
92
int
delete_sbuf_;
93
int
depth_;
94
95
char
*get_filename(
const
char
*objectname);
96
void
open_sbuf(
const
char
*objectname);
97
void
close_sbuf();
98
public
:
99
FileRender
(
const
char
* filename);
100
FileRender
(std::ostream &o =
ExEnv::out0
());
101
FileRender
(
const
Ref<KeyVal>
&);
102
virtual
~
FileRender
();
103
104
void
clear();
105
106
virtual
void
set_filename(
const
char
*name);
107
virtual
void
set_basename(
const
char
*name);
108
virtual
const
char
*file_extension();
109
};
110
111
}
112
113
#endif
114
115
// Local Variables:
116
// mode: c++
117
// c-file-style: "CLJ"
118
// End:
sc::FileRender
Definition:
render.h:87
sc::Ref
A template class that maintains references counts.
Definition:
ref.h:361
sc::Render
Definition:
render.h:46
sc::Stack
Definition:
stack.h:37
sc::DescribedClass
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition:
class.h:233
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc
Contains all MPQC code up to version 3.
Definition:
mpqcin.h:14
Generated at Sun Jan 26 2020 23:24:02 for
MPQC
3.0.0-alpha using the documentation package
Doxygen
1.8.16.