I made a simple 3d engine with python, but it's slow, intersections don't show, and faces dissapear when your at a certian place. Here's the link: http://www.mediafire.com/?dggmjfnfts0
If you can tell me how to make a better one, please do!
14 1739
Well 1st of all. If you posted a question and it hasn't been answered in the correct thread, please do not go and start posting it other places. It's not going to get you an answer faster. You have enough posts and seem to have been here long enough that you should have read the posting guidelines and saw that you shouldn't double post questions.
In case you don't know where the POSTING GUIDELINES are i have posted the link.
Secondly, when i looked at your post in the other forum, you only posted it yesterday. Give it time for someone to look at. Please do not go around posting things like this to draw attention to your question. When our experts have time to look at it they will. Give it sometime.
Thank You.
......................................okay.
I made a simple 3d engine with python, but it's slow, intersections don't show, and faces dissapear when your at a certian place. Here's the link:
http://www.mediafire.com/?dggmjfnfts0
If you can tell me how to make a better one, please do!
It would be better for you to try to identify the problem yourself or at least narrow it down and then post the relavent code for us to look at.
You arn't getting any help because people are not interested in downloading some random files from someone who they don't know and then go through it line by line telling you how to make it better. It is up to you to make it better, or you can join a site like sf.net and start a project then recruit people to help you. We are here to troubleshoot problems and help you solve specific issues.
Also, I moved your post from Misc forum and merged it into this one. Please pay attention to Stang02GT's post. Further issues regarding your ignorance of the posting guidelines will be met more harshly then with warnings.
Yes, I know. I already got in a little trouble.
(I still don't know how I missed that...)
The fact is I have now way of showing you the code cause I'm on an old computer. I have to go to my school, plug in a flashdrive, then upload a file, but the only way I can do that is if I'm on a newer computer.
Also, if you are too afraid to download the file, that's fine. But I make a strong promise that it will cause your computer no harm.
Yes, I know. I already got in a little trouble.
(I still don't know how I missed that...)
The fact is I have now way of showing you the code cause I'm on an old computer. I have to go to my school, plug in a flashdrive, then upload a file, but the only way I can do that is if I'm on a newer computer.
Also, if you are too afraid to download the file, that's fine. But I make a strong promise that it will cause your computer no harm.
What do you mean you can't show the code? You already put it online, just download it to any computer you want. Then you can post the code in this forum or if you don't want to do that you can use something like http://pastebin.ca/ and post it there.
I'm afraid I don't see what the problem is. Also for future reference, no matter how strong your promise is, doesn't mean I'm going to trust you any more then I did previously.
I guess you right. My explination didn't make much sense. Let me try again:
(1) I don't have internet at home so I have to plug in a flash drive into my computer and put my files on it
(2) I then go to my school to upload my files onto mediafire.com. The only time I can do this is when one of my classes is in a computer lab because the computer lab has new Dell computers, not crapy old macs (like the one I'm on right now)
(3) This crappy computer cannot handle flashdrives, and even though I can access this computer any time I want, I cannot get to the newer ones when ever I want.
(4) The schools computers block many things (websites, files, etc.), one of those things is downloading and uploading. This specific problem isn't built into the new computers, just the old ones, so I can't just download the files and show it to you.
There, I think that sums it up. So you see, the only way you could help me is if you downloaded the file. Sorry.
Hey! And isn't mediafire.com a protected website? ...yeah! It scans for possable viruses so you don't get infected!
Hey! And isn't mediafire.com a protected website? ...yeah! It scans for possable viruses so you don't get infected!
The thing about virus's is the fact that a virus first has to be seen in the wild and a signature has to be made for it, it doesn't do heuristic scanning very well. Furthermore a text file (a .py) is considered low risk because it is not an executable and you cannot embed executable code in it.
I'll see if someone might be willing to look at it but don't get your hopes up.
Atli 5,058
Expert 4TB
Seeing as the OP is having technical difficulties, let me just help out by posting his code here where everybody can see it.
Not knowing the first thing about python, I'll just post the whole thing.
Good luck :P -
import pygame
-
from pygame.locals import*
-
import math
-
import random
-
import time
-
-
pygame.init()
-
-
size = [800,400]
-
screen = pygame.display.set_mode(size)
-
-
def rotate_point(point, center, rotation):
-
import math
-
info= [math.sqrt( (point[0]-center[0])**2+ (point[1]-center[1])**2 ), math.atan( (point[1]-center[1])/(point[0]-center[0]) ) ]
-
-
info[1]+=math.radians(rotation)
-
if info[1]>math.pi*2: info[1]-=math.pi*2
-
-
return[math.cos(info[1])*info[0]+center[0],math.sin(info[1])*info[0]+center[1]]
-
-
class Face(object):
-
def __init__(self, face_vectors, color):
-
self.shape = face_vectors
-
self.color = color
-
def update(self, camera, cam_range, rotation):
-
p = []
-
min_magn = camera[2]-self.shape[0][2]
-
for point in self.shape:
-
-
rot_points=rotate_point([point[0],point[2]],[camera[0],camera[2]],rotation[1])
-
cam_view = [ camera[0]-rot_points[0], camera[1]-point[1], camera[2]-rot_points[1]]
-
-
presp_view = get_3d_view(cam_view, camera_range)
-
-
presp_view[0]+=screen.get_width()/2
-
presp_view[1]+=screen.get_height()/2
-
-
-
p.append(presp_view)
-
if cam_view[2]<min_magn:
-
min_magn = cam_view[2]
-
-
self.threedshape = p
-
self.closest = min_magn
-
-
def render(self, screen, disappear_distance):
-
min_magn = self.closest
-
if min_magn>0.1:
-
red = int(min(abs(disappear_distance/float(min_magn)*self.color[0]),self.color[0]))
-
green = int(min(abs(disappear_distance/float(min_magn)*self.color[1]),self.color[1]))
-
blue = int(min(abs(disappear_distance/float(min_magn)*self.color[2]),self.color[2]))
-
pygame.draw.polygon(screen, [red,green,blue], self.threedshape)
-
-
def Face_closest(faces):
-
return faces.closest
-
-
def get_3d_view(vector, d):
-
x,y,z=vector
-
return [-int(x*float(d)/z), int(y*float(d)/z)]
-
-
-
-
-
camera_range = 900
-
disappear_distance=100
-
cam_speed = 0.1
-
res = 100
-
rot_speed = 1
-
-
camera =[ 1.0001,1.0001,10.0001 ]
-
-
faces = [ Face( [ [15.,0.,15.], [15.,1.,15.], [16.,1.,15.], [16.,0.,15.] ], [255,255,255]) ]
-
-
rotate = [0.0001,0.0001,0.0001]
-
-
-
while True:
-
print rotate
-
while rotate[1]>360:
-
rotate[1]-=360
-
while rotate[1]<0:
-
rotate[1]+=360
-
-
keys = pygame.key.get_pressed()
-
-
if keys[K_DOWN]:
-
camera[2]-=math.cos(math.radians(rotate[1]))*cam_speed
-
camera[0]-=math.sin(math.radians(rotate[1]))*cam_speed
-
elif keys[K_UP]:
-
camera[2]+=math.cos(math.radians(rotate[1]))*cam_speed
-
camera[0]+=math.sin(math.radians(rotate[1]))*cam_speed
-
-
if keys[K_LEFT]:
-
rotate[1]+=rot_speed
-
elif keys[K_RIGHT]:
-
rotate[1]-=rot_speed
-
-
if keys[K_q]:
-
camera[1]+=cam_speed
-
elif keys[K_a]:
-
camera[1]-=cam_speed
-
-
for face in faces:
-
face.update(camera, camera_range, rotate)
-
faces.sort(key=Face_closest, reverse=True)
-
for face in faces:
-
face.render(screen, disappear_distance)
-
-
-
pygame.draw.rect(screen, [0,0,255], [camera[0],camera[2],0,0])
-
pygame.display.update()
-
screen.fill([0,0,0])
-
-
# === ANTI-CRASH ===
-
for event in pygame.event.get():
-
if event.type == QUIT or keys[K_ESCAPE]:
-
pygame.quit(); sys.exit()
-
Yep! That's my code! Thanks a ton, man!
My typing is very messy and I might have spelling errors everywhere. I also should have put notes in everyplace, but...you know.
Once again, thanks a lot!
I don't get it. When I run this all I get is a black screen with a blue pixel that I can move around with the arrow keys. Occasionally there is a white rectangle that will zoom by in the background.
Is this what the problem is? Or am I missing something?
Yes, that's the problem.
OH! the dot is like a map thing that shows where your at and you start out with the face behind you. To see it, movge untill the dot is still visable and is diaganal to the corner it starts at. Then turn to see the face.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: jianchiwei |
last post by:
question:
I run
c:\python23\Lib\site-packages\win32comext\axscript\client\pyscript.py
and it told me
Registered: Python
Registration of Python ActiveX Scripting Engine complete.
But, when I...
|
by: Som |
last post by:
A clients website is a combination of ASP pages and COM/COM+ objects -
The following errors are being reported. Once this happens on the
server the entire
script engine fails... we have to...
|
by: dito |
last post by:
I have a .asp page that contains an activex componet. When I launch
it in a browser, it returns an error that the viewer is unable to
create it's resource objects. "To rectify this problem,...
|
by: Petre Huile |
last post by:
I have designed a site for a client, but they have hired an internet
marketing person to incrase their search engine ranking and traffic.
He wants to put extra-large fonts on every page which will...
|
by: Phil McKrackin |
last post by:
Hello all,
I've been blazing through John Sharp and Jon Jagger's "Microsoft
Visual C# .NET Step by Step" book, but I've hit a bit of a roadblock
once I made it to the database section....
|
by: raf_z |
last post by:
Hi,
I think i'm doing something simple, although i may be wrong. I was able
to load a Crystal report file up until today, and even now, its only 1
report that's misbehaving. I'll confess that i...
|
by: Carl Waldbieser |
last post by:
Has anyone had any experience embedding a CPython engine in a .NET
application? In the COM/ActiveX world, it was pretty easy to use Mark
Hammond's win32 modules to create a script engine component...
|
by: hazly |
last post by:
I'm very new in the web technology and need advice on search engine. I
want to develop a portal using PHP and MySQL on Linux. Need to know on
the following features :
1. search engine that could...
|
by: alf |
last post by:
Hi,
is it possible that due to OS crash or mysql itself crash or some e.g.
SCSI failure to lose all the data stored in the table (let's say million
of 1KB rows). In other words what is the worst...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |