Browse Source

correct some little things on bitmaps

master
milang 10 months ago
parent
commit
1274ba29c5
No known key found for this signature in database GPG Key ID: D287C9D6C33D9035
17 changed files with 1162 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +30
    -0
      doc/html/search/defines_1.html
  3. +9
    -0
      doc/html/search/defines_1.js
  4. +151
    -0
      doc/html/structrender__floating__position.html
  5. +133
    -0
      doc/html/structrender__integer__point.html
  6. +151
    -0
      doc/html/structrender__integer__position.html
  7. +47
    -0
      doc/man/man3/render_floating_position.3
  8. +40
    -0
      doc/man/man3/render_integer_point.3
  9. +47
    -0
      doc/man/man3/render_integer_position.3
  10. +27
    -0
      include/fxengine/event/keyboard.h
  11. +84
    -0
      include/fxengine/render/bitmap.h
  12. +17
    -0
      include/fxengine/render/parameters.h
  13. +103
    -0
      include/fxengine/render/translate.h
  14. +51
    -0
      include/fxengine/render/triangle.h
  15. +21
    -0
      include/fxengine/render/zbuffer.h
  16. +33
    -0
      src/keyboard/keyboard.c
  17. +215
    -0
      src/render/triangle.c

+ 3
- 0
.gitignore View File

@@ -1,3 +1,6 @@
# Specify filepatterns you want git to ignore.

/build/*

*.c.o
*.c.d

+ 30
- 0
doc/html/search/defines_1.html View File

@@ -0,0 +1,30 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="defines_1.js"></script>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div id="SRResults"></div>
<script type="text/javascript"><!--
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
createResults();
/* @license-end */
--></script>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!--
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
/* @license-end */
--></script>
</div>
</body>
</html>

+ 9
- 0
doc/html/search/defines_1.js View File

@@ -0,0 +1,9 @@
var searchData=
[
['render_5fheight',['render_height',['../parameters_8h.html#a287d41473ee77db859d4d709d66ddb03',1,'parameters.h']]],
['render_5fmax_5fdist',['render_max_dist',['../parameters_8h.html#a83f9e629cfbf1dcd0de077265b29a1f4',1,'parameters.h']]],
['render_5fmin_5fdist',['render_min_dist',['../parameters_8h.html#a0ba94ff36e6c2a548735e40012f7ccbd',1,'parameters.h']]],
['render_5fwidth',['render_width',['../parameters_8h.html#a791a4a111886d2cab059ebc5ab6aa722',1,'parameters.h']]],
['render_5fx_5fmid',['render_x_mid',['../parameters_8h.html#a887e6ccc340beb6774eb95667d3bfe05',1,'parameters.h']]],
['render_5fy_5fmid',['render_y_mid',['../parameters_8h.html#ab67f355ab6184dcd911f0bf9380196c4',1,'parameters.h']]]
];

+ 151
- 0
doc/html/structrender__floating__position.html View File

@@ -0,0 +1,151 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FxEngine: render_floating_position Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">FxEngine
&#160;<span id="projectnumber">0.0.1</span>
</div>
<div id="projectbrief">3d engine for fx9860G calculators</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">render_floating_position Struct Reference</div> </div>
</div><!--header-->
<div class="contents">

<p>this struct is a point in 3d, which has coords save as double it is not recommended to use it for high performances rendering, because of the sh3eb-elf architecture, which does not support natively floating calculation
<a href="structrender__floating__position.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="translate_8h_source.html">translate.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:af88b946fb90d5f08b5fb740c70e98c10"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrender__floating__position.html#af88b946fb90d5f08b5fb740c70e98c10">x</a></td></tr>
<tr class="separator:af88b946fb90d5f08b5fb740c70e98c10"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab927965981178aa1fba979a37168db2a"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrender__floating__position.html#ab927965981178aa1fba979a37168db2a">y</a></td></tr>
<tr class="separator:ab927965981178aa1fba979a37168db2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3e6ed577a7c669c19de1f9c1b46c872"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrender__floating__position.html#ab3e6ed577a7c669c19de1f9c1b46c872">z</a></td></tr>
<tr class="separator:ab3e6ed577a7c669c19de1f9c1b46c872"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>this struct is a point in 3d, which has coords save as double it is not recommended to use it for high performances rendering, because of the sh3eb-elf architecture, which does not support natively floating calculation </p>

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00023">23</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>
</div><h2 class="groupheader">Field Documentation</h2>
<a id="af88b946fb90d5f08b5fb740c70e98c10"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af88b946fb90d5f08b5fb740c70e98c10">&#9670;&nbsp;</a></span>x</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double x</td>
</tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00025">25</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>

</div>
</div>
<a id="ab927965981178aa1fba979a37168db2a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab927965981178aa1fba979a37168db2a">&#9670;&nbsp;</a></span>y</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double y</td>
</tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00025">25</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>

</div>
</div>
<a id="ab3e6ed577a7c669c19de1f9c1b46c872"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab3e6ed577a7c669c19de1f9c1b46c872">&#9670;&nbsp;</a></span>z</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double z</td>
</tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00025">25</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>include/render/<a class="el" href="translate_8h_source.html">translate.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>

+ 133
- 0
doc/html/structrender__integer__point.html View File

@@ -0,0 +1,133 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FxEngine: render_integer_point Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">FxEngine
&#160;<span id="projectnumber">0.0.1</span>
</div>
<div id="projectbrief">3d engine for fx9860G calculators</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">render_integer_point Struct Reference</div> </div>
</div><!--header-->
<div class="contents">

<p>This is a point which is used for 3d translations and rendering integer mode is the best solution to increase perfs, and that's why I didn't have implemented te floating_points yet.
<a href="structrender__integer__point.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="translate_8h_source.html">translate.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a07494c9011ab307701955a2a50447d8e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structrender__integer__position.html">render_integer_position</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrender__integer__point.html#a07494c9011ab307701955a2a50447d8e">real</a></td></tr>
<tr class="separator:a07494c9011ab307701955a2a50447d8e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a127ca4356a403fe834505dfb3dee44a7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structrender__integer__position.html">render_integer_position</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrender__integer__point.html#a127ca4356a403fe834505dfb3dee44a7">translated</a></td></tr>
<tr class="separator:a127ca4356a403fe834505dfb3dee44a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This is a point which is used for 3d translations and rendering integer mode is the best solution to increase perfs, and that's why I didn't have implemented te floating_points yet. </p>

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00036">36</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>
</div><h2 class="groupheader">Field Documentation</h2>
<a id="a07494c9011ab307701955a2a50447d8e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a07494c9011ab307701955a2a50447d8e">&#9670;&nbsp;</a></span>real</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structrender__integer__position.html">render_integer_position</a> real</td>
</tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00038">38</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>

</div>
</div>
<a id="a127ca4356a403fe834505dfb3dee44a7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a127ca4356a403fe834505dfb3dee44a7">&#9670;&nbsp;</a></span>translated</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structrender__integer__position.html">render_integer_position</a> translated</td>
</tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00038">38</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>include/render/<a class="el" href="translate_8h_source.html">translate.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>

+ 151
- 0
doc/html/structrender__integer__position.html View File

@@ -0,0 +1,151 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FxEngine: render_integer_position Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">FxEngine
&#160;<span id="projectnumber">0.0.1</span>
</div>
<div id="projectbrief">3d engine for fx9860G calculators</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">render_integer_position Struct Reference</div> </div>
</div><!--header-->
<div class="contents">

<p>this struct is a point in 3d, which has coords save as uint32_t this is the recommended type for high performance rendering, because the sh3eb-elf architecture is 32 bits
<a href="structrender__integer__position.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="translate_8h_source.html">translate.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:af6d3062751bd565decb1a2cd3b63bdb2"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrender__integer__position.html#af6d3062751bd565decb1a2cd3b63bdb2">x</a></td></tr>
<tr class="separator:af6d3062751bd565decb1a2cd3b63bdb2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af64066d134a77e01b3d6eb8da813627a"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrender__integer__position.html#af64066d134a77e01b3d6eb8da813627a">y</a></td></tr>
<tr class="separator:af64066d134a77e01b3d6eb8da813627a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac2fb30be1b894e32b31b68bb513262a3"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrender__integer__position.html#ac2fb30be1b894e32b31b68bb513262a3">z</a></td></tr>
<tr class="separator:ac2fb30be1b894e32b31b68bb513262a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>this struct is a point in 3d, which has coords save as uint32_t this is the recommended type for high performance rendering, because the sh3eb-elf architecture is 32 bits </p>

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00011">11</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>
</div><h2 class="groupheader">Field Documentation</h2>
<a id="af6d3062751bd565decb1a2cd3b63bdb2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af6d3062751bd565decb1a2cd3b63bdb2">&#9670;&nbsp;</a></span>x</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t x</td>
</tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00013">13</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>

