fix warnings
This commit is contained in:
parent
f8c82b7e29
commit
c6260f7c48
4 changed files with 39 additions and 46 deletions
|
|
@ -113,9 +113,9 @@ void obj::ObjectsGUI::setClipboard(obj::Object* obj) {
|
|||
|
||||
obj::Object* obj::ObjectsGUI::getClipboard() { return mClipboard; }
|
||||
|
||||
obj::Object* imgui_object_create_menu(obj::TypeGroups* type_group = NULL) {
|
||||
obj::Object* imgui_object_create_menu(obj::TypeGroups* type_group = nullptr) {
|
||||
|
||||
obj::Object* newo = NULL;
|
||||
obj::Object* newo = nullptr;
|
||||
|
||||
if (!type_group) {
|
||||
type_group = &obj::NDO->type_groups;
|
||||
|
|
@ -346,9 +346,9 @@ obj::ObjectsGUI::ViewStackNode obj::ObjectsGUI::interpreterView(obj::Interpreter
|
|||
auto operand = interp.mOperandsStack.mBuff[i];
|
||||
tp::alni operand_val = (tp::alni) operand;
|
||||
|
||||
if (operand_val == NULL) {
|
||||
Text("NULL");
|
||||
} else if (tp::uint2(operand_val) == NULL) {
|
||||
if (operand_val == 0) {
|
||||
Text("nullptr");
|
||||
} else if (tp::uint2(operand_val) == 0) {
|
||||
Text("2 BYTE VAL : %i", tp::uint2(operand_val));
|
||||
} else {
|
||||
if (Selectable(operand->type->name, false, 0, ImVec2(100, 0))) {
|
||||
|
|
@ -513,7 +513,7 @@ obj::ObjectsGUI::ViewStackNode obj::ObjectsGUI::linkoView(obj::LinkObject* obj)
|
|||
setClipboard(obj->getLink());
|
||||
}
|
||||
if (ImGui::Selectable("Set Null")) {
|
||||
obj->setLink(NULL);
|
||||
obj->setLink(nullptr);
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
@ -907,7 +907,7 @@ void obj::ObjectsGUI::explorer() {
|
|||
}
|
||||
ImGui::PopID();
|
||||
|
||||
if (ImGui::BeginPopupContextItem(NULL, ImGuiPopupFlags_MouseButtonRight)) {
|
||||
if (ImGui::BeginPopupContextItem(nullptr, ImGuiPopupFlags_MouseButtonRight)) {
|
||||
|
||||
obj::Object* curretn_object = childo->data->obj;
|
||||
ImGui::Text("%s at %x", curretn_object->type->name, curretn_object);
|
||||
|
|
@ -997,7 +997,7 @@ void obj::ObjectsGUI::explorer() {
|
|||
ImGui::Text("Preview is Unavaliable");
|
||||
}
|
||||
|
||||
if (new_active != NULL) {
|
||||
if (new_active != 0) {
|
||||
cd(new_active.obj, new_active.id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@ void skip_param(ByteCode* bytecode) { bytecode->mInstructionIdx += 2; }
|
|||
|
||||
uint2 param(ByteCode* bytecode) { return loadConstDataIdx(bytecode); }
|
||||
|
||||
void Interpreter::exec(obj::MethodObject* method, obj::ClassObject* self, obj::DictObject* globals, InitialierList<GlobalDef> globals2) {
|
||||
void Interpreter::exec(
|
||||
obj::MethodObject* method, obj::ClassObject* self, obj::DictObject* globals, InitialierList<GlobalDef> globals2
|
||||
) {
|
||||
if (!method->mScript->mBytecode.mInstructions.size()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -272,7 +274,7 @@ void Interpreter::stepBytecodeIn() {
|
|||
|
||||
// PUSH_ARGS protocol
|
||||
uint2 len = 0;
|
||||
mOperandsStack.push((Object*) len);
|
||||
mOperandsStack.push((Object*) (alni) len);
|
||||
mOperandsStack.push(nullptr);
|
||||
|
||||
// CALL protocol
|
||||
|
|
@ -320,7 +322,7 @@ void Interpreter::stepBytecodeIn() {
|
|||
// ...
|
||||
|
||||
uint2 len = read_byte(bytecode);
|
||||
mOperandsStack.push((Object*) len);
|
||||
mOperandsStack.push((Object*) (alni) len);
|
||||
mOperandsStack.push(nullptr);
|
||||
break;
|
||||
}
|
||||
|
|
@ -594,7 +596,9 @@ void Interpreter::stepBytecodeIn() {
|
|||
}
|
||||
}
|
||||
|
||||
void Interpreter::execAll(obj::MethodObject* method, obj::ClassObject* self, obj::DictObject* globals, InitialierList<GlobalDef> globals2) {
|
||||
void Interpreter::execAll(
|
||||
obj::MethodObject* method, obj::ClassObject* self, obj::DictObject* globals, InitialierList<GlobalDef> globals2
|
||||
) {
|
||||
if (!method->mScript->mBytecode.mInstructions.size()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Buffer<StrokePoint>& Stroke::getPoints() { return mPoints; }
|
|||
|
||||
const Buffer<StrokePoint>& Stroke::getPoints() const { return mPoints; }
|
||||
|
||||
void Stroke::setColor(const RGBA& col) { mColor = col; }
|
||||
void Stroke::setColor(const RGBA& col) { mColor = col; }
|
||||
|
||||
const RGBA& Stroke::getColor() const { return mColor; }
|
||||
|
||||
|
|
@ -61,9 +61,9 @@ void Stroke::compress(halnf factor) {
|
|||
passed_poits.pushBack(mPoints[idx]);
|
||||
}
|
||||
|
||||
List<StrokePoint>::Node* min_node = NULL;
|
||||
List<StrokePoint>::Node* min_node = nullptr;
|
||||
do {
|
||||
min_node = NULL;
|
||||
min_node = nullptr;
|
||||
halnf min_factor = factor;
|
||||
|
||||
List<StrokePoint>::Node* iter = passed_poits.first()->next;
|
||||
|
|
@ -83,7 +83,6 @@ void Stroke::compress(halnf factor) {
|
|||
}
|
||||
} while (min_node);
|
||||
|
||||
|
||||
mPoints.reserve(passed_poits.length());
|
||||
|
||||
ualni idx = 0;
|
||||
|
|
@ -178,7 +177,7 @@ void Stroke::subdiv(halnf precision, const Camera* cam, halni passes) {
|
|||
continue;
|
||||
}
|
||||
|
||||
SKIP:
|
||||
SKIP:
|
||||
p0 = p1;
|
||||
p1 = p2;
|
||||
p2 = p3;
|
||||
|
|
@ -200,9 +199,7 @@ void Stroke::subdiv(halnf precision, const Camera* cam, halni passes) {
|
|||
}
|
||||
}
|
||||
|
||||
PencilBrush::PencilBrush() {
|
||||
mType = "pencil";
|
||||
}
|
||||
PencilBrush::PencilBrush() { mType = "pencil"; }
|
||||
|
||||
void PencilBrush::ensureReady(Stroke* stroke, const Camera* cam, bool debug) const {
|
||||
if (stroke->getPoints().size() == 1) {
|
||||
|
|
@ -230,7 +227,7 @@ void PencilBrush::sample(Project* proj, Vec2F crs, halnf pressure) {
|
|||
if (mStroke) {
|
||||
ensureReady(mStroke, &proj->mCamera);
|
||||
proj->mLayers[proj->mActiveLayer]->strokes.pushBack(mStroke);
|
||||
mStroke = NULL;
|
||||
mStroke = nullptr;
|
||||
}
|
||||
|
||||
if (max_level) {
|
||||
|
|
@ -331,8 +328,7 @@ Project::~Project() {
|
|||
Renderer::Renderer(Vec2F size) :
|
||||
mBuffer(size, 4),
|
||||
mBufferDowncast(size),
|
||||
mShader("rsc/shaders/stroke.vert", "rsc/shaders/stroke.geom", "rsc/shaders/stroke.frag")
|
||||
{
|
||||
mShader("rsc/shaders/stroke.vert", "rsc/shaders/stroke.geom", "rsc/shaders/stroke.frag") {
|
||||
mMaxSize = size;
|
||||
|
||||
mMatrixUniform = mShader.getu("MVP");
|
||||
|
|
@ -374,12 +370,10 @@ void Renderer::renderBegin() {
|
|||
mBuffer.clear();
|
||||
}
|
||||
|
||||
void Renderer::setViewport(RectF viewport) {
|
||||
mBuffer.setViewport(viewport);
|
||||
}
|
||||
void Renderer::setViewport(RectF viewport) { mBuffer.setViewport(viewport); }
|
||||
|
||||
void Renderer::drawStroke(const Stroke* str, const Camera* camera) {
|
||||
//return;
|
||||
// return;
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
|
|
@ -400,22 +394,22 @@ void Renderer::drawStroke(const Stroke* str, const Camera* camera) {
|
|||
auto ratio = camera->getRatio();
|
||||
glUniform1fv(mRatioUniform, 1, &ratio);
|
||||
|
||||
auto target = halnf(((camera->getTarget() - camera->getPos()).length() - camera->getNear())
|
||||
/ (camera->getFar() - camera->getNear()));
|
||||
auto target = halnf(
|
||||
((camera->getTarget() - camera->getPos()).length() - camera->getNear()) / (camera->getFar() - camera->getNear())
|
||||
);
|
||||
|
||||
glUniform1fv(mTargetUniform, 1, &target);
|
||||
|
||||
// 1st attribute buffer : vertices
|
||||
glEnableVertexAttribArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, str->mGPUHandles.vertexbuffer);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, (void*) 0);
|
||||
|
||||
glDrawArrays(GL_LINE_STRIP, 0, str->mGPUHandles.vbo_len);
|
||||
|
||||
glDisableVertexAttribArray(0);
|
||||
|
||||
mShader.unbind();
|
||||
|
||||
}
|
||||
|
||||
void Renderer::renderEnd() {
|
||||
|
|
@ -433,18 +427,13 @@ void Renderer::renderEnd() {
|
|||
mBufferDowncast.endDraw();
|
||||
}
|
||||
|
||||
uhalni Renderer::getTextudeId() {
|
||||
return mBufferDowncast.texId();
|
||||
}
|
||||
uhalni Renderer::getTextudeId() { return mBufferDowncast.texId(); }
|
||||
|
||||
RenderBuffer* Renderer::getBuff() {
|
||||
return &mBufferDowncast;
|
||||
}
|
||||
RenderBuffer* Renderer::getBuff() { return &mBufferDowncast; }
|
||||
|
||||
void Renderer::setClearCol(RGBA col) {
|
||||
mBuffer.mClearCol = col;
|
||||
mBufferDowncast.mClearCol = col;
|
||||
}
|
||||
|
||||
Renderer::~Renderer() {
|
||||
}
|
||||
Renderer::~Renderer() {}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace tp {
|
|||
|
||||
struct StrokePoint {
|
||||
Vec3F pos = { 0, 0, 0 };
|
||||
halnf thickness = NULL;
|
||||
halnf thickness = 0;
|
||||
};
|
||||
|
||||
struct StrokeGPUHandles {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue