Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AppCanvas.cpp « application « intern « freestyle « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 848d8ce08bbf33d31e662d08a43567ed2c9e1d63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

//
//  Copyright (C) : Please refer to the COPYRIGHT file distributed 
//   with this source distribution. 
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
///////////////////////////////////////////////////////////////////////////////

#include "../rendering/GLBlendEquation.h"

#include "AppView.h"
#include "../image/Image.h"
#include "../system/TimeStamp.h"
#include "Controller.h"
#include "../stroke/StrokeRenderer.h"
#include "AppCanvas.h"
#include "../rendering/GLRenderer.h"
#include "../rendering/GLStrokeRenderer.h"
#include "AppConfig.h"

#include "../system/StringUtils.h"

AppCanvas::AppCanvas()
:Canvas()
{
  _pViewer = 0;
	_MapsPath = StringUtils::toAscii( Config::Path::getInstance()->getMapsDir() ).c_str();
}

AppCanvas::AppCanvas(AppView* iViewer)
:Canvas()
{
  _pViewer = iViewer;
}

AppCanvas::AppCanvas(const AppCanvas& iBrother)
:Canvas(iBrother)
{
  _pViewer = iBrother._pViewer;
}

AppCanvas::~AppCanvas()
{
  _pViewer = 0;
}

void AppCanvas::setViewer(AppView *iViewer)
{
  _pViewer = iViewer;
}  

int AppCanvas::width() const 
{
  return _pViewer->width();
}

int AppCanvas::height() const
{
  return _pViewer->height();;
}

BBox<Vec3r> AppCanvas::scene3DBBox() const 
{
  return _pViewer->scene3DBBox();
}

void AppCanvas::preDraw()
{
  Canvas::preDraw();
}

void AppCanvas::init() 
{

	//   static bool firsttime = true;
	//   if (firsttime) {
	// 
	//   _Renderer = new BlenderStrokeRenderer;
	//   if(!StrokeRenderer::loadTextures())
	//     {
	//       cerr << "unable to load stroke textures" << endl;
	//       return;
	//     }
	// 	}
}

void AppCanvas::postDraw()
{
	Canvas::postDraw();
}

void AppCanvas::Erase()
{
  Canvas::Erase();
}

// Abstract

#include "../image/GaussianFilter.h"
void AppCanvas::readColorPixels(int x,int y,int w, int h, RGBImage& oImage) const
{
  //static unsigned number = 0;
  float *rgb = new float[3*w*h];
  //_pViewer->readPixels(x,y,w,h,AppGLWidget::RGB,rgb);
  oImage.setArray(rgb, width(), height(), w,h, x, y, false);
}

void AppCanvas::readDepthPixels(int x,int y,int w, int h, GrayImage& oImage) const
{
  float *rgb = new float[w*h];
  //_pViewer->readPixels(x,y,w,h,AppGLWidget::DEPTH,rgb);
  oImage.setArray(rgb, width(), height(), w,h, x, y, false);
}

void AppCanvas::RenderStroke(Stroke *iStroke) {

	if(_basic)
		iStroke->RenderBasic(_Renderer);
	else
		iStroke->Render(_Renderer);
}


void AppCanvas::update() {}