</div>
</div>
<a id="af64066d134a77e01b3d6eb8da813627a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af64066d134a77e01b3d6eb8da813627a">&#9670;&nbsp;</a></span>y</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t y</td>
</tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00013">13</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>

</div>
</div>
<a id="ac2fb30be1b894e32b31b68bb513262a3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac2fb30be1b894e32b31b68bb513262a3">&#9670;&nbsp;</a></span>z</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t z</td>
</tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="translate_8h_source.html#l00013">13</a> of file <a class="el" href="translate_8h_source.html">translate.h</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>include/render/<a class="el" href="translate_8h_source.html">translate.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>

+ 47
- 0
doc/man/man3/render_floating_position.3 View File

@@ -0,0 +1,47 @@
.TH "render_floating_position" 3 "Fri Aug 30 2019" "Version 0.0.1" "FxEngine" \" -*- nroff -*-
.ad l
.nh
.SH NAME
render_floating_position \- this struct is a point in 3d, which has coords save as double it is not recommended to use it for high performances rendering, because of the sh3eb-elf architecture, which does not support natively floating calculation

.SH SYNOPSIS
.br
.PP
.PP
\fC#include <translate\&.h>\fP
.SS "Data Fields"

.in +1c
.ti -1c
.RI "double \fBx\fP"
.br
.ti -1c
.RI "double \fBy\fP"
.br
.ti -1c
.RI "double \fBz\fP"
.br
.in -1c
.SH "Detailed Description"
.PP
this struct is a point in 3d, which has coords save as double it is not recommended to use it for high performances rendering, because of the sh3eb-elf architecture, which does not support natively floating calculation
.PP
Definition at line 23 of file translate\&.h\&.
.SH "Field Documentation"
.PP
.SS "double x"

.PP
Definition at line 25 of file translate\&.h\&.
.SS "double y"

.PP
Definition at line 25 of file translate\&.h\&.
.SS "double z"

.PP
Definition at line 25 of file translate\&.h\&.

.SH "Author"
.PP
Generated automatically by Doxygen for FxEngine from the source code\&.

+ 40
- 0
doc/man/man3/render_integer_point.3 View File

@@ -0,0 +1,40 @@
.TH "render_integer_point" 3 "Fri Aug 30 2019" "Version 0.0.1" "FxEngine" \" -*- nroff -*-
.ad l
.nh
.SH NAME
render_integer_point \- This is a point which is used for 3d translations and rendering integer mode is the best solution to increase perfs, and that's why I didn't have implemented te floating_points yet\&.

.SH SYNOPSIS
.br
.PP
.PP
\fC#include <translate\&.h>\fP
.SS "Data Fields"

.in +1c
.ti -1c
.RI "\fBrender_integer_position\fP \fBreal\fP"
.br
.ti -1c
.RI "\fBrender_integer_position\fP \fBtranslated\fP"
.br
.in -1c
.SH "Detailed Description"
.PP
This is a point which is used for 3d translations and rendering integer mode is the best solution to increase perfs, and that's why I didn't have implemented te floating_points yet\&.
.PP
Definition at line 36 of file translate\&.h\&.
.SH "Field Documentation"
.PP
.SS "\fBrender_integer_position\fP real"

.PP
Definition at line 38 of file translate\&.h\&.
.SS "\fBrender_integer_position\fP translated"

.PP
Definition at line 38 of file translate\&.h\&.

.SH "Author"
.PP
Generated automatically by Doxygen for FxEngine from the source code\&.

+ 47
- 0
doc/man/man3/render_integer_position.3 View File

@@ -0,0 +1,47 @@
.TH "render_integer_position" 3 "Fri Aug 30 2019" "Version 0.0.1" "FxEngine" \" -*- nroff -*-
.ad l
.nh
.SH NAME
render_integer_position \- this struct is a point in 3d, which has coords save as uint32_t this is the recommended type for high performance rendering, because the sh3eb-elf architecture is 32 bits

.SH SYNOPSIS
.br
.PP
.PP
\fC#include <translate\&.h>\fP
.SS "Data Fields"

.in +1c
.ti -1c
.RI "int32_t \fBx\fP"
.br
.ti -1c
.RI "int32_t \fBy\fP"
.br
.ti -1c
.RI "int32_t \fBz\fP"
.br
.in -1c
.SH "Detailed Description"
.PP
this struct is a point in 3d, which has coords save as uint32_t this is the recommended type for high performance rendering, because the sh3eb-elf architecture is 32 bits
.PP
Definition at line 11 of file translate\&.h\&.
.SH "Field Documentation"
.PP
.SS "int32_t x"

.PP
Definition at line 13 of file translate\&.h\&.
.SS "int32_t y"

.PP
Definition at line 13 of file translate\&.h\&.
.SS "int32_t z"

.PP
Definition at line 13 of file translate\&.h\&.

.SH "Author"
.PP
Generated automatically by Doxygen for FxEngine from the source code\&.

+ 27
- 0
include/fxengine/event/keyboard.h View File

@@ -0,0 +1,27 @@
#ifndef FE_KEYBOARD
#define FE_KEYBOARD

#include <gint/keyboard.h>
#include <gint/keycodes.h>
#include <stdint.h>

/* FE_keyboard: gestion evenementielle du clavier
on peut assigner des callbacks à certains evènements définis dans gint
les arguments envoyés sont le code de la touche en question (event.key)
le type d'evenement (event.type)
void (*callback)(void)
la fonction à exécuter en cas de pression sur une touche
la fonction reload est appelée à la demande de l'utilisateur et appelle tous les callbacks dans l'ordre */

typedef void (*callback)(void);

void event_keyboard_set_key(uint32_t matrix_code, uint32_t ev_type, callback function);

// reload all key events and call callbacks
void event_keyboard_reload();

//void event_keyboard_start();

//void event_keyboard_stop();

#endif

+ 84
- 0
include/fxengine/render/bitmap.h View File

@@ -0,0 +1,84 @@
#ifndef RENDER_BITMAP
#define RENDER_BITMAP

#include <stdint.h>
#include <stdbool.h>

/**
* @brief bitmap rich type
* transparency is in the layout
* @warning Monochrome only !
*/
struct bitmap_rich
{
uint32_t size_px_x;
uint32_t size_px_y;
uint32_t size_o_y;

uint32_t * color;
bool color_dynamic;
uint32_t * layout;
bool layout_dynamic;
};
typedef struct bitmap_rich bitmap_rich;


/**
* @brief { function_description }
*
* @param[in] size_px_x The width in px
* @param[in] size_px_y The height in px
* @param color color origin
* @param[in] copy_color if you want to make a copy, or only to make a link
* @param layout layout origin -> can be set as 0 if it isn't needed
* @param[in] copy_layout if you want to make a copy, or to make a link
*
* @return a rich bitmap, ready to use !
*/
bitmap_rich* bitmap_new_rich(uint32_t size_px_x, uint32_t size_px_y, uint32_t* color, bool copy_color,
uint32_t *layout, bool copy_layout);

/**
* @brief delete a rich bitmap created with bitmap_new_rich()
*
* @param bmp The bitmap to delete
*/
void bitmap_delete_rich(bitmap_rich* bmp);


/**
* @brief get the color of pixel from rich bitmap
*
* @param[in] bmp The bitmap
* @param[in] x The bitmap x coordinate (in pixels)
* @param[in] y The bitmap y coordinate (in pixels)
*
* @return the color coded in a unsigned char :
* if (color >> 1)
* switch (color%2)
* {
* case 0:
* // WHITE
* break;
* case 1:
* // BLACK
* }
* else
*/
uint8_t bitmap_get_pixel_r(const bitmap_rich * bmp, uint32_t x, uint32_t y);


/**
* @brief display a specific rich bitmap pixel on the screen
*
* @param[in] bmp The bitmap
* @param[in] bmp_x The bitmap x coordinate (in pixels)
* @param[in] bmp_y The bitmap y coordinate (in pixels)
* @param[in] x screen : x coordinate
* @param[in] y screen : y coordinate
*/
void bitmap_display_pixel_r(const bitmap_rich * bmp, uint32_t bmp_x, uint32_t bmp_y, uint32_t x, uint32_t y);



#endif

+ 17
- 0
include/fxengine/render/parameters.h View File

@@ -0,0 +1,17 @@
#ifndef RENDER_PARAM
#define RENDER_PARAM


// Render param

#define render_width 128
#define render_height 64
#define render_x_mid ((render_width - 1) / 2) // depends on screen width
#define render_y_mid ((render_height - 1) / 2)

#define render_max_dist 3000
#define render_min_dist 1



#endif

+ 103
- 0
include/fxengine/render/translate.h View File

@@ -0,0 +1,103 @@
#ifndef RENDER_TRANSLATE_H
#define RENDER_TRANSLATE_H

#include <stdint.h>
#include <fxengine/render/parameters.h>

/**
* @brief this struct is a point in 3d, which has coords save as uint32_t
* this is the recommended type for high performance rendering, because the sh3eb-elf architecture is 32 bits
*/
struct render_integer_position
{
int32_t x,
y,
z;
};
typedef struct render_integer_position render_integer_position;

/**
* @brief this struct is a point in 3d, which has coords save as double
* it is not recommended to use it for high performances rendering, because of the sh3eb-elf architecture, which does not support natively floating calculation
*/
struct render_floating_position
{
double x,
y,
z;
};
typedef struct render_floating_position render_floating_position;


/**
* @brief This is a point which is used for 3d translations and rendering
* integer mode is the best solution to increase perfs, and that's why I didn't have implemented te floating_points yet.
*/
struct render_integer_point
{
render_integer_position real;
render_integer_position translated;
};

typedef struct render_integer_point render_integer_point;


// applique la matrice de rotation et les deltas sur les coordonnées d'un point

/**
* @brief This function rotates and applies perspective on an integer point
*
* @param point The point which needs to be translated
*/
void render_translate(render_integer_point * point);



/**
* @brief Sets up the translation matrices for a new rendering cycle
* There is no need to call this function if you have already called render_update()
*
* @param[in] dh Camera's horizontal direction (rad)
* @param[in] dv Camera's vertical direction (rad)
* @param[in] roulis Optionnal rotation around the middle of the screen
* @param[in] camera The camera's coordinates, as an integer position
*/
void render_set(const double dh, const double dv, const double roulis, const render_integer_position * camera);



/**
* mathematics constants
*/
extern const double pi, pi2, pi_sur_2;


/**
* @brief Sets up an angle mesure between -pi and +pi
*
* @param[in] a the angle (rad)
*
* @return angle mesure which respect the following contraint :
* -pi <= angle <= pi
*/
double modulo_2pi(double a);

/**
* @brief Homemade cosinus implementation, which is faster than casio provided cosinus function
*
* @param[in] angle The angle (rad)
*
* @return cos angle
*/
double cos(double angle);

/**
* @brief Homemade sinus implementation, which is faster than casio provided sinus function
*
* @param[in] angle The angle (rad)
*
* @return sin angle
*/
double sin(const double angle);

#endif

+ 51
- 0
include/fxengine/render/triangle.h View File

@@ -0,0 +1,51 @@
#ifndef RENDER_TRIANGLE_H
#define RENDER_TRIANGLE_H

#include <fxengine/render/translate.h>
#include <fxengine/render/bitmap.h>
#include <stdbool.h>

/**
* @brief Regulates the maximum fps count to 30 fps
*/
#define MINIMUM_FRAME_DELAY 3333

/**
* @brief Triangle struct used to render fonctions
* @param[out] part choose the used texture half
* @param[out] clockwised choose the visible side of the face
* @param[out] s1,s2,s3 three points
* @param[out] texture used texture
*/
struct render_triangle
{
render_integer_position * s1;
render_integer_position * s2;
render_integer_position * s3;

bitmap_rich * texture;

bool part;
bool clockwised;
};
typedef struct render_triangle render_triangle;

/**
* @brief Renders a triangle with perspective deformation
*
* @param[in] face pointer to the face to draw
*/
void render_display_triangle(const render_triangle * face);

