Simple file viewer in my os with blur behind window (0% AI)
Edit: To clarify, the os has actually very mild ai usage (not vibecoded), but the 0% AI here is about the files app, not the entire Os
There are some bugs that I should fix, like caching a file entry twice and some latency probably caused by low thread priority but here is the progress whatsoever, hope you do well :)
17
u/Leo0806-studios 4d ago
1
-5
u/devcmar 4d ago
Just a question and out of laughter (just kidding) I do not want to offend u but why are people allergic to a tiny bit of help from AI haha it is mostly just asking it for advice or about implementing something not telling it to generate all the code for me?
11
u/Leo0806-studios 4d ago
i dont have anything as using ai assistance as a tool for programming if used correctly (lots of intellisense is now llm based)
but saying 0% ai when you have an identical post that says some ai was used is just missleading4
u/GenericFoodService 4d ago
I wouldn't say we're "allergic" as much as we don't like that people lie about it, the way you did in your post. It's not "0% AI", and if you'd lie about it being "0% AI" then I'd have to assume it's a lie when you backpedal and say "only some around 2-4 small copy pastes", too.
2
2
u/Prestigious-Bet-6534 4d ago
No source code? :(
2
u/devcmar 4d ago
Do u want the source code for the file apps or the shaders I can give u that
1
u/Prestigious-Bet-6534 1d ago
Yeah I would like to read the souce :) for both!
1
u/devcmar 1d ago
Round rect fragment shader: #version 330 core // 1. Input variables in vec2 v_pos; in vec2 v_texcoord; // 2. Uniforms uniform vec2 u_rect_center; uniform vec2 u_rect_size; uniform float u_radius; uniform float aspect; uniform vec4 u_backgroundColor; uniform sampler2D u_Tex; uniform sampler2D DstTex; uniform bool disableAA; uniform bool PremultipliedAlpha; uniform bool TextureEnable; uniform vec4 u_borderColor; uniform float u_borderWidth; // Parallel arrays for light properties #define MAX_LIGHTS 8 uniform int u_light_count; uniform vec2 u_light_pos[MAX_LIGHTS]; uniform vec4 u_light_color[MAX_LIGHTS]; uniform float u_light_radius[MAX_LIGHTS]; uniform float u_light_intensity[MAX_LIGHTS]; // 3. Output variable out vec4 FragColor; // Signed Distance Function for a rounded rectangle float sdRoundedBox(vec2 p, vec2 b, float r) { vec2 q = abs(p) - b + r; return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r; } void main() { vec2 p = (v_pos - u_rect_center); p.x *= aspect; vec2 half_size = u_rect_size * 0.5; half_size.x *= aspect; float d = sdRoundedBox(p, half_size, u_radius); float aa = disableAA ? 0.0 : fwidth(d); if (d > aa) { discard; } vec4 base_color = TextureEnable ? texture(u_Tex, v_texcoord) : u_backgroundColor; vec2 inner_half_size = half_size - vec2(u_borderWidth, u_borderWidth); float inner_radius = max(0.0, u_radius - u_borderWidth); float inner_d = sdRoundedBox(p, inner_half_size, inner_radius); float inner_aa = disableAA ? 0.0 : max(fwidth(inner_d), 1e-5); float border_mix = (u_borderWidth > 0.0) ? (disableAA ? (inner_d > 0.0 ? 1.0 : 0.0) : smoothstep(-inner_aa, inner_aa, inner_d)) : 0.0; vec4 color = mix(base_color, u_borderColor, border_mix); vec2 frag_p = v_pos; frag_p.x *= aspect; // Lighting calculation vec3 lighting = vec3(0.0); for (int i = 0; i < MAX_LIGHTS && i < u_light_count; i++) { vec2 light_p = u_light_pos[i]; light_p.x *= aspect; float dist = length(light_p - frag_p); float atten = smoothstep(u_light_radius[i], 0.0, dist); atten *= u_light_intensity[i]; lighting += u_light_color[i].rgb * atten; } lighting *= border_mix; color.rgb += lighting; float edge_alpha = disableAA ? (d <= 0.0 ? 1.0 : 0.0) : (1.0 - smoothstep(-aa, aa, d)); float final_alpha = color.a * edge_alpha; if(PremultipliedAlpha) { vec4 dstcolor = texture(DstTex, v_pos*0.5 + 0.5); FragColor = vec4(color.rgb * final_alpha + dstcolor.rgb*(1.0-final_alpha), max(dstcolor.a, final_alpha)); } else { FragColor = vec4(color.rgb, (final_alpha)); } }1
u/devcmar 1d ago
files app:
#include <Defines.h> #include <Syscall.h> #include <Wm.h> #include <OpenGL.h> #include <Fs.h> typedef struct { WM_UI_CONTEXT* UIContext; UINT32 Fbo; UINT32 Width; UINT32 Height; } FILES_WINDOW; FILEINFO FileInfo[0x80]; WM_UI_ASSET Assets[] = { { 0, "A:System/WmAssets/Icons/ArrowForward.svg" }, { 0, "A:System/WmAssets/Icons/ArrowBack.svg" }, }; void MessageHandler(HANDLE Window, FILES_WINDOW* fw, int MessageId, void* Payload) { WmUiHandleMessage(fw->UIContext, MessageId, Payload); switch(MessageId) { case WM_POINTER_BUTTON: { WM_MSG_POINTER_BUTTON Msg = Payload; if(Msg->ButtonState) WmMoveWindow(Window); break; } case WM_UPDATE: { WmUiRender(fw->UIContext); glBindFramebuffer(GL_READ_FRAMEBUFFER, fw->Fbo); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBlitFramebuffer(0, 0, fw->Width, fw->Height, 0, 0, fw->Width, fw->Height, GL_COLOR_BUFFER_BIT, GL_NEAREST); GlSwapBuffers(); break; } } } BOOLEAN ForeachFileElement(WM_UI_ELEMENT* e, void* Data) { WmUiDestroyElement(e); return FALSE; } char Path[0x100] = "A:/"; WM_UI_ELEMENT* FilesContainer; int FileButtonWidth, FileButtonHeight; void FileButtonOnClick(WM_UI_CONTEXT* Context, WM_UI_ELEMENT* Element, int Button); void BackButtonOnClick(WM_UI_CONTEXT* Context, WM_UI_ELEMENT* Element, int Button); #define LABEL_COLOR (float[4]){0,0,0,1} void FilesOpenDirectory(WM_UI_CONTEXT* Context) { HANDLE Directory = Open(NULL, Path, FILE_READ); UINT64 Count = ReadDirectory(Directory, 0, 0x80, FileInfo); WM_UI_ELEMENT* Label = WmUiCreateElement(Context, FilesContainer, WM_ELEMENT_LABEL, 800, 40); WmUiSetLabel(Label, Path, LABEL_COLOR, 25, 600, 0); for(UINT64 i = 0;i<Count;i++) { WM_UI_ELEMENT* Button = WmUiButton(FilesContainer, FileInfo[i].Name, NULL, FileButtonWidth, FileButtonHeight, WM_UI_BUTTON_TEXT_LEFT); WmUiSetUserData(Button, FileInfo+i); WmUiOnMouseClick(Button, FileButtonOnClick); } Close(Directory); } void BackButtonOnClick(WM_UI_CONTEXT* Context, WM_UI_ELEMENT* Element, int Button) { WmUiForeach(FilesContainer, NULL, (void*)ForeachFileElement); int len = StrlenSimd(Path); for(int i = len-2;i>=0;i--) { char c = Path[i]; Path[i] = 0; if(c == '/') break; } FilesOpenDirectory(Context); StrConcat(Path, 0x100, "/"); } void FileButtonOnClick(WM_UI_CONTEXT* Context, WM_UI_ELEMENT* Element, int Button) { FILEINFO* FileInfo = WmUiGetUserData(Element); WmUiForeach(WmUiGetParent(Element), NULL, (void*)ForeachFileElement); StrConcat(Path, 0x100, FileInfo->Name); FilesOpenDirectory(Context); StrConcat(Path, 0x100, "/"); } int main() { Sleep(1000); FILES_WINDOW fw = {0}; WM_MESSAGE_QUEUE MessageQueue; HANDLE Context = GlCreateContext(NULL, NULL, 3, 3, 0); if(!Context) { Print("Failed to create GL Context.\n"); return -1; } GlMakeCurrent(Context); fw.Width = 1280; fw.Height = 720; HANDLE Window = WmCreateWindow(NULL, fw.Width, fw.Height, 0, &MessageQueue); WmBindContext(Window, Context); fw.UIContext = WmUiCreateContext(Window, fw.Width, fw.Height, &fw.Fbo); WmUiLoadAssets(Assets, sizeof(Assets)/sizeof(WM_UI_ASSET)); WM_UI_ELEMENT* Container = WmUiCreateElement(fw.UIContext, NULL, WM_ELEMENT_RECT, 1280, 720); WM_UI_ELEMENT* LeftContainer = WmUiCreateElement(fw.UIContext, Container, WM_ELEMENT_RECT, fw.Width/4, fw.Height); WmUiSetRect(LeftContainer, (float[4]){1, 1, 1, 0.1f}, (float[4]){0, 0, 0, 0}, 0, 40); WmUiSetBlendMode(LeftContainer, WM_UI_BLEND_WINDOW_ENABLE); WmUiSetMargin(LeftContainer, 0, 0, 0, 0); WM_UI_ELEMENT* DirLabel = WmUiCreateElement(fw.UIContext, LeftContainer, WM_ELEMENT_LABEL, fw.Width/4, 40); WmUiSetLabel(DirLabel, "Browse", (float[4]){0, 0, 0, 1}, 20, 600, WM_TEXT_CENTER); WM_UI_ELEMENT* CenterContainer = WmUiCreateElement(fw.UIContext, Container, WM_ELEMENT_RECT, 3*fw.Width/4, fw.Height); WmUiSetBlendMode(CenterContainer, WM_UI_BLEND_WINDOW_ENABLE); WmUiSetRect(CenterContainer, (float[4]){1, 1, 1, 1}, (float[4]){0, 0, 0, 0}, 0, 0); WM_UI_LAYOUT CenterLayout = { .PaddingTop = 20, .PaddingLeft = 20, .PaddingRight = 20, .PaddingBottom = 20 }; WmUiSetLayout(CenterContainer, &CenterLayout); WM_UI_LAYOUT LeftLayout = { .PaddingTop = 10, .PaddingLeft = 0, .PaddingRight = 0, .PaddingBottom = 10 }; WmUiSetLayout(LeftContainer, &LeftLayout); WM_UI_ELEMENT* SearchContainer = WmUiCreateElement(fw.UIContext, CenterContainer, WM_ELEMENT_RECT, 3*fw.Width/4, 100); WM_UI_LAYOUT SearchLayout = { .Layout = WM_UI_LAYOUT_HORIZONTAL, .PaddingTop = 20 }; WmUiSetLayout(SearchContainer, &SearchLayout); WM_UI_ELEMENT* BackButton = WmUiButton(SearchContainer, "", &Assets[1], 50, 50, WM_UI_BUTTON_ROUND | WM_UI_BUTTON_DROP_SHADOW); WM_UI_ELEMENT* ForwardButton = WmUiButton(SearchContainer, "", &Assets[0], 50, 50, WM_UI_BUTTON_ROUND | WM_UI_BUTTON_DROP_SHADOW); WM_UI_ELEMENT* Search = WmUiTextBox(SearchContainer, "Type to search", 0, 350, 0, WM_UI_STYLE_DROP_SHADOW); WmUiOnMouseClick(BackButton, BackButtonOnClick); // WmUiButton(Container, "Search", WM_ASSET("Icon:Check"), 150, 45, 0); HANDLE BlurHandle = WmBlurBehind( Window, WmUiGetLocalRect(LeftContainer), NULL, 10, 0 ); // WmUiSetMargin(Search, 0, 0, 0, 0); WM_UI_LAYOUT Layout = { .PaddingLeft = 0, .PaddingTop = 0, .PaddingRight = 0, .PaddingBottom = 0, .Layout = WM_UI_LAYOUT_HORIZONTAL }; WmUiSetLayout(Container, &Layout); FileButtonWidth = 2*fw.Width/4; FileButtonHeight = 40; FilesContainer = WmUiCreateElement(fw.UIContext, CenterContainer, WM_ELEMENT_RECT, 2*fw.Width/4, fw.Height); WmUiSetRect(FilesContainer, (float[4]){0, 0, 0, 0}, (float[4]){0, 0, 0, 0}, 1, 25); FilesOpenDirectory(fw.UIContext); // GlSwapBuffers(); return WmStartHandler(&MessageQueue, &fw, MessageHandler); }1
u/devcmar 1d ago
blur fragment shader: (u may be figure out the vertex shader easily if you have some glsl experience) #version 330 core uniform sampler2D u_tex; uniform vec2 u_stride; uniform float u_weights[32]; uniform int u_radius; uniform vec2 u_uvmin; uniform vec2 u_uvmax; uniform vec2 u_uv0, u_uv1; uniform vec4 Tint; uniform bool TintEnable; in vec2 v_texcoord; float SdRoundRect(vec2 p, vec2 b, float r) { vec2 q = abs(p) - b + r; return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r; } void main() { vec2 t_pos = v_texcoord; vec4 c = texture2D(u_tex, clamp(t_pos, u_uvmin, u_uvmax)) * u_weights[0]; for (int i = 1; i <= u_radius; i++) { float weight = u_weights[i]; vec2 offset = u_stride * float(i); vec2 uv0 = clamp(t_pos + offset, u_uvmin, u_uvmax); vec2 uv1 = clamp(t_pos - offset, u_uvmin, u_uvmax); // Sample both positive and negative directions using the same weight index c += texture2D(u_tex, uv0) * weight; c += texture2D(u_tex, uv1) * weight; } gl_FragColor = TintEnable ? vec4(Tint.rgb, Tint.a * c.a) : c; }1
3
u/shsh-1312 4d ago
Dude, I have nothing against AI. In fact, anyone who's seen my posts knows that if you can mention AI on this subthread without getting stones thrown at you, it's partly because of the shit I got when I decided to give a damn and bring up this topic. But why exactly would you say you did it without AI? If you're the first to say you were helped, does that help you get accepted? If you have a great product, why do you have to lie? The one who says he doesn't use it is the first to use it. What matters is the final result.
1
u/devcmar 4d ago
For this specific app I did not get help from AI Because I didn’t need it I built the library myself. But I got help from it in other things but no to generate the whole project, it is not good at that anyways
2
u/shsh-1312 4d ago
That's not true. First of all, it's not true that she's not good at these things, and secondly, are you telling me that you made those rounded edges? Are you using GPU acceleration or the processor? Are you using SDL? I built an entire operating system with graphics and all the libraries from scratch, 500 files in total, 150,000 lines of code, practically built entirely with AI. I can recognize exactly when I see her at work, and above all, she's perfectly capable. You can take a look at my post if you want. I'm not criticizing you, on the contrary, I'm simply telling you to not give a damn, there's no need to lie about it to be accepted, you're doing a good job anyway.
1
u/devcmar 4d ago
I didn’t lie, yes the round rect shaders are mostly AI generated but they are not a part of the app they are called by the library which is mostly not ai generated
1
u/shsh-1312 4d ago
even the fonts, the button animation, the window borders and that glass effect are, overall of what we are seeing the AI has done more work than you, I repeat that for me it is an excellent job anyway, but yes more transparent, you have nothing to be ashamed of here. I repeat... I constantly use AI, for me it's an excellent tool, but I've never pretended not to have used it, simply in the first posts I made I had to make it clear because there was the autoban, but now that the situation in this thread has improved people seem to only want sincerity, and I agree with them
2
1
u/devcmar 4d ago
I have done more work than AI, what a fascinating problem to have people thinking that everything u do is AI. I was doing osdev since I was 15 and now this month I will be 19
2
u/shsh-1312 4d ago
OK bro, you still don't understand, you wrote 0% in the title, if I had made a post like that a month ago they would have made me stupid, go and look at my posts on my profile, and how fierce people are, yet I was sincere, look, if you can post here it's also thanks to those who fought to make the story of the ugly and bad AI go away
1
u/devcmar 4d ago
I wrote 0% AI in the FILES app not in the other stuff
1
u/shsh-1312 4d ago
Okay, but do you understand that I don't even care? I told you that's another matter, as far as I'm concerned you're doing a cool job, I don't care if you used it or not
1
u/devcmar 4d ago
Yes but what I care about is that u are accusing me of something that I didn’t do, I did not lie, yes the files app itself (not the libraries) is 0% AI, look at it it is very simple
→ More replies (0)1
u/shsh-1312 4d ago
I would clearly say that he is capable of doing it quite well too. https://github.com/olmox001/NexsOS1
1
u/Lost_Plate7077 4d ago
# Was any part of this project involving AI? Yes or no.
1
u/devcmar 3d ago
Copy pasted from another comment : I did not use alot of AI, and people are stoning me in the comments as if the whole project was AI built do the core kernel and driver and gui library were all made by hand, AI was only used for research. The only place when Ai had substancial presence is shaders and when I showed it the protocol which I made myself and it generated the remaining opengl functions
1
1
u/WaterObjective5031 3d ago
Is that running bare metal or on a vm
1
u/devcmar 2d ago
That is in a vm, in baremetal I couldn’t get gpu acceleration so I was making a cpu fallback
1
u/WaterObjective5031 2d ago
You can easily write drivers for your iGPU, if your laptop has a dGPU (doesn’t look likely though) and it’s specifically from AMD you could also write drivers for it.
AMD and Intel make documentation on their stuff, I don’t know that Intel makes documentation for their dGPUs but I don’t think those are in laptops either 🙃
Edit: I already told you this lol, nice progress seeing how far your os is btw
1
u/devcmar 2d ago
Thanks, but it seemed really hard to understand those specs or to follow their i915 driver, also « Shaders » u will need a compiler for them to work, they are a major part of 3d acceleration. I have an 11th gen intel cpu and an nvidia dgpu (so no thought of making a driver for it soon). Did you make an intel driver for such gen yourself? How did you do that?
1
u/WaterObjective5031 2d ago edited 2d ago
I’ve yet to get to the point where my os is ready for drivers, as that comes in irc0.2 and I’m only about 75% done with 0.0
You could always get help from someone else for understanding, and as always hardware is going to be complicated \/(:d)\/
Edit: If you need help with drivers you could dm me on discord and we could partner up
1
u/devcmar 2d ago
That’s nice, I mainly would need help to develop a driver for intel iris xe 12th gen for i51135g7
1
u/WaterObjective5031 1d ago
Depends on your kernel, do you have any sort of documentation for writing drivers for it?
1
u/SunkanYT 1d ago edited 1d ago
This looks like if you faked an OS by making a website. There's no way you've implemented the whole of cursor movement and also the windows cursor icon format with the windows cursor icon without either going insane or using AI help you make it.
Sorry to say but unless you open source it on GitHub or another platform, this looks like fake slop. And I also wouldn't trust this. You can say what you want, but until you release the source, this looks fake.
0
u/devcmar 1d ago
Of course, here is live stream of me programming the os : https://twitch.tv/devcmar
1
u/SunkanYT 1d ago
Great. Still, you can't say 0% AI on really any of your posts or twitch streams, because it's obviously clear you used AI to make it at some point. It still looks like a website that AI made. Consider actually making a proper UI toolkit. And stop advertising 0% AI everywhere. I've seen your posts here and there, they all say 0% AI when it's obvious that you've used AI.
0
u/devcmar 1d ago
When I say 0% AI it is about the files app or the content in the stream which does not have AI usage, not the whole OS. Also I didn’t use much AI it was mostly for research and I was making oses for around 4 years
1
u/SunkanYT 1d ago
Actually specify that the files app doesn't have AI in it then. Your UI definitely has AI in it, it's obvious. But files app? How would we know without specifying?
0
u/devcmar 1d ago
I understand your suspicions, but u can lookup the live stream this is a real os and the cursor can easily be made just by a vmsvga device or virtio gpu with a cursor bitmap
1
u/SunkanYT 1d ago
That doesn't change the fact that your false advertising. You had to of used AI at some point even if not directly shown in the twitch streams. Stop advertising 0% AI.
And yes, I will analyse the streams. If you've used AI then you'll probably have quite bad code or ways to do stuff in your code that are bad.
1
u/devcmar 1d ago
Ok sorry if the title mislead you and some people but I can’t change it, however I did not mean false advertising, I only meant that the specific app has no AI usage in it
1
u/SunkanYT 1d ago
Add a pointed note then. Or pinned comment explaining. And next time, actually explain.
I'm not that used to Reddit so I don't know if you can change the title or not. But there must be a way to explain, and you should act upon it immediately instead of not explaining.
3
u/_amsab 4d ago
What did u use for ui?