Giter Club home page Giter Club logo

nitro-engine's People

Contributors

antoniond avatar awmc000 avatar fewnity avatar wiiiiam278 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nitro-engine's Issues

Textures above 128*128 are not rendered correctly

Hi,
got into NE quiete a bit. After spending some time on the engine itself i started 3D modelling.
Theres some optimisation to be done for sure, but i quick tested my 3D Modell and Texture. It works as long as the texture is only 128x128 big. As soon i try to use an 256x256 Texture it looks pretty ugly and like UV coordinates not respected anymore?

Following package contains:
-Screenshots of the issue
-Compiled NDS files of that example
-Texture Files i used in 128
-and the 3D modell itself

Texture_Size_Error.zip

Tested on Desmume, MelonDS and real Hardware (Nintendo DSI and DS Lite) :)
128x128 Texture
Screenshot128

256x256 Texture
Screenshot256

@AntonioND

Rich text: Add methods for getting string width/height, limiting text to a box/to certain num of chars

I'd like to draw text using rich text's quad drawing mode within a specific box region on a screen (ideally, wrapping the text if it goes over). With the monospace NE_Text.h API I could do NE_TextPrintBox/NE_TextPrintBoxFree to do this, or implement my own thing using NE_TextPrintFree since characters were of a constant known width.

Since rich text is VWF and box drawing isn't a thing in NE_RichText, this isn't quite possible. It'd be great to expose a method to get the length of a string, as DSF exposes DSF_StringRenderDryRun for this purpose, but the handle needed to call DSF methods is abstracted away by Nitro-Engine :).

Similarly, an option to limit the number of characters to draw is no longer present (though of course this isn't a big deal as you can just trim the string before passing it). Still, it'd be nice to have this option.

[Bug] Collision problem

Hello again!
I changed your example to show a problem with the physics engine.
If you have a floor made from more than 2 blocks, if you slide on this floor and when try to go in the other floor block, the blue cube is stuck.

(you can launch the .nds file, it's more explicit)
collisionProblem.zip

Any examples for pallets?

Hi,
are there any examples for how to use pallets?
Like when using RGB256 for textures?

Couldnt find any in the example folders :)

[Improvement] Add real 2D support

Hello,
For me the big problem of Nitro Engine is the 2D.
Because if the 2D system we are limited to 30fps in dual screen mode if we just want to use 3D at the top and 2D at the bottom.
Real 2D would allow 60 fps with both screen mode.
You are adding the support of compressed textures, maybe it's time to support real 2D right? :)

Thanks!

ARM9 is compressed to a binary from elf before ndstool?

All source code for examples in Nitro Engine is compressing the elf to binary before using ndstool on it:

$(OUTPUT).nds : $(OUTPUT).arm9

Is this intended? Was there a performance benefit to doing so?

This correlates to an issue in TWiLight where none of the Nitro Engine examples were detected in TWiLight as homebrew and was instead detected as a retail title: DS-Homebrew/TWiLightMenu#1753. I removed the $(TARGET).arm9 flag from here and directly used the .elf against ndstool and this was detected fine, but I'm not sure if that would break functionality in Nitro Engine somewhere.

2D mode: sprites height not set correctly

First of all, thanks so much for making this library; it's been a huge boon to the project I'm working on so far. Fair warning that I'm not sure this is actually a bug with NE -- I may just be holding something wrong, but I was hoping to get help either way.

I'm attempting to use the 3D engine to display 2D textures using nitro-engine. I have a 256x256 texture that is transparent below pixel 192.

logo_aqi

I converted this texture to a DS texture, first using a tool I wrote and then using your tool to confirm it wasn't something I was doing while preparing the texture. I am displaying the texture with the following code:

void displayBgAsTex(GraphicInfo &bgInfo, Globals &globals)
{
    GraphicImage bgTex = loadPixels(bgInfo.name);
    Palette bgPal = loadPalette(bgInfo.name);

    if (globals.bgTex[0])
    {
        NE_Palette *oldPalette = globals.bgTex[0]->mat->palette;
        NE_Material *oldMaterial = globals.bgTex[0]->mat;
        NE_SpriteDelete(globals.bgTex[0]);
        NE_MaterialDelete(oldMaterial);
        NE_PaletteDelete(oldPalette);
        globals.bgTex[0] = NULL;
    }
    
    NE_Material *material = NE_MaterialCreate();
    NE_Palette *palette = NE_PaletteCreate();

    NE_PaletteLoad(palette, (u16 *)bgPal.palette, bgPal.numColors, bgInfo.format);
    NE_MaterialTexLoad(material, bgInfo.format, bgInfo.width, bgInfo.height, NE_TEXGEN_OFF, (void *)bgTex.pixels);
    NE_MaterialSetPalette(material, palette);

    globals.bgTex[0] = NE_SpriteCreate();
    NE_SpriteSetPos(globals.bgTex[0], 0, 0);
    NE_SpriteSetSize(globals.bgTex[0], bgInfo.width, bgInfo.height);
    NE_SpriteSetPriority(globals.bgTex[0], 256);
    NE_SpriteSetMaterial(globals.bgTex[0], material);
}

which is called by a script which does the appropriate thing for rendering the texture

void Draw3DScene()
{
    NE_2DViewInit();
    NE_SpriteDrawAll();
}

...

NE_Process(Draw3DScene);

In my main function, I do all the appropriate setup:

irqEnable(IRQ_HBLANK);
irqSet(IRQ_VBLANK, NE_VBLFunc);
irqSet(IRQ_HBLANK, NE_HBLFunc);
NE_Init3D();
NE_SwapScreens();
Globals globals = loadStaticFiles();

so i think I'm doing everything correctly.

The bgInfo class reads in the width and height from a file I prepared; both of those values are set to 256.

However, in-game, it looks like this:
image

And the 3D rendering screen in no$ seems to indicate that the lower texcoords are being set to 252 rather than 256:

image

So... weird!

Hoping you can help figure out what's going on. I can provide the ROM if needed!

Thanks!

What language

What language is this scripting in?
Is there ample documentation?

Found NE_CameraSet() bug and a sprite sheet question

Hi, I've been using your library to learn to program in c for my old dsi, I'm using version 0.9.1 and there seems to be a problem with the NE_CameraSet() function, the X unit vector up generates rendering problems with values greater and lower than zero, however, this input doesn't seems to do anything if the other two inputs, Y up and Z up, are not zero (either positive and negative values), I'm testing a the function to get an idea of a way to implement a fully free camera rotation using quaternions (though I don't know if there's another way to do this).
Also, I have a question, maybe there's already a function or a way to do this but I haven't found nor understand it yet, it is how can I specify a non power of 2 sector/area from a power of 2 material to be the texture for a quad, because I have the textures and sprite sheets extracted from Age of Empires 3 Mobile (j2me) and all of them are non power of 2 textures (i.e. the background tiles are 48x23, many sprites are 12x48 and so on), I can merge most of them in a power of 2 sprite sheet to use nitro-engine material function. I've seen Fewinty's minecraft ds project for reference but I want to use your library because it makes it alot of it way easier.

Outlining affecting sprites

Hello,

I am using the NE_OutliningEnable function to draw outlines for my models in dual screen 3D mode - however, I am also drawing sprites on top of these models, which are affected by the outlines.

Is it possible to turn off outlining for sprites?

I have tried this code, but sadly that didn't work out.

	NE_OutliningEnable(true);

	NE_CameraUse(TSCamera);
	NE_PolyFormat(31, 0, NE_LIGHT_0, NE_CULL_NONE, 0);
	NE_ModelDraw(GetModel(MODEL_MainChara));

	NE_OutliningEnable(false);

	NE_2DViewInit();
	NE_SpriteDrawAll();

Thank you!

Dynamic shadows suggestion

Hi, I'm curious about the volumetric shadow example, didn't expected that in nitro-engine, it reminded me to a character shadow effect present in star wars Clone Wars - Jedi Alliance, I don't know if you already know this, but there's a short writing by the programmer about how he implemented animated characters' dynamic shadows:
http://tfpsly.free.fr/english/3d/Shadows_on_ds.html

Would it be possible to implement something similar to nitro-engie?, I don't know if it is something hard to do, I'm learing C/C++ in my free time and your engine already is incredible.

Support alternative way to use DMA to send display lists to the GPU

Right now the only ways supported by Nitro Engine to send display lists to the GPU are to use the CPU itself to copy the display list, or to use the DMA in GFX FIFO mode. This DMA mode is buggy and it can't be used at the same time as the HBL DMA mode, so this task involves creating a new way to send the display lists using DMA.

The new way should setup an interrupt to trigger when the GFX FIFO is half empty, or empty, and it should use DMA to send more commands to the FIFO.

Trying to undestand differences between Cameras position and Models positions

Hi,
im trying to understand the differences when setting the positions of an camera in comparison to setting the position of an model.

Doing:

NE_ModelSetCoord(PlayerModel,-0.07424927f,1.3f,16.1f);
...
    NE_CameraSet(Camera,
		     -0.07424927f,1.3f,16.1f, // Position
		     0,0,0,   // Look at
		     0, 1, 0);

Works and positions of the PlayerModel and the Camera are the same.

Tho, doing following doesnt work:

NE_ModelSetCoord(PlayerModel,-0.07424927f,1.3f,16.1f);
...
    NE_CameraSet(Camera,
		     PlayerModel->x,PlayerModel->y,PlayerModel->z, // Position
		     0,0,0,   // Look at
		     0, 1, 0);

I know positions of an Model are declared as an int and are effectifely f32, shouldnt those values be compatible with the cameras NE_CameraSet function? Sorry for the questions!

Unable to run .nds file generated by example "using_nflib" in MelonDS

Here is what my shell gives me:

melonDS 0.9.4
https://melonds.kuribo64.net/
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

(process:75401): Gtk-WARNING **: 22:34:02.501: Locale not supported by C library.
	Using the fallback 'C' locale.
Gtk-Message: 22:34:02.532: Failed to load module "canberra-gtk-module"
Gtk-Message: 22:34:02.533: Failed to load module "canberra-gtk-module"
Qt: Session management error: Could not open network socket
libpng warning: iCCP: known incorrect sRGB profile
Audio output frequency: 48000 Hz
Resetting JIT block cache...
done resetting jit mem
done resetting jit mem
MAC: 00:09:BF:11:22:33
FW: WIFI CRC16 = GOOD
FW: AP1 CRC16 = GOOD
FW: AP2 CRC16 = GOOD
FW: AP3 CRC16 = GOOD
FW: USER0 CRC16 = GOOD
FW: USER1 CRC16 = BAD
Game code: ####
ROM entry not found
!! bad ROM size 703488 (expected 1048576) rounded to 1048576
Cart ID: 400000C2
remapping SWRAM
Secure area decryption failed
remapping DTCM 0 1000 ffffffff ffffffff
PU: region 0 = 04000033 : enabled, 04000000-08000000
PU: region 0 = 04000033 : enabled, 04000000-08000000
PU: region 1 = 0200002B : enabled, 02000000-02400000
PU: region 1 = 0200002B : enabled, 02000000-02400000
PU: region 2 = 00000000 : disabled, 00000000-00000002
PU: region 2 = 00000000 : disabled, 00000000-00000002
PU: region 3 = 08000035 : enabled, 08000000-10000000
PU: region 3 = 08000035 : enabled, 08000000-10000000
PU: region 4 = 0300001B : enabled, 03000000-03004000
PU: region 4 = 0300001B : enabled, 03000000-03004000
PU: region 5 = 00000000 : disabled, 00000000-00000002
PU: region 5 = 00000000 : disabled, 00000000-00000002
PU: region 6 = FFFF001D : enabled, FFFF0000-FFFF8000
PU: region 6 = FFFF001D : enabled, FFFF0000-FFFF8000
PU: region 7 = 027FF017 : enabled, 027FF000-02800000
PU: region 7 = 027FF017 : enabled, 027FF000-02800000
remapping DTCM 3000000 3004000 0 fffff000
Game is now booting
Mic init failed: Could not connect PulseAudio stream
remapping DTCM ffffffff ffffffff 3000000 2ffc000
PU: region 0 = 04000033 : enabled, 04000000-08000000
PU: region 1 = FFFF001F : enabled, FFFF0000-00000000
PU: region 2 = 00000017 : enabled, 00000000-00001000
PU: region 5 = 02FF001B : enabled, 02FF0000-02FF4000
PU: region 4 = 0100001D : enabled, 01000000-01008000
unknown ARM9 IO read32 04004008 02017794
PU: region 3 = 08000035 : enabled, 08000000-10000000
PU: region 6 = 0200002F : enabled, 02000000-03000000
PU: region 7 = 0200002B : enabled, 02000000-02400000
remapping DTCM 2ff0000 2ff4000 ffffffff ffffffff
PU region 0: 04000000-08000000, user=07 priv=07
33333363/33333363
PU region 1: FFFF0000-00000000, user=55 priv=55
33333363/33333363
PU region 2: 00000000-00001000, user=07 priv=07
33333363/33333363
PU region 3: 08000000-10000000, user=07 priv=07
33333363/33333363
PU region 4: 01000000-01008000, user=07 priv=07
33333363/33333363
PU region 5: 02FF0000-02FF4000, user=07 priv=07
33333363/33333363
PU region 6: 02000000-03000000, user=07 priv=07
33333363/33333363
PU region 7: 02000000-02400000, user=77 priv=77
33333363/33333363
unknown ARM9 IO read8 04004000 02000864
RTC INTERRUPT ON: 41
NDSCART: !! BAD TRANSFER DIRECTION FOR CMD B7, DIR=0, ROMCNT=E97F3FFF

The error given at the end seems the most relevant. One person reported a similar issue on the MelonDS repo:

melonDS-emu/melonDS#1116

I will try with desmume and see if I get the same issue or not.

3d: add way of drawing simple polys outside of range supported by v16

Thanks for your superb work on this lib!!

It'd be nice if nitro-engine provided a way of drawing polygons outside -6 < x < 6 | -6 < z < 6, which isn't currently possible without dipping into libnds and manually calling one of the glTranslate methods (as this is the approximate max range supported by the 4.12 fixed point number)

My use case is drawing a super-simple shadow below a character, so would rather not have to bother making and loading a super simple model when I can just draw it directly.

Perhaps an alternate/better solution for my use case (as I note you say to avoid drawing polys where possible) would be some methods for the 3d engine to draw simple planes/shapes?

note: I could have missed something in the docs!! very sorry for wasting your time if so (am quite new to this)!

Dual Mode, bank C and D

Hi,
im sorry! In Dual mode, bank C and D cant be used. What are they used for?
If i understand correctly, i cant use them to store textures for the bottom screens ui?

[Bug] Dual 3D mode renders models on the opposite screen

In dual 3D mode, models drawn by the function that runs on the main screen are rendered on the sub screen and vice-versa; this doesn't seem to happen with sprites/GUI elements, only models

For example, the landscape model here is supposed to be rendered on the main screen (currently set to the top screen), but instead renders on the other one
image
image
image

Here this sprite is rendered correctly on the main screen
image

Md2 to nea animation issues

Hi, I'm having an issue with (What I presume to be) the md2_to_nea exporter.

I've got a rigged 3D model created in Maya and exported to .md2 using MilkShape 3D. Inside both Ms3d and it's accompanying md2 model viewer I can see it exported perfectly fine, animated, etc. But when I convert it into a nea bin and load it into the game, there seems to be a couple of things that can happen;

  1. All frames are working perfectly
  2. A portion of the animation is working perfectly, then it distorts/scales down to 0 instantly at around halfway
  3. Only the first frame is visible, though clearly distorted, and all other frames are blank.

The examples I've encountered have all occurred by scrapping and starting my animation from scratch in MilkShape, a different result being achieved each time. I've tried modifying the nea exporter to print values such as frame->scale and frame->translate, and in my findings, on the broken model scale/translate was set to 0.000 at some point through the animation, where on the working model they were all unique values. I'm not sure if this is relevant to the problem, but figured I'd mention it anyway.

Do you have a specific workflow/programs to use to ensure compatibility with the exporter, or is there other special care that needs to be taken with it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.