fix warnings

This commit is contained in:
IlyaShurupov 2024-03-24 10:13:18 +03:00
parent 5d9e270aa9
commit 0fb9326c08
4 changed files with 39 additions and 46 deletions

View file

@ -113,9 +113,9 @@ void obj::ObjectsGUI::setClipboard(obj::Object* obj) {
obj::Object* obj::ObjectsGUI::getClipboard() { return mClipboard; } 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) { if (!type_group) {
type_group = &obj::NDO->type_groups; type_group = &obj::NDO->type_groups;
@ -346,9 +346,9 @@ obj::ObjectsGUI::ViewStackNode obj::ObjectsGUI::interpreterView(obj::Interpreter
auto operand = interp.mOperandsStack.mBuff[i]; auto operand = interp.mOperandsStack.mBuff[i];
tp::alni operand_val = (tp::alni) operand; tp::alni operand_val = (tp::alni) operand;
if (operand_val == NULL) { if (operand_val == 0) {
Text("NULL"); Text("nullptr");
} else if (tp::uint2(operand_val) == NULL) { } else if (tp::uint2(operand_val) == 0) {
Text("2 BYTE VAL : %i", tp::uint2(operand_val)); Text("2 BYTE VAL : %i", tp::uint2(operand_val));
} else { } else {
if (Selectable(operand->type->name, false, 0, ImVec2(100, 0))) { 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()); setClipboard(obj->getLink());
} }
if (ImGui::Selectable("Set Null")) { if (ImGui::Selectable("Set Null")) {
obj->setLink(NULL); obj->setLink(nullptr);
} }
return {}; return {};
@ -907,7 +907,7 @@ void obj::ObjectsGUI::explorer() {
} }
ImGui::PopID(); ImGui::PopID();
if (ImGui::BeginPopupContextItem(NULL, ImGuiPopupFlags_MouseButtonRight)) { if (ImGui::BeginPopupContextItem(nullptr, ImGuiPopupFlags_MouseButtonRight)) {
obj::Object* curretn_object = childo->data->obj; obj::Object* curretn_object = childo->data->obj;
ImGui::Text("%s at %x", curretn_object->type->name, curretn_object); ImGui::Text("%s at %x", curretn_object->type->name, curretn_object);
@ -997,7 +997,7 @@ void obj::ObjectsGUI::explorer() {
ImGui::Text("Preview is Unavaliable"); ImGui::Text("Preview is Unavaliable");
} }
if (new_active != NULL) { if (new_active != 0) {
cd(new_active.obj, new_active.id); cd(new_active.obj, new_active.id);
} }
} }

View file

@ -29,7 +29,9 @@ void skip_param(ByteCode* bytecode) { bytecode->mInstructionIdx += 2; }
uint2 param(ByteCode* bytecode) { return loadConstDataIdx(bytecode); } 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()) { if (!method->mScript->mBytecode.mInstructions.size()) {
return; return;
} }
@ -272,7 +274,7 @@ void Interpreter::stepBytecodeIn() {
// PUSH_ARGS protocol // PUSH_ARGS protocol
uint2 len = 0; uint2 len = 0;
mOperandsStack.push((Object*) len); mOperandsStack.push((Object*) (alni) len);
mOperandsStack.push(nullptr); mOperandsStack.push(nullptr);
// CALL protocol // CALL protocol
@ -320,7 +322,7 @@ void Interpreter::stepBytecodeIn() {
// ... // ...
uint2 len = read_byte(bytecode); uint2 len = read_byte(bytecode);
mOperandsStack.push((Object*) len); mOperandsStack.push((Object*) (alni) len);
mOperandsStack.push(nullptr); mOperandsStack.push(nullptr);
break; 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()) { if (!method->mScript->mBytecode.mInstructions.size()) {
return; return;
} }

View file

@ -61,9 +61,9 @@ void Stroke::compress(halnf factor) {
passed_poits.pushBack(mPoints[idx]); passed_poits.pushBack(mPoints[idx]);
} }
List<StrokePoint>::Node* min_node = NULL; List<StrokePoint>::Node* min_node = nullptr;
do { do {
min_node = NULL; min_node = nullptr;
halnf min_factor = factor; halnf min_factor = factor;
List<StrokePoint>::Node* iter = passed_poits.first()->next; List<StrokePoint>::Node* iter = passed_poits.first()->next;
@ -83,7 +83,6 @@ void Stroke::compress(halnf factor) {
} }
} while (min_node); } while (min_node);
mPoints.reserve(passed_poits.length()); mPoints.reserve(passed_poits.length());
ualni idx = 0; ualni idx = 0;
@ -200,9 +199,7 @@ void Stroke::subdiv(halnf precision, const Camera* cam, halni passes) {
} }
} }
PencilBrush::PencilBrush() { PencilBrush::PencilBrush() { mType = "pencil"; }
mType = "pencil";
}
void PencilBrush::ensureReady(Stroke* stroke, const Camera* cam, bool debug) const { void PencilBrush::ensureReady(Stroke* stroke, const Camera* cam, bool debug) const {
if (stroke->getPoints().size() == 1) { if (stroke->getPoints().size() == 1) {
@ -230,7 +227,7 @@ void PencilBrush::sample(Project* proj, Vec2F crs, halnf pressure) {
if (mStroke) { if (mStroke) {
ensureReady(mStroke, &proj->mCamera); ensureReady(mStroke, &proj->mCamera);
proj->mLayers[proj->mActiveLayer]->strokes.pushBack(mStroke); proj->mLayers[proj->mActiveLayer]->strokes.pushBack(mStroke);
mStroke = NULL; mStroke = nullptr;
} }
if (max_level) { if (max_level) {
@ -331,8 +328,7 @@ Project::~Project() {
Renderer::Renderer(Vec2F size) : Renderer::Renderer(Vec2F size) :
mBuffer(size, 4), mBuffer(size, 4),
mBufferDowncast(size), 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; mMaxSize = size;
mMatrixUniform = mShader.getu("MVP"); mMatrixUniform = mShader.getu("MVP");
@ -374,9 +370,7 @@ void Renderer::renderBegin() {
mBuffer.clear(); mBuffer.clear();
} }
void Renderer::setViewport(RectF viewport) { void Renderer::setViewport(RectF viewport) { mBuffer.setViewport(viewport); }
mBuffer.setViewport(viewport);
}
void Renderer::drawStroke(const Stroke* str, const Camera* camera) { void Renderer::drawStroke(const Stroke* str, const Camera* camera) {
// return; // return;
@ -400,8 +394,9 @@ void Renderer::drawStroke(const Stroke* str, const Camera* camera) {
auto ratio = camera->getRatio(); auto ratio = camera->getRatio();
glUniform1fv(mRatioUniform, 1, &ratio); glUniform1fv(mRatioUniform, 1, &ratio);
auto target = halnf(((camera->getTarget() - camera->getPos()).length() - camera->getNear()) auto target = halnf(
/ (camera->getFar() - camera->getNear())); ((camera->getTarget() - camera->getPos()).length() - camera->getNear()) / (camera->getFar() - camera->getNear())
);
glUniform1fv(mTargetUniform, 1, &target); glUniform1fv(mTargetUniform, 1, &target);
@ -415,7 +410,6 @@ void Renderer::drawStroke(const Stroke* str, const Camera* camera) {
glDisableVertexAttribArray(0); glDisableVertexAttribArray(0);
mShader.unbind(); mShader.unbind();
} }
void Renderer::renderEnd() { void Renderer::renderEnd() {
@ -433,18 +427,13 @@ void Renderer::renderEnd() {
mBufferDowncast.endDraw(); mBufferDowncast.endDraw();
} }
uhalni Renderer::getTextudeId() { uhalni Renderer::getTextudeId() { return mBufferDowncast.texId(); }
return mBufferDowncast.texId();
}
RenderBuffer* Renderer::getBuff() { RenderBuffer* Renderer::getBuff() { return &mBufferDowncast; }
return &mBufferDowncast;
}
void Renderer::setClearCol(RGBA col) { void Renderer::setClearCol(RGBA col) {
mBuffer.mClearCol = col; mBuffer.mClearCol = col;
mBufferDowncast.mClearCol = col; mBufferDowncast.mClearCol = col;
} }
Renderer::~Renderer() { Renderer::~Renderer() {}
}

View file

@ -19,7 +19,7 @@ namespace tp {
struct StrokePoint { struct StrokePoint {
Vec3F pos = { 0, 0, 0 }; Vec3F pos = { 0, 0, 0 };
halnf thickness = NULL; halnf thickness = 0;
}; };
struct StrokeGPUHandles { struct StrokeGPUHandles {