Jump to content

Recommended Posts

Posted

In lua I would do this :

--index which vary on each recurisive run.
local mid=-dim..":"..-df..":"..dim..":"..df..":"..xfactor..":"..yfactor..":"..division..":"..factor..":"..orientation.x..":"..orientation.y..":"..orientation.z

--create model if the index "mid" doesn't exist in table models
if models[mid]==nil then
	model = Model:Create()
    model:SetRotation(orientation)
    models[mid] = model
end

 

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Posted
#include <stdio.h>
#include <unordered_map>
unordered_map<std::string, Model*> models;
...
  
std::stringstream mid_stream;
mid_stream << -dim << ":" << -df << ":" << dim << (...)
std::string mid = mid_stream.str();
if (models.find(mid) == models.end())
{
    Model* model = Model::Create();
    model->SetRotation(orientation);
    models[mid] = model;
}

Edit: meh, 5 minutes too late ;)

  • Upvote 1
Posted

Oh yours were much nicer than mine, I used 2 std::vectors one for the text index (I used stringstream) and one to store the models.

Thank you!

 

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...