Code Monkey home page Code Monkey logo

phoenix-studio's People

Contributors

lmichaelis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

phoenix-studio's Issues

Dumping world mesh into .obj files - inverted X and Z axis

Hi,

I'm not sure if you are aware of this, but in Gothic .zen file for some reason the vertices in world mesh are stored in a funny order, that is: Z, Y, X. Therefore, when you dump world mesh inso .obj file you must consider that when writing v ... ... ... line to the file.

So here:

out << "v " << item.x << " " << item.y << " " << item.z << "\n";

it should rather be out << "v " << item.z << " " << item.y << " " << item.x << "\n";,
but only in case if we are dealing with world mesh. (I think other meshes have the proper order)

The world mesh .obj file rendered currently:
image
as you can see the world looks as if seen in a mirror - things that should be on the left side are on the right. Moreover, both the normal vectors (the vn ... ... lines in .obj) and texture coordinates (the vt ... ... lines) seem to be defined with the above assumptions regarding the vertice orders. Hence, you can notice some strange artifacts when rendering, like objects being seen through, objects being lit on the bottom even though I set a source of directional sun light from above the scene, etc.

Here is how the .obj file is rendered after making the change in the source code:
image
looks correct.

Cheers :)

[zscript] Decompiler does not correctly handle `if ... else` with nested `if`s

Originally mentioned by @auronen in the GMC Discord (also see auronen/DecDat#2).

Original

func void B_SetNpcVisual (var C_NPC slf, var int gender, var string headMesh, var int faceTex, var int bodyTex, var int armorInstance)
{
	slf.aivar[AIV_Gender] = gender;

	Mdl_SetVisual (slf,"HUMANS.MDS");

	if (gender == MALE)
	{
               Mdl_SetVisualBody (slf,	"hum_body_Naked0", 	bodyTex,	0,			headMesh, 	faceTex,	0, 			armorInstance);
		
		if (slf.attribute[ATR_STRENGTH] < 50)
		{
			Mdl_SetModelScale		(slf, 0.9, 1, 1); 			//BREITE / Höhe / Tiefe
		};

		if (slf.attribute[ATR_STRENGTH] > 100)
		{
			Mdl_SetModelScale		(slf, 1.1, 1, 1);			//BREITE / Höhe / Tiefe
		};
	}
	else //gender == FEMALE
	{
		if (bodyTex >= 0) && (bodyTex <= 3) //MännerBodyTex angegeben
		{
			bodyTex = bodyTex + 4; // Females haben Variation 4-7 (Males 0-3)
		};
		Mdl_SetVisualBody (slf,	"Hum_Body_Babe0", 	bodyTex,	0,			headMesh, 	faceTex,  	0,			armorInstance);
	};
};

Decompiled

func void B_SETNPCVISUAL(var C_NPC SLF, var int GENDER, var string HEADMESH, var int FACETEX, var int BODYTEX, var int ARMORINSTANCE) {
    SLF.AIVAR[17] = GENDER;
    MDL_SETVISUAL(SLF, "HUMANS.MDS");
    if ((GENDER) == (MALE)) {
        MDL_SETVISUALBODY(SLF, "hum_body_Naked0", BODYTEX, 0, HEADMESH, FACETEX, 0, ARMORINSTANCE);
        if ((SLF.ATTRIBUTE[4]) < (50)) {
            MDL_SETMODELSCALE(SLF, 1063675494, 1065353216, 1065353216);
        };
        if ((SLF.ATTRIBUTE[4]) > (100)) {
            MDL_SETMODELSCALE(SLF, 1066192077, 1065353216, 1065353216);
        };
    };

    // -----------------------------------------------------
    if (((BODYTEX) >= (0)) && ((BODYTEX) <= (3))) {
        BODYTEX = (BODYTEX) + (4);
    };
    MDL_SETVISUALBODY(SLF, "Hum_Body_Babe0", BODYTEX, 0, HEADMESH, FACETEX, 0, ARMORINSTANCE);
}

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.