/**
* @brief Clears vram, zbuffer
*
* @param[in] libprof_channel The libprof channel to be used to count_fps
* @param[in] dh Horizontal direction (rad)
* @param[in] dv Vertical direction (rad)
* @param[in] roulis The roulis (rad)
* @param[in] camera Pointer to the camera
*/
void render_update(const uint32_t libprof_channel);

#endif

+ 21
- 0
include/fxengine/render/zbuffer.h View File

@@ -0,0 +1,21 @@
#ifndef RENDER_ZBUFFER
#define RENDER_ZBUFFER

#include <fxengine/render/parameters.h>
#include <stdint.h>

/** FE_zbuffer_clear
* effacer le z buffer pour un nouveau cycle de dessin
* TODO : ajouter effacement avec le DMA Controller pour les modèles ayant un processeur SH4-A
**/
void render_zbuffer_clear();

#include <stdbool.h>
/** FE_zbuffer_set_dist
* change la distance d'un pixel du zbuffer
* retourne true si il faut dessiner le pixel
* retourne false si le pixel est déjà existant
**/
bool render_zbuffer_set_px(uint32_t x, uint32_t y, uint32_t dist); // if you are allowed to draw the pixel on vram

#endif

+ 33
- 0
src/keyboard/keyboard.c View File

@@ -0,0 +1,33 @@
#include <fxengine/event/keyboard.h>

static callback callbacks[3][6][10]={0};

static inline uint32_t get_x(const uint32_t matrix_code)
{
return (matrix_code-1) % 0x10;
}

static inline uint32_t get_y(const uint32_t matrix_code)
{
return (matrix_code-1) / 0x10;
}

void FE_keyboard_reload()
{
key_event_t event;
while (1)
{
event=pollevent();
event.type--;
if (event.type==-1)
break;
callback action = callbacks[event.type][get_x(event.key)][get_y(event.key)];
if (action)
action();
}
}

void FE_keyboard_set_key(uint32_t matrix_code, uint32_t ev_type, callback function)
{
callbacks[ev_type-1][get_x(matrix_code)][get_y(matrix_code)]=function;
}

+ 215
- 0
src/render/triangle.c View File

@@ -0,0 +1,215 @@
#include <fxengine/render/triangle.h>
#include <fxengine/render/bitmap.h>
#include <fxengine/render/translate.h>
#include <fxengine/render/zbuffer.h>

#include <libprof.h>

#include <gint/display.h>
#include <gint/clock.h>

static uint32_t frame_interval_min;
static uint32_t frame_interval_max;

void render_update(const uint32_t libprof_channel)
{
//dupdate();

// gestion du temps avec libprof
if (prof_elapsed)
{
prof_leave(0);
uint32_t frame_interval = prof_time(0);
//sleep_us(0, MINIMUM_FRAME_DELAY-frame_interval);
if (frame_interval<frame_interval_min)
frame_interval_min = frame_interval;
if (frame_interval>frame_interval_max)
frame_interval_max = frame_interval;
}
else
{
prof_init(libprof_channel+1, 0);
}
//dupdate();
prof_clear(0);
prof_enter(0);

render_zbuffer_clear();

///render_set(dh, dv, roulis, camera);

dclear(C_WHITE);
}

/**
* @brief Orientation of the face
*
* @param face The face
*
* @return if it is true the it is clockwised else it isn't clockwised
*/
static bool is_colckwised(render_triangle const * face)
{
int32_t area = 0;

area += face->s1->x * face->s2->y;
area -= face->s2->x * face->s1->y;

area += face->s2->x * face->s3->y;
area -= face->s3->x * face->s2->y;

area += face->s3->x * face->s1->y;
area -= face->s1->x * face->s3->y;

return (area < 0);
}


// gestion locale des arètes
typedef struct line line;
struct line
{
int32_t x,y,z;
int32_t dx,dy,dz;
int32_t no_line; // si les deux points sont confondus (se comporte comme un bool)
};

/**
* @brief Sets up a line with 2 points
*
* @param l The line
* @param s1 The s 1
* @param s2 The s 2
*/
static void line_set(line* l,render_integer_position const * s1, render_integer_position const * s2)
{
l->x = s1->x;
l->y = s1->y;
l->z = s1->z;
l->dx = s2->x - s1->x;
l->dy = s2->y - s1->y;
l->dz = s2->z - s1->z;
l->no_line = (l->dx==0 && l->dy==0);
}

