WebGL

爬虫3-爬虫防范

安稳与你 提交于 2019-12-17 05:33:38
目录 1. 服务器端的检测 2. 客户端的检测 ——参考博客 https://www.zhuyingda.com/blog/article.html?id=17 机器人协议 爬虫领域有一个“白道手段”——robots协议,这是一个君子协议,即用allow和disallow声明各个页面的爬取授权,但除了商业搜索引擎的爬虫程序,野生爬虫根本不会管你这个(明白了scrapy框架中的ROBOTSTXT_OBEY 默认为True) 1. 服务器端的检测 服务器端针对user-agent、referer、cookie等字段进行检查,但这种检查方式存在明显的缺点,这些字段都是可以轻易伪造的,甚至还能不断变换这些字段和ip代理,伪装成多个用户在访问,所以这种检查方式还是不太靠谱。 另一种检查方式是,服务器端可以检查浏览器http头指纹,根据声明的浏览器厂商和版本,来鉴别http header中的各字段是否符合该浏览器的特征。典型的就是PhantomJS 1.X版本采用的Qt框架,在http头里面有明显的Qt框架网络请求特征,可以被服务器直接识别拦截 还有一种变态的检测机制,服务器对所有的页面请求,在http response中种下一个cookie token,然后在这个页面内异步执行一些的ajax接口里面去校验来访请求是否含有cookie token,并将token传回表明这是一个合法的浏览器

Javascript Typed Arrays and Endianness

吃可爱长大的小学妹 提交于 2019-12-17 04:47:31
问题 I'm using WebGL to render a binary encoded mesh file. The binary file is written out in big-endian format (I can verify this by opening the file in a hex editor, or viewing the network traffic using fiddler). When I try to read the binary response using a Float32Array or Int32Array, the binary is interpreted as little-endian and my values are wrong: // Interpret first 32bits in buffer as an int var wrongValue = new Int32Array(binaryArrayBuffer)[0]; I can't find any references to the default

WebGL in QuickLook

江枫思渺然 提交于 2019-12-14 04:20:14
问题 Is it possible to use WebGL in a quicklook plugin? I followed this tutorial replacing the relevant code in GeneratePreviewForURL.m with OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options) { NSString *_content = [NSString stringWithContentsOfURL:(__bridge NSURL *)url encoding:NSUTF8StringEncoding error:nil]; NSString* path = @"/Users/myusername/Downloads/TodoQL/demo.html"; NSError *error = nil;

How can I use layers on WebGL?

人走茶凉 提交于 2019-12-14 04:09:21
问题 I´m doing a tile map with light mapping, and I want to know how can I declare a tile map (rasterized in two triangules) as layer 1, and other tile map above with transparency in some parts to see the first layer? 回答1: WebGL is a rasterization API. It just draws. It has no concept of "layers". You can achieve layers by every frame, drawing your first tilemap, then drawing your second tilemap on top of the first one. This is no different than the canvas 2D API. As for how to render a tilemap

WebGL 3d usage for depth sorting 2d objects

ぃ、小莉子 提交于 2019-12-14 03:59:24
问题 This question has a strong relation with my other question: Isometric rendering without tiles, is that goal reachable? I want to depth sort objects in an isometric world (html5 canvas). The world is not tiled, so every item in the world can be placed on each x, y, z coordinate. Since it's not a tiled world, depth sorting is hard to do. I even want that if items intersect, that the visible parts are drawn as if it were intersecting parts in a fully 3d world. As people answered in my other

in int gl_VertexID causing error with three.js

淺唱寂寞╮ 提交于 2019-12-14 03:57:46
问题 I've been having trouble with the gl_VertexID built in vertex index, passed using in , to work with Three.js I'm not sure why, as the documentation says it works in all versions of OpenGL http://www.opengl.org/sdk/docs/manglsl/xhtml/gl_VertexID.xml I'm using this vertex shader: uniform int freqData[64]; uniform int fftSize; in int gl_VertexID; void main() { vec3 norm = normalize(position); int modFFT = mod(gl_VertexID, fftSize); vec3 newPosition = norm * float(freqData[modFFT]); gl_Position =

unexpected screen clearing WebGL

青春壹個敷衍的年華 提交于 2019-12-14 03:20:20
问题 Good day! I need a help with webgl! According to http://www.html5rocks.com/en/tutorials/webgl/webgl_fundamentals/#disqus_thread tutorial, I created simple demo of my problem: https://jsfiddle.net/kurz/o2116mz2/1/. 1) Draw first black rect in main task queue drawRect(10, 10, 20, 20); 2) Try to draw same rect in timeout and the whole scene will be cleared and only after that the rect is drawing. setTimeout(function(){drawRect(30, 30, 20, 20);}, 1000); My question is how to avoid screen clearing

Three.js lookat seems to be flipped

人走茶凉 提交于 2019-12-14 00:32:45
问题 I have a demo of what I mean here: Test Site or (Backup) For some reason, even though the mouse vector is correct my object is rotated by 90 degrees always in favor of the positive Y axis. The only call that this could be going wrong, as far as I can tell, in is the call: ship.mesh.lookAt(mouse); , I call this every time the screen is animated. Can anyone tell me what to do to fix this and why it is doing it? 回答1: object.lookAt( position ) orients the object so that the object's local

How to use multiple textures on a cube in WebGL?

馋奶兔 提交于 2019-12-13 23:30:39
问题 This is my source code. It still doesnt work. I want to put 6 different pictures on the 6 sides of a cube, which is animated. Please help :) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head> <title>WebGL</title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <script type="text/javascript" src="glMatrix-0.9.5.min.js"></script> <script type="text/javascript" src="webgl-utils.js"></script> <script id="shader-fs" type="x-shader/x-fragment">

Three.js texture not repeating properly

做~自己de王妃 提交于 2019-12-13 20:35:07
问题 I'm trying to repeat a 16x16 texture on a plane, but when I set the texture to repeat I get the following result: The texture is shown correctly in the bottom left of the plane, but it looks as though the top and right edges are stretched across the rest of the plane. So far I've been unable to find out why it does this. This is the code: function addTerrain(){ var texture = THREE.ImageUtils.loadTexture( "tex/tex.png" ); texture.WrapS = texture.WrapT = THREE.RepeatWrapping; texture.repeat.set