Unstable & with drawing restored
This commit is contained in:
parent
11402f577a
commit
0f4a67e244
15 changed files with 1004 additions and 31 deletions
|
|
@ -14,7 +14,7 @@ void StrokeGPUHandles::sendDataToGPU(Buffer<StrokePoint>* mPoints) {
|
|||
glBindVertexArray(VertexArrayID);
|
||||
vbo_len = mPoints->size();
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(mPoints[0]) * vbo_len, mPoints->getBuff(), GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(mPoints[0]) * vbo_len, mPoints->getBuff(), GL_DYNAMIC_DRAW);
|
||||
}
|
||||
|
||||
StrokeGPUHandles::~StrokeGPUHandles() {
|
||||
|
|
@ -79,7 +79,7 @@ void Stroke::compress(halnf factor) {
|
|||
}
|
||||
|
||||
if (min_node) {
|
||||
passed_poits.deleteNode(min_node);
|
||||
passed_poits.removeNode(min_node);
|
||||
}
|
||||
} while (min_node);
|
||||
|
||||
|
|
@ -268,19 +268,18 @@ void PencilBrush::sample(Project* proj, Vec2F crs, halnf pressure) {
|
|||
// mStroke->updateGpuBuffers();
|
||||
}
|
||||
|
||||
void PencilBrush::draw(Renderer* render, const Camera* camera) const {
|
||||
void PencilBrush::draw(Renderer* render, const Camera* camera) {
|
||||
if (mStroke) {
|
||||
if (mEnableCompression) {
|
||||
Stroke tempDisplayStroke;
|
||||
tempDisplayStroke.getPoints() = mStroke->getPoints();
|
||||
tempDisplayStroke.setColor(mStroke->getColor());
|
||||
ensureReady(&tempDisplayStroke, camera, 0);
|
||||
mTempDisplayStroke.getPoints() = mStroke->getPoints();
|
||||
mTempDisplayStroke.setColor(mStroke->getColor());
|
||||
ensureReady(&mTempDisplayStroke, camera, 0);
|
||||
|
||||
render->drawStroke(&tempDisplayStroke, camera);
|
||||
render->drawStroke(&mTempDisplayStroke, camera);
|
||||
} else {
|
||||
render->drawStroke(mStroke, camera);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PencilBrush::~PencilBrush() {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ namespace tp {
|
|||
String mType = "equal";
|
||||
Brush() {}
|
||||
virtual void sample(Project* proj, Vec2F crs, halnf pressure) {}
|
||||
virtual void draw(Renderer* render, const Camera* camera) const {}
|
||||
virtual void draw(Renderer* render, const Camera* camera) {}
|
||||
virtual ~Brush() {}
|
||||
};
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ namespace tp {
|
|||
virtual ~PencilBrush();
|
||||
|
||||
virtual void sample(Project* proj, Vec2F crs, halnf pressure) override;
|
||||
virtual void draw(Renderer* render, const Camera* camera) const override;
|
||||
virtual void draw(Renderer* render, const Camera* camera) override;
|
||||
|
||||
private:
|
||||
void ensureReady(Stroke* stroke, const Camera* cam, bool debug = false) const;
|
||||
|
|
@ -148,12 +148,13 @@ namespace tp {
|
|||
halni mMaxPoints = 100;
|
||||
|
||||
Stroke* mStroke = NULL;
|
||||
Stroke mTempDisplayStroke;
|
||||
};
|
||||
|
||||
struct EraserBrush : public Brush {
|
||||
EraserBrush() { mType = "eraser"; }
|
||||
virtual void sample(Project* proj, Vec2F crs, halnf pressure) override {}
|
||||
virtual void draw(Renderer* render, const Camera* camera) const override {}
|
||||
virtual void draw(Renderer* render, const Camera* camera) override {}
|
||||
virtual ~EraserBrush() {}
|
||||
};
|
||||
}
|
||||
|
|
@ -28,14 +28,12 @@ namespace tp {
|
|||
return;
|
||||
}
|
||||
|
||||
halnf pressure = 0.f;
|
||||
|
||||
auto crs = (events.getPos() - this->mArea.pos);
|
||||
crs.x /= this->mArea.z;
|
||||
crs.y /= this->mArea.w;
|
||||
crs = (crs - 0.5) * 2;
|
||||
|
||||
mProject.sample(pressure, this->mArea.w / this->mArea.z, crs);
|
||||
mProject.sample(events.pressure, this->mArea.w / this->mArea.z, crs);
|
||||
|
||||
// mProject.setBackGroundColor();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue