Jump to content

TylerH

Members
  • Posts

    525
  • Joined

  • Last visited

Everything posted by TylerH

  1. I always thought it would, but I guess if you are creating and freeing it properly, it may not be noticeable. Though, I always was curious how the heck ANY game ends up with so much **** on the screen with decent frames.
  2. It is basically like applying a heightmap (disaplcement) to your mesh per-pixel, which is like how Leadwerks does terrain, except the terrain is a per-vertex.
  3. On the note of the rgba, xyzw stuff: In GLSL, if you read the specification, the following values are all interchangeable: rgba -> xyzw -> uvst .r = .x = .u .g = .y = .v .b = .z = .s .a = .w = .t They are just all there to make it obvious what that vector variable is (color, vector, texture coord respectively). You can also do other things, like .rr, .xyxz, .yyyy, .wwst, .argb, .bgra, .uvzw They can be combined and interchanged at no cost, and even reordered like I showed.
  4. Ok guys, I asked Argorious when he PMed me with the question to post here, so since I understand what he is asking, here is the full explanation on how to do this: At lines 14- 20 in mesh.frag: #ifdef LW_DIFFUSE uniform sampler2D LW_DIFFUSE; #endif #ifdef LW_SPECULARMAP uniform sampler2D LW_SPECULARMAP; #endif Add code to make it look like this: #ifdef LW_DIFFUSE uniform sampler2D LW_DIFFUSE; #endif #ifdef LW_OPACITYMAP uniform sampler2D LW_OPACITYMAP; #endif #ifdef LW_SPECULARMAP uniform sampler2D LW_SPECULARMAP; #endif At lines 102 - 104 in mesh.frag: #ifdef LW_DIFFUSE diffuse *= texture2D(LW_DIFFUSE,texcoord);//*fOcclusionShadow; #endif Add a line to make it this: #ifdef LW_DIFFUSE diffuse *= texture2D(LW_DIFFUSE,texcoord);//*fOcclusionShadow; diffuse.w *= texture2D(LW_OPACITYMAP,texcoord).r; // Assuming you map an opacity map properly, the RGB values will all be the same. #endif Now, in any of the mesh_x_y_z.frag shaders: #define LW_OPACITYMAP texture4 In your .mat file: texture4="abstract:myopacitymap.dds" And to get the proper alpha blending: blend=1 This is what we use in Jeklynn Heights to get transparent windows with glow.
  5. TylerH

    flip hook

    I second that.
  6. As not to confuse the level with a prefab, could it be more like a self-contained .PFB or something file. To me it seems like it would be an SBX file, but minus all the terrain and extra stuff, and containing some relationship settings (joints, relative positioning, etc.).
  7. Thanks Josh, good to know that you will give it some thought and research time
  8. mesh_diffuse_bumpmap_specularmap_pom.frag Not sure if it exists. And if you want to use the opacity map on its own, then you just need to do: diffuse.w = alphamap.r; in the mesh.frag shader #define LW_DIFFUSE texture0 #define LW_BUMPMAP texture1 #define LW_SPECULARMAP texture2 #define LW_PARALLAXMAP texture3 #define LW_POMMAP Include "mesh.frag"
  9. This occurs in the tunnel underground map just like it used to, if you jump onto the corner at the junction of two tunnels it will shoot you to the other end, like back in 2.23. Josh fixed it before, but seems it is back... Could be a Julio thing?
  10. Josh: You act like users to dumb, and you are the only smart person. I think people would know not to use raycast commands if they disabled physics... And I don't like PhysX. Havok heightfields can be updated dynamically and even deformed using collision dynamically, you seem to be basing all your hate against other physics engines only on PhysX. PhysX is pretty eye candy, so you shouldn't base your opinions/decisions solely on it. Havok has been used in every game from A to Z atleast twice. I mean, all we are asking for is the ability to turn of Newton, shouldn't be that hard, nor does it require all this hypothetical non-sense and fan-hate.
  11. I thought InitDialog actually passed you the grid as a parameter?
  12. We are using the C++ framework. Nothing was changed in it by us other than CreateCube for the skybox was replaced with CreateSphere for a sky dome.
  13. I like the way OGRE does it. A Scene manager, you have scene nodes, and you attach entities, lights, billboards, emitters, etc. to the nodes.
  14. If this unlikely/hard to do, it would be cool to know. Just curious if we could get a verdict on how plausible this is, just out of curiosity?
  15. I can settle for that solution. Thanks.
  16. The command replaces the values in the vec3 you pass in to the projected/unprojected coordinates respectively. Kind of sloppy, but passing my reference is indeed faster than it returning a copy of the vec3.
  17. What do you think I was referring to? Why don't you take a look at the bugs Ryan Wenke, head of Vex, posted from testing I did with him. Josh took the time to respond here and in my other thread about editor entities with meshes, but from what I can tell didn't even look at the bug tracker... -- Some corrections: I am 16, I work a full-time job, 40 hours a week, I still attend school, and still make it with every single other commitment I have ever made, ranging from Boy Scouts, to things with friends, seeing my grandparents everyday, Robotics, Academic Challenge, Kiwanis, Salvation Army, etc. I live in a single parent household, and have to take on the responsibilities of an adult in order to keep my house and family in order. I supplement the lives of both my mother and grandparents as well, so you can just shut your mouth and redirect your focus on something other than a post about how people spend their time, and how at my age I have so much time to myself, because I absolutely do not.
  18. Here is the code: Bones / Animation is the large commented out section. Not sure what state I left this in, but it worked, ish. Major problems, but it didn't crash. #include "stdafx.h" #include "msPlugInImpl.h" #include "msLib.h" #include "gmfsdk.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } cMsPlugIn* CreatePlugIn () { return new cPlugIn (); } cPlugIn::cPlugIn () { strcpy (szTitle, "Leadwerks GMF..."); } cPlugIn::~cPlugIn () { } int cPlugIn::GetType () { return cMsPlugIn::eTypeExport; } const char* cPlugIn::GetTitle () { return szTitle; } int cPlugIn::Execute (msModel *pModel) { if (!pModel) return -1; GMFInitialize(); // // check, if we have something to export // if (msModel_GetMeshCount (pModel) == 0) { ::MessageBox (NULL, "The model is empty! Nothing exported!", "Leadwerks GMF Export", MB_OK | MB_ICONWARNING); return 0; } // // choose filename // OPENFILENAME ofn; memset (&ofn, 0, sizeof (OPENFILENAME)); char szFile[MS_MAX_PATH]; char szFileTitle[MS_MAX_PATH]; char szDefExt[32] = "gmf"; char szFilter[128] = "GMF Files (*.gmf)\0*.gmf\0All Files (*.*)\0*.*\0\0"; szFile[0] = '\0'; szFileTitle[0] = '\0'; ofn.lStructSize = sizeof (OPENFILENAME); ofn.lpstrDefExt = szDefExt; ofn.lpstrFilter = szFilter; ofn.lpstrFile = szFile; ofn.nMaxFile = MS_MAX_PATH; ofn.lpstrFileTitle = szFileTitle; ofn.nMaxFileTitle = MS_MAX_PATH; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST; ofn.lpstrTitle = "Export GMF"; if (!::GetSaveFileName (&ofn)) return 0; TGMFMesh mesh; TGMFSurface surface; //Create the root mesh mesh = GMFMeshCreate(NULL); msVec3 pPosition, pRotation; msModel_GetPosition(pModel, pPosition); msModel_GetRotation(pModel, pRotation); GMFEntitySetPositionRotationScale(mesh, pPosition[0], pPosition[1], pPosition[2], pRotation[0], pRotation[1], pRotation[2], 1, 1, 1); int i, j, k, l, m, n; /*/////////// // BONES // /////////// TGMFBone bones[128]; // Bones for (i = 0; i < msModel_GetBoneCount (pModel); i++) { msBone *pBone = msModel_GetBoneAt (pModel, i); char szName[64]; char szParentName[64]; // Bone Name msBone_GetName (pBone, szName, MS_MAX_NAME); if (strlen(szName) == 0) strcpy(szName, " "); // Bone Parent Name msBone_GetParentName (pBone, szParentName, MS_MAX_NAME); // Bone Position and Rotation msVec3 Position, Rotation; msBone_GetPosition (pBone, Position); msBone_GetRotation (pBone, Rotation); // Check for parent bone int nParentBoneIndex = msModel_FindBoneByName(pModel, szParentName); msBone *pParentBone = msModel_GetBoneAt(pModel, nParentBoneIndex); //I has an idea hmmmm its -1 i.e. no parent, hence the >= 0 ah, i thought 0 was root..phail // Create Leadwerks Bone (Parented to mesh if a root bone, else parented to parent bone) if (nParentBoneIndex >= 0) { bones[i] = GMFBoneCreate(bones[nParentBoneIndex]); } else { bones[i] = GMFBoneCreate(mesh); } // Set bone position and rotation GMFEntitySetPositionRotationScale(bones[i], Position[0], Position[1], Position[2], Rotation[0], Rotation[1], Rotation[2]); // Set bone name GMFNodeSetProperty(bones[i],"name",szName); GMFNodeSetProperty(bones[i],"parentname",szParentName); // Iterate all of the bone's position keys for (j = 0; j < msBone_GetPositionKeyCount (pBone); j++) { // Get position key msPositionKey *pKey = msBone_GetPositionKeyAt (pBone, j); // Add position key to the bone entity GMFEntityAddPositionKey(bones[i], pKey->Position[0], pKey->Position[1], pKey->Position[2], pKey->fTime); } // Iterate all of bone's rotation keys for (j = 0; j < msBone_GetRotationKeyCount (pBone); j++) { // Get rotation key msRotationKey *pKey = msBone_GetRotationKeyAt (pBone, j); // Add rotation key to the bone entity GMFEntityAddRotationKey(bones[i], pKey->Rotation[0], pKey->Rotation[1], pKey->Rotation[2], pKey->fTime); } }*/ ////////////// // SURFACES // ////////////// // Loop through all meshes (a MS3D mesh is a Leadwerks Surface) for (i = 0; i < msModel_GetMeshCount (pModel); i++) { // Grab the mesh msMesh *pMesh = msModel_GetMeshAt (pModel, i); char szName[64]; msMesh_GetName (pMesh, szName, 64); //Add a surface surface = GMFMeshAddSurface(mesh); // Set the surface name to the mesh name //GMFNodeSetProperty(surface,"name",szName); // Get material index int nMatIndex = msMesh_GetMaterialIndex (pMesh); /////////////// // TRIANGLES // /////////////// // Iterate all triangles in the current mesh/surface for (j = 0; j < msMesh_GetTriangleCount (pMesh); j++) { // Get a triangle per iteration msTriangle *pTriangle = msMesh_GetTriangleAt (pMesh, j); word nIndices[3]; word nNormalIndices[3]; // Get vertex indices of the current triangle msTriangle_GetVertexIndices (pTriangle, nIndices); // Get normal indices of the current triangle msTriangle_GetNormalIndices(pTriangle, nNormalIndices); // Get 3 vertices + normals per triangle msVertex *pVertex; msVec3 Vertex; msVec3 Normal; msVec2 uv; ////////////// // VERTICES // ////////////// unsigned short v1,v2,v3; v1 = v2 = v3 = 0; // Vertex 1 from the 1st index pVertex = msMesh_GetVertexAt(pMesh, nIndices[0]); // Get vertex msMesh_GetVertexNormalAt(pMesh, nNormalIndices[0], Normal); msVertex_GetVertex (pVertex, Vertex); msVertex_GetTexCoords (pVertex, uv); // The surface should be full of vertices, normals, UVs, colors, etc. stuff... // Because of this call v1 = GMFSurfaceFindVertex(surface, Vertex[0], // X Vertex[1], // Y Vertex[2], // Z Normal[0], // Normal X Normal[1], // Normal Y Normal[2], // Normal Z uv[0], // U0 Texture Coordinate uv[1]//, // V0 Texture Coordinate //uv[0], // U1 Texture Coordinate //uv[1], // V1 Texture Coordinate //255, // Vertex Color Red //255, // Vertex Color Green //255, // Vertex Color Blue //255 // Vertex Color Alpha ); // Vertex 2 from the 2nd index pVertex = msMesh_GetVertexAt(pMesh, nIndices[1]); // Get vertex msMesh_GetVertexNormalAt(pMesh, nNormalIndices[1], Normal); msVertex_GetVertex (pVertex, Vertex); msVertex_GetTexCoords (pVertex, uv); // The surface should be full of vertices, normals, UVs, colors, etc. stuff... // Because of this call v2 = GMFSurfaceFindVertex(surface, Vertex[0], // X Vertex[1], // Y Vertex[2], // Z Normal[0], // Normal X Normal[1], // Normal Y Normal[2], // Normal Z uv[0], // U0 Texture Coordinate uv[1]//, // V0 Texture Coordinate //uv[0], // U1 Texture Coordinate //uv[1], // V1 Texture Coordinate //255, // Vertex Color Red //255, // Vertex Color Green //255, // Vertex Color Blue //255 // Vertex Color Alpha ); // Vertex 3 pVertex = msMesh_GetVertexAt(pMesh, nIndices[2]); // Get vertex msMesh_GetVertexNormalAt(pMesh, nNormalIndices[2], Normal); msVertex_GetVertex (pVertex, Vertex); msVertex_GetTexCoords (pVertex, uv); // The surface should be full of vertices, normals, UVs, colors, etc. stuff... // Because of this call v3 = GMFSurfaceFindVertex(surface, Vertex[0], // X Vertex[1], // Y Vertex[2], // Z Normal[0], // Normal X Normal[1], // Normal Y Normal[2], // Normal Z uv[0], // U0 Texture Coordinate uv[1]//, // V0 Texture Coordinate //uv[0], // U1 Texture Coordinate //uv[1], // V1 Texture Coordinate //255, // Vertex Color Red //255, // Vertex Color Green //255, // Vertex Color Blue //255 // Vertex Color Alpha ); //GMFSurfaceAddTriangle(surface, nIndices[0], nIndices[2], nIndices[1]); GMFSurfaceAddTriangle(surface, v1, v2, v3); } ////////////// // MATERIAL // ////////////// //brb fixing a desktop comp. msMaterial *pMaterial = msModel_GetMaterialAt(pModel, nMatIndex); char szDiffuseTexture[64]; msMaterial_GetDiffuseTexture(pMaterial, szDiffuseTexture, 64); // Set surface material to the mesh material GMFNodeSetProperty( surface, "material", szDiffuseTexture ); /*////////////////////// // BONE ATTACHMENTS // ////////////////////// // Vertex Bone Indices / Bone Weights for (j = 0; j < msMesh_GetVertexCount (pMesh); j++) // Thanks to Christian for being a beast. { // Vertex Ex structure msVertexEx *pVertexEx; // Grab vertex bone indices and bone weights pVertexEx = msMesh_GetVertexExAt(pMesh, j); // Loop through the 3 possible bones, attach vertices to the Leadwerks Bones on the surface for (k = 0; k < 3; k++) { int nBoneIndex = pVertexEx->nBoneIndices[k]; byte nBoneWeight = pVertexEx->nBoneWeights[k]; if (nBoneIndex >= 0 && bones[nBoneIndex] != NULL && nBoneWeight != -1) GMFSurfaceAttachVertex(surface, j, bones[nBoneIndex], (float)nBoneWeight); } }*/ ////////////////////////// // TANGENTS & BINORMALS // ////////////////////////// // Calculate binormals and tangents for the surface GMFSurfaceCalculateBinormalsAndTangents(surface); } /////////////// // SAVE FILE // /////////////// GMFMeshSaveFile(mesh, szFile); // dont' forget to destroy the model msModel_Destroy (pModel); GMFTerminate(); return 0; }
  19. Most editors I see test against the AABB of the entity, and select based on that. I can come to some middle ground, and would settle for meshes, if we could atleast not have the auto-generated phy files. EDIT: Maybe not. Meshes are what get detected in the pick commands, so we would still have that problem. Removing them ourselves just seems hacky. There should be something like this in by default.
  20. Well, the problem with that is, my seemingly friendly and useful critiques are always ignored. Vex has been using the engine for 2 months now, and bugs we reported in month 1 have been completely ignored and swept under the rug to other, seemingly useless bugs that I have never even experienced. I just think something is out of whack here, and it gets me a bit ticked off. -- If you want to get into disputes over age here, I will gladly prove you wrong in your assumptions.
  21. But why? It isn't like emitters and lights and such don't have Position, Rotation, and Scale on their own...
  22. But why must we be forced to have models? Why can't we have entities that are in fact modeless? Take a look at any other editor out there, and you will see that none of their info, light, etc. type entities have a model and physics shape...
  23. Exactly. This is why something needs to be changed about how the system fundamentally works. The hierarchy is TEntity, from which TMesh inherits, and TLight inherits TEntity too. It doesn't go TEntity, TMesh, TLight inheriting TMesh. You should be able to have entities in the editor that are just that, entities. If you want meshes, you parent a mesh, or do whatever.
  24. This would lead me to believe that over time Leadwerks Editor is like clogging your VRAM or something that gets cleared on a restart or shutdown? This has existed since the first version of Sandbox, atleast for me, so that makes the most sense.
×
×
  • Create New...