351 lines
33 KiB
HTML
351 lines
33 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="robots" content="noodp" />
|
|
<title>Getting Deja Vu Right Now - LitlToast's Blog</title><meta name="Description" content="I feel like I wrote this code before..."><meta property="og:title" content="Getting Deja Vu Right Now" />
|
|
<meta property="og:description" content="I feel like I wrote this code before..." />
|
|
<meta property="og:type" content="article" />
|
|
<meta property="og:url" content="https://higgy999.github.io/butter-dejavu/" /><meta property="og:image" content="https://higgy999.github.io/butter-smiley-streched.png" /><meta property="og:image" content="https://higgy999.github.io/butter-smiley-projected.png" /><meta property="og:image" content="https://higgy999.github.io/butter-dragon-modelloading.png" /><meta property="article:section" content="posts" />
|
|
<meta property="article:published_time" content="2021-08-08T21:21:30-04:00" />
|
|
<meta property="article:modified_time" content="2022-08-23T15:10:16-04:00" /><meta property="og:site_name" content="LitlToast's Blog" />
|
|
<meta name="twitter:card" content="summary_large_image"/>
|
|
<meta name="twitter:image" content="https://higgy999.github.io/butter-smiley-streched.png"/>
|
|
|
|
<meta name="twitter:title" content="Getting Deja Vu Right Now"/>
|
|
<meta name="twitter:description" content="I feel like I wrote this code before..."/>
|
|
<meta name="application-name" content="LitlToast's Blog">
|
|
<meta name="apple-mobile-web-app-title" content="LitlToast's Blog"><meta name="theme-color" content="#ffffff"><meta name="msapplication-TileColor" content="#da532c"><link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><link rel="manifest" href="/site.webmanifest"><link rel="canonical" href="https://higgy999.github.io/butter-dejavu/" /><link rel="prev" href="https://higgy999.github.io/general-catchingup/" /><link rel="next" href="https://higgy999.github.io/site-redesigned-2022/" /><link rel="stylesheet" href="/css/style.min.css"><link rel="preload" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/all.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
|
<noscript><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/all.min.css"></noscript><link rel="preload" href="https://cdn.jsdelivr.net/npm/animate.css@4.1.1/animate.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
|
<noscript><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@4.1.1/animate.min.css"></noscript><script type="application/ld+json">
|
|
{
|
|
"@context": "http://schema.org",
|
|
"@type": "BlogPosting",
|
|
"headline": "Getting Deja Vu Right Now",
|
|
"inLanguage": "en",
|
|
"mainEntityOfPage": {
|
|
"@type": "WebPage",
|
|
"@id": "https:\/\/higgy999.github.io\/butter-dejavu\/"
|
|
},"image": [{
|
|
"@type": "ImageObject",
|
|
"url": "https:\/\/higgy999.github.io\/butter-dejavu\/featured-image.png",
|
|
"width": 1280 ,
|
|
"height": 720
|
|
}],"genre": "posts","keywords": "Butter Engine, Update, Programming","wordcount": 1004 ,
|
|
"url": "https:\/\/higgy999.github.io\/butter-dejavu\/","datePublished": "2021-08-08T21:21:30-04:00","dateModified": "2022-08-23T15:10:16-04:00","publisher": {
|
|
"@type": "Organization",
|
|
"name": "LitlToast","logo": {
|
|
"@type": "ImageObject",
|
|
"url": "https:\/\/higgy999.github.io\/images\/dark-avatar.png",
|
|
"width": 288 ,
|
|
"height": 288
|
|
}},"author": {
|
|
"@type": "Person",
|
|
"name": "LitlToast"
|
|
},"description": "I feel like I wrote this code before..."
|
|
}
|
|
</script></head>
|
|
<body data-header-desktop="fixed" data-header-mobile="auto"><script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('auto' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : 'auto' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>
|
|
|
|
<div id="mask"></div><div class="wrapper"><header class="desktop" id="header-desktop">
|
|
<div class="header-wrapper">
|
|
<div class="header-title">
|
|
<a href="/" title="LitlToast's Blog">LitlToast</a>
|
|
</div>
|
|
<div class="menu">
|
|
<div class="menu-inner"><a class="menu-item" href="/posts/"> Posts </a><a class="menu-item" href="/categories/"> Projects </a><a class="menu-item" href="/tags/"> Tags </a><a class="menu-item" href="/about/"> About </a><span class="menu-item delimiter"></span><span class="menu-item search" id="search-desktop">
|
|
<input type="text" placeholder="Search titles or contents..." id="search-input-desktop">
|
|
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-desktop" title="Search">
|
|
<i class="fas fa-search fa-fw" aria-hidden="true"></i>
|
|
</a>
|
|
<a href="javascript:void(0);" class="search-button search-clear" id="search-clear-desktop" title="Clear">
|
|
<i class="fas fa-times-circle fa-fw" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="search-button search-loading" id="search-loading-desktop">
|
|
<i class="fas fa-spinner fa-fw fa-spin" aria-hidden="true"></i>
|
|
</span>
|
|
</span><a href="javascript:void(0);" class="menu-item theme-switch" title="Switch Theme">
|
|
<i class="fas fa-adjust fa-fw" aria-hidden="true"></i>
|
|
</a></div>
|
|
</div>
|
|
</div>
|
|
</header><header class="mobile" id="header-mobile">
|
|
<div class="header-container">
|
|
<div class="header-wrapper">
|
|
<div class="header-title">
|
|
<a href="/" title="LitlToast's Blog">LitlToast</a>
|
|
</div>
|
|
<div class="menu-toggle" id="menu-toggle-mobile">
|
|
<span></span><span></span><span></span>
|
|
</div>
|
|
</div>
|
|
<div class="menu" id="menu-mobile"><div class="search-wrapper">
|
|
<div class="search mobile" id="search-mobile">
|
|
<input type="text" placeholder="Search titles or contents..." id="search-input-mobile">
|
|
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-mobile" title="Search">
|
|
<i class="fas fa-search fa-fw" aria-hidden="true"></i>
|
|
</a>
|
|
<a href="javascript:void(0);" class="search-button search-clear" id="search-clear-mobile" title="Clear">
|
|
<i class="fas fa-times-circle fa-fw" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="search-button search-loading" id="search-loading-mobile">
|
|
<i class="fas fa-spinner fa-fw fa-spin" aria-hidden="true"></i>
|
|
</span>
|
|
</div>
|
|
<a href="javascript:void(0);" class="search-cancel" id="search-cancel-mobile">
|
|
Cancel
|
|
</a>
|
|
</div><a class="menu-item" href="/posts/" title="">Posts</a><a class="menu-item" href="/categories/" title="">Projects</a><a class="menu-item" href="/tags/" title="">Tags</a><a class="menu-item" href="/about/" title="">About</a><a href="javascript:void(0);" class="menu-item theme-switch" title="Switch Theme">
|
|
<i class="fas fa-adjust fa-fw" aria-hidden="true"></i>
|
|
</a></div>
|
|
</div>
|
|
</header><div class="search-dropdown desktop">
|
|
<div id="search-dropdown-desktop"></div>
|
|
</div>
|
|
<div class="search-dropdown mobile">
|
|
<div id="search-dropdown-mobile"></div>
|
|
</div><main class="main">
|
|
<div class="container"><div class="toc" id="toc-auto">
|
|
<h2 class="toc-title">Contents</h2>
|
|
<div class="toc-content" id="toc-content-auto"></div>
|
|
</div><article class="page single"><h1 class="single-title animate__animated animate__flipInX">Getting Deja Vu Right Now</h1><div class="post-meta">
|
|
<div class="post-meta-line"><span class="post-author"><a href="/" title="Author" rel="author" class="author"><i class="fas fa-user-circle fa-fw" aria-hidden="true"></i>LitlToast</a></span> <span class="post-category">included in <a href="/categories/butterengine/"><i class="far fa-folder fa-fw" aria-hidden="true"></i>Butter Engine</a></span></div>
|
|
<div class="post-meta-line"><i class="far fa-calendar-alt fa-fw" aria-hidden="true"></i> <time datetime="2021-08-08">2021-08-08</time> <i class="fas fa-pencil-alt fa-fw" aria-hidden="true"></i> 1004 words
|
|
<i class="far fa-clock fa-fw" aria-hidden="true"></i> 5 minutes </div>
|
|
</div><div class="featured-image"><img
|
|
class="lazyload"
|
|
src="/svg/loading.min.svg"
|
|
data-src="/butter-dejavu/featured-image.png"
|
|
data-srcset="/butter-dejavu/featured-image.png, /butter-dejavu/featured-image.png 1.5x, /butter-dejavu/featured-image.png 2x"
|
|
data-sizes="auto"
|
|
alt="/butter-dejavu/featured-image.png"
|
|
title="I feel like I wrote this code before..." /></div><div class="details toc" id="toc-static" data-kept="">
|
|
<div class="details-summary toc-title">
|
|
<span>Contents</span>
|
|
<span><i class="details-icon fas fa-angle-right" aria-hidden="true"></i></span>
|
|
</div>
|
|
<div class="details-content toc-content" id="toc-content-static"><nav id="TableOfContents">
|
|
<ul>
|
|
<li><a href="#base-rendering">Base Rendering</a></li>
|
|
<li><a href="#textures">Textures</a></li>
|
|
<li><a href="#3d-projection">3D Projection</a></li>
|
|
<li><a href="#mod-loading">Mod Loading</a></li>
|
|
<li><a href="#cameras">Cameras</a></li>
|
|
<li><a href="#physics">Physics</a></li>
|
|
<li><a href="#ecs">ECS</a></li>
|
|
<li><a href="#model-loading">Model Loading</a></li>
|
|
</ul>
|
|
</nav></div>
|
|
</div><div class="content" id="content"><p>I feel like I wrote this code before…</p>
|
|
<p>Up until last week, I have been working on the base rendering, textures, and 3D projection which all felt vaguely familiar (<em>cough cough..<a href="https://github.com/higgy999/tf2-opengl" target="_blank" rel="noopener noreffer ">TF2 OpenGL & Java</a>..cough cough</em>). As well as a basis for mod loading.</p>
|
|
<p>But for this week, I didn’t do much (<em>less than I wanted to</em>) but I did do research into physics, cameras, model loading, and entity component systems/ECS.</p>
|
|
<h2 id="base-rendering">Base Rendering</h2>
|
|
<p>I’m really happy with the way this got done. The mesh class makes a bunch of BufferObjects that hold the OpenGL pointers and have base functions for cleanup. This allows very easy derivatives of the Mesh class for whatever they needed.</p>
|
|
<div class="highlight"><div class="chroma">
|
|
<table class="lntable"><tr><td class="lntd">
|
|
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
|
|
</span><span class="lnt"> 2
|
|
</span><span class="lnt"> 3
|
|
</span><span class="lnt"> 4
|
|
</span><span class="lnt"> 5
|
|
</span><span class="lnt"> 6
|
|
</span><span class="lnt"> 7
|
|
</span><span class="lnt"> 8
|
|
</span><span class="lnt"> 9
|
|
</span><span class="lnt">10
|
|
</span><span class="lnt">11
|
|
</span><span class="lnt">12
|
|
</span><span class="lnt">13
|
|
</span><span class="lnt">14
|
|
</span><span class="lnt">15
|
|
</span><span class="lnt">16
|
|
</span><span class="lnt">17
|
|
</span><span class="lnt">18
|
|
</span><span class="lnt">19
|
|
</span><span class="lnt">20
|
|
</span><span class="lnt">21
|
|
</span><span class="lnt">22
|
|
</span><span class="lnt">23
|
|
</span><span class="lnt">24
|
|
</span><span class="lnt">25
|
|
</span><span class="lnt">26
|
|
</span><span class="lnt">27
|
|
</span><span class="lnt">28
|
|
</span><span class="lnt">29
|
|
</span><span class="lnt">30
|
|
</span><span class="lnt">31
|
|
</span><span class="lnt">32
|
|
</span><span class="lnt">33
|
|
</span><span class="lnt">34
|
|
</span><span class="lnt">35
|
|
</span><span class="lnt">36
|
|
</span><span class="lnt">37
|
|
</span><span class="lnt">38
|
|
</span></code></pre></td>
|
|
<td class="lntd">
|
|
<pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">FooMesh</span> <span class="kd">extends</span> <span class="n">Mesh</span> <span class="o">{</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="c1">//...
|
|
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
|
|
</span></span><span class="line"><span class="cl"> <span class="nd">@Override</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="kd">public</span> <span class="kt">void</span> <span class="nf">Create</span><span class="o">()</span> <span class="o">{</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="c1">//Make our VAO
|
|
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">VAO</span> <span class="o">=</span> <span class="k">new</span> <span class="n">BufferObject</span><span class="o">.</span><span class="na">VAO</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">VAO</span><span class="o">.</span><span class="na">Bind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="c1">//Array of non specific BufferObjects
|
|
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">bufferObjects</span><span class="o">[</span><span class="mi">0</span><span class="o">]</span> <span class="o">=</span> <span class="k">new</span> <span class="n">BufferObject</span><span class="o">.</span><span class="na">VBO</span><span class="o">(</span><span class="n">vertices</span><span class="o">,</span> <span class="mi">0</span><span class="o">);</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="c1">//Static classes that inherit BufferObject.
|
|
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">//These are binded and attached with no intervention
|
|
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="n">bufferObjects</span><span class="o">[</span><span class="mi">1</span><span class="o">]</span> <span class="o">=</span> <span class="k">new</span> <span class="n">BufferObject</span><span class="o">.</span><span class="na">CBO</span><span class="o">(</span><span class="n">vertices</span><span class="o">,</span> <span class="mi">1</span><span class="o">);</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">bufferObjects</span><span class="o">[</span><span class="mi">2</span><span class="o">]</span> <span class="o">=</span> <span class="k">new</span> <span class="n">BufferObject</span><span class="o">.</span><span class="na">TBO</span><span class="o">(</span><span class="n">vertices</span><span class="o">,</span> <span class="mi">2</span><span class="o">);</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">IBO</span> <span class="o">=</span> <span class="k">new</span> <span class="n">BufferObject</span><span class="o">.</span><span class="na">IBO</span><span class="o">(</span><span class="n">indices</span><span class="o">);</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">VAO</span><span class="o">.</span><span class="na">Unbind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
|
|
</span></span><span class="line"><span class="cl">
|
|
</span></span><span class="line"><span class="cl"> <span class="c1">//...
|
|
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
|
|
</span></span><span class="line"><span class="cl"> <span class="c1">//Rendering, method calls are pretty self explanatory.
|
|
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">//Inputs aren't final.
|
|
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">//I'm not happy with the Entity being passed in for rendering when Entity's hold meshes
|
|
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="kd">public</span> <span class="kt">void</span> <span class="nf">Render</span><span class="o">(</span><span class="n">Entity</span> <span class="n">entity</span><span class="o">,</span> <span class="n">Camera</span> <span class="n">camera</span><span class="o">)</span> <span class="o">{</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">VAO</span><span class="o">.</span><span class="na">Bind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">enableVertexAttrib</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">IBO</span><span class="o">.</span><span class="na">Bind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">material</span><span class="o">.</span><span class="na">Bind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">shader</span><span class="o">.</span><span class="na">Bind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">SetUniforms</span><span class="o">(</span><span class="n">entity</span><span class="o">,</span> <span class="n">camera</span><span class="o">);</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">DrawElements</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">shader</span><span class="o">.</span><span class="na">Unbind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">material</span><span class="o">.</span><span class="na">Unbind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">IBO</span><span class="o">.</span><span class="na">Unbind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">disableVertexAttrib</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="n">VAO</span><span class="o">.</span><span class="na">Unbind</span><span class="o">();</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
|
|
</span></span><span class="line"><span class="cl"><span class="o">}</span></span></span></code></pre></td></tr></table>
|
|
</div>
|
|
</div>
|
|
<p>Derivatives were made when going through the tutorials but were ultimately removed for the approach of having a better base because having a different Mesh for color and then for texture and then color, but color is never used… It was just a headache for general refactoring and keeping them up to date. A lot of buffer stuff was taken from TF2 in Java & OpenGL.</p>
|
|
<h2 id="textures">Textures</h2>
|
|
<p>Right now, only Albedo is being used and the Material class is nothing but a holder for SlickUtil Textures. I want the Material class to hold all of the textures without order and you leave it to modders to make their shaders and textures line up. I’m only using SlickUtil right now because of the ability to load Textures from class resources rather than the file path. But I’m ultimately going to replace it with my one Texture class because of the [model loader](#Model Loading) not using class resources. Supposedly we can load from resources, and call the function to load model from memory or textures from memory with STB, but I have no idea what the size of the buffers should be.</p>
|
|
<p><figure><a class="lightgallery" href="/images/butter-smiley-streched.png" title="butter-smiley-streched" data-thumbnail="/images/butter-smiley-streched.png" data-sub-html="<h2>Smiley is rendering but streched!</h2><p>butter-smiley-streched</p>">
|
|
<img
|
|
class="lazyload"
|
|
src="/svg/loading.min.svg"
|
|
data-src="/images/butter-smiley-streched.png"
|
|
data-srcset="/images/butter-smiley-streched.png, /images/butter-smiley-streched.png 1.5x, /images/butter-smiley-streched.png 2x"
|
|
data-sizes="auto"
|
|
alt="/images/butter-smiley-streched.png" width="1280" height="720" />
|
|
</a><figcaption class="image-caption">Smiley is rendering but streched!</figcaption>
|
|
</figure></p>
|
|
<h2 id="3d-projection">3D Projection</h2>
|
|
<p>JOML is being used for math and matrix loading and what not but this may change (see <a href="#physics" rel="">the physics section</a>). Once I did this, it kinda made me think about what next. I thought I should focus on an ECS system for holding positions, rotations, etc. which right now is the Entity class that should be derived from but will change (see <a href="#ecs" rel="">the ECS section</a>). This was kind of the thing that spun off into the unproductive week. Although this was not easy at all because the shader was originally going from different matrices in the wrong order.</p>
|
|
<div class="highlight"><div class="chroma">
|
|
<table class="lntable"><tr><td class="lntd">
|
|
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
|
|
</span><span class="lnt"> 2
|
|
</span><span class="lnt"> 3
|
|
</span><span class="lnt"> 4
|
|
</span><span class="lnt"> 5
|
|
</span><span class="lnt"> 6
|
|
</span><span class="lnt"> 7
|
|
</span><span class="lnt"> 8
|
|
</span><span class="lnt"> 9
|
|
</span><span class="lnt">10
|
|
</span><span class="lnt">11
|
|
</span><span class="lnt">12
|
|
</span><span class="lnt">13
|
|
</span><span class="lnt">14
|
|
</span></code></pre></td>
|
|
<td class="lntd">
|
|
<pre tabindex="0" class="chroma"><code class="language-glsl" data-lang="glsl"><span class="line"><span class="cl"><span class="c1">//...</span>
|
|
</span></span><span class="line"><span class="cl">
|
|
</span></span><span class="line"><span class="cl"><span class="k">uniform</span> <span class="n">mat4</span> <span class="n">model</span><span class="p">;</span>
|
|
</span></span><span class="line"><span class="cl"><span class="k">uniform</span> <span class="n">mat4</span> <span class="n">view</span><span class="p">;</span>
|
|
</span></span><span class="line"><span class="cl"><span class="k">uniform</span> <span class="n">mat4</span> <span class="n">projection</span><span class="p">;</span>
|
|
</span></span><span class="line"><span class="cl">
|
|
</span></span><span class="line"><span class="cl"><span class="k">void</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
|
|
</span></span><span class="line"><span class="cl"> <span class="c1">//How it should be: </span>
|
|
</span></span><span class="line"><span class="cl"> <span class="c1">//gl_Position = vec4(position, 1.0) * model * view * projection;</span>
|
|
</span></span><span class="line"><span class="cl">
|
|
</span></span><span class="line"><span class="cl"> <span class="n">gl_Position</span> <span class="o">=</span> <span class="n">projection</span> <span class="o">*</span> <span class="n">view</span> <span class="o">*</span> <span class="n">model</span> <span class="o">*</span> <span class="k">vec4</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">);</span>
|
|
</span></span><span class="line"><span class="cl">
|
|
</span></span><span class="line"><span class="cl"> <span class="c1">//...</span>
|
|
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></td></tr></table>
|
|
</div>
|
|
</div>
|
|
<p>But here it is now working just right:</p>
|
|
<p><figure><a class="lightgallery" href="/images/butter-smiley-projected.png" title="butter-smiley-projected" data-thumbnail="/images/butter-smiley-projected.png" data-sub-html="<h2>Smiley looking better now</h2><p>butter-smiley-projected</p>">
|
|
<img
|
|
class="lazyload"
|
|
src="/svg/loading.min.svg"
|
|
data-src="/images/butter-smiley-projected.png"
|
|
data-srcset="/images/butter-smiley-projected.png, /images/butter-smiley-projected.png 1.5x, /images/butter-smiley-projected.png 2x"
|
|
data-sizes="auto"
|
|
alt="/images/butter-smiley-projected.png" width="1280" height="720" />
|
|
</a><figcaption class="image-caption">Smiley looking better now</figcaption>
|
|
</figure></p>
|
|
<h2 id="mod-loading">Mod Loading</h2>
|
|
<p>The Main class no longer holds any GLFW and is instead held in the Window class, similar to the Mesh class and BufferObjects. Mods right now hold a lot of control over what’s happening. This is still subject to change because while this was going to be a render engine, it quickly became this bigger thing and the order of events right now is: Rendering (v0.1) -> ECS/Physics (v0.2) -> Audio/Sound (v0.3) -> Events/Mod Loading (v0.4). So we aren’t even done with v0.1 and shouldn’t worry about the specifics of this just yet. I just want to emphasize that this is a render engine before a game engine, no matter how much I want the latter.</p>
|
|
<h2 id="cameras">Cameras</h2>
|
|
<p>Absolute pain, never again. Jokes aside I just need to do more research because right now it looks like this:</p>
|
|
<iframe width="560" height="315" src="https://www.youtube.com/embed/anVOEiAujAY" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
|
<p>Should just leave it static right now with no movement…</p>
|
|
<h2 id="physics">Physics</h2>
|
|
<p>Well, more of the research of it for Java. The best solution would be to use <a href="http://jbullet.advel.cz/" target="_blank" rel="noopener noreffer ">JBullet</a>, an outdated port of Bullet. It’s the easiest to set up and using LibGDX port while similar, has no real prebuilt support for shapes and has to be done manually. LWJGL has a binding, but with a client-server architecture which is just terrible for doing anything simple. The only problem is, it uses javax.vecmath while right now I’m using JOML. Managing both is a pain and javax.vecmath has Transform objects, similar to Unity, so I’m gonna need to refractor a lot to use vecmath.</p>
|
|
<h2 id="ecs">ECS</h2>
|
|
<p>For ECS I’m gonna go with <a href="https://github.com/libgdx/ashley" target="_blank" rel="noopener noreffer ">Ashley</a>, a LibGDX solution. It seems like the only one used for games but not hard to build from scratch either, as a concept. Of course, I’m not going to dump a bunch of hours into custom-made when this is good enough. Although I don’t know much in this and it is mainly up to developers on how they should organize this and this may change.</p>
|
|
<h2 id="model-loading">Model Loading</h2>
|
|
<p>This is in no way finished as it is not grabbing all possible data right now, which is kind of driving me nuts but I’m gonna try to ignore it for now until the data being grabbed, like material data, can be used in engine. Here it is so far, using the smiley texture and the dragon model:</p>
|
|
<p><figure><a class="lightgallery" href="/images/butter-dragon-modelloading.png" title="butter-dragon-modelloading" data-thumbnail="/images/butter-dragon-modelloading.png" data-sub-html="<h2>Model loaded!</h2><p>butter-dragon-modelloading</p>">
|
|
<img
|
|
class="lazyload"
|
|
src="/svg/loading.min.svg"
|
|
data-src="/images/butter-dragon-modelloading.png"
|
|
data-srcset="/images/butter-dragon-modelloading.png, /images/butter-dragon-modelloading.png 1.5x, /images/butter-dragon-modelloading.png 2x"
|
|
data-sizes="auto"
|
|
alt="/images/butter-dragon-modelloading.png" width="1280" height="720" />
|
|
</a><figcaption class="image-caption">Model loaded!</figcaption>
|
|
</figure></p></div><div class="post-footer" id="post-footer">
|
|
<div class="post-info">
|
|
<div class="post-info-line">
|
|
<div class="post-info-mod">
|
|
<span>Updated on 2022-08-23 <a class="git-hash" href="https://github.com/higgy999/higgy999.github.io/commit/176375515f15c94950184256ef64edc4f048643d" target="_blank" title="commit by Litl Toast(joshuafhiggins@gmail.com) 176375515f15c94950184256ef64edc4f048643d: Regular Files">
|
|
<i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>1763755</a></span>
|
|
</div></div>
|
|
<div class="post-info-line">
|
|
<div class="post-info-md"><span>
|
|
<a class="link-to-markdown" href="/butter-dejavu/index.md" target="_blank">Read Markdown</a>
|
|
</span></div>
|
|
<div class="post-info-share">
|
|
<span><a href="javascript:void(0);" title="Share on Twitter" data-sharer="twitter" data-url="https://higgy999.github.io/butter-dejavu/" data-title="Getting Deja Vu Right Now" data-via="ModsToasty" data-hashtags="Butter Engine,Update,Programming"><i class="fab fa-twitter fa-fw" aria-hidden="true"></i></a><a href="javascript:void(0);" title="Share on Reddit" data-sharer="reddit" data-url="https://higgy999.github.io/butter-dejavu/"><i class="fab fa-reddit fa-fw" aria-hidden="true"></i></a></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="post-info-more">
|
|
<section class="post-tags"><i class="fas fa-tags fa-fw" aria-hidden="true"></i> <a href="/tags/butter-engine/">Butter Engine</a>, <a href="/tags/update/">Update</a>, <a href="/tags/programming/">Programming</a></section>
|
|
<section>
|
|
<span><a href="javascript:void(0);" onclick="window.history.back();">Back</a></span> | <span><a href="/">Home</a></span>
|
|
</section>
|
|
</div>
|
|
|
|
<div class="post-nav"><a href="/general-catchingup/" class="prev" rel="prev" title="Catching Up & Centralizing"><i class="fas fa-angle-left fa-fw" aria-hidden="true"></i>Catching Up & Centralizing</a>
|
|
<a href="/site-redesigned-2022/" class="next" rel="next" title="I Redesigned the Site">I Redesigned the Site<i class="fas fa-angle-right fa-fw" aria-hidden="true"></i></a></div>
|
|
</div>
|
|
</article></div>
|
|
</main><footer class="footer">
|
|
<div class="footer-container"><div class="footer-line">Powered by <a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo 0.111.3">Hugo</a> | Theme - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt 0.2.11"><i class="far fa-kiss-wink-heart fa-fw" aria-hidden="true"></i> LoveIt</a>
|
|
</div><div class="footer-line" itemscope itemtype="http://schema.org/CreativeWork"><i class="far fa-copyright fa-fw" aria-hidden="true"></i><span itemprop="copyrightYear">2021 - 2023</span><span class="author" itemprop="copyrightHolder"> <a href="/" target="_blank">LitlToast</a></span></div>
|
|
</div>
|
|
</footer></div>
|
|
|
|
<div id="fixed-buttons"><a href="#" id="back-to-top" class="fixed-button" title="Back to Top">
|
|
<i class="fas fa-arrow-up fa-fw" aria-hidden="true"></i>
|
|
</a><a href="#" id="view-comments" class="fixed-button" title="View Comments">
|
|
<i class="fas fa-comment fa-fw" aria-hidden="true"></i>
|
|
</a>
|
|
</div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lightgallery@2.5.0/css/lightgallery-bundle.min.css"><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/autocomplete.js@0.38.1/dist/autocomplete.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lunr@2.3.9/lunr.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lazysizes@5.3.2/lazysizes.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lightgallery@2.5.0/lightgallery.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lightgallery@2.5.0/plugins/thumbnail/lg-thumbnail.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lightgallery@2.5.0/plugins/zoom/lg-zoom.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sharer.js@0.5.1/sharer.min.js"></script><script type="text/javascript">window.config={"code":{"copyTitle":"Copy to clipboard","maxShownLines":50},"comment":{},"lightgallery":true,"search":{"highlightTag":"em","lunrIndexURL":"/index.json","maxResultLength":10,"noResultsFound":"No results found","snippetLength":30,"type":"lunr"}};</script><script type="text/javascript" src="/js/theme.min.js"></script></body>
|
|
</html>
|