[QUOTE=paindoc;52229909]Goddamn, that's neat as hell. I was wondering a bit about different ways you could do this stuff, and using something like compute shaders was top of the list. If I excelled at something beyond breaking vulkan, this would be a fun position :v:[/QUOTE]
We use compute shaders in our actual software to render ~8million particles at a time haha. If you'd like to do some more basic tasks, you'd be welcome to join as well! Could be a great learning experience haha.
Basic models work, even if they are made from multiple meshes, however as soon as I load a more complex model it gets distorted. I have tried both .dae and .obj (both formats I want to support) without any success.
Here is the full loading code (I have commented a lot of code to make it as basic as possible but it still gets distorted):
[CODE] JUMA_Mesh::JUMA_Mesh(aiMesh* mesh){
for(int j=0;j<mesh->mNumVertices;j++){
vertices.push_back(mesh->mVertices[j].x);
vertices.push_back(mesh->mVertices[j].y);
vertices.push_back(mesh->mVertices[j].z);
// vertices.push_back(mesh->mNormals[j].x);
// vertices.push_back(mesh->mNormals[j].y);
// vertices.push_back(mesh->mNormals[j].z);
// vertices.push_back(mesh->mTextureCoords[0][j].x);
// vertices.push_back(mesh->mTextureCoords[0][j].y);
//printf("%f %f %f %f %f\n",mesh->mVertices[j].x,mesh->mVertices[j].y,mesh->mVertices[j].z,mesh->mTextureCoords[0][j].x,mesh->mTextureCoords[0][j].y);
}
for(int i=0;i<mesh->mNumFaces;i++){
for(int j=0;j<mesh->mFaces[i].mNumIndices;j++){
indices.push_back(mesh->mFaces[i].mIndices[j]);
//printf(" %d",mesh->mFaces[i].mIndices[j]);
}
// printf("\n");
}
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*vertices.size(), &vertices[0], GL_STATIC_DRAW);
///Bind EBO and BUFFER DATA into it
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLint)*indices.size(), &indices[0], GL_STATIC_DRAW);
// Position attribute
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE,3 * sizeof(GLfloat), (GLvoid*)0);
glEnableVertexAttribArray(0);
// TexCoord attribute
/*glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));
glEnableVertexAttribArray(2);*/
/* glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), (GLvoid*)0);
glEnableVertexAttribArray(0);*/
// glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));
// glEnableVertexAttribArray(1);
/* glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid*)(6 * sizeof(GLfloat)));
glEnableVertexAttribArray(1);
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));
glEnableVertexAttribArray(2);*/
glBindVertexArray(0); // Unbind VAO
}
JUMA_GO::JUMA_GO(char *FilePath, JUMA_material mat, double mass, std::string transMatName, glm::mat4 view, std::string viewname, glm::mat4 proj, std::string projName){
matrixCollection.modelName = transMatName;
matrixCollection.proj = proj;
matrixCollection.projName = projName;
matrixCollection.view = view;
matrixCollection.viewName = viewname;
material = mat;
//scale = {1.0,1.0,1.0};
//transformations = glm::translate(transformations, glm::vec3(0.0f, 0.0f, 0.0f));
//read shapes from flag bitmask
// Create an instance of the Importer class
Assimp::Importer importer;
// And have it read the given file with some example postprocessing
// Usually - if speed is not the most important aspect for you - you'll
// propably to request more postprocessing than we do in this example.
const aiScene* scene = importer.ReadFile( FilePath,
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType);
// If the import failed, report it
if( !scene)
{
printf("ASSIMP ERROR!:%s\n", importer.GetErrorString());
}
// Now we can access the file's contents.
if(scene->HasMeshes()){
for(int i=0;i<scene->mNumMeshes;i++){
meshes.push_back(JUMA_Mesh(scene->mMeshes[i]));
}
}
/*if(scene->HasMaterials()){
for(int i=0;i<scene->mNumMaterials;i++){
}
}*/
printf("Finished constructor...\n");
}[/CODE]
Here are the models I have tried this with:
[url]https://www.blendswap.com/blends/view/88092[/url]
[url]https://www.blendswap.com/blends/view/81237[/url]
I exported them with blender.
Here is the result for the first model:
[url]http://imgur.com/a/1hBAw[/url]
Here is the code for the classes:
[CODE]
class JUMA_Mesh{
public:
std::vector<GLfloat> vertices;
std::vector<GLuint> indices;
GLuint VAO;
GLuint VBO;
GLuint EBO;
JUMA_Mesh(aiMesh* mesh);
JUMA_Mesh(){};
};
class JUMA_GO {
private:
glm::vec3 velocity;
float mass;
JUMA_Mat3DCollectPlus matrixCollection;
unsigned int type;
std::vector<JUMA_Mesh> meshes;
JUMA_material material;
public:
JUMA_Transform transform;
JUMA_GO() {
velocity = { 0.0,0.0,0.0 };
mass = 0;
type = 0;
matrixCollection.modelName = std::string("UNDEFINED");
};
JUMA_GO(unsigned int TYPE, JUMA_material mat, double mass, std::string transMatName, glm::mat4 view, std::string viewname, glm::mat4 proj, std::string projName);
//JUMA_GO(JUMA_LOADTYPE TYPE, JUMA_material mat, double mass, std::string transMatName, glm::mat4 view, std::string viewname, glm::mat4 proj, std::string projName);
JUMA_GO(char *FilePath, JUMA_material mat, double mass, std::string transMatName, glm::mat4 view, std::string viewname, glm::mat4 proj, std::string projName);
void draw(JUMA_Shader shader);
};
[/CODE]
I'm generating graphs which look somewhat like this (graphs might have holes inside them):
[img]http://i.imgur.com/O25HYES.png[/img]
I'm trying to find which graph vertices are inside the graph and want to get some info about their depth level. To illustrate, for the same graph I would like to extract such info:
[img]http://i.imgur.com/PsyaGGV.png[/img]
Color descriptions:
purple = 0 depth (outer vertices)
red = 1 depth
yellow = 2 depth
blue = 3 depth
Anyone know an algorithm which would give similar results to what I need?
Im trying to make my own vehicle but i cant find any tutorials.
also how do i edit current ones?
[QUOTE=wasted257;52232159]Im trying to make my own vehicle but i cant find any tutorials.
also how do i edit current ones?[/QUOTE]
In what context??
[editline]15th May 2017[/editline]
This is a general programming help thread.
[QUOTE=Adelle Zhu;52232206]In what context??
[editline]15th May 2017[/editline]
This is a general programming help thread.[/QUOTE]
Sorry my bad, must have opend several tabs at the same time not looking what sub it was in. But its in garrysmod, cant seem to find any tutorials what so ever, maybe you got an idea or not? either way sry my bad.
[QUOTE=wasted257;52244694]Sorry my bad, must have opend several tabs at the same time not looking what sub it was in. But its in garrysmod, cant seem to find any tutorials what so ever, maybe you got an idea or not? either way sry my bad.[/QUOTE]
You need model of car itself and then for Source engine you need to rig the model for things like: Steering wheel turn, wheel turn, wheel spin, suspension.
If anyone has worked with Qt Designer, should I make every possible window in my program in a different project? Or is there a way to make new windows in the same project to export as a single class for Python?
[QUOTE=tschumann;52172145]I've been making some progress with OpenGL retained mode but I've got some questions.
The above screenshots (of frenzy from Half-Life) show the lines I'm drawing as being cut off on the left, but if I rotate the view (as I've done in the second image) more of the lines become visible. Can someone help me diagnose what's going on? I understand there are multiple reasons why this could be happening but I'm not too sure. I've disabled culling but that had no effect (I guess because it's off by default?).
Also, I'm trying to make the view properly movable - currently I've got a transform that I apply to each vertex - projection matrix * view matrix * model matrix- the projection matrix seems to be the field of view, the view matrix I guess is the orientation of the camera but I'm not sure what the model matrix is - I think it's meant to be some sort of origin but I'm not sure what.[/QUOTE]
So I've made some more progress with this - solved one problem by realising that Half-Life's coordinate system has the z-axis going up whereas OpenGL has it going out of the screen.
With regards to writing a renderer - is it enough to just render arbitrary sets of vertices each frame? OpenGL will work out what z-order things will get rendered in and it shouldn't matter in what order they get sent to the graphics card?
[QUOTE=tschumann;52256811]So I've made some more progress with this - solved one problem by realising that Half-Life's coordinate system has the z-axis going up whereas OpenGL has it going out of the screen.
With regards to writing a renderer - is it enough to just render arbitrary sets of vertices each frame? OpenGL will work out what z-order things will get rendered in and it shouldn't matter in what order they get sent to the graphics card?[/QUOTE]
You adjust this by changing what function what function OpenGL uses to set depth. Given that the zorder is already flipped , the default depth function GL_LESS won't work.
.NET has [URL="https://msdn.microsoft.com/en-us/library/system.type.isassignablefrom%28v=vs.110%29.aspx"][I]Type.IsAssignableFrom(Type)[/I][/URL]. Is there something like this that works with JS/TypeScript?
A library that only provides a [URL="https://msdn.microsoft.com/en-us/library/system.workflow.componentmodel.compiler.typeprovider.isassignable(v=vs.110).aspx"]TypeProvider.IsAssignable(Type, Type)[/URL] equivalent would work too, if it works with [URL="https://www.npmjs.com/package/prop-types"]prop-types[/URL].
Can anyone offer me some tips related to Java? I'm working on a project and it's just a matter of reading strings & ints from a file that I can't seem to pull off for some reason. I'll PM whomever the relative bit of code if they want to help because it's been giving me a headache for hours now.
hit me up if you want my help again
What's the best way to use a hook system (think GLua) in Java? Are there specific language features? Packages? Should I just roll my own and send it to every single object?
[QUOTE=Ott;52279812]What's the best way to use a hook system (think GLua) in Java? Are there specific language features? Packages? Should I just roll my own and send it to every single object?[/QUOTE]
Something like [url=https://docs.oracle.com/javase/tutorial/uiswing/events/]events[/url]?
So I'm trying to make a userscript to passively sniff all api requests a page makes and notify me when something of interest comes up. Opening devtools on every page is just too much of a hassle and I might catch things I would otherwise overlook.
[code]
(function(window) {
var filter = [
"json"
];
XMLHttpRequest.prototype.track = function() {
this.oldsend = this.send;
this.send = function(data) {
if (data)
console.log(data);
return this.oldsend(data);
};
};
XMLHttpRequest.prototype.oldopen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(method, url, isasync, user, password) {
if (url.indexOf(".") > url.length - 8) { //todo: remove all the crap like get params first
filter.some(needle => {
if (url.endsWith(needle)) {
console.log(method, url, isasync, user, password);
this.track();
return true;
}
});
} else {
this.track();
console.log(method, url, isasync, user, password);
}
return this.oldopen(method, url, isasync, user, password);
};
})(window);
[/code]
The problem is for some reason this prevents youtube videos from loading, like the player shows the controls and stuff, but it just stays black and has the play again button but that doesn't work either.
Can you spot anything wrong with it that might block a request or something?
In good Python practice, would it be better to make the root class smaller by sending it's functions to other files? Or should I keep all the important bits in the main script? I feel like it's a subjective questions but one is more liked than the other in the field.
[QUOTE=LennyPenny;52282519][...]
Can you spot anything wrong with it that might block a request or something?[/QUOTE]
The only thing I can think of is that maybe it already replaces the method with one that takes more parameters. Does it work if you use [I]return oldFunction.apply(this, arguments);[/I] instead?
[QUOTE=Adelle Zhu;52306138]In good Python practice, would it be better to make the root class smaller by sending it's functions to other files? Or should I keep all the important bits in the main script? I feel like it's a subjective questions but one is more liked than the other in the field.[/QUOTE]
I don't know about python practices, but in general. If something is becoming unwieldy, you move it to another file or class if possible.
Not sure if this fits into this thread but here goes.
I'm getting into the Source modding scene, want to create a Half-Life 2 mod. I don't want to make a mod from scratch, to begin with I just wan't to modify the original Half-Life 2 game, while still playing the original campaign. (Think SMOD)
I already created the mod using Source SDK 2013 code from [URL="https://github.com/ValveSoftware/source-sdk-2013"]GitHub.[/URL]
The mod loads most of the Half-Life 2 content fine. Sounds, textures, and the like. What I'm having issues with are the maps. I can't get the mod to load the HL2 maps. I got it working by either copying the HL2 maps to the mod's maps directory, which I heard is not allowed once and if one shares the mod with others for them to play.
I have also got it working by putting this into the gameinfo.txt:
[code]game "G:\Steam\steamapps\common\Half-Life 2\hl2"[/code]
But that would obviously not work because not everyone has their HL2 directory in the same place as I do. The correct way to do it should be:
[code]game |all_source_engine_paths|hl2[/code]
But that doesn't work. It doesn't load the maps. I read somewhere that the Source engine itself recognizes the "|all_source_engine_paths|" part but that SDK 2013 itself doesn't, or something along those lines.
I just need a solution to mount the HL2 maps to my mod.
Edit: Just in case it's needed, [URL="https://pastebin.com/6cZmp4vF"]here's my current gameinfo.txt file.[/URL]
Did you try this exact config example? [url]https://developer.valvesoftware.com/wiki/Gameinfo.txt#Source_2013_Example[/url]
[QUOTE=LennyPenny;52311277]Did you try this exact config example? [URL]https://developer.valvesoftware.com/wiki/Gameinfo.txt#Source_2013_Example[/URL][/QUOTE]
Didn't work and replaces all the chapter thumbnails with EP2 thumbnails. Don't need episodic or ep2 content anyway.
Edit: Update. I commented out this line in gameinfo.txt:
[code]game |all_source_engine_paths|hl2[/code]
and I get this error:
[IMG]https://i.imgur.com/n5n88Wc.png[/IMG]
So I guess it is mounting the HL2 content after all, but for some odd reason, not the maps. Which is what I need right now.
Edit2: Alright I looked at the gameinfo.txt file of the mod Synergy and I found a way. This way it works:
[code]game "|gameinfo_path|../../common/Half-Life 2/hl2"[/code]
So basically what's going on there is it's jumping 2 folders back from the mod folder, which places it into the steamapps folder and then from there guide it to the hl2 folder.
Hope this helps anyone with this issue in the future.
Is there anyway to make a swep only call once when you left click? Whenever I left click, it calls the function in SWEP:PrimaryAttack() 4-9 times. I have self:SetNextPrimaryFire(CurTime() + 4) yet it continously calls the function plenty of times.
This is all from one click:
[url]https://gyazo.com/869aaa929bffda979f649b6a385e813c[/url]
Code:
[CODE]
function SWEP:PrimaryAttack()
self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
local plyclient = self.Owner:GetEyeTrace().Entity
if not plyclient:IsValid() then return end
if not plyclient:IsPlayer() then return end
if table.HasValue(bmmhealthcooldown,plyclient) then return end
if plyclient:GetPos():Distance(self.Owner:GetPos()) > self.Primary.Dist then return end
RunConsoleCommand(self.PRIMARYCM)
end
[/CODE]
Console command:
[CODE]
ply:ChatPrint("Offer was successfully sent to: "..plyclient:Nick())
[/CODE]
[QUOTE=xjailbreakx2;52313335]Is there anyway to make a swep only call once when you left click? Whenever I left click, it calls the function in SWEP:PrimaryAttack() 4-9 times. I have
[/CODE][/QUOTE]
Wrong thread but here: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/IsFirstTimePredicted]IsFirstTimePredicted[/url]
-snip-
[QUOTE=G4MB!T;52314678]-snip-[/QUOTE]
Have you checked if your matrix is in the same format as the default? If not, transpose it?
Anyone on here had any experience with emulator dev? Looking for advice on how to get into it the right way. I have pretty good programming experience but no low level whatsoever.
[QUOTE=Furbreeze;52316591]Anyone on here had any experience with emulator dev? Looking for advice on how to get into it the right way. I have pretty good programming experience but no low level whatsoever.[/QUOTE]
It really depends on what you want to emulate and on what specifically you get stuck. Your question is too generic. Also what exactly do you mean by emulator, only processors or whole systems?
Try digging trough some example code to help you started
[URL]https://github.com/cartman300/M68K[/URL]
How can I calculate what distance I need to render an AABB so that both its min and max points just fit inside the viewing volume?
I'm making an object spawning panel, and I'm going to generate thumbnails for all of the models within a directory.
[QUOTE=Karmah;52328269]How can I calculate what distance I need to render an AABB so that both its min and max points just fit inside the viewing volume?
I'm making an object spawning panel, and I'm going to generate thumbnails for all of the models within a directory.[/QUOTE]
This is an answer on the unity forums for C# (unless you're using C#? I forget), but it seems like it might help: [url]http://answers.unity3d.com/questions/988036/position-and-scale-gameobject-according-to-screen.html[/url]
I was looking for a similar thing, actually, so I could scale the various celestial objects I'm making to the screen when using an arcball camera. I think that you just need to find to objects size in pixels when placed in the world at a scale 1.0, and then given the size of your viewing window you can scale the object by the ratio of (world_pixel_size / viewport_pixel_size). Presumably, you'll need to choose the scale in xyz that results in the greatest reduction, to make sure the whole object fits in the window. Not sure how that would work. My case is a lot easier, since its not for sub-windows and its for spherical objects :v
Sorry, you need to Log In to post a reply to this thread.