static int32_t max(int32_t x, int32_t y)
{
return (x>y ? x : y);
}

static int32_t min(int32_t x, int32_t y)
{
return (x<y ? x : y);
}

static int32_t abs(int32_t x)
{
return(x<0 ? -x : x);
}

/**
* @brief get the corresponding x from the y coordinate
*
* @param[in] y the y coordinate
* @param l the line
* @param x address where x is written
*
* @return if given point coordinate belongs to the l
*/
static bool line_get_x(int32_t y, line const * l, int32_t * x)
{
y -= l->y;
if (y < 0 && l->dy > 0)
return false;
if (y > 0 && l->dy < 0)
return false;
if (abs(y) > abs(l->dy))
return false;

if (l->dy != 0)
*x = l->x + (y * l->dx) / l->dy;
else if (y==0)
*x = l->x + l->dx;
else
return false;
return true;
}


void render_display_triangle(const render_triangle * face)
{
// backface culling
if (is_colckwised(face) != face->clockwised)
return;

// incomplete clipping
if (face->s1->x < 0 && face->s2->x < 0 && face->s3->x < 0)
return;
if (face->s1->x >= render_width && face->s2->x >= render_width && face->s3->x >= render_width)
return;
if (face->s1->y < 0 && face->s2->y < 0 && face->s3->y < 0)
return;
if (face->s1->y >= render_height && face->s2->y >= render_height && face->s3->y >= render_height)
return;
if (face->s1->z <= 0 && face->s2->z <= 0 && face->s3->z <= 0)
return;

line cotes[3];
line_set(&cotes[0], face->s1, face->s2);
line_set(&cotes[1], face->s1, face->s3);
line_set(&cotes[2], face->s2, face->s3);

if (cotes[0].no_line || cotes[1].no_line || cotes[2].no_line)
return;

const int32_t ymin = max(min(face->s1->y, min(face->s2->y, face->s3->y)), 0);
const int32_t ymax = min(max(face->s1->y, max(face->s2->y, face->s3->y)), 63);

const int32_t xAB = face->s2->x - face->s1->x, yAB = face->s2->y - face->s1->y, zAB=face->s2->z-face->s1->z;
const int32_t xAC = face->s3->x - face->s1->x, yAC = face->s3->y - face->s1->y, zAC=face->s3->z-face->s1->z;
const int32_t diviseur_commun = (xAB * yAC - yAB * xAC);

const int32_t fact_1= (32768 * yAC) / diviseur_commun, fact_2 = (32768 * xAC) / diviseur_commun;
const int32_t fact_3= (32768 * xAB) / diviseur_commun, fact_4 = (32768 * yAB) / diviseur_commun;

for (int32_t y = ymin; y <= ymax; y++)
{
// xmin and xmax determination
int32_t tx1,tx2;

for (int t=0;t<3;t++)
{
if (line_get_x(y,&cotes[t],&tx1))
break;
}
for (int32_t t=0;t<3;t++)
{
if (line_get_x(y,&cotes[t],&tx2)&&tx1!=tx2)
break;
}

const int32_t txmin=max(min(tx1,tx2),0), txmax=min(max(tx1,tx2),127);

for (int32_t x=txmin; x<=txmax; x++)
{
double vx, vy, z;
const double xcalc = x - face->s1->x, ycalc = y - face->s1->y;
// calcul de vx, vy
vx=(xcalc*fact_1-ycalc*fact_2); // 0 <vx< 10_000
vy=(ycalc*fact_3-xcalc*fact_4); // idem
z=face->s1->z + (vx * zAB + vy * zAC) / 32768;
vx /= 32768;
vy /= 32768;

vx /= (double) face->s2->z / ((1 - vx) / face->s1->z + vx / (double) face->s2->z);
vy /= (double) face->s3->z / ((1 - vy) / face->s1->z + vy / (double) face->s3->z);

// Affichage du point
const uint8_t color = bitmap_get_pixel_r(face->texture, 8*vx, 8*vy);

if (color)
if (render_zbuffer_set_px(x,y,z))
dpixel(x, y, 3 * (color % 2)); // 3* means cast to black and white, and vx,and vy casted between 0 and 7
}
}
}

Loading…
Cancel